Mercurial > cpython-lru_cache-weakref
annotate Mac/Modules/ae/AEmodule.c @ 4566:6403c94de50d legacy-trunk
Added safeguard against failure in __del__.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 27 Nov 1996 19:39:58 +0000 |
| parents | ff68a2ec1ff1 |
| children | e22eea5d126d |
| rev | line source |
|---|---|
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* =========================== Module AE ============================ */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 #include "Python.h" |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 #define SystemSevenOrLater 1 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 #include "macglue.h" |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 #include <Memory.h> |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 #include <Dialogs.h> |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 #include <Menus.h> |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 #include <Controls.h> |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 extern PyObject *ResObj_New(Handle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 extern int ResObj_Convert(PyObject *, Handle *); |
|
3295
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
18 extern PyObject *OptResObj_New(Handle); |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
19 extern int OptResObj_Convert(PyObject *, Handle *); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 extern PyObject *WinObj_New(WindowPtr); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 extern int WinObj_Convert(PyObject *, WindowPtr *); |
|
3295
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
23 extern PyTypeObject Window_Type; |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
24 #define WinObj_Check(x) ((x)->ob_type == &Window_Type) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 extern PyObject *DlgObj_New(DialogPtr); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 extern int DlgObj_Convert(PyObject *, DialogPtr *); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 extern PyTypeObject Dialog_Type; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 extern PyObject *MenuObj_New(MenuHandle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 extern int MenuObj_Convert(PyObject *, MenuHandle *); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 extern PyObject *CtlObj_New(ControlHandle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 extern int CtlObj_Convert(PyObject *, ControlHandle *); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 |
|
3295
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
37 extern PyObject *GrafObj_New(GrafPtr); |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
38 extern int GrafObj_Convert(PyObject *, GrafPtr *); |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
39 |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
40 extern PyObject *BMObj_New(BitMapPtr); |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
41 extern int BMObj_Convert(PyObject *, BitMapPtr *); |
|
3ca111e0b1a7
- Added color window/pixmap support
Jack Jansen <jack.jansen@cwi.nl>
parents:
2999
diff
changeset
|
42 |
| 2286 | 43 extern PyObject *WinObj_WhichWindow(WindowPtr); |
| 44 | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 #include <AppleEvents.h> |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 |
| 2343 | 47 #ifndef HAVE_UNIVERSAL_HEADERS |
| 2286 | 48 #define AEIdleProcPtr IdleProcPtr |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 #define AEFilterProcPtr EventFilterProcPtr |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 #define AEEventHandlerProcPtr EventHandlerProcPtr |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 #endif |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 |
| 2343 | 53 #ifndef HAVE_UNIVERSAL_HEADERS |
| 54 /* I'm trying to setup the code here so that is easily automated, | |
| 2286 | 55 ** as follows: |
| 56 ** - Use the UPP in the source | |
| 57 ** - for pre-universal headers, #define each UPP as the corresponding ProcPtr | |
| 58 ** - for each routine we pass we declare a upp_xxx that | |
| 59 ** we initialize to the correct value in the init routine. | |
| 60 */ | |
| 61 #define AEIdleUPP AEIdleProcPtr | |
| 62 #define AEFilterUPP AEFilterProcPtr | |
| 63 #define AEEventHandlerUPP AEEventHandlerProcPtr | |
| 64 #define NewAEIdleProc(x) (x) | |
| 65 #define NewAEFilterProc(x) (x) | |
| 66 #define NewAEEventHandlerProc(x) (x) | |
| 67 #endif | |
| 68 | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 static pascal OSErr GenericEventHandler(); /* Forward */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 |
| 2286 | 71 AEEventHandlerUPP upp_GenericEventHandler; |
| 72 | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 { |
| 2719 | 75 PyMac_Yield(); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 return 0; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 |
| 2286 | 79 AEIdleUPP upp_AEIdleProc; |
| 80 | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 static PyObject *AE_Error; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 /* ----------------------- Object type AEDesc ----------------------- */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 staticforward PyTypeObject AEDesc_Type; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 #define AEDesc_Check(x) ((x)->ob_type == &AEDesc_Type) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 typedef struct AEDescObject { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 PyObject_HEAD |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 AEDesc ob_itself; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 } AEDescObject; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 static PyObject *AEDesc_New(itself) |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
95 AEDesc *itself; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 AEDescObject *it; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 it = PyObject_NEW(AEDescObject, &AEDesc_Type); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 if (it == NULL) return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 it->ob_itself = *itself; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 return (PyObject *)it; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 static AEDesc_Convert(v, p_itself) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 PyObject *v; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 AEDesc *p_itself; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 if (!AEDesc_Check(v)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 PyErr_SetString(PyExc_TypeError, "AEDesc required"); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
110 return 0; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 *p_itself = ((AEDescObject *)v)->ob_itself; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 return 1; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
114 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
116 static void AEDesc_dealloc(self) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 AEDescObject *self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
118 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
119 AEDisposeDesc(&self->ob_itself); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
120 PyMem_DEL(self); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
121 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
122 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 static PyObject *AEDesc_AECoerceDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
128 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
129 DescType toType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 PyMac_GetOSType, &toType)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 _err = AECoerceDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 toType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 static PyObject *AEDesc_AEDuplicateDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 _err = AEDuplicateDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 static PyObject *AEDesc_AECountItems(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 long theCount; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 _err = AECountItems(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 &theCount); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 _res = Py_BuildValue("l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 theCount); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 |
|
2833
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
177 static PyObject *AEDesc_AEPutPtr(_self, _args) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
178 AEDescObject *_self; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
179 PyObject *_args; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
180 { |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
181 PyObject *_res = NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
182 OSErr _err; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
183 long index; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
184 DescType typeCode; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
185 char *dataPtr__in__; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
186 long dataPtr__len__; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
187 int dataPtr__in_len__; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
188 if (!PyArg_ParseTuple(_args, "lO&s#", |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
189 &index, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
190 PyMac_GetOSType, &typeCode, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
191 &dataPtr__in__, &dataPtr__in_len__)) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
192 return NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
193 dataPtr__len__ = dataPtr__in_len__; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
194 _err = AEPutPtr(&_self->ob_itself, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
195 index, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
196 typeCode, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
197 dataPtr__in__, dataPtr__len__); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
198 if (_err != noErr) return PyMac_Error(_err); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
199 Py_INCREF(Py_None); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
200 _res = Py_None; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
201 dataPtr__error__: ; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
202 return _res; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
203 } |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
204 |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
205 static PyObject *AEDesc_AEPutDesc(_self, _args) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
206 AEDescObject *_self; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
207 PyObject *_args; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
208 { |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
209 PyObject *_res = NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
210 OSErr _err; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
211 long index; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
212 AEDesc theAEDesc; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
213 if (!PyArg_ParseTuple(_args, "lO&", |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
214 &index, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
215 AEDesc_Convert, &theAEDesc)) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
216 return NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
217 _err = AEPutDesc(&_self->ob_itself, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
218 index, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
219 &theAEDesc); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
220 if (_err != noErr) return PyMac_Error(_err); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
221 Py_INCREF(Py_None); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
222 _res = Py_None; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
223 return _res; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
224 } |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
225 |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
226 static PyObject *AEDesc_AEGetNthPtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 long index; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
236 char *dataPtr__out__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
238 int dataPtr__in_len__; |
|
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
239 if (!PyArg_ParseTuple(_args, "lO&i", |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 &index, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
241 PyMac_GetOSType, &desiredType, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
242 &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
244 if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
246 PyErr_NoMemory(); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
247 goto dataPtr__error__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
248 } |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
249 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
250 _err = AEGetNthPtr(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
251 index, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
253 &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
254 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
255 dataPtr__out__, dataPtr__len__, &dataPtr__len__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
256 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
257 _res = Py_BuildValue("O&O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
258 PyMac_BuildOSType, theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
259 PyMac_BuildOSType, typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
260 dataPtr__out__, (int)dataPtr__len__); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
261 free(dataPtr__out__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
263 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
264 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
265 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
266 static PyObject *AEDesc_AEGetNthDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
267 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
268 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
269 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
270 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
271 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
272 long index; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
275 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
276 if (!PyArg_ParseTuple(_args, "lO&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 &index, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 PyMac_GetOSType, &desiredType)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
279 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
280 _err = AEGetNthDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
281 index, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
282 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
283 &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
284 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
285 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
286 _res = Py_BuildValue("O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
287 PyMac_BuildOSType, theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
288 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
289 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
290 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
291 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
292 static PyObject *AEDesc_AESizeOfNthItem(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
293 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
294 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
295 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
296 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
297 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
298 long index; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
299 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
300 Size dataSize; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
301 if (!PyArg_ParseTuple(_args, "l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
302 &index)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
303 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
304 _err = AESizeOfNthItem(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
305 index, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
306 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
307 &dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
308 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
309 _res = Py_BuildValue("O&l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
310 PyMac_BuildOSType, typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
311 dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
312 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
313 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
314 |
|
2833
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
315 static PyObject *AEDesc_AEDeleteItem(_self, _args) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
316 AEDescObject *_self; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
317 PyObject *_args; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
318 { |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
319 PyObject *_res = NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
320 OSErr _err; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
321 long index; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
322 if (!PyArg_ParseTuple(_args, "l", |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
323 &index)) |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
324 return NULL; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
325 _err = AEDeleteItem(&_self->ob_itself, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
326 index); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
327 if (_err != noErr) return PyMac_Error(_err); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
328 Py_INCREF(Py_None); |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
329 _res = Py_None; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
330 return _res; |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
331 } |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
332 |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
333 static PyObject *AEDesc_AEPutParamPtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
334 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
335 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
336 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
337 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
338 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
339 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
340 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
341 char *dataPtr__in__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
342 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
343 int dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
344 if (!PyArg_ParseTuple(_args, "O&O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
345 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
346 PyMac_GetOSType, &typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
347 &dataPtr__in__, &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
348 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
349 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
350 _err = AEPutParamPtr(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
351 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
352 typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
353 dataPtr__in__, dataPtr__len__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
354 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
355 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
356 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
357 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
358 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
359 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
360 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
361 static PyObject *AEDesc_AEPutParamDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
362 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
363 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
364 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
365 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
366 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
367 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
368 AEDesc theAEDesc; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
369 if (!PyArg_ParseTuple(_args, "O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
370 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
371 AEDesc_Convert, &theAEDesc)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
372 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
373 _err = AEPutParamDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
374 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
375 &theAEDesc); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
376 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
377 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
378 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
379 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
380 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
381 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
382 static PyObject *AEDesc_AEGetParamPtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
383 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
384 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
385 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
386 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
387 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
388 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
389 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
390 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
391 char *dataPtr__out__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
392 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
393 int dataPtr__in_len__; |
|
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
394 if (!PyArg_ParseTuple(_args, "O&O&i", |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
395 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
396 PyMac_GetOSType, &desiredType, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
397 &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
398 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
399 if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
400 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
401 PyErr_NoMemory(); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
402 goto dataPtr__error__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
403 } |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
404 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
405 _err = AEGetParamPtr(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
406 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
407 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
408 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
409 dataPtr__out__, dataPtr__len__, &dataPtr__len__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
410 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
411 _res = Py_BuildValue("O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
412 PyMac_BuildOSType, typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
413 dataPtr__out__, (int)dataPtr__len__); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
414 free(dataPtr__out__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
415 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
416 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
418 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
419 static PyObject *AEDesc_AEGetParamDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
420 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
421 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
422 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
423 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
424 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
425 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
426 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
427 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
428 if (!PyArg_ParseTuple(_args, "O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
429 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
430 PyMac_GetOSType, &desiredType)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
431 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
432 _err = AEGetParamDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
433 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
434 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
435 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
436 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
437 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
438 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
439 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
440 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
441 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
442 static PyObject *AEDesc_AESizeOfParam(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
443 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
444 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
445 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
446 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
447 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
448 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
449 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
450 Size dataSize; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
451 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
452 PyMac_GetOSType, &theAEKeyword)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
453 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
454 _err = AESizeOfParam(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
455 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
456 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
457 &dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
458 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
459 _res = Py_BuildValue("O&l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
460 PyMac_BuildOSType, typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
461 dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
462 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
463 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
464 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
465 static PyObject *AEDesc_AEDeleteParam(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
466 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
467 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
468 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
469 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
470 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
471 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
472 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
473 PyMac_GetOSType, &theAEKeyword)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
474 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
475 _err = AEDeleteParam(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
476 theAEKeyword); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
477 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
478 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
479 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
480 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
481 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
482 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
483 static PyObject *AEDesc_AEGetAttributePtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
484 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
485 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
486 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
487 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
488 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
489 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
490 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
491 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
492 char *dataPtr__out__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
493 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
494 int dataPtr__in_len__; |
|
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
495 if (!PyArg_ParseTuple(_args, "O&O&i", |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
496 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
497 PyMac_GetOSType, &desiredType, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
498 &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
499 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
500 if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
501 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
502 PyErr_NoMemory(); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
503 goto dataPtr__error__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
504 } |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
505 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
506 _err = AEGetAttributePtr(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
507 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
508 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
509 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
510 dataPtr__out__, dataPtr__len__, &dataPtr__len__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
511 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
512 _res = Py_BuildValue("O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
513 PyMac_BuildOSType, typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
514 dataPtr__out__, (int)dataPtr__len__); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
515 free(dataPtr__out__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
516 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
517 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
518 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
519 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
520 static PyObject *AEDesc_AEGetAttributeDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
521 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
522 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
523 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
524 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
525 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
526 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
527 DescType desiredType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
528 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
529 if (!PyArg_ParseTuple(_args, "O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
530 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
531 PyMac_GetOSType, &desiredType)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
532 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
533 _err = AEGetAttributeDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
534 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
535 desiredType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
536 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
537 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
538 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
539 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
540 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
541 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
542 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
543 static PyObject *AEDesc_AESizeOfAttribute(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
544 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
545 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
546 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
547 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
548 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
549 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
550 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
551 Size dataSize; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
552 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
553 PyMac_GetOSType, &theAEKeyword)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
554 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
555 _err = AESizeOfAttribute(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
556 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
557 &typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
558 &dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
559 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
560 _res = Py_BuildValue("O&l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
561 PyMac_BuildOSType, typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
562 dataSize); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
563 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
564 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
565 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
566 static PyObject *AEDesc_AEPutAttributePtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
567 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
568 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
569 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
570 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
571 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
572 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
573 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
574 char *dataPtr__in__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
575 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
576 int dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
577 if (!PyArg_ParseTuple(_args, "O&O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
578 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
579 PyMac_GetOSType, &typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
580 &dataPtr__in__, &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
581 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
582 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
583 _err = AEPutAttributePtr(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
584 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
585 typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
586 dataPtr__in__, dataPtr__len__); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
587 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
588 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
589 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
590 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
591 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
592 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
593 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
594 static PyObject *AEDesc_AEPutAttributeDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
595 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
596 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
597 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
598 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
599 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
600 AEKeyword theAEKeyword; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
601 AEDesc theAEDesc; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
602 if (!PyArg_ParseTuple(_args, "O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
603 PyMac_GetOSType, &theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
604 AEDesc_Convert, &theAEDesc)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
605 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
606 _err = AEPutAttributeDesc(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
607 theAEKeyword, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
608 &theAEDesc); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
609 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
610 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
611 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
612 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
613 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
614 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
615 static PyObject *AEDesc_AESend(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
616 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
617 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
618 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
619 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
620 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
621 AppleEvent reply; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
622 AESendMode sendMode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
623 AESendPriority sendPriority; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
624 long timeOutInTicks; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
625 if (!PyArg_ParseTuple(_args, "lhl", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
626 &sendMode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
627 &sendPriority, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
628 &timeOutInTicks)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
629 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
630 _err = AESend(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
631 &reply, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
632 sendMode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
633 sendPriority, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
634 timeOutInTicks, |
| 2286 | 635 upp_AEIdleProc, |
| 636 (AEFilterUPP)0); | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
637 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
638 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
639 AEDesc_New, &reply); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
640 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
641 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
642 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
643 static PyObject *AEDesc_AEResetTimer(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
644 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
645 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
646 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
647 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
648 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
649 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
650 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
651 _err = AEResetTimer(&_self->ob_itself); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
652 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
653 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
654 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
655 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
656 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
657 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
658 static PyObject *AEDesc_AESuspendTheCurrentEvent(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
659 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
660 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
661 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
662 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
663 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
664 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
665 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
666 _err = AESuspendTheCurrentEvent(&_self->ob_itself); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
667 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
668 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
669 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
670 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
671 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
672 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
673 static PyObject *AEDesc_AEResumeTheCurrentEvent(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
674 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
675 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
676 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
677 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
678 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
679 AppleEvent reply; |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
680 AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
681 PyObject *dispatcher; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
682 if (!PyArg_ParseTuple(_args, "O&O", |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
683 AEDesc_Convert, &reply, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
684 &dispatcher)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
685 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
686 _err = AEResumeTheCurrentEvent(&_self->ob_itself, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
687 &reply, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
688 dispatcher__proc__, (long)dispatcher); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
689 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
690 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
691 _res = Py_None; |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
692 Py_INCREF(dispatcher); /* XXX leak, but needed */ |
| 2719 | 693 return _res; |
| 694 } | |
| 695 | |
| 696 static PyObject *AEDesc_AEGetTheCurrentEvent(_self, _args) | |
| 697 AEDescObject *_self; | |
| 698 PyObject *_args; | |
| 699 { | |
| 700 PyObject *_res = NULL; | |
| 701 OSErr _err; | |
| 702 if (!PyArg_ParseTuple(_args, "")) | |
| 703 return NULL; | |
| 704 _err = AEGetTheCurrentEvent(&_self->ob_itself); | |
| 705 if (_err != noErr) return PyMac_Error(_err); | |
| 706 Py_INCREF(Py_None); | |
| 707 _res = Py_None; | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
708 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
709 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
710 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
711 static PyObject *AEDesc_AESetTheCurrentEvent(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
712 AEDescObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
713 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
714 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
715 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
716 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
717 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
718 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
719 _err = AESetTheCurrentEvent(&_self->ob_itself); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
720 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
721 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
722 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
723 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
724 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
725 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
726 static PyMethodDef AEDesc_methods[] = { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
727 {"AECoerceDesc", (PyCFunction)AEDesc_AECoerceDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
728 "(DescType toType) -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
729 {"AEDuplicateDesc", (PyCFunction)AEDesc_AEDuplicateDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
730 "() -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
731 {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
732 "() -> (long theCount)"}, |
|
2833
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
733 {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
734 "(long index, DescType typeCode, Buffer dataPtr) -> None"}, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
735 {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
736 "(long index, AEDesc theAEDesc) -> None"}, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
737 {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
738 "(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
739 {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
740 "(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
741 {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
742 "(long index) -> (DescType typeCode, Size dataSize)"}, |
|
2833
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
743 {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1, |
|
1643997f1718
Generated anew after fixing aescan.py
Jack Jansen <jack.jansen@cwi.nl>
parents:
2719
diff
changeset
|
744 "(long index) -> None"}, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
745 {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
746 "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
747 {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
748 "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
749 {"AEGetParamPtr", (PyCFunction)AEDesc_AEGetParamPtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
750 "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
751 {"AEGetParamDesc", (PyCFunction)AEDesc_AEGetParamDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
752 "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
753 {"AESizeOfParam", (PyCFunction)AEDesc_AESizeOfParam, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
754 "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
755 {"AEDeleteParam", (PyCFunction)AEDesc_AEDeleteParam, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
756 "(AEKeyword theAEKeyword) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
757 {"AEGetAttributePtr", (PyCFunction)AEDesc_AEGetAttributePtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
758 "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
759 {"AEGetAttributeDesc", (PyCFunction)AEDesc_AEGetAttributeDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
760 "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
761 {"AESizeOfAttribute", (PyCFunction)AEDesc_AESizeOfAttribute, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
762 "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
763 {"AEPutAttributePtr", (PyCFunction)AEDesc_AEPutAttributePtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
764 "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
765 {"AEPutAttributeDesc", (PyCFunction)AEDesc_AEPutAttributeDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
766 "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
767 {"AESend", (PyCFunction)AEDesc_AESend, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
768 "(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
769 {"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
770 "() -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
771 {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
772 "() -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
773 {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
774 "(AppleEvent reply, EventHandler dispatcher) -> None"}, |
| 2719 | 775 {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, |
| 776 "() -> None"}, | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
777 {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
778 "() -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
779 {NULL, NULL, 0} |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
780 }; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
781 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
782 static PyMethodChain AEDesc_chain = { AEDesc_methods, NULL }; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
783 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
784 static PyObject *AEDesc_getattr(self, name) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
785 AEDescObject *self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
786 char *name; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
787 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
788 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
789 if (strcmp(name, "type") == 0) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
790 return PyMac_BuildOSType(self->ob_itself.descriptorType); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
791 if (strcmp(name, "data") == 0) { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
792 PyObject *res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
793 char state; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
794 state = HGetState(self->ob_itself.dataHandle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
795 HLock(self->ob_itself.dataHandle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
796 res = PyString_FromStringAndSize( |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
797 *self->ob_itself.dataHandle, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
798 GetHandleSize(self->ob_itself.dataHandle)); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
799 HUnlock(self->ob_itself.dataHandle); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
800 HSetState(self->ob_itself.dataHandle, state); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
801 return res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
802 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
803 if (strcmp(name, "__members__") == 0) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
804 return Py_BuildValue("[ss]", "data", "type"); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
805 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
806 return Py_FindMethodInChain(&AEDesc_chain, (PyObject *)self, name); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
807 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
808 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
809 #define AEDesc_setattr NULL |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
810 |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
811 staticforward PyTypeObject AEDesc_Type = { |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
812 PyObject_HEAD_INIT(&PyType_Type) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
813 0, /*ob_size*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
814 "AEDesc", /*tp_name*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
815 sizeof(AEDescObject), /*tp_basicsize*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
816 0, /*tp_itemsize*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
817 /* methods */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
818 (destructor) AEDesc_dealloc, /*tp_dealloc*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
819 0, /*tp_print*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
820 (getattrfunc) AEDesc_getattr, /*tp_getattr*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
821 (setattrfunc) AEDesc_setattr, /*tp_setattr*/ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
822 }; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
823 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
824 /* --------------------- End object type AEDesc --------------------- */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
825 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
826 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
827 static PyObject *AE_AECreateDesc(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
828 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
829 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
830 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
831 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
832 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
833 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
834 char *dataPtr__in__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
835 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
836 int dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
837 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
838 if (!PyArg_ParseTuple(_args, "O&s#", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
839 PyMac_GetOSType, &typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
840 &dataPtr__in__, &dataPtr__in_len__)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
841 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
842 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
843 _err = AECreateDesc(typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
844 dataPtr__in__, dataPtr__len__, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
845 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
846 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
847 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
848 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
849 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
850 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
851 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
852 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
853 static PyObject *AE_AECoercePtr(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
854 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
855 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
856 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
857 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
858 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
859 DescType typeCode; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
860 char *dataPtr__in__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
861 long dataPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
862 int dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
863 DescType toType; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
864 AEDesc result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
865 if (!PyArg_ParseTuple(_args, "O&s#O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
866 PyMac_GetOSType, &typeCode, |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
867 &dataPtr__in__, &dataPtr__in_len__, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
868 PyMac_GetOSType, &toType)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
869 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
870 dataPtr__len__ = dataPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
871 _err = AECoercePtr(typeCode, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
872 dataPtr__in__, dataPtr__len__, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
873 toType, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
874 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
875 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
876 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
877 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
878 dataPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
879 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
880 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
881 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
882 static PyObject *AE_AECreateList(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
883 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
884 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
885 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
886 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
887 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
888 char *factoringPtr__in__; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
889 long factoringPtr__len__; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
890 int factoringPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
891 Boolean isRecord; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
892 AEDescList resultList; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
893 if (!PyArg_ParseTuple(_args, "s#b", |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
894 &factoringPtr__in__, &factoringPtr__in_len__, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
895 &isRecord)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
896 return NULL; |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
897 factoringPtr__len__ = factoringPtr__in_len__; |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
898 _err = AECreateList(factoringPtr__in__, factoringPtr__len__, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
899 isRecord, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
900 &resultList); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
901 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
902 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
903 AEDesc_New, &resultList); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
904 factoringPtr__error__: ; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
905 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
906 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
907 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
908 static PyObject *AE_AECreateAppleEvent(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
909 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
910 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
911 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
912 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
913 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
914 AEEventClass theAEEventClass; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
915 AEEventID theAEEventID; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
916 AEAddressDesc target; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
917 short returnID; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
918 long transactionID; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
919 AppleEvent result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
920 if (!PyArg_ParseTuple(_args, "O&O&O&hl", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
921 PyMac_GetOSType, &theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
922 PyMac_GetOSType, &theAEEventID, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
923 AEDesc_Convert, &target, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
924 &returnID, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
925 &transactionID)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
926 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
927 _err = AECreateAppleEvent(theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
928 theAEEventID, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
929 &target, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
930 returnID, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
931 transactionID, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
932 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
933 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
934 _res = Py_BuildValue("O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
935 AEDesc_New, &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
936 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
937 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
938 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
939 static PyObject *AE_AEProcessAppleEvent(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
940 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
941 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
942 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
943 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
944 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
945 EventRecord theEventRecord; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
946 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
947 PyMac_GetEventRecord, &theEventRecord)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
948 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
949 _err = AEProcessAppleEvent(&theEventRecord); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
950 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
951 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
952 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
953 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
954 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
955 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
956 static PyObject *AE_AEGetInteractionAllowed(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
957 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
958 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
959 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
960 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
961 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
962 AEInteractAllowed level; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
963 if (!PyArg_ParseTuple(_args, "")) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
964 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
965 _err = AEGetInteractionAllowed(&level); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
966 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
967 _res = Py_BuildValue("b", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
968 level); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
969 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
970 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
971 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
972 static PyObject *AE_AESetInteractionAllowed(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
973 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
974 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
975 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
976 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
977 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
978 AEInteractAllowed level; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
979 if (!PyArg_ParseTuple(_args, "b", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
980 &level)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
981 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
982 _err = AESetInteractionAllowed(level); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
983 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
984 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
985 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
986 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
987 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
988 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
989 static PyObject *AE_AEInteractWithUser(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
990 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
991 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
992 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
993 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
994 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
995 long timeOutInTicks; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
996 if (!PyArg_ParseTuple(_args, "l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
997 &timeOutInTicks)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
998 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
999 _err = AEInteractWithUser(timeOutInTicks, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1000 (NMRecPtr)0, |
| 2286 | 1001 upp_AEIdleProc); |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1002 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1003 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1004 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1005 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1006 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1007 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1008 static PyObject *AE_AEInstallEventHandler(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1009 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1010 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1011 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1012 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1013 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1014 AEEventClass theAEEventClass; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1015 AEEventID theAEEventID; |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1016 AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1017 PyObject *handler; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1018 if (!PyArg_ParseTuple(_args, "O&O&O", |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1019 PyMac_GetOSType, &theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1020 PyMac_GetOSType, &theAEEventID, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1021 &handler)) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1022 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1023 _err = AEInstallEventHandler(theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1024 theAEEventID, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1025 handler__proc__, (long)handler, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1026 0); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1027 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1028 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1029 _res = Py_None; |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1030 Py_INCREF(handler); /* XXX leak, but needed */ |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1031 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1032 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1033 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1034 static PyObject *AE_AERemoveEventHandler(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1035 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1036 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1037 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1038 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1039 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1040 AEEventClass theAEEventClass; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1041 AEEventID theAEEventID; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1042 if (!PyArg_ParseTuple(_args, "O&O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1043 PyMac_GetOSType, &theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1044 PyMac_GetOSType, &theAEEventID)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1045 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1046 _err = AERemoveEventHandler(theAEEventClass, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1047 theAEEventID, |
| 2286 | 1048 upp_GenericEventHandler, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1049 0); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1050 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1051 Py_INCREF(Py_None); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1052 _res = Py_None; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1053 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1054 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1055 |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1056 static PyObject *AE_AEGetEventHandler(_self, _args) |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1057 PyObject *_self; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1058 PyObject *_args; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1059 { |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1060 PyObject *_res = NULL; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1061 OSErr _err; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1062 AEEventClass theAEEventClass; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1063 AEEventID theAEEventID; |
|
2999
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1064 AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler; |
|
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1065 PyObject *handler; |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1066 if (!PyArg_ParseTuple(_args, "O&O&", |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1067 PyMac_GetOSType, &theAEEventClass, |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1068 PyMac_GetOSType, &theAEEventID)) |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1069 return NULL; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1070 _err = AEGetEventHandler(theAEEventClass, |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1071 theAEEventID, |
|
2999
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1072 &handler__proc__, (long *)&handler, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1073 0); |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1074 if (_err != noErr) return PyMac_Error(_err); |
|
2999
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1075 _res = Py_BuildValue("O", |
|
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1076 handler); |
|
ba2fe5f836a8
Different arg to GetEventHandler (but I cannot really remember fixing
Jack Jansen <jack.jansen@cwi.nl>
parents:
2878
diff
changeset
|
1077 Py_INCREF(handler); /* XXX leak, but needed */ |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1078 return _res; |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1079 } |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1080 |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1081 static PyObject *AE_AEManagerInfo(_self, _args) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1082 PyObject *_self; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1083 PyObject *_args; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1084 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1085 PyObject *_res = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1086 OSErr _err; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1087 AEKeyword keyWord; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1088 long result; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1089 if (!PyArg_ParseTuple(_args, "O&", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1090 PyMac_GetOSType, &keyWord)) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1091 return NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1092 _err = AEManagerInfo(keyWord, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1093 &result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1094 if (_err != noErr) return PyMac_Error(_err); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1095 _res = Py_BuildValue("l", |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1096 result); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1097 return _res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1098 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1099 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1100 static PyMethodDef AE_methods[] = { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1101 {"AECreateDesc", (PyCFunction)AE_AECreateDesc, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1102 "(DescType typeCode, Buffer dataPtr) -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1103 {"AECoercePtr", (PyCFunction)AE_AECoercePtr, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1104 "(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1105 {"AECreateList", (PyCFunction)AE_AECreateList, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1106 "(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1107 {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1108 "(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, short returnID, long transactionID) -> (AppleEvent result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1109 {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1110 "(EventRecord theEventRecord) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1111 {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1112 "() -> (AEInteractAllowed level)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1113 {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1114 "(AEInteractAllowed level) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1115 {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1116 "(long timeOutInTicks) -> None"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1117 {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1118 "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"}, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1119 {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1120 "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"}, |
|
2878
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1121 {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1, |
|
5a5219c8c2e6
Fixed incorrect call to InstallHandler and a few other things
Jack Jansen <jack.jansen@cwi.nl>
parents:
2833
diff
changeset
|
1122 "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"}, |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1123 {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1124 "(AEKeyword keyWord) -> (long result)"}, |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1125 {NULL, NULL, 0} |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1126 }; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1127 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1128 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1129 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1130 static pascal OSErr |
|
2398
cabb7c5732ef
another round... ported to __SC__
Guido van Rossum <guido@python.org>
parents:
2343
diff
changeset
|
1131 GenericEventHandler(AppleEvent *request, AppleEvent *reply, long refcon) |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1132 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1133 PyObject *handler = (PyObject *)refcon; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1134 AEDescObject *requestObject, *replyObject; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1135 PyObject *args, *res; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1136 if ((requestObject = (AEDescObject *)AEDesc_New(request)) == NULL) { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1137 return -1; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1138 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1139 if ((replyObject = (AEDescObject *)AEDesc_New(reply)) == NULL) { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1140 Py_DECREF(requestObject); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1141 return -1; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1142 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1143 if ((args = Py_BuildValue("OO", requestObject, replyObject)) == NULL) { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1144 Py_DECREF(requestObject); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1145 Py_DECREF(replyObject); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1146 return -1; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1147 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1148 res = PyEval_CallObject(handler, args); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1149 requestObject->ob_itself.descriptorType = 'null'; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1150 requestObject->ob_itself.dataHandle = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1151 replyObject->ob_itself.descriptorType = 'null'; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1152 replyObject->ob_itself.dataHandle = NULL; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1153 Py_DECREF(args); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1154 if (res == NULL) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1155 return -1; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1156 Py_DECREF(res); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1157 return noErr; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1158 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1159 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1160 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1161 void initAE() |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1162 { |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1163 PyObject *m; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1164 PyObject *d; |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1165 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1166 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1167 |
| 2286 | 1168 upp_AEIdleProc = NewAEIdleProc(AEIdleProc); |
| 1169 upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); | |
| 1170 | |
|
2267
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1171 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1172 m = Py_InitModule("AE", AE_methods); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1173 d = PyModule_GetDict(m); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1174 AE_Error = PyMac_GetOSErrException(); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1175 if (AE_Error == NULL || |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1176 PyDict_SetItemString(d, "Error", AE_Error) != 0) |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1177 Py_FatalError("can't initialize AE.Error"); |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1178 } |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1179 |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1180 /* ========================= End module AE ========================== */ |
|
7411b6a06920
Committed a more or less working version.
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1181 |
