[Python-checkins] CVS: python/dist/src/Mac/Modules/cm cmsupport.py,1.2,1.3
Jack Jansen
jackjansen@users.sourceforge.net
Thu, 17 May 2001 14:54:37 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules/cm
In directory usw-pr-cvs1:/tmp/cvs-serv7575/Python/Mac/Modules/cm
Modified Files:
cmsupport.py
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: cmsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** cmsupport.py 2000/07/14 22:16:38 1.2
--- cmsupport.py 2001/05/17 21:54:35 1.3
***************
*** 23,27 ****
--- 23,38 ----
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+ #ifdef USE_TOOLBOX_OBJECT_GLUE
+ extern PyObject *_CmpObj_New(Component);
+ extern int _CmpObj_Convert(PyObject *, Component *);
+ extern PyObject *_CmpInstObj_New(ComponentInstance);
+ extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *);
+ #define CmpObj_New _CmpObj_New
+ #define CmpObj_Convert _CmpObj_Convert
+ #define CmpInstObj_New _CmpInstObj_New
+ #define CmpInstObj_Convert _CmpInstObj_Convert
+ #endif
+
/*
** Parse/generate ComponentDescriptor records
***************
*** 51,54 ****
--- 62,72 ----
}
+ """
+
+ initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert);
"""