annotate Mac/Modules/res/_Resmodule.c @ 58925:eecf1bef052d 2.6

Merged revisions 78207 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line #7930: fix stripid ........
author Ezio Melotti <ezio.melotti@gmail.com>
date Tue, 16 Feb 2010 23:29:44 +0000
parents 52294af4b663
children fd25030223b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2 /* ========================== Module _Res =========================== */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4 #include "Python.h"
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7 #include "pymactoolbox.h"
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9 /* Macro to test whether a weak-loaded CFM function exists */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 #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: 26769
diff changeset
11 PyErr_SetString(PyExc_NotImplementedError, \
53e4b7fe0969 Getting rid of WITHOUT_FRAMEWORKS and ACCESSOR_CALLS_ARE_FUNCTIONS:
Jack Jansen <jack.jansen@cwi.nl>
parents: 26769
diff changeset
12 "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: 26769
diff changeset
13 return NULL; \
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14 }} while(0)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17 #include <Carbon/Carbon.h>
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19 #ifdef USE_TOOLBOX_OBJECT_GLUE
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20 extern PyObject *_ResObj_New(Handle);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21 extern int _ResObj_Convert(PyObject *, Handle *);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 extern PyObject *_OptResObj_New(Handle);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 extern int _OptResObj_Convert(PyObject *, Handle *);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24 #define ResObj_New _ResObj_New
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 #define ResObj_Convert _ResObj_Convert
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 #define OptResObj_New _OptResObj_New
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27 #define OptResObj_Convert _OptResObj_Convert
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28 #endif
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
30 /* Function to dispose a resource, with a "normal" calling sequence */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
31 static void
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
32 PyMac_AutoDisposeHandle(Handle h)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
33 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
34 DisposeHandle(h);
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37 static PyObject *Res_Error;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
38
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 /* ---------------------- Object type Resource ---------------------- */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
40
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 PyTypeObject Resource_Type;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
42
26720
a12e1727850a Regenerated with inheritance-aware xxxx_Check() macros.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26610
diff changeset
43 #define ResObj_Check(x) ((x)->ob_type == &Resource_Type || PyObject_TypeCheck((x), &Resource_Type))
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
44
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 typedef struct ResourceObject {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46 PyObject_HEAD
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47 Handle ob_itself;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 void (*ob_freeit)(Handle ptr);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 } ResourceObject;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
51 PyObject *ResObj_New(Handle itself)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
52 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
53 ResourceObject *it;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
54 if (itself == NULL) return PyMac_Error(resNotFound);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
55 it = PyObject_NEW(ResourceObject, &Resource_Type);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
56 if (it == NULL) return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
57 it->ob_itself = itself;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
58 it->ob_freeit = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
59 return (PyObject *)it;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
60 }
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
61
19708
6eafc4a6359a Regenerated without default int return types.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19443
diff changeset
62 int ResObj_Convert(PyObject *v, Handle *p_itself)
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
63 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
64 if (!ResObj_Check(v))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66 PyObject *tmp;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67 if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) )
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
68 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 *p_itself = ((ResourceObject *)tmp)->ob_itself;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70 Py_DECREF(tmp);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
71 return 1;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
73 PyErr_Clear();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
74 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
75 if (!ResObj_Check(v))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
76 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77 PyErr_SetString(PyExc_TypeError, "Resource required");
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
78 return 0;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
79 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
80 *p_itself = ((ResourceObject *)v)->ob_itself;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
81 return 1;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
82 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
83
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
84 static void ResObj_dealloc(ResourceObject *self)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
85 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
86 if (self->ob_freeit && self->ob_itself)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
87 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
88 self->ob_freeit(self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
89 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90 self->ob_itself = NULL;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26720
diff changeset
91 self->ob_type->tp_free((PyObject *)self);
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
93
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
94 static PyObject *ResObj_HomeResFile(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
95 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
96 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
97 short _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
98 #ifndef HomeResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
99 PyMac_PRECHECK(HomeResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
100 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
101 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
102 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
103 _rv = HomeResFile(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
104 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
105 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
106 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
107 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
108 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
109 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
110 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
111 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
112
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
113 static PyObject *ResObj_MacLoadResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
114 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
115 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
116 #ifndef MacLoadResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
117 PyMac_PRECHECK(MacLoadResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
118 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
119 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
120 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
121 MacLoadResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
122 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
123 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
124 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
125 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
126 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
127 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
128 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
129 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
130
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
131 static PyObject *ResObj_ReleaseResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
132 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
133 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
134 #ifndef ReleaseResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
135 PyMac_PRECHECK(ReleaseResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
136 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
137 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
138 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
139 ReleaseResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
140 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
141 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
142 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
143 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
144 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
145 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
146 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
147 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
148
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
149 static PyObject *ResObj_DetachResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
150 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
151 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
152 #ifndef DetachResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
153 PyMac_PRECHECK(DetachResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
154 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
155 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
156 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
157 DetachResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
158 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
159 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
160 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
161 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
162 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
163 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
164 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
165 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
166
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
167 static PyObject *ResObj_GetResAttrs(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
168 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
169 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
170 short _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
171 #ifndef GetResAttrs
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
172 PyMac_PRECHECK(GetResAttrs);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
173 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
174 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
175 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
176 _rv = GetResAttrs(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
177 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
178 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
179 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
180 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
181 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
182 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
183 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
184 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
185
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
186 static PyObject *ResObj_GetResInfo(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
187 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
188 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
189 short theID;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
190 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
191 Str255 name;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
192 #ifndef GetResInfo
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
193 PyMac_PRECHECK(GetResInfo);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
194 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
195 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
196 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
197 GetResInfo(_self->ob_itself,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
198 &theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
199 &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
200 name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
201 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
202 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
203 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
204 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
205 _res = Py_BuildValue("hO&O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
206 theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
207 PyMac_BuildOSType, theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
208 PyMac_BuildStr255, name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
209 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
210 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
211
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
212 static PyObject *ResObj_SetResInfo(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
213 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
214 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
215 short theID;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
216 Str255 name;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
217 #ifndef SetResInfo
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
218 PyMac_PRECHECK(SetResInfo);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
219 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
220 if (!PyArg_ParseTuple(_args, "hO&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
221 &theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
222 PyMac_GetStr255, name))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
223 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
224 SetResInfo(_self->ob_itself,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
225 theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
226 name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
227 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
228 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
229 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
230 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
231 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
232 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
233 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
234 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
235
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
236 static PyObject *ResObj_AddResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
237 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
238 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
239 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
240 short theID;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
241 Str255 name;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
242 #ifndef AddResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
243 PyMac_PRECHECK(AddResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
244 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
245 if (!PyArg_ParseTuple(_args, "O&hO&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
246 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
247 &theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
248 PyMac_GetStr255, name))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
249 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
250 AddResource(_self->ob_itself,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
251 theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
252 theID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
253 name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
254 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
255 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
256 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
257 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
258 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
259 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
260 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
261 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
262
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
263 static PyObject *ResObj_GetResourceSizeOnDisk(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
264 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
265 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
266 long _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
267 #ifndef GetResourceSizeOnDisk
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
268 PyMac_PRECHECK(GetResourceSizeOnDisk);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
269 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
270 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
271 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
272 _rv = GetResourceSizeOnDisk(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
273 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
274 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
275 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
276 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
277 _res = Py_BuildValue("l",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
278 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
279 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
280 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
281
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
282 static PyObject *ResObj_GetMaxResourceSize(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
283 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
284 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
285 long _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
286 #ifndef GetMaxResourceSize
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
287 PyMac_PRECHECK(GetMaxResourceSize);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
288 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
289 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
290 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
291 _rv = GetMaxResourceSize(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
292 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
293 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
294 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
295 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
296 _res = Py_BuildValue("l",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
297 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
298 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
299 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
300
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
301 static PyObject *ResObj_SetResAttrs(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
302 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
303 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
304 short attrs;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
305 #ifndef SetResAttrs
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
306 PyMac_PRECHECK(SetResAttrs);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
307 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
308 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
309 &attrs))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
310 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
311 SetResAttrs(_self->ob_itself,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
312 attrs);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
313 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
314 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
315 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
316 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
317 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
318 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
319 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
320 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
321
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
322 static PyObject *ResObj_ChangedResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
323 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
324 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
325 #ifndef ChangedResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
326 PyMac_PRECHECK(ChangedResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
327 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
328 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
329 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
330 ChangedResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
331 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
332 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
333 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
334 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
335 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
336 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
337 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
338 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
339
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
340 static PyObject *ResObj_RemoveResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
341 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
342 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
343 #ifndef RemoveResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
344 PyMac_PRECHECK(RemoveResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
345 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
346 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
347 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
348 RemoveResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
349 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
350 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
351 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
352 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
353 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
354 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
355 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
356 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
357
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
358 static PyObject *ResObj_WriteResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
359 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
360 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
361 #ifndef WriteResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
362 PyMac_PRECHECK(WriteResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
363 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
364 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
365 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
366 WriteResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
367 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
368 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
369 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
370 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
371 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
372 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
373 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
374 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
375
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
376 static PyObject *ResObj_SetResourceSize(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
377 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
378 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
379 long newSize;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
380 #ifndef SetResourceSize
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
381 PyMac_PRECHECK(SetResourceSize);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
382 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
383 if (!PyArg_ParseTuple(_args, "l",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
384 &newSize))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
385 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
386 SetResourceSize(_self->ob_itself,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
387 newSize);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
388 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
389 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
390 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
391 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
392 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
393 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
394 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
395 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
396
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
397 static PyObject *ResObj_GetNextFOND(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
398 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
399 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
400 Handle _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
401 #ifndef GetNextFOND
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
402 PyMac_PRECHECK(GetNextFOND);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
403 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
404 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
405 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
406 _rv = GetNextFOND(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
407 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
408 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
409 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
410 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
411 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
412 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
413 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
414 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
415
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
416 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
417 static PyObject *ResObj_as_Control(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
418 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
419 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
420
19723
2a9bbdbefbb1 Shut up many more gcc warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19708
diff changeset
421 _res = CtlObj_New((ControlHandle)_self->ob_itself);
2a9bbdbefbb1 Shut up many more gcc warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19708
diff changeset
422 return _res;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
423
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
424 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
425
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
426 static PyObject *ResObj_as_Menu(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
427 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
428 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
429
19723
2a9bbdbefbb1 Shut up many more gcc warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19708
diff changeset
430 _res = MenuObj_New((MenuHandle)_self->ob_itself);
2a9bbdbefbb1 Shut up many more gcc warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19708
diff changeset
431 return _res;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
432
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
433 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
434 #endif /* !__LP64__ */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
435
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
436 static PyObject *ResObj_LoadResource(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
437 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
438 PyObject *_res = NULL;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
439 #ifndef LoadResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
440 PyMac_PRECHECK(LoadResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
441 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
442 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
443 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
444 LoadResource(_self->ob_itself);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
445 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
446 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
447 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
448 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
449 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
450 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
451 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
452 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
453
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
454 static PyObject *ResObj_AutoDispose(ResourceObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
455 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
456 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
457
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
458 int onoff, old = 0;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
459 if (!PyArg_ParseTuple(_args, "i", &onoff))
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
460 return NULL;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
461 if ( _self->ob_freeit )
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
462 old = 1;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
463 if ( onoff )
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
464 _self->ob_freeit = PyMac_AutoDisposeHandle;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
465 else
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
466 _self->ob_freeit = NULL;
19734
d9daa4a67be2 A few more gcc warnings bite the dust.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19723
diff changeset
467 _res = Py_BuildValue("i", old);
d9daa4a67be2 A few more gcc warnings bite the dust.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19723
diff changeset
468 return _res;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
469
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
470 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
471
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
472 static PyMethodDef ResObj_methods[] = {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
473 {"HomeResFile", (PyCFunction)ResObj_HomeResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
474 PyDoc_STR("() -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
475 {"MacLoadResource", (PyCFunction)ResObj_MacLoadResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
476 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
477 {"ReleaseResource", (PyCFunction)ResObj_ReleaseResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
478 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
479 {"DetachResource", (PyCFunction)ResObj_DetachResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
480 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
481 {"GetResAttrs", (PyCFunction)ResObj_GetResAttrs, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
482 PyDoc_STR("() -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
483 {"GetResInfo", (PyCFunction)ResObj_GetResInfo, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
484 PyDoc_STR("() -> (short theID, ResType theType, Str255 name)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
485 {"SetResInfo", (PyCFunction)ResObj_SetResInfo, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
486 PyDoc_STR("(short theID, Str255 name) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
487 {"AddResource", (PyCFunction)ResObj_AddResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
488 PyDoc_STR("(ResType theType, short theID, Str255 name) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
489 {"GetResourceSizeOnDisk", (PyCFunction)ResObj_GetResourceSizeOnDisk, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
490 PyDoc_STR("() -> (long _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
491 {"GetMaxResourceSize", (PyCFunction)ResObj_GetMaxResourceSize, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
492 PyDoc_STR("() -> (long _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
493 {"SetResAttrs", (PyCFunction)ResObj_SetResAttrs, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
494 PyDoc_STR("(short attrs) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
495 {"ChangedResource", (PyCFunction)ResObj_ChangedResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
496 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
497 {"RemoveResource", (PyCFunction)ResObj_RemoveResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
498 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
499 {"WriteResource", (PyCFunction)ResObj_WriteResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
500 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
501 {"SetResourceSize", (PyCFunction)ResObj_SetResourceSize, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
502 PyDoc_STR("(long newSize) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
503 {"GetNextFOND", (PyCFunction)ResObj_GetNextFOND, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
504 PyDoc_STR("() -> (Handle _rv)")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
505 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
506 {"as_Control", (PyCFunction)ResObj_as_Control, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
507 PyDoc_STR("Return this resource/handle as a Control")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
508 {"as_Menu", (PyCFunction)ResObj_as_Menu, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
509 PyDoc_STR("Return this resource/handle as a Menu")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
510 #endif /* !__LP64__ */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
511 {"LoadResource", (PyCFunction)ResObj_LoadResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
512 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
513 {"AutoDispose", (PyCFunction)ResObj_AutoDispose, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
514 PyDoc_STR("(int)->int. Automatically DisposeHandle the object on Python object cleanup")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
515 {NULL, NULL, 0}
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
516 };
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
517
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
518 static PyObject *ResObj_get_data(ResourceObject *self, void *closure)
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
519 {
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
520
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
521 PyObject *res;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
522 char state;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
523
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
524 state = HGetState(self->ob_itself);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
525 HLock(self->ob_itself);
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
526 res = PyString_FromStringAndSize(
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
527 *self->ob_itself,
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
528 GetHandleSize(self->ob_itself));
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
529 HUnlock(self->ob_itself);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
530 HSetState(self->ob_itself, state);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
531 return res;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
532
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
533 }
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
534
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
535 static int ResObj_set_data(ResourceObject *self, PyObject *v, void *closure)
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
536 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
537
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
538 char *data;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
539 long size;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
540
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
541 if ( v == NULL )
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
542 return -1;
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
543 if ( !PyString_Check(v) )
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
544 return -1;
47527
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
545 size = PyString_Size(v);
52294af4b663 This reverts r63675 based on the discussion in this thread:
Gregory P. Smith <greg@mad-scientist.com>
parents: 47473
diff changeset
546 data = PyString_AsString(v);
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
547 /* XXXX Do I need the GetState/SetState calls? */
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
548 SetHandleSize(self->ob_itself, size);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
549 if ( MemError())
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
550 return -1;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
551 HLock(self->ob_itself);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
552 memcpy((char *)*self->ob_itself, data, size);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
553 HUnlock(self->ob_itself);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
554 /* XXXX Should I do the Changed call immedeately? */
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
555 return 0;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
556
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
557 return 0;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
558 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
559
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
560 static PyObject *ResObj_get_size(ResourceObject *self, void *closure)
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
561 {
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
562 return PyInt_FromLong(GetHandleSize(self->ob_itself));
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
563 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
564
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
565 #define ResObj_set_size NULL
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
566
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
567 static PyGetSetDef ResObj_getsetlist[] = {
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
568 {"data", (getter)ResObj_get_data, (setter)ResObj_set_data, "The resource data"},
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
569 {"size", (getter)ResObj_get_size, (setter)ResObj_set_size, "The length of the resource data"},
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
570 {NULL, NULL, NULL, NULL},
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
571 };
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
572
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
573
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
574 #define ResObj_compare NULL
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
575
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
576 #define ResObj_repr NULL
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
577
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
578 #define ResObj_hash NULL
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
579 static int ResObj_tp_init(PyObject *_self, PyObject *_args, PyObject *_kwds)
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
580 {
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
581 char *srcdata = NULL;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
582 int srclen = 0;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
583 Handle itself;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
584 char *kw[] = {"itself", 0};
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
585
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
586 if (PyArg_ParseTupleAndKeywords(_args, _kwds, "O&", kw, ResObj_Convert, &itself))
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
587 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
588 ((ResourceObject *)_self)->ob_itself = itself;
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
589 return 0;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
590 }
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
591 PyErr_Clear();
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
592 if (!PyArg_ParseTupleAndKeywords(_args, _kwds, "|s#", kw, &srcdata, &srclen)) return -1;
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
593 if ((itself = NewHandle(srclen)) == NULL)
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
594 {
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
595 PyErr_NoMemory();
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
596 return 0;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
597 }
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
598 ((ResourceObject *)_self)->ob_itself = itself;
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
599 if (srclen && srcdata)
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
600 {
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
601 HLock(itself);
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
602 memcpy(*itself, srcdata, srclen);
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
603 HUnlock(itself);
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
604 }
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
605 return 0;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
606 }
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
607
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
608 #define ResObj_tp_alloc PyType_GenericAlloc
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
609
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
610 static PyObject *ResObj_tp_new(PyTypeObject *type, PyObject *_args, PyObject *_kwds)
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
611 {
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
612 PyObject *self;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
613 if ((self = type->tp_alloc(type, 0)) == NULL) return NULL;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
614 ((ResourceObject *)self)->ob_itself = NULL;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
615 ((ResourceObject *)self)->ob_freeit = NULL;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
616 return self;
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
617 }
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
618
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
619 #define ResObj_tp_free PyObject_Del
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
620
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
621
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
622 PyTypeObject Resource_Type = {
21113
ed3dce17fc79 Merged changes made on r22b2-branch between r22b2 and r22b2-mac (the
Jack Jansen <jack.jansen@cwi.nl>
parents: 19734
diff changeset
623 PyObject_HEAD_INIT(NULL)
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
624 0, /*ob_size*/
21313
91dd223829c6 Patch supplied by Burton Radons for his own SF bug #487390: Modifying
Guido van Rossum <guido@python.org>
parents: 21113
diff changeset
625 "_Res.Resource", /*tp_name*/
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
626 sizeof(ResourceObject), /*tp_basicsize*/
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
627 0, /*tp_itemsize*/
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
628 /* methods */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
629 (destructor) ResObj_dealloc, /*tp_dealloc*/
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
630 0, /*tp_print*/
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
631 (getattrfunc)0, /*tp_getattr*/
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
632 (setattrfunc)0, /*tp_setattr*/
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
633 (cmpfunc) ResObj_compare, /*tp_compare*/
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
634 (reprfunc) ResObj_repr, /*tp_repr*/
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
635 (PyNumberMethods *)0, /* tp_as_number */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
636 (PySequenceMethods *)0, /* tp_as_sequence */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
637 (PyMappingMethods *)0, /* tp_as_mapping */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
638 (hashfunc) ResObj_hash, /*tp_hash*/
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
639 0, /*tp_call*/
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
640 0, /*tp_str*/
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
641 PyObject_GenericGetAttr, /*tp_getattro*/
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
642 PyObject_GenericSetAttr, /*tp_setattro */
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
643 0, /*tp_as_buffer*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
644 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
645 0, /*tp_doc*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
646 0, /*tp_traverse*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
647 0, /*tp_clear*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
648 0, /*tp_richcompare*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
649 0, /*tp_weaklistoffset*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
650 0, /*tp_iter*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
651 0, /*tp_iternext*/
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
652 ResObj_methods, /* tp_methods */
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
653 0, /*tp_members*/
26464
14fc187334c5 Converted the Carbon modules to use PEP252-style objects, with
Jack Jansen <jack.jansen@cwi.nl>
parents: 26268
diff changeset
654 ResObj_getsetlist, /*tp_getset*/
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
655 0, /*tp_base*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
656 0, /*tp_dict*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
657 0, /*tp_descr_get*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
658 0, /*tp_descr_set*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
659 0, /*tp_dictoffset*/
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
660 ResObj_tp_init, /* tp_init */
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
661 ResObj_tp_alloc, /* tp_alloc */
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
662 ResObj_tp_new, /* tp_new */
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
663 ResObj_tp_free, /* tp_free */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
664 };
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
665
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
666 /* -------------------- End object type Resource -------------------- */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
667
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
668
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
669 static PyObject *Res_CloseResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
670 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
671 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
672 short refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
673 #ifndef CloseResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
674 PyMac_PRECHECK(CloseResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
675 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
676 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
677 &refNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
678 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
679 CloseResFile(refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
680 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
681 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
682 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
683 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
684 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
685 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
686 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
687 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
688
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
689 static PyObject *Res_ResError(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
690 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
691 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
692 OSErr _err;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
693 #ifndef ResError
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
694 PyMac_PRECHECK(ResError);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
695 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
696 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
697 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
698 _err = ResError();
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
699 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
700 Py_INCREF(Py_None);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
701 _res = Py_None;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
702 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
703 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
704
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
705 static PyObject *Res_CurResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
706 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
707 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
708 short _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
709 #ifndef CurResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
710 PyMac_PRECHECK(CurResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
711 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
712 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
713 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
714 _rv = CurResFile();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
715 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
716 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
717 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
718 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
719 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
720 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
721 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
722 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
723
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
724 static PyObject *Res_UseResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
725 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
726 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
727 short refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
728 #ifndef UseResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
729 PyMac_PRECHECK(UseResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
730 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
731 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
732 &refNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
733 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
734 UseResFile(refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
735 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
736 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
737 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
738 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
739 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
740 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
741 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
742 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
743
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
744 static PyObject *Res_CountTypes(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
745 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
746 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
747 short _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
748 #ifndef CountTypes
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
749 PyMac_PRECHECK(CountTypes);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
750 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
751 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
752 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
753 _rv = CountTypes();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
754 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
755 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
756 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
757 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
758 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
759 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
760 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
761 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
762
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
763 static PyObject *Res_Count1Types(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
764 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
765 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
766 short _rv;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
767 #ifndef Count1Types
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
768 PyMac_PRECHECK(Count1Types);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
769 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
770 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
771 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
772 _rv = Count1Types();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
773 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
774 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
775 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
776 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
777 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
778 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
779 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
780 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
781
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
782 static PyObject *Res_GetIndType(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
783 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
784 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
785 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
786 short index;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
787 #ifndef GetIndType
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
788 PyMac_PRECHECK(GetIndType);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
789 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
790 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
791 &index))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
792 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
793 GetIndType(&theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
794 index);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
795 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
796 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
797 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
798 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
799 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
800 PyMac_BuildOSType, theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
801 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
802 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
803
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
804 static PyObject *Res_Get1IndType(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
805 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
806 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
807 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
808 short index;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
809 #ifndef Get1IndType
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
810 PyMac_PRECHECK(Get1IndType);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
811 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
812 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
813 &index))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
814 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
815 Get1IndType(&theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
816 index);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
817 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
818 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
819 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
820 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
821 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
822 PyMac_BuildOSType, theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
823 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
824 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
825
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
826 static PyObject *Res_SetResLoad(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
827 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
828 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
829 Boolean load;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
830 #ifndef SetResLoad
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
831 PyMac_PRECHECK(SetResLoad);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
832 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
833 if (!PyArg_ParseTuple(_args, "b",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
834 &load))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
835 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
836 SetResLoad(load);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
837 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
838 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
839 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
840 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
841 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
842 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
843 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
844 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
845
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
846 static PyObject *Res_CountResources(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
847 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
848 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
849 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
850 ResType theType;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
851 #ifndef CountResources
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
852 PyMac_PRECHECK(CountResources);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
853 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
854 if (!PyArg_ParseTuple(_args, "O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
855 PyMac_GetOSType, &theType))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
856 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
857 _rv = CountResources(theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
858 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
859 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
860 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
861 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
862 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
863 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
864 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
865 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
866
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
867 static PyObject *Res_Count1Resources(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
868 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
869 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
870 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
871 ResType theType;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
872 #ifndef Count1Resources
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
873 PyMac_PRECHECK(Count1Resources);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
874 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
875 if (!PyArg_ParseTuple(_args, "O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
876 PyMac_GetOSType, &theType))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
877 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
878 _rv = Count1Resources(theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
879 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
880 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
881 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
882 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
883 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
884 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
885 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
886 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
887
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
888 static PyObject *Res_GetIndResource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
889 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
890 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
891 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
892 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
893 short index;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
894 #ifndef GetIndResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
895 PyMac_PRECHECK(GetIndResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
896 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
897 if (!PyArg_ParseTuple(_args, "O&h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
898 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
899 &index))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
900 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
901 _rv = GetIndResource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
902 index);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
903 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
904 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
905 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
906 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
907 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
908 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
909 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
910 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
911
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
912 static PyObject *Res_Get1IndResource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
913 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
914 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
915 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
916 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
917 short index;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
918 #ifndef Get1IndResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
919 PyMac_PRECHECK(Get1IndResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
920 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
921 if (!PyArg_ParseTuple(_args, "O&h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
922 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
923 &index))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
924 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
925 _rv = Get1IndResource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
926 index);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
927 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
928 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
929 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
930 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
931 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
932 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
933 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
934 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
935
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
936 static PyObject *Res_GetResource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
937 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
938 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
939 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
940 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
941 short theID;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
942 #ifndef GetResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
943 PyMac_PRECHECK(GetResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
944 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
945 if (!PyArg_ParseTuple(_args, "O&h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
946 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
947 &theID))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
948 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
949 _rv = GetResource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
950 theID);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
951 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
952 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
953 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
954 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
955 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
956 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
957 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
958 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
959
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
960 static PyObject *Res_Get1Resource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
961 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
962 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
963 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
964 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
965 short theID;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
966 #ifndef Get1Resource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
967 PyMac_PRECHECK(Get1Resource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
968 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
969 if (!PyArg_ParseTuple(_args, "O&h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
970 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
971 &theID))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
972 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
973 _rv = Get1Resource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
974 theID);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
975 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
976 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
977 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
978 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
979 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
980 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
981 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
982 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
983
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
984 static PyObject *Res_GetNamedResource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
985 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
986 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
987 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
988 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
989 Str255 name;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
990 #ifndef GetNamedResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
991 PyMac_PRECHECK(GetNamedResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
992 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
993 if (!PyArg_ParseTuple(_args, "O&O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
994 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
995 PyMac_GetStr255, name))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
996 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
997 _rv = GetNamedResource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
998 name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
999 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1000 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1001 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1002 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1003 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1004 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1005 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1006 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1007
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1008 static PyObject *Res_Get1NamedResource(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1009 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1010 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1011 Handle _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1012 ResType theType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1013 Str255 name;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1014 #ifndef Get1NamedResource
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1015 PyMac_PRECHECK(Get1NamedResource);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1016 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1017 if (!PyArg_ParseTuple(_args, "O&O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1018 PyMac_GetOSType, &theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1019 PyMac_GetStr255, name))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1020 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1021 _rv = Get1NamedResource(theType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1022 name);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1023 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1024 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1025 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1026 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1027 _res = Py_BuildValue("O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1028 ResObj_New, _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1029 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1030 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1031
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1032 static PyObject *Res_UniqueID(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1033 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1034 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1035 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1036 ResType theType;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1037 #ifndef UniqueID
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1038 PyMac_PRECHECK(UniqueID);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1039 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1040 if (!PyArg_ParseTuple(_args, "O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1041 PyMac_GetOSType, &theType))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1042 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1043 _rv = UniqueID(theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1044 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1045 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1046 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1047 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1048 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1049 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1050 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1051 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1052
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1053 static PyObject *Res_Unique1ID(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1054 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1055 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1056 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1057 ResType theType;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1058 #ifndef Unique1ID
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1059 PyMac_PRECHECK(Unique1ID);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1060 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1061 if (!PyArg_ParseTuple(_args, "O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1062 PyMac_GetOSType, &theType))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1063 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1064 _rv = Unique1ID(theType);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1065 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1066 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1067 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1068 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1069 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1070 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1071 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1072 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1073
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1074 static PyObject *Res_UpdateResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1075 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1076 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1077 short refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1078 #ifndef UpdateResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1079 PyMac_PRECHECK(UpdateResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1080 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1081 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1082 &refNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1083 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1084 UpdateResFile(refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1085 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1086 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1087 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1088 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1089 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1090 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1091 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1092 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1093
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1094 static PyObject *Res_SetResPurge(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1095 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1096 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1097 Boolean install;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1098 #ifndef SetResPurge
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1099 PyMac_PRECHECK(SetResPurge);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1100 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1101 if (!PyArg_ParseTuple(_args, "b",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1102 &install))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1103 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1104 SetResPurge(install);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1105 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1106 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1107 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1108 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1109 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1110 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1111 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1112 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1113
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1114 static PyObject *Res_GetResFileAttrs(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1115 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1116 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1117 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1118 short refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1119 #ifndef GetResFileAttrs
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1120 PyMac_PRECHECK(GetResFileAttrs);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1121 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1122 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1123 &refNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1124 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1125 _rv = GetResFileAttrs(refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1126 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1127 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1128 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1129 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1130 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1131 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1132 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1133 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1134
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1135 static PyObject *Res_SetResFileAttrs(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1136 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1137 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1138 short refNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1139 short attrs;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1140 #ifndef SetResFileAttrs
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1141 PyMac_PRECHECK(SetResFileAttrs);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1142 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1143 if (!PyArg_ParseTuple(_args, "hh",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1144 &refNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1145 &attrs))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1146 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1147 SetResFileAttrs(refNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1148 attrs);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1149 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1150 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1151 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1152 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1153 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1154 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1155 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1156 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1157
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1158 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1159 static PyObject *Res_OpenRFPerm(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1160 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1161 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1162 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1163 Str255 fileName;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1164 short vRefNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1165 SignedByte permission;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1166 #ifndef OpenRFPerm
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1167 PyMac_PRECHECK(OpenRFPerm);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1168 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1169 if (!PyArg_ParseTuple(_args, "O&hb",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1170 PyMac_GetStr255, fileName,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1171 &vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1172 &permission))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1173 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1174 _rv = OpenRFPerm(fileName,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1175 vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1176 permission);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1177 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1178 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1179 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1180 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1181 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1182 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1183 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1184 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1185
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1186 static PyObject *Res_HOpenResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1187 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1188 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1189 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1190 short vRefNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1191 long dirID;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1192 Str255 fileName;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1193 SignedByte permission;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1194 #ifndef HOpenResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1195 PyMac_PRECHECK(HOpenResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1196 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1197 if (!PyArg_ParseTuple(_args, "hlO&b",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1198 &vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1199 &dirID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1200 PyMac_GetStr255, fileName,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1201 &permission))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1202 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1203 _rv = HOpenResFile(vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1204 dirID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1205 fileName,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1206 permission);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1207 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1208 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1209 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1210 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1211 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1212 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1213 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1214 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1215
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1216 static PyObject *Res_HCreateResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1217 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1218 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1219 short vRefNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1220 long dirID;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1221 Str255 fileName;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1222 #ifndef HCreateResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1223 PyMac_PRECHECK(HCreateResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1224 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1225 if (!PyArg_ParseTuple(_args, "hlO&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1226 &vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1227 &dirID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1228 PyMac_GetStr255, fileName))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1229 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1230 HCreateResFile(vRefNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1231 dirID,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1232 fileName);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1233 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1234 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1235 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1236 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1237 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1238 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1239 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1240 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1241
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1242 static PyObject *Res_FSpOpenResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1243 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1244 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1245 short _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1246 FSSpec spec;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1247 SignedByte permission;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1248 #ifndef FSpOpenResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1249 PyMac_PRECHECK(FSpOpenResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1250 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1251 if (!PyArg_ParseTuple(_args, "O&b",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1252 PyMac_GetFSSpec, &spec,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1253 &permission))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1254 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1255 _rv = FSpOpenResFile(&spec,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1256 permission);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1257 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1258 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1259 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1260 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1261 _res = Py_BuildValue("h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1262 _rv);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1263 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1264 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1265
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1266 static PyObject *Res_FSpCreateResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1267 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1268 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1269 FSSpec spec;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1270 OSType creator;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1271 OSType fileType;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1272 ScriptCode scriptTag;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1273 #ifndef FSpCreateResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1274 PyMac_PRECHECK(FSpCreateResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1275 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1276 if (!PyArg_ParseTuple(_args, "O&O&O&h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1277 PyMac_GetFSSpec, &spec,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1278 PyMac_GetOSType, &creator,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1279 PyMac_GetOSType, &fileType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1280 &scriptTag))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1281 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1282 FSpCreateResFile(&spec,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1283 creator,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1284 fileType,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1285 scriptTag);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1286 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1287 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1288 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1289 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1290 Py_INCREF(Py_None);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1291 _res = Py_None;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1292 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1293 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1294 #endif /* !__LP64__ */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1295
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1296 static PyObject *Res_InsertResourceFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1297 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1298 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1299 OSErr _err;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1300 SInt16 refNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1301 RsrcChainLocation where;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1302 #ifndef InsertResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1303 PyMac_PRECHECK(InsertResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1304 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1305 if (!PyArg_ParseTuple(_args, "hh",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1306 &refNum,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1307 &where))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1308 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1309 _err = InsertResourceFile(refNum,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1310 where);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1311 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1312 Py_INCREF(Py_None);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1313 _res = Py_None;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1314 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1315 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1316
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1317 static PyObject *Res_DetachResourceFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1318 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1319 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1320 OSErr _err;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1321 SInt16 refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1322 #ifndef DetachResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1323 PyMac_PRECHECK(DetachResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1324 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1325 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1326 &refNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1327 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1328 _err = DetachResourceFile(refNum);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1329 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1330 Py_INCREF(Py_None);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1331 _res = Py_None;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1332 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1333 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1334
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1335 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1336 static PyObject *Res_FSpResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1337 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1338 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1339 Boolean _rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1340 FSSpec resourceFile;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1341 Boolean inChain;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1342 SInt16 refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1343 #ifndef FSpResourceFileAlreadyOpen
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1344 PyMac_PRECHECK(FSpResourceFileAlreadyOpen);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1345 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1346 if (!PyArg_ParseTuple(_args, "O&",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1347 PyMac_GetFSSpec, &resourceFile))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1348 return NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1349 _rv = FSpResourceFileAlreadyOpen(&resourceFile,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1350 &inChain,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1351 &refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1352 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1353 OSErr _err = ResError();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1354 if (_err != noErr) return PyMac_Error(_err);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1355 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1356 _res = Py_BuildValue("bbh",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1357 _rv,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1358 inChain,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1359 refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1360 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1361 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1362
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1363 static PyObject *Res_FSpOpenOrphanResFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1364 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1365 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1366 OSErr _err;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1367 FSSpec spec;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1368 SignedByte permission;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1369 SInt16 refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1370 #ifndef FSpOpenOrphanResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1371 PyMac_PRECHECK(FSpOpenOrphanResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1372 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1373 if (!PyArg_ParseTuple(_args, "O&b",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1374 PyMac_GetFSSpec, &spec,
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1375 &permission))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1376 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1377 _err = FSpOpenOrphanResFile(&spec,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1378 permission,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1379 &refNum);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1380 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1381 _res = Py_BuildValue("h",
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1382 refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1383 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1384 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1385
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1386 static PyObject *Res_GetTopResourceFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1387 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1388 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1389 OSErr _err;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1390 SInt16 refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1391 #ifndef GetTopResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1392 PyMac_PRECHECK(GetTopResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1393 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1394 if (!PyArg_ParseTuple(_args, ""))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1395 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1396 _err = GetTopResourceFile(&refNum);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1397 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1398 _res = Py_BuildValue("h",
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1399 refNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1400 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1401 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1402
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1403
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1404 static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1405 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1406 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1407 OSErr _err;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1408 SInt16 curRefNum;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1409 SInt16 nextRefNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1410 #ifndef GetNextResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1411 PyMac_PRECHECK(GetNextResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1412 #endif
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1413 if (!PyArg_ParseTuple(_args, "h",
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1414 &curRefNum))
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1415 return NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1416 _err = GetNextResourceFile(curRefNum,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1417 &nextRefNum);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1418 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1419 _res = Py_BuildValue("h",
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1420 nextRefNum);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1421 return _res;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1422 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1423 #endif /* !__LP64__ */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1424
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1425 static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1426 {
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1427 PyObject *_res = NULL;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1428 short _rv;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1429 FSRef ref;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1430 SignedByte permission;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1431 #ifndef FSOpenResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1432 PyMac_PRECHECK(FSOpenResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1433 #endif
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1434 if (!PyArg_ParseTuple(_args, "O&b",
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1435 PyMac_GetFSRef, &ref,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1436 &permission))
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1437 return NULL;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1438 _rv = FSOpenResFile(&ref,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1439 permission);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1440 {
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1441 OSErr _err = ResError();
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1442 if (_err != noErr) return PyMac_Error(_err);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1443 }
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1444 _res = Py_BuildValue("h",
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1445 _rv);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1446 return _res;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1447 }
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1448
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1449
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1450 #ifndef __LP64__
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1451 static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1452 {
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1453 PyObject *_res = NULL;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1454 FSRef parentRef;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1455 UniChar *nameLength__in__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1456 UniCharCount nameLength__len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1457 int nameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1458 FSRef newRef;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1459 FSSpec newSpec;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1460 #ifndef FSCreateResFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1461 PyMac_PRECHECK(FSCreateResFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1462 #endif
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1463 if (!PyArg_ParseTuple(_args, "O&u#",
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1464 PyMac_GetFSRef, &parentRef,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1465 &nameLength__in__, &nameLength__in_len__))
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1466 return NULL;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1467 nameLength__len__ = nameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1468 FSCreateResFile(&parentRef,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1469 nameLength__len__, nameLength__in__,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1470 0,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1471 (FSCatalogInfo *)0,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1472 &newRef,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1473 &newSpec);
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1474 {
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1475 OSErr _err = ResError();
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1476 if (_err != noErr) return PyMac_Error(_err);
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1477 }
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1478 _res = Py_BuildValue("O&O&",
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1479 PyMac_BuildFSRef, &newRef,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1480 PyMac_BuildFSSpec, &newSpec);
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1481 return _res;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1482 }
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1483
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1484 static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1485 {
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1486 PyObject *_res = NULL;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1487 Boolean _rv;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1488 FSRef resourceFileRef;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1489 Boolean inChain;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1490 SInt16 refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1491 #ifndef FSResourceFileAlreadyOpen
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1492 PyMac_PRECHECK(FSResourceFileAlreadyOpen);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1493 #endif
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1494 if (!PyArg_ParseTuple(_args, "O&",
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1495 PyMac_GetFSRef, &resourceFileRef))
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1496 return NULL;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1497 _rv = FSResourceFileAlreadyOpen(&resourceFileRef,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1498 &inChain,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1499 &refNum);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1500 {
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1501 OSErr _err = ResError();
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1502 if (_err != noErr) return PyMac_Error(_err);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1503 }
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1504 _res = Py_BuildValue("bbh",
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1505 _rv,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1506 inChain,
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1507 refNum);
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1508 return _res;
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1509 }
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1510
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1511 static PyObject *Res_FSCreateResourceFile(PyObject *_self, PyObject *_args)
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1512 {
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1513 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1514 OSErr _err;
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1515 FSRef parentRef;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1516 UniChar *nameLength__in__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1517 UniCharCount nameLength__len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1518 int nameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1519 UniChar *forkNameLength__in__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1520 UniCharCount forkNameLength__len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1521 int forkNameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1522 FSRef newRef;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1523 FSSpec newSpec;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1524 #ifndef FSCreateResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1525 PyMac_PRECHECK(FSCreateResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1526 #endif
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1527 if (!PyArg_ParseTuple(_args, "O&u#u#",
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1528 PyMac_GetFSRef, &parentRef,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1529 &nameLength__in__, &nameLength__in_len__,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1530 &forkNameLength__in__, &forkNameLength__in_len__))
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1531 return NULL;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1532 nameLength__len__ = nameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1533 forkNameLength__len__ = forkNameLength__in_len__;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1534 _err = FSCreateResourceFile(&parentRef,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1535 nameLength__len__, nameLength__in__,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1536 0,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1537 (FSCatalogInfo *)0,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1538 forkNameLength__len__, forkNameLength__in__,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1539 &newRef,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1540 &newSpec);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1541 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1542 _res = Py_BuildValue("O&O&",
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1543 PyMac_BuildFSRef, &newRef,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1544 PyMac_BuildFSSpec, &newSpec);
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1545 return _res;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1546 }
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1547 #endif /* __LP64__ */
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1548
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1549 static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1550 {
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1551 PyObject *_res = NULL;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1552 OSErr _err;
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1553 FSRef ref;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1554 UniChar *forkNameLength__in__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1555 UniCharCount forkNameLength__len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1556 int forkNameLength__in_len__;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1557 SignedByte permissions;
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1558 ResFileRefNum refNum;
22443
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1559 #ifndef FSOpenResourceFile
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1560 PyMac_PRECHECK(FSOpenResourceFile);
d1aecf663167 Generate with weaklink stubs, so missing routines (on MacOS 8.6 and earlier)
Jack Jansen <jack.jansen@cwi.nl>
parents: 22384
diff changeset
1561 #endif
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1562 if (!PyArg_ParseTuple(_args, "O&u#b",
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1563 PyMac_GetFSRef, &ref,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1564 &forkNameLength__in__, &forkNameLength__in_len__,
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1565 &permissions))
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1566 return NULL;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1567 forkNameLength__len__ = forkNameLength__in_len__;
22384
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1568 _err = FSOpenResourceFile(&ref,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1569 forkNameLength__len__, forkNameLength__in__,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1570 permissions,
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1571 &refNum);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1572 if (_err != noErr) return PyMac_Error(_err);
42e6c3cdc095 Some of the newer routines return an OSErr, like most toolbox calls, in stead of depending on ResError(). Second half of fix for #531291.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21633
diff changeset
1573 _res = Py_BuildValue("h",
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1574 refNum);
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1575 return _res;
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1576 }
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1577
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1578 static PyObject *Res_Handle(PyObject *_self, PyObject *_args)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1579 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1580 PyObject *_res = NULL;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1581
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1582 char *buf;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1583 int len;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1584 Handle h;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1585 ResourceObject *rv;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1586
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1587 if (!PyArg_ParseTuple(_args, "s#", &buf, &len))
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1588 return NULL;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1589 h = NewHandle(len);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1590 if ( h == NULL ) {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1591 PyErr_NoMemory();
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1592 return NULL;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1593 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1594 HLock(h);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1595 memcpy(*h, buf, len);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1596 HUnlock(h);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1597 rv = (ResourceObject *)ResObj_New(h);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1598 rv->ob_freeit = PyMac_AutoDisposeHandle;
19734
d9daa4a67be2 A few more gcc warnings bite the dust.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19723
diff changeset
1599 _res = (PyObject *)rv;
d9daa4a67be2 A few more gcc warnings bite the dust.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19723
diff changeset
1600 return _res;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1601
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1602 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1603
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1604 static PyMethodDef Res_methods[] = {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1605 {"CloseResFile", (PyCFunction)Res_CloseResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1606 PyDoc_STR("(short refNum) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1607 {"ResError", (PyCFunction)Res_ResError, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1608 PyDoc_STR("() -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1609 {"CurResFile", (PyCFunction)Res_CurResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1610 PyDoc_STR("() -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1611 {"UseResFile", (PyCFunction)Res_UseResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1612 PyDoc_STR("(short refNum) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1613 {"CountTypes", (PyCFunction)Res_CountTypes, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1614 PyDoc_STR("() -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1615 {"Count1Types", (PyCFunction)Res_Count1Types, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1616 PyDoc_STR("() -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1617 {"GetIndType", (PyCFunction)Res_GetIndType, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1618 PyDoc_STR("(short index) -> (ResType theType)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1619 {"Get1IndType", (PyCFunction)Res_Get1IndType, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1620 PyDoc_STR("(short index) -> (ResType theType)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1621 {"SetResLoad", (PyCFunction)Res_SetResLoad, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1622 PyDoc_STR("(Boolean load) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1623 {"CountResources", (PyCFunction)Res_CountResources, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1624 PyDoc_STR("(ResType theType) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1625 {"Count1Resources", (PyCFunction)Res_Count1Resources, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1626 PyDoc_STR("(ResType theType) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1627 {"GetIndResource", (PyCFunction)Res_GetIndResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1628 PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1629 {"Get1IndResource", (PyCFunction)Res_Get1IndResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1630 PyDoc_STR("(ResType theType, short index) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1631 {"GetResource", (PyCFunction)Res_GetResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1632 PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1633 {"Get1Resource", (PyCFunction)Res_Get1Resource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1634 PyDoc_STR("(ResType theType, short theID) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1635 {"GetNamedResource", (PyCFunction)Res_GetNamedResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1636 PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1637 {"Get1NamedResource", (PyCFunction)Res_Get1NamedResource, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1638 PyDoc_STR("(ResType theType, Str255 name) -> (Handle _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1639 {"UniqueID", (PyCFunction)Res_UniqueID, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1640 PyDoc_STR("(ResType theType) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1641 {"Unique1ID", (PyCFunction)Res_Unique1ID, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1642 PyDoc_STR("(ResType theType) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1643 {"UpdateResFile", (PyCFunction)Res_UpdateResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1644 PyDoc_STR("(short refNum) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1645 {"SetResPurge", (PyCFunction)Res_SetResPurge, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1646 PyDoc_STR("(Boolean install) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1647 {"GetResFileAttrs", (PyCFunction)Res_GetResFileAttrs, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1648 PyDoc_STR("(short refNum) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1649 {"SetResFileAttrs", (PyCFunction)Res_SetResFileAttrs, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1650 PyDoc_STR("(short refNum, short attrs) -> None")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1651 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1652 {"OpenRFPerm", (PyCFunction)Res_OpenRFPerm, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1653 PyDoc_STR("(Str255 fileName, short vRefNum, SignedByte permission) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1654 {"HOpenResFile", (PyCFunction)Res_HOpenResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1655 PyDoc_STR("(short vRefNum, long dirID, Str255 fileName, SignedByte permission) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1656 {"HCreateResFile", (PyCFunction)Res_HCreateResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1657 PyDoc_STR("(short vRefNum, long dirID, Str255 fileName) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1658 {"FSpOpenResFile", (PyCFunction)Res_FSpOpenResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1659 PyDoc_STR("(FSSpec spec, SignedByte permission) -> (short _rv)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1660 {"FSpCreateResFile", (PyCFunction)Res_FSpCreateResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1661 PyDoc_STR("(FSSpec spec, OSType creator, OSType fileType, ScriptCode scriptTag) -> None")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1662 #endif /* !__LP64__ */
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1663 {"InsertResourceFile", (PyCFunction)Res_InsertResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1664 PyDoc_STR("(SInt16 refNum, RsrcChainLocation where) -> None")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1665 {"DetachResourceFile", (PyCFunction)Res_DetachResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1666 PyDoc_STR("(SInt16 refNum) -> None")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1667 #ifndef __LP64__
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1668 {"FSpResourceFileAlreadyOpen", (PyCFunction)Res_FSpResourceFileAlreadyOpen, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1669 PyDoc_STR("(FSSpec resourceFile) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1670 {"FSpOpenOrphanResFile", (PyCFunction)Res_FSpOpenOrphanResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1671 PyDoc_STR("(FSSpec spec, SignedByte permission) -> (SInt16 refNum)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1672 {"GetTopResourceFile", (PyCFunction)Res_GetTopResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1673 PyDoc_STR("() -> (SInt16 refNum)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1674 {"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1675 PyDoc_STR("(SInt16 curRefNum) -> (SInt16 nextRefNum)")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1676 #endif /* __LP64__ */
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1677 {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1678 PyDoc_STR("(FSRef ref, SignedByte permission) -> (short _rv)")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1679 #ifndef __LP64__
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1680 {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1681 PyDoc_STR("(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)")},
21464
b27599abcc49 Updated to Universal Headers 3.4
Jack Jansen <jack.jansen@cwi.nl>
parents: 21313
diff changeset
1682 {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1683 PyDoc_STR("(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)")},
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1684 {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1685 PyDoc_STR("(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (FSRef newRef, FSSpec newSpec)")},
47473
c34e34057714 MacOS X: Enable 4-way universal builds
Ronald Oussoren <ronaldoussoren@mac.com>
parents: 47294
diff changeset
1686 #endif /* __LP64__ */
21614
095cff21956c Added some support for unicode arguments.
Jack Jansen <jack.jansen@cwi.nl>
parents: 21464
diff changeset
1687 {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1688 PyDoc_STR("(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (SInt16 refNum)")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1689 {"Handle", (PyCFunction)Res_Handle, 1,
24865
b54cfa98b66b Regenerated with PyDoc_STR() around docstrings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 23261
diff changeset
1690 PyDoc_STR("Convert a string to a Handle object.\n\nResource() and Handle() are very similar, but objects created with Handle() are\nby default automatically DisposeHandle()d upon object cleanup. Use AutoDispose()\nto change this.\n")},
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1691 {NULL, NULL, 0}
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1692 };
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1693
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1694
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1695
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1696 /* Alternative version of ResObj_New, which returns None for null argument */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1697 PyObject *OptResObj_New(Handle itself)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1698 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1699 if (itself == NULL) {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1700 Py_INCREF(Py_None);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1701 return Py_None;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1702 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1703 return ResObj_New(itself);
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1704 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1705
19723
2a9bbdbefbb1 Shut up many more gcc warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 19708
diff changeset
1706 int OptResObj_Convert(PyObject *v, Handle *p_itself)
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1707 {
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1708 PyObject *tmp;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1709
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1710 if ( v == Py_None ) {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1711 *p_itself = NULL;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1712 return 1;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1713 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1714 if (ResObj_Check(v))
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1715 {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1716 *p_itself = ((ResourceObject *)v)->ob_itself;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1717 return 1;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1718 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1719 /* If it isn't a resource yet see whether it is convertible */
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1720 if ( (tmp=PyObject_CallMethod(v, "as_Resource", "")) ) {
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1721 *p_itself = ((ResourceObject *)tmp)->ob_itself;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1722 Py_DECREF(tmp);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1723 return 1;
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1724 }
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1725 PyErr_Clear();
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1726 PyErr_SetString(PyExc_TypeError, "Resource required");
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1727 return 0;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1728 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1729
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1730
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1731 void init_Res(void)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1732 {
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1733 PyObject *m;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1734 PyObject *d;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1735
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1736
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1737
35200
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1738 PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1739 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1740 PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New);
5df1c692bb41 Updated (and regenerated) for name change in tp_init method arguments:
Jack Jansen <jack.jansen@cwi.nl>
parents: 30982
diff changeset
1741 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert);
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1742
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1743
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1744 m = Py_InitModule("_Res", Res_methods);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1745 d = PyModule_GetDict(m);
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1746 Res_Error = PyMac_GetOSErrException();
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1747 if (Res_Error == NULL ||
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1748 PyDict_SetItemString(d, "Error", Res_Error) != 0)
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1749 return;
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1750 Resource_Type.ob_type = &PyType_Type;
26769
aef3a03a79f1 - Various tweaks to shut up compiler warnings.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26720
diff changeset
1751 if (PyType_Ready(&Resource_Type) < 0) return;
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1752 Py_INCREF(&Resource_Type);
26545
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
1753 PyModule_AddObject(m, "Resource", (PyObject *)&Resource_Type);
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
1754 /* Backward-compatible name */
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
1755 Py_INCREF(&Resource_Type);
8a75c66bfa14 Fixed so the Res.Resource() accepts either another resource, a string
Jack Jansen <jack.jansen@cwi.nl>
parents: 26464
diff changeset
1756 PyModule_AddObject(m, "ResourceType", (PyObject *)&Resource_Type);
19443
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1757 }
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1758
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1759 /* ======================== End module _Res ========================= */
0922d609acd1 Renamed the Mac toolbox modules to have an initial _ in their name.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1760