[Python-checkins] CVS: python/dist/src/Mac/Modules/qd Qdmodule.c,1.37,1.38
Jack Jansen
jackjansen@users.sourceforge.net
Thu, 17 May 2001 14:56:45 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules/qd
In directory usw-pr-cvs1:/tmp/cvs-serv8195/Python/Mac/Modules/qd
Modified Files:
Qdmodule.c
Log Message:
First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers.
And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again.
Index: Qdmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/Qdmodule.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** Qdmodule.c 2001/02/06 16:13:50 1.37
--- Qdmodule.c 2001/05/17 21:56:43 1.38
***************
*** 11,14 ****
--- 11,30 ----
#include <QuickDraw.h>
+ #ifdef USE_TOOLBOX_OBJECT_GLUE
+ extern PyObject *_GrafObj_New(GrafPtr);
+ extern int _GrafObj_Convert(PyObject *, GrafPtr *);
+ extern PyObject *_BMObj_New(BitMapPtr);
+ extern int _BMObj_Convert(PyObject *, BitMapPtr *);
+ extern PyObject *_QdRGB_New(RGBColorPtr);
+ extern int _QdRGB_Convert(PyObject *, RGBColorPtr *);
+
+ #define GrafObj_New _GrafObj_New
+ #define GrafObj_Convert _GrafObj_Convert
+ #define BMObj_New _BMObj_New
+ #define BMObj_Convert _BMObj_Convert
+ #define QdRGB_New _QdRGB_New
+ #define QdRGB_Convert _QdRGB_Convert
+ #endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits)
***************
*** 145,148 ****
--- 161,174 ----
GrafPtr *p_itself;
{
+ #if 1
+ {
+ WindowRef win;
+ if (WinObj_Convert(v, &win) && v) {
+ *p_itself = (GrafPtr)GetWindowPort(win);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+ #else
if (DlgObj_Check(v)) {
DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;
***************
*** 155,158 ****
--- 181,185 ----
return 1;
}
+ #endif
if (!GrafObj_Check(v))
{
***************
*** 6194,6197 ****
--- 6221,6231 ----
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert);