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