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