1 | /*
|
---|
2 | ** pymactoolbox.h - globals defined in mactoolboxglue.c
|
---|
3 | */
|
---|
4 | #ifndef Py_PYMACTOOLBOX_H
|
---|
5 | #define Py_PYMACTOOLBOX_H
|
---|
6 | #ifdef __cplusplus
|
---|
7 | extern "C" {
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #include <Carbon/Carbon.h>
|
---|
11 | #include <QuickTime/QuickTime.h>
|
---|
12 |
|
---|
13 | /*
|
---|
14 | ** Helper routines for error codes and such.
|
---|
15 | */
|
---|
16 | char *PyMac_StrError(int); /* strerror with mac errors */
|
---|
17 | extern PyObject *PyMac_OSErrException; /* Exception for OSErr */
|
---|
18 | PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */
|
---|
19 | PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */
|
---|
20 | PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */
|
---|
21 | extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert
|
---|
22 | fsspec->path */
|
---|
23 | /*
|
---|
24 | ** These conversion routines are defined in mactoolboxglue.c itself.
|
---|
25 | */
|
---|
26 | int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */
|
---|
27 | PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */
|
---|
28 |
|
---|
29 | PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */
|
---|
30 |
|
---|
31 | int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */
|
---|
32 | PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */
|
---|
33 | PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject,
|
---|
34 | NULL to None */
|
---|
35 |
|
---|
36 | int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */
|
---|
37 | PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */
|
---|
38 |
|
---|
39 | int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */
|
---|
40 | PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */
|
---|
41 |
|
---|
42 | int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for
|
---|
43 | EventRecord */
|
---|
44 | PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to
|
---|
45 | PyObject */
|
---|
46 |
|
---|
47 | int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */
|
---|
48 | PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */
|
---|
49 | int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */
|
---|
50 | PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */
|
---|
51 |
|
---|
52 | /*
|
---|
53 | ** The rest of the routines are implemented by extension modules. If they are
|
---|
54 | ** dynamically loaded mactoolboxglue will contain a stub implementation of the
|
---|
55 | ** routine, which imports the module, whereupon the module's init routine will
|
---|
56 | ** communicate the routine pointer back to the stub.
|
---|
57 | ** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the
|
---|
58 | ** extension modules simply declare the routine. This is the case for static
|
---|
59 | ** builds (and could be the case for MacPython CFM builds, because CFM extension
|
---|
60 | ** modules can reference each other without problems).
|
---|
61 | */
|
---|
62 |
|
---|
63 | #ifdef USE_TOOLBOX_OBJECT_GLUE
|
---|
64 | /*
|
---|
65 | ** These macros are used in the module init code. If we use toolbox object glue
|
---|
66 | ** it sets the function pointer to point to the real function.
|
---|
67 | */
|
---|
68 | #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \
|
---|
69 | extern PyObject *(*PyMacGluePtr_##rtn)(object); \
|
---|
70 | PyMacGluePtr_##rtn = _##rtn; \
|
---|
71 | }
|
---|
72 | #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \
|
---|
73 | extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \
|
---|
74 | PyMacGluePtr_##rtn = _##rtn; \
|
---|
75 | }
|
---|
76 | #else
|
---|
77 | /*
|
---|
78 | ** If we don't use toolbox object glue the init macros are empty. Moreover, we define
|
---|
79 | ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included.
|
---|
80 | */
|
---|
81 | #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn)
|
---|
82 | #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn)
|
---|
83 | #endif /* USE_TOOLBOX_OBJECT_GLUE */
|
---|
84 |
|
---|
85 | /* macfs exports */
|
---|
86 | int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */
|
---|
87 | PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */
|
---|
88 |
|
---|
89 | int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */
|
---|
90 | PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */
|
---|
91 |
|
---|
92 | /* AE exports */
|
---|
93 | extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */
|
---|
94 | extern PyObject *AEDesc_NewBorrowed(AppleEvent *);
|
---|
95 | extern int AEDesc_Convert(PyObject *, AppleEvent *);
|
---|
96 |
|
---|
97 | /* Cm exports */
|
---|
98 | extern PyObject *CmpObj_New(Component);
|
---|
99 | extern int CmpObj_Convert(PyObject *, Component *);
|
---|
100 | extern PyObject *CmpInstObj_New(ComponentInstance);
|
---|
101 | extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
|
---|
102 |
|
---|
103 | /* Ctl exports */
|
---|
104 | extern PyObject *CtlObj_New(ControlHandle);
|
---|
105 | extern int CtlObj_Convert(PyObject *, ControlHandle *);
|
---|
106 |
|
---|
107 | /* Dlg exports */
|
---|
108 | extern PyObject *DlgObj_New(DialogPtr);
|
---|
109 | extern int DlgObj_Convert(PyObject *, DialogPtr *);
|
---|
110 | extern PyObject *DlgObj_WhichDialog(DialogPtr);
|
---|
111 |
|
---|
112 | /* Drag exports */
|
---|
113 | extern PyObject *DragObj_New(DragReference);
|
---|
114 | extern int DragObj_Convert(PyObject *, DragReference *);
|
---|
115 |
|
---|
116 | /* List exports */
|
---|
117 | extern PyObject *ListObj_New(ListHandle);
|
---|
118 | extern int ListObj_Convert(PyObject *, ListHandle *);
|
---|
119 |
|
---|
120 | /* Menu exports */
|
---|
121 | extern PyObject *MenuObj_New(MenuHandle);
|
---|
122 | extern int MenuObj_Convert(PyObject *, MenuHandle *);
|
---|
123 |
|
---|
124 | /* Qd exports */
|
---|
125 | extern PyObject *GrafObj_New(GrafPtr);
|
---|
126 | extern int GrafObj_Convert(PyObject *, GrafPtr *);
|
---|
127 | extern PyObject *BMObj_New(BitMapPtr);
|
---|
128 | extern int BMObj_Convert(PyObject *, BitMapPtr *);
|
---|
129 | extern PyObject *QdRGB_New(RGBColor *);
|
---|
130 | extern int QdRGB_Convert(PyObject *, RGBColor *);
|
---|
131 |
|
---|
132 | /* Qdoffs exports */
|
---|
133 | extern PyObject *GWorldObj_New(GWorldPtr);
|
---|
134 | extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
|
---|
135 |
|
---|
136 | /* Qt exports */
|
---|
137 | extern PyObject *TrackObj_New(Track);
|
---|
138 | extern int TrackObj_Convert(PyObject *, Track *);
|
---|
139 | extern PyObject *MovieObj_New(Movie);
|
---|
140 | extern int MovieObj_Convert(PyObject *, Movie *);
|
---|
141 | extern PyObject *MovieCtlObj_New(MovieController);
|
---|
142 | extern int MovieCtlObj_Convert(PyObject *, MovieController *);
|
---|
143 | extern PyObject *TimeBaseObj_New(TimeBase);
|
---|
144 | extern int TimeBaseObj_Convert(PyObject *, TimeBase *);
|
---|
145 | extern PyObject *UserDataObj_New(UserData);
|
---|
146 | extern int UserDataObj_Convert(PyObject *, UserData *);
|
---|
147 | extern PyObject *MediaObj_New(Media);
|
---|
148 | extern int MediaObj_Convert(PyObject *, Media *);
|
---|
149 |
|
---|
150 | /* Res exports */
|
---|
151 | extern PyObject *ResObj_New(Handle);
|
---|
152 | extern int ResObj_Convert(PyObject *, Handle *);
|
---|
153 | extern PyObject *OptResObj_New(Handle);
|
---|
154 | extern int OptResObj_Convert(PyObject *, Handle *);
|
---|
155 |
|
---|
156 | /* TE exports */
|
---|
157 | extern PyObject *TEObj_New(TEHandle);
|
---|
158 | extern int TEObj_Convert(PyObject *, TEHandle *);
|
---|
159 |
|
---|
160 | /* Win exports */
|
---|
161 | extern PyObject *WinObj_New(WindowPtr);
|
---|
162 | extern int WinObj_Convert(PyObject *, WindowPtr *);
|
---|
163 | extern PyObject *WinObj_WhichWindow(WindowPtr);
|
---|
164 |
|
---|
165 | /* CF exports */
|
---|
166 | extern PyObject *CFObj_New(CFTypeRef);
|
---|
167 | extern int CFObj_Convert(PyObject *, CFTypeRef *);
|
---|
168 | extern PyObject *CFTypeRefObj_New(CFTypeRef);
|
---|
169 | extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
|
---|
170 | extern PyObject *CFStringRefObj_New(CFStringRef);
|
---|
171 | extern int CFStringRefObj_Convert(PyObject *, CFStringRef *);
|
---|
172 | extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef);
|
---|
173 | extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *);
|
---|
174 | extern PyObject *CFArrayRefObj_New(CFArrayRef);
|
---|
175 | extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *);
|
---|
176 | extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef);
|
---|
177 | extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *);
|
---|
178 | extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef);
|
---|
179 | extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *);
|
---|
180 | extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef);
|
---|
181 | extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *);
|
---|
182 | extern PyObject *CFURLRefObj_New(CFURLRef);
|
---|
183 | extern int CFURLRefObj_Convert(PyObject *, CFURLRef *);
|
---|
184 | extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
|
---|
185 |
|
---|
186 | #ifdef __cplusplus
|
---|
187 | }
|
---|
188 | #endif
|
---|
189 | #endif
|
---|