annotate Mac/Modules/folder/_Foldermodule.c @ 32527:0da660e05e69 legacy-trunk

"#if WITH_THREAD" is incorrect; must be #ifdef instead; WITH_THREAD isn't always set to an integer value when it's defined.
author Tim Peters <tim.peters@gmail.com>
date Wed, 07 Jul 2004 20:42:07 +0000
parents e543b3f0d906
children c34e34057714
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 ) {\
30973
53e4b7fe0969 Getting rid of WITHOUT_FRAMEWORKS and ACCESSOR_CALLS_ARE_FUNCTIONS:
Jack Jansen <jack.jansen@cwi.nl>
parents: 26350
diff changeset
12 PyErr_SetString(PyExc_NotImplementedError, \
53e4b7fe0969 Getting rid of WITHOUT_FRAMEWORKS and ACCESSOR_CALLS_ARE_FUNCTIONS:
Jack Jansen <jack.jansen@cwi.nl>
parents: 26350
diff changeset
13 "Not available in this shared library/OS version"); \
53e4b7fe0969 Getting rid of WITHOUT_FRAMEWORKS and ACCESSOR_CALLS_ARE_FUNCTIONS:
Jack Jansen <jack.jansen@cwi.nl>
parents: 26350
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 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
26 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
27 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
28 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
29 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
30 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
31 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
32 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
33 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
34 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
35 &createFolder))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36 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
37 _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
38 folderType,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 createFolder,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
40 &foundVRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 &foundDirID);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
42 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
43 _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
44 foundVRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 foundDirID);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46 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
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
51 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
52 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
53 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
54 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
55 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
56 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
57 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
58 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
59 _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
60 folderType);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
61 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
62 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
63 _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
64 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
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 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
70 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
71 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
72 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
73 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
74 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
75 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
76 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77 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
78 &createFolder))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
79 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
80 _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
81 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 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 &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 (_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
85 _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
86 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
87 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
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 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
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 &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 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
106 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
107 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
108 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
109 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
110 &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 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
112 _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
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 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 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 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 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 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 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
121 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
122 _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
123 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
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
128 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
129 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
130 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
131 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
132 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
133 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
134 &requestedTypeCount))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
135 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
136 _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
137 &totalTypeCount,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
138 &theTypes);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
139 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
140 _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
141 totalTypeCount,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
142 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
143 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
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 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
148 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
149 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
150 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
151 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
152 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
153 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
154 _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
155 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
156 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
157 _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
158 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
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
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
161 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
162 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
163 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
164 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
165 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
166 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
167 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
168 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
169 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
170 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
171 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
172 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
173 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
174 _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
175 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 &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 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 (_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
179 _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
180 foundVRefNum);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
181 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
182 }
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 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
185 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
186 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
187 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
188 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
189 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
190 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
191 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
192 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
193 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
194 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
195 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
196 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
197 &flags,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
198 &replaceFlag))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
199 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
200 _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
201 routeFromFolder,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
202 routeToFolder,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
203 flags,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
204 replaceFlag);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
205 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
206 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
207 _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
208 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
209 }
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 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
212 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 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
214 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
215 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
216 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
217 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
218 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
219 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
220 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
221 _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
222 routeFromFolder);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
223 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
224 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
225 _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
226 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
227 }
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 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
230 {
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
231 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
232 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
233 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
234 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
235 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
236 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
237 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
238 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
239 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
240 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
241 _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
242 routeFromFolder,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
243 &routeToFolder,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
244 &flags);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
245 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
246 _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
247 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
248 flags);
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 _res;
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
250 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
251
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
252 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
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 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
255 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
256 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
257 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
258 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
259 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
260 &dirID))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
261 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
262 _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
263 dirID);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
264 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
265 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
266 _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
267 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
268 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
269
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
270 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
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 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
273 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
274 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
275 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
276 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
277 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
278 &vRefNum,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
279 &dirID))
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
280 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
281 _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
282 dirID,
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
283 &foldType);
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
284 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
285 _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
286 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
287 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
288 }
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
289
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290 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
291 {"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
292 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
293 {"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
294 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
295 {"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
296 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
297 {"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
298 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
299 {"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
300 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
301 {"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
302 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
303 {"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
304 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
305 {"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
306 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
307 {"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
308 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
309 {"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
310 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
311 {"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
312 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
313 {"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
314 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
315 {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
316 };
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
317
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
318
abf565cf5b54 Got angry and added support for pretty much the whole file and folder
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
319
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 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
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 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
324 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
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 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
330 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
331 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
332 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
333 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
334 return;
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 /* ======================= 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
338