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