[Python-checkins] CVS: python/dist/src/Mac/Modules/win Winmodule.c,1.33,1.34
Jack Jansen
jackjansen@users.sourceforge.net
Thu, 17 May 2001 14:58:30 -0700
Update of /cvsroot/python/python/dist/src/Mac/Modules/win
In directory usw-pr-cvs1:/tmp/cvs-serv8641/Python/Mac/Modules/win
Modified Files:
Winmodule.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: Winmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/Winmodule.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -r1.33 -r1.34
*** Winmodule.c 2001/04/25 22:09:29 1.33
--- Winmodule.c 2001/05/17 21:58:27 1.34
***************
*** 11,14 ****
--- 11,24 ----
#include <Windows.h>
+ #ifdef USE_TOOLBOX_OBJECT_GLUE
+ extern PyObject *_WinObj_New(WindowRef);
+ extern PyObject *_WinObj_WhichWindow(WindowRef);
+ extern int _WinObj_Convert(PyObject *, WindowRef *);
+
+ #define WinObj_New _WinObj_New
+ #define WinObj_WhichWindow _WinObj_WhichWindow
+ #define WinObj_Convert _WinObj_Convert
+ #endif
+
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
/* Carbon calls that we emulate in classic mode */
***************
*** 66,73 ****
--- 76,94 ----
WindowPtr *p_itself;
{
+ #if 1
+ {
+ DialogRef dlg;
+ if (DlgObj_Convert(v, &dlg) && dlg) {
+ *p_itself = GetDialogWindow(dlg);
+ return 1;
+ }
+ PyErr_Clear();
+ }
+ #else
if (DlgObj_Check(v)) {
*p_itself = DlgObj_ConvertToWindow(v);
return 1;
}
+ #endif
if (v == Py_None) { *p_itself = NULL; return 1; }
***************
*** 3057,3060 ****
--- 3078,3085 ----
+
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert);