PageRenderTime 68ms CodeModel.GetById 51ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/Include/pymactoolbox.h

http://unladen-swallow.googlecode.com/
C++ Header | 217 lines | 142 code | 29 blank | 46 comment | 0 complexity | 924697f74ceeb4618ef6a840bcf4e1d8 MD5 | raw file
  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*/
 19char *PyMac_StrError(int);			/* strerror with mac errors */
 20extern PyObject *PyMac_OSErrException;		/* Exception for OSErr */
 21PyObject *PyMac_GetOSErrException(void);	/* Initialize & return it */
 22PyObject *PyErr_Mac(PyObject *, int);		/* Exception with a mac error */
 23PyObject *PyMac_Error(OSErr);			/* Uses PyMac_GetOSErrException */
 24#ifndef __LP64__ 
 25extern 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*/
 32int PyMac_GetOSType(PyObject *, OSType *);	/* argument parser for OSType */
 33PyObject *PyMac_BuildOSType(OSType);		/* Convert OSType to PyObject */
 34
 35PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */
 36
 37int PyMac_GetStr255(PyObject *, Str255);	/* argument parser for Str255 */
 38PyObject *PyMac_BuildStr255(Str255);		/* Convert Str255 to PyObject */
 39PyObject *PyMac_BuildOptStr255(Str255);		/* Convert Str255 to PyObject,
 40						   NULL to None */
 41
 42int PyMac_GetRect(PyObject *, Rect *);		/* argument parser for Rect */
 43PyObject *PyMac_BuildRect(Rect *);		/* Convert Rect to PyObject */
 44
 45int PyMac_GetPoint(PyObject *, Point *);	/* argument parser for Point */
 46PyObject *PyMac_BuildPoint(Point);		/* Convert Point to PyObject */
 47
 48int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for
 49							EventRecord */
 50PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to
 51						    PyObject */
 52
 53int PyMac_GetFixed(PyObject *, Fixed *);	/* argument parser for Fixed */
 54PyObject *PyMac_BuildFixed(Fixed);		/* Convert Fixed to PyObject */
 55int PyMac_Getwide(PyObject *, wide *);		/* argument parser for wide */
 56PyObject *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__
 93int PyMac_GetFSSpec(PyObject *, FSSpec *);	/* argument parser for FSSpec */
 94PyObject *PyMac_BuildFSSpec(FSSpec *);		/* Convert FSSpec to PyObject */
 95#endif /* !__LP64__ */
 96
 97int PyMac_GetFSRef(PyObject *, FSRef *);	/* argument parser for FSRef */
 98PyObject *PyMac_BuildFSRef(FSRef *);		/* Convert FSRef to PyObject */
 99
100/* AE exports */
101extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */
102extern PyObject *AEDesc_NewBorrowed(AppleEvent *);
103extern int AEDesc_Convert(PyObject *, AppleEvent *);
104
105/* Cm exports */
106extern PyObject *CmpObj_New(Component);
107extern int CmpObj_Convert(PyObject *, Component *);
108extern PyObject *CmpInstObj_New(ComponentInstance);
109extern int CmpInstObj_Convert(PyObject *, ComponentInstance *);
110
111/* Ctl exports */
112#ifndef __LP64__
113extern PyObject *CtlObj_New(ControlHandle);
114extern int CtlObj_Convert(PyObject *, ControlHandle *);
115#endif /* !__LP64__ */
116
117/* Dlg exports */
118#ifndef __LP64__
119extern PyObject *DlgObj_New(DialogPtr);
120extern int DlgObj_Convert(PyObject *, DialogPtr *);
121extern PyObject *DlgObj_WhichDialog(DialogPtr);
122#endif /* !__LP64__ */
123
124/* Drag exports */
125#ifndef __LP64__
126extern PyObject *DragObj_New(DragReference);
127extern int DragObj_Convert(PyObject *, DragReference *);
128#endif /* !__LP64__ */
129
130/* List exports */
131#ifndef __LP64__
132extern PyObject *ListObj_New(ListHandle);
133extern int ListObj_Convert(PyObject *, ListHandle *);
134#endif /* !__LP64__ */
135
136/* Menu exports */
137#ifndef __LP64__
138extern PyObject *MenuObj_New(MenuHandle);
139extern int MenuObj_Convert(PyObject *, MenuHandle *);
140#endif /* !__LP64__ */
141
142/* Qd exports */
143#ifndef __LP64__
144extern PyObject *GrafObj_New(GrafPtr);
145extern int GrafObj_Convert(PyObject *, GrafPtr *);
146extern PyObject *BMObj_New(BitMapPtr);
147extern int BMObj_Convert(PyObject *, BitMapPtr *);
148extern PyObject *QdRGB_New(RGBColor *);
149extern int QdRGB_Convert(PyObject *, RGBColor *);
150#endif /* !__LP64__ */
151
152/* Qdoffs exports */
153#ifndef __LP64__
154extern PyObject *GWorldObj_New(GWorldPtr);
155extern int GWorldObj_Convert(PyObject *, GWorldPtr *);
156#endif /* !__LP64__ */
157
158/* Qt exports */
159#ifndef __LP64__
160extern PyObject *TrackObj_New(Track);
161extern int TrackObj_Convert(PyObject *, Track *);
162extern PyObject *MovieObj_New(Movie);
163extern int MovieObj_Convert(PyObject *, Movie *);
164extern PyObject *MovieCtlObj_New(MovieController);
165extern int MovieCtlObj_Convert(PyObject *, MovieController *);
166extern PyObject *TimeBaseObj_New(TimeBase);
167extern int TimeBaseObj_Convert(PyObject *, TimeBase *);
168extern PyObject *UserDataObj_New(UserData);
169extern int UserDataObj_Convert(PyObject *, UserData *);
170extern PyObject *MediaObj_New(Media);
171extern int MediaObj_Convert(PyObject *, Media *);
172#endif /* !__LP64__ */
173
174/* Res exports */
175extern PyObject *ResObj_New(Handle);
176extern int ResObj_Convert(PyObject *, Handle *);
177extern PyObject *OptResObj_New(Handle);
178extern int OptResObj_Convert(PyObject *, Handle *);
179
180/* TE exports */
181#ifndef __LP64__
182extern PyObject *TEObj_New(TEHandle);
183extern int TEObj_Convert(PyObject *, TEHandle *);
184#endif /* !__LP64__ */
185
186/* Win exports */
187#ifndef __LP64__
188extern PyObject *WinObj_New(WindowPtr);
189extern int WinObj_Convert(PyObject *, WindowPtr *);
190extern PyObject *WinObj_WhichWindow(WindowPtr);
191#endif /* !__LP64__ */
192
193/* CF exports */
194extern PyObject *CFObj_New(CFTypeRef);
195extern int CFObj_Convert(PyObject *, CFTypeRef *);
196extern PyObject *CFTypeRefObj_New(CFTypeRef);
197extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
198extern PyObject *CFStringRefObj_New(CFStringRef);
199extern int CFStringRefObj_Convert(PyObject *, CFStringRef *);
200extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef);
201extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *);
202extern PyObject *CFArrayRefObj_New(CFArrayRef);
203extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *);
204extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef);
205extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *);
206extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef);
207extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *);
208extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef);
209extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *);
210extern PyObject *CFURLRefObj_New(CFURLRef);
211extern int CFURLRefObj_Convert(PyObject *, CFURLRef *);
212extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *);
213
214#ifdef __cplusplus
215	}
216#endif
217#endif