annotate Mac/Modules/folder/_Foldermodule.c @ 80661:94de77bd0b4b 2.7

Issue #16194: document imp.load_dynamic problems when read several extension modules from the same binary object file.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Thu, 29 Nov 2012 19:51:28 +0200
parents fd25030223b0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 /* ========================= Module _Folder ========================= */
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 #include "Python.h"
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8 #include "pymactoolbox.h"
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 /* Macro to test whether a weak-loaded CFM function exists */
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
12 PyErr_SetString(PyExc_NotImplementedError, \
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
13 "Not available in this shared library/OS version"); \
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
14 return NULL; \
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 }} while(0)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18 #include <Carbon/Carbon.h>
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21 static PyObject *Folder_Error;
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 static PyObject *Folder_FindFolder(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
25 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
26 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
27 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
28 OSType folderType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
29 Boolean createFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
30 FSVolumeRefNum foundVRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
31 SInt32 foundDirID;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
32 if (!PyArg_ParseTuple(_args, "hO&b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
33 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
34 PyMac_GetOSType, &folderType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
35 &createFolder))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
36 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
37 _err = FindFolder(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
38 folderType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
39 createFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
40 &foundVRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
41 &foundDirID);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
42 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
43 _res = Py_BuildValue("hl",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
44 foundVRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
45 foundDirID);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
46 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 static PyObject *Folder_ReleaseFolder(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
51 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
52 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
53 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
54 OSType folderType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
55 if (!PyArg_ParseTuple(_args, "hO&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
56 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
57 PyMac_GetOSType, &folderType))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
58 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
59 _err = ReleaseFolder(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
60 folderType);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
61 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
62 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
63 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
64 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67 static PyObject *Folder_FSFindFolder(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
69 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
70 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
71 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
72 OSType folderType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
73 Boolean createFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
74 FSRef foundRef;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
75 if (!PyArg_ParseTuple(_args, "hO&b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
76 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
77 PyMac_GetOSType, &folderType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
78 &createFolder))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
79 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
80 _err = FSFindFolder(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
81 folderType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
82 createFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
83 &foundRef);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
84 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
85 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
86 PyMac_BuildFSRef, &foundRef);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
87 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
88 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
89
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90 static PyObject *Folder_AddFolderDescriptor(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
91 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
92 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
93 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
94 FolderType foldType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
95 FolderDescFlags flags;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
96 FolderClass foldClass;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
97 FolderLocation foldLocation;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
98 OSType badgeSignature;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
99 OSType badgeType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
100 Str255 name;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
101 Boolean replaceFlag;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
102 if (!PyArg_ParseTuple(_args, "O&lO&O&O&O&O&b",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
103 PyMac_GetOSType, &foldType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
104 &flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
105 PyMac_GetOSType, &foldClass,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
106 PyMac_GetOSType, &foldLocation,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
107 PyMac_GetOSType, &badgeSignature,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
108 PyMac_GetOSType, &badgeType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
109 PyMac_GetStr255, name,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
110 &replaceFlag))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
111 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
112 _err = AddFolderDescriptor(foldType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
113 flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
114 foldClass,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
115 foldLocation,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
116 badgeSignature,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
117 badgeType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
118 name,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
119 replaceFlag);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
120 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
121 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
122 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
123 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
124 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
125
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
126 static PyObject *Folder_GetFolderTypes(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
127 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
128 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
129 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
130 UInt32 requestedTypeCount;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
131 UInt32 totalTypeCount;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
132 FolderType theTypes;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
133 if (!PyArg_ParseTuple(_args, "l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
134 &requestedTypeCount))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
135 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
136 _err = GetFolderTypes(requestedTypeCount,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
137 &totalTypeCount,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
138 &theTypes);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
139 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
140 _res = Py_BuildValue("lO&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
141 totalTypeCount,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
142 PyMac_BuildOSType, theTypes);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
143 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
144 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
145
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
146 static PyObject *Folder_RemoveFolderDescriptor(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
147 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
148 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
149 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
150 FolderType foldType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
151 if (!PyArg_ParseTuple(_args, "O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
152 PyMac_GetOSType, &foldType))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
153 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
154 _err = RemoveFolderDescriptor(foldType);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
155 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
156 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
157 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
158 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
159 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
160
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 30982
diff changeset
161 #ifndef __LP64__
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
162 static PyObject *Folder_GetFolderName(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
163 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
164 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
165 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
166 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
167 OSType foldType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
168 short foundVRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
169 Str255 name;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
170 if (!PyArg_ParseTuple(_args, "hO&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
171 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
172 PyMac_GetOSType, &foldType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
173 PyMac_GetStr255, name))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
174 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
175 _err = GetFolderName(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
176 foldType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
177 &foundVRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
178 name);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
179 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
180 _res = Py_BuildValue("h",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
181 foundVRefNum);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
182 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
183 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
184
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
185 static PyObject *Folder_AddFolderRouting(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
186 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
187 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
188 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
189 OSType fileType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
190 FolderType routeFromFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
191 FolderType routeToFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
192 RoutingFlags flags;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
193 Boolean replaceFlag;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
194 if (!PyArg_ParseTuple(_args, "O&O&O&lb",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
195 PyMac_GetOSType, &fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
196 PyMac_GetOSType, &routeFromFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
197 PyMac_GetOSType, &routeToFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
198 &flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
199 &replaceFlag))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
200 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
201 _err = AddFolderRouting(fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
202 routeFromFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
203 routeToFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
204 flags,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
205 replaceFlag);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
206 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
207 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
208 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
209 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
210 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
211
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
212 static PyObject *Folder_RemoveFolderRouting(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
214 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
215 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
216 OSType fileType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
217 FolderType routeFromFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
218 if (!PyArg_ParseTuple(_args, "O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
219 PyMac_GetOSType, &fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
220 PyMac_GetOSType, &routeFromFolder))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
221 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
222 _err = RemoveFolderRouting(fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
223 routeFromFolder);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
224 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
225 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
226 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
227 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
228 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
229
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
230 static PyObject *Folder_FindFolderRouting(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
231 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
232 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
233 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
234 OSType fileType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
235 FolderType routeFromFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
236 FolderType routeToFolder;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
237 RoutingFlags flags;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
238 if (!PyArg_ParseTuple(_args, "O&O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
239 PyMac_GetOSType, &fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
240 PyMac_GetOSType, &routeFromFolder))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
241 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
242 _err = FindFolderRouting(fileType,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
243 routeFromFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
244 &routeToFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
245 &flags);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
246 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
247 _res = Py_BuildValue("O&l",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
248 PyMac_BuildOSType, routeToFolder,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
249 flags);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
250 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
251 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 30982
diff changeset
252 #endif /* !__LP64__ */
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
253
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
254 static PyObject *Folder_InvalidateFolderDescriptorCache(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
255 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
256 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
257 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
258 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
259 long dirID;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
260 if (!PyArg_ParseTuple(_args, "hl",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
261 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
262 &dirID))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
263 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
264 _err = InvalidateFolderDescriptorCache(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
265 dirID);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
266 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
267 Py_INCREF(Py_None);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
268 _res = Py_None;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
269 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
270 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
271
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
272 static PyObject *Folder_IdentifyFolder(PyObject *_self, PyObject *_args)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
273 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
274 PyObject *_res = NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
275 OSErr _err;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
276 short vRefNum;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
277 long dirID;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
278 FolderType foldType;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
279 if (!PyArg_ParseTuple(_args, "hl",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
280 &vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
281 &dirID))
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
282 return NULL;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
283 _err = IdentifyFolder(vRefNum,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
284 dirID,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
285 &foldType);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
286 if (_err != noErr) return PyMac_Error(_err);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
287 _res = Py_BuildValue("O&",
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
288 PyMac_BuildOSType, foldType);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
289 return _res;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
291
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
292 static PyMethodDef Folder_methods[] = {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
293 {"FindFolder", (PyCFunction)Folder_FindFolder, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
294 PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (short foundVRefNum, long foundDirID)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
295 {"ReleaseFolder", (PyCFunction)Folder_ReleaseFolder, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
296 PyDoc_STR("(short vRefNum, OSType folderType) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
297 {"FSFindFolder", (PyCFunction)Folder_FSFindFolder, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
298 PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (FSRef foundRef)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
299 {"AddFolderDescriptor", (PyCFunction)Folder_AddFolderDescriptor, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
300 PyDoc_STR("(FolderType foldType, FolderDescFlags flags, FolderClass foldClass, FolderLocation foldLocation, OSType badgeSignature, OSType badgeType, Str255 name, Boolean replaceFlag) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
301 {"GetFolderTypes", (PyCFunction)Folder_GetFolderTypes, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
302 PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
303 {"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
304 PyDoc_STR("(FolderType foldType) -> None")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 30982
diff changeset
305 #ifndef __LP64__
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
306 {"GetFolderName", (PyCFunction)Folder_GetFolderName, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
307 PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
308 {"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
309 PyDoc_STR("(OSType fileType, FolderType routeFromFolder, FolderType routeToFolder, RoutingFlags flags, Boolean replaceFlag) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
310 {"RemoveFolderRouting", (PyCFunction)Folder_RemoveFolderRouting, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
311 PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
312 {"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
313 PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 30982
diff changeset
314 #endif /* !__LP64__ */
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
315 {"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
316 PyDoc_STR("(short vRefNum, long dirID) -> None")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
317 {"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1,
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
318 PyDoc_STR("(short vRefNum, long dirID) -> (FolderType foldType)")},
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
319 {NULL, NULL, 0}
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
320 };
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
321
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
322
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
323
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
324
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
325 void init_Folder(void)
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
326 {
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
327 PyObject *m;
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
328 PyObject *d;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
329
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
330
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
331
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
332
61463
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
333 m = Py_InitModule("_Folder", Folder_methods);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
334 d = PyModule_GetDict(m);
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
335 Folder_Error = PyMac_GetOSErrException();
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
336 if (Folder_Error == NULL ||
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
337 PyDict_SetItemString(d, "Error", Folder_Error) != 0)
fd25030223b0 Untabify C files. Will watch buildbots.
Antoine Pitrou <solipsis@pitrou.net>
parents: 47473
diff changeset
338 return;
26350
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
339 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
340
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
341 /* ======================= End module _Folder ======================= */
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
342