Chris@87: /* Chris@87: ** pymactoolbox.h - globals defined in mactoolboxglue.c Chris@87: */ Chris@87: #ifndef Py_PYMACTOOLBOX_H Chris@87: #define Py_PYMACTOOLBOX_H Chris@87: #ifdef __cplusplus Chris@87: extern "C" { Chris@87: #endif Chris@87: Chris@87: #include Chris@87: Chris@87: #ifndef __LP64__ Chris@87: #include Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Chris@87: ** Helper routines for error codes and such. Chris@87: */ Chris@87: char *PyMac_StrError(int); /* strerror with mac errors */ Chris@87: extern PyObject *PyMac_OSErrException; /* Exception for OSErr */ Chris@87: PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ Chris@87: PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ Chris@87: PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ Chris@87: #ifndef __LP64__ Chris@87: extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert Chris@87: fsspec->path */ Chris@87: #endif /* __LP64__ */ Chris@87: Chris@87: /* Chris@87: ** These conversion routines are defined in mactoolboxglue.c itself. Chris@87: */ Chris@87: int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ Chris@87: PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */ Chris@87: Chris@87: PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */ Chris@87: Chris@87: int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */ Chris@87: PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */ Chris@87: PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject, Chris@87: NULL to None */ Chris@87: Chris@87: int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */ Chris@87: PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */ Chris@87: Chris@87: int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */ Chris@87: PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */ Chris@87: Chris@87: int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for Chris@87: EventRecord */ Chris@87: PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to Chris@87: PyObject */ Chris@87: Chris@87: int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */ Chris@87: PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */ Chris@87: int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */ Chris@87: PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */ Chris@87: Chris@87: /* Chris@87: ** The rest of the routines are implemented by extension modules. If they are Chris@87: ** dynamically loaded mactoolboxglue will contain a stub implementation of the Chris@87: ** routine, which imports the module, whereupon the module's init routine will Chris@87: ** communicate the routine pointer back to the stub. Chris@87: ** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the Chris@87: ** extension modules simply declare the routine. This is the case for static Chris@87: ** builds (and could be the case for MacPython CFM builds, because CFM extension Chris@87: ** modules can reference each other without problems). Chris@87: */ Chris@87: Chris@87: #ifdef USE_TOOLBOX_OBJECT_GLUE Chris@87: /* Chris@87: ** These macros are used in the module init code. If we use toolbox object glue Chris@87: ** it sets the function pointer to point to the real function. Chris@87: */ Chris@87: #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \ Chris@87: extern PyObject *(*PyMacGluePtr_##rtn)(object); \ Chris@87: PyMacGluePtr_##rtn = _##rtn; \ Chris@87: } Chris@87: #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \ Chris@87: extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \ Chris@87: PyMacGluePtr_##rtn = _##rtn; \ Chris@87: } Chris@87: #else Chris@87: /* Chris@87: ** If we don't use toolbox object glue the init macros are empty. Moreover, we define Chris@87: ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. Chris@87: */ Chris@87: #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) Chris@87: #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) Chris@87: #endif /* USE_TOOLBOX_OBJECT_GLUE */ Chris@87: Chris@87: /* macfs exports */ Chris@87: #ifndef __LP64__ Chris@87: int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ Chris@87: PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ Chris@87: PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ Chris@87: Chris@87: /* AE exports */ Chris@87: extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ Chris@87: extern PyObject *AEDesc_NewBorrowed(AppleEvent *); Chris@87: extern int AEDesc_Convert(PyObject *, AppleEvent *); Chris@87: Chris@87: /* Cm exports */ Chris@87: extern PyObject *CmpObj_New(Component); Chris@87: extern int CmpObj_Convert(PyObject *, Component *); Chris@87: extern PyObject *CmpInstObj_New(ComponentInstance); Chris@87: extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); Chris@87: Chris@87: /* Ctl exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *CtlObj_New(ControlHandle); Chris@87: extern int CtlObj_Convert(PyObject *, ControlHandle *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Dlg exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *DlgObj_New(DialogPtr); Chris@87: extern int DlgObj_Convert(PyObject *, DialogPtr *); Chris@87: extern PyObject *DlgObj_WhichDialog(DialogPtr); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Drag exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *DragObj_New(DragReference); Chris@87: extern int DragObj_Convert(PyObject *, DragReference *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* List exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *ListObj_New(ListHandle); Chris@87: extern int ListObj_Convert(PyObject *, ListHandle *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Menu exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *MenuObj_New(MenuHandle); Chris@87: extern int MenuObj_Convert(PyObject *, MenuHandle *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Qd exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *GrafObj_New(GrafPtr); Chris@87: extern int GrafObj_Convert(PyObject *, GrafPtr *); Chris@87: extern PyObject *BMObj_New(BitMapPtr); Chris@87: extern int BMObj_Convert(PyObject *, BitMapPtr *); Chris@87: extern PyObject *QdRGB_New(RGBColor *); Chris@87: extern int QdRGB_Convert(PyObject *, RGBColor *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Qdoffs exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *GWorldObj_New(GWorldPtr); Chris@87: extern int GWorldObj_Convert(PyObject *, GWorldPtr *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Qt exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *TrackObj_New(Track); Chris@87: extern int TrackObj_Convert(PyObject *, Track *); Chris@87: extern PyObject *MovieObj_New(Movie); Chris@87: extern int MovieObj_Convert(PyObject *, Movie *); Chris@87: extern PyObject *MovieCtlObj_New(MovieController); Chris@87: extern int MovieCtlObj_Convert(PyObject *, MovieController *); Chris@87: extern PyObject *TimeBaseObj_New(TimeBase); Chris@87: extern int TimeBaseObj_Convert(PyObject *, TimeBase *); Chris@87: extern PyObject *UserDataObj_New(UserData); Chris@87: extern int UserDataObj_Convert(PyObject *, UserData *); Chris@87: extern PyObject *MediaObj_New(Media); Chris@87: extern int MediaObj_Convert(PyObject *, Media *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Res exports */ Chris@87: extern PyObject *ResObj_New(Handle); Chris@87: extern int ResObj_Convert(PyObject *, Handle *); Chris@87: extern PyObject *OptResObj_New(Handle); Chris@87: extern int OptResObj_Convert(PyObject *, Handle *); Chris@87: Chris@87: /* TE exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *TEObj_New(TEHandle); Chris@87: extern int TEObj_Convert(PyObject *, TEHandle *); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* Win exports */ Chris@87: #ifndef __LP64__ Chris@87: extern PyObject *WinObj_New(WindowPtr); Chris@87: extern int WinObj_Convert(PyObject *, WindowPtr *); Chris@87: extern PyObject *WinObj_WhichWindow(WindowPtr); Chris@87: #endif /* !__LP64__ */ Chris@87: Chris@87: /* CF exports */ Chris@87: extern PyObject *CFObj_New(CFTypeRef); Chris@87: extern int CFObj_Convert(PyObject *, CFTypeRef *); Chris@87: extern PyObject *CFTypeRefObj_New(CFTypeRef); Chris@87: extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *); Chris@87: extern PyObject *CFStringRefObj_New(CFStringRef); Chris@87: extern int CFStringRefObj_Convert(PyObject *, CFStringRef *); Chris@87: extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef); Chris@87: extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *); Chris@87: extern PyObject *CFArrayRefObj_New(CFArrayRef); Chris@87: extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *); Chris@87: extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef); Chris@87: extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *); Chris@87: extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef); Chris@87: extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *); Chris@87: extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef); Chris@87: extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *); Chris@87: extern PyObject *CFURLRefObj_New(CFURLRef); Chris@87: extern int CFURLRefObj_Convert(PyObject *, CFURLRef *); Chris@87: extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *); Chris@87: Chris@87: #ifdef __cplusplus Chris@87: } Chris@87: #endif Chris@87: #endif