Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/folder/_Foldermodule.c @ 27998:e27f58a50737 legacy-trunk
SF bug #690377: Dud footnote reference in distutils docs
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Fri, 21 Feb 2003 02:47:09 +0000 |
| parents | abf565cf5b54 |
| children | 53e4b7fe0969 |
| 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 #ifdef _WIN32 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
9 #include "pywintoolbox.h" |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
10 #else |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
11 #include "macglue.h" |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
12 #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
|
13 #endif |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
14 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
15 /* 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
|
16 #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
17 PyErr_SetString(PyExc_NotImplementedError, \ |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
18 "Not available in this shared library/OS version"); \ |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
19 return NULL; \ |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
20 }} 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
|
21 |
|
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 #ifdef WITHOUT_FRAMEWORKS |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
24 #include <Folders.h> |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
25 #else |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
26 #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
|
27 #endif |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
28 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
29 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
30 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
|
31 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
32 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
|
33 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
34 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
35 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
36 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
37 OSType folderType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
38 Boolean createFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
39 short foundVRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
40 long foundDirID; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
41 if (!PyArg_ParseTuple(_args, "hO&b", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
42 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
43 PyMac_GetOSType, &folderType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
44 &createFolder)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
45 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
46 _err = FindFolder(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
47 folderType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
48 createFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
49 &foundVRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
50 &foundDirID); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
51 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
52 _res = Py_BuildValue("hl", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
53 foundVRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
54 foundDirID); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
55 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
56 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
57 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
58 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
|
59 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
60 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
61 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
62 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
63 OSType folderType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
64 if (!PyArg_ParseTuple(_args, "hO&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
65 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
66 PyMac_GetOSType, &folderType)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
67 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
68 _err = ReleaseFolder(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
69 folderType); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
70 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
71 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
72 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
73 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
74 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
75 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
76 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
|
77 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
78 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
79 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
80 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
81 OSType folderType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
82 Boolean createFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
83 FSRef foundRef; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
84 if (!PyArg_ParseTuple(_args, "hO&b", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
85 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
86 PyMac_GetOSType, &folderType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
87 &createFolder)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
88 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
89 _err = FSFindFolder(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
90 folderType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
91 createFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
92 &foundRef); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
93 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
94 _res = Py_BuildValue("O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
95 PyMac_BuildFSRef, &foundRef); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
96 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
97 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
98 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
99 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
|
100 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
101 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
102 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
103 FolderType foldType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
104 FolderDescFlags flags; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
105 FolderClass foldClass; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
106 FolderLocation foldLocation; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
107 OSType badgeSignature; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
108 OSType badgeType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
109 Str255 name; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
110 Boolean replaceFlag; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
111 if (!PyArg_ParseTuple(_args, "O&lO&O&O&O&O&b", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
112 PyMac_GetOSType, &foldType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
113 &flags, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
114 PyMac_GetOSType, &foldClass, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
115 PyMac_GetOSType, &foldLocation, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
116 PyMac_GetOSType, &badgeSignature, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
117 PyMac_GetOSType, &badgeType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
118 PyMac_GetStr255, name, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
119 &replaceFlag)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
120 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
121 _err = AddFolderDescriptor(foldType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
122 flags, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
123 foldClass, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
124 foldLocation, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
125 badgeSignature, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
126 badgeType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
127 name, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
128 replaceFlag); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
129 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
130 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
131 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
132 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
133 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
134 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
135 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
|
136 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
137 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
138 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
139 UInt32 requestedTypeCount; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
140 UInt32 totalTypeCount; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
141 FolderType theTypes; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
142 if (!PyArg_ParseTuple(_args, "l", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
143 &requestedTypeCount)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
144 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
145 _err = GetFolderTypes(requestedTypeCount, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
146 &totalTypeCount, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
147 &theTypes); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
148 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
149 _res = Py_BuildValue("lO&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
150 totalTypeCount, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
151 PyMac_BuildOSType, theTypes); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
152 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
153 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
154 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
155 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
|
156 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
157 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
158 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
159 FolderType foldType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
160 if (!PyArg_ParseTuple(_args, "O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
161 PyMac_GetOSType, &foldType)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
162 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
163 _err = RemoveFolderDescriptor(foldType); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
164 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
165 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
166 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
167 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
168 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
169 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
170 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
|
171 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
172 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
173 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
174 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
175 OSType foldType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
176 short foundVRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
177 Str255 name; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
178 if (!PyArg_ParseTuple(_args, "hO&O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
179 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
180 PyMac_GetOSType, &foldType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
181 PyMac_GetStr255, name)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
182 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
183 _err = GetFolderName(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
184 foldType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
185 &foundVRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
186 name); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
187 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
188 _res = Py_BuildValue("h", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
189 foundVRefNum); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
190 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
191 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
192 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
193 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
|
194 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
195 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
196 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
197 OSType fileType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
198 FolderType routeFromFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
199 FolderType routeToFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
200 RoutingFlags flags; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
201 Boolean replaceFlag; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
202 if (!PyArg_ParseTuple(_args, "O&O&O&lb", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
203 PyMac_GetOSType, &fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
204 PyMac_GetOSType, &routeFromFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
205 PyMac_GetOSType, &routeToFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
206 &flags, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
207 &replaceFlag)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
208 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
209 _err = AddFolderRouting(fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
210 routeFromFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
211 routeToFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
212 flags, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
213 replaceFlag); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
214 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
215 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
216 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
217 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
218 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
219 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
220 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
|
221 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
222 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
223 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
224 OSType fileType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
225 FolderType routeFromFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
226 if (!PyArg_ParseTuple(_args, "O&O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
227 PyMac_GetOSType, &fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
228 PyMac_GetOSType, &routeFromFolder)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
229 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
230 _err = RemoveFolderRouting(fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
231 routeFromFolder); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
232 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
233 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
234 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
235 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
236 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
237 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
238 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
|
239 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
240 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
241 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
242 OSType fileType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
243 FolderType routeFromFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
244 FolderType routeToFolder; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
245 RoutingFlags flags; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
246 if (!PyArg_ParseTuple(_args, "O&O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
247 PyMac_GetOSType, &fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
248 PyMac_GetOSType, &routeFromFolder)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
249 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
250 _err = FindFolderRouting(fileType, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
251 routeFromFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
252 &routeToFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
253 &flags); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
254 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
255 _res = Py_BuildValue("O&l", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
256 PyMac_BuildOSType, routeToFolder, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
257 flags); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
258 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
259 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
260 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
261 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
|
262 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
263 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
264 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
265 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
266 long dirID; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
267 if (!PyArg_ParseTuple(_args, "hl", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
268 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
269 &dirID)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
270 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
271 _err = InvalidateFolderDescriptorCache(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
272 dirID); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
273 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
274 Py_INCREF(Py_None); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
275 _res = Py_None; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
276 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
277 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
278 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
279 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
|
280 { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
281 PyObject *_res = NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
282 OSErr _err; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
283 short vRefNum; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
284 long dirID; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
285 FolderType foldType; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
286 if (!PyArg_ParseTuple(_args, "hl", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
287 &vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
288 &dirID)) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
289 return NULL; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
290 _err = IdentifyFolder(vRefNum, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
291 dirID, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
292 &foldType); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
293 if (_err != noErr) return PyMac_Error(_err); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
294 _res = Py_BuildValue("O&", |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
295 PyMac_BuildOSType, foldType); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
296 return _res; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
297 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
298 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
299 static PyMethodDef Folder_methods[] = { |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
300 {"FindFolder", (PyCFunction)Folder_FindFolder, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
301 PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (short foundVRefNum, long foundDirID)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
302 {"ReleaseFolder", (PyCFunction)Folder_ReleaseFolder, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
303 PyDoc_STR("(short vRefNum, OSType folderType) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
304 {"FSFindFolder", (PyCFunction)Folder_FSFindFolder, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
305 PyDoc_STR("(short vRefNum, OSType folderType, Boolean createFolder) -> (FSRef foundRef)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
306 {"AddFolderDescriptor", (PyCFunction)Folder_AddFolderDescriptor, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
307 PyDoc_STR("(FolderType foldType, FolderDescFlags flags, FolderClass foldClass, FolderLocation foldLocation, OSType badgeSignature, OSType badgeType, Str255 name, Boolean replaceFlag) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
308 {"GetFolderTypes", (PyCFunction)Folder_GetFolderTypes, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
309 PyDoc_STR("(UInt32 requestedTypeCount) -> (UInt32 totalTypeCount, FolderType theTypes)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
310 {"RemoveFolderDescriptor", (PyCFunction)Folder_RemoveFolderDescriptor, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
311 PyDoc_STR("(FolderType foldType) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
312 {"GetFolderName", (PyCFunction)Folder_GetFolderName, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
313 PyDoc_STR("(short vRefNum, OSType foldType, Str255 name) -> (short foundVRefNum)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
314 {"AddFolderRouting", (PyCFunction)Folder_AddFolderRouting, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
315 PyDoc_STR("(OSType fileType, FolderType routeFromFolder, FolderType routeToFolder, RoutingFlags flags, Boolean replaceFlag) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
316 {"RemoveFolderRouting", (PyCFunction)Folder_RemoveFolderRouting, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
317 PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
318 {"FindFolderRouting", (PyCFunction)Folder_FindFolderRouting, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
319 PyDoc_STR("(OSType fileType, FolderType routeFromFolder) -> (FolderType routeToFolder, RoutingFlags flags)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
320 {"InvalidateFolderDescriptorCache", (PyCFunction)Folder_InvalidateFolderDescriptorCache, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
321 PyDoc_STR("(short vRefNum, long dirID) -> None")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
322 {"IdentifyFolder", (PyCFunction)Folder_IdentifyFolder, 1, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
323 PyDoc_STR("(short vRefNum, long dirID) -> (FolderType foldType)")}, |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
324 {NULL, NULL, 0} |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
325 }; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
326 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
327 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
328 |
|
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 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
|
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 PyObject *m; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
333 PyObject *d; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
334 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
335 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
336 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
337 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
338 m = Py_InitModule("_Folder", Folder_methods); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
339 d = PyModule_GetDict(m); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
340 Folder_Error = PyMac_GetOSErrException(); |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
341 if (Folder_Error == NULL || |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
342 PyDict_SetItemString(d, "Error", Folder_Error) != 0) |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
343 return; |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
344 } |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
345 |
|
abf565cf5b54
Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
346 /* ======================= 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
|
347 |
