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