summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/dlg
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-05-17 21:58:34 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-05-17 21:58:34 (GMT)
commit0e04eecdbf8467cf3fe055e41e96fa48507b998c (patch)
tree0c3373b79a29ab55b8c542fd06ddbc9d78dd9d39 /Mac/Modules/dlg
parent99f9baa33190482784900970fd3e1c76e7cb48d6 (diff)
downloadcpython-0e04eecdbf8467cf3fe055e41e96fa48507b998c.zip
cpython-0e04eecdbf8467cf3fe055e41e96fa48507b998c.tar.gz
cpython-0e04eecdbf8467cf3fe055e41e96fa48507b998c.tar.bz2
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.
Diffstat (limited to 'Mac/Modules/dlg')
-rw-r--r--Mac/Modules/dlg/Dlgmodule.c16
-rw-r--r--Mac/Modules/dlg/dlgsupport.py18
2 files changed, 32 insertions, 2 deletions
diff --git a/Mac/Modules/dlg/Dlgmodule.c b/Mac/Modules/dlg/Dlgmodule.c
index 2262b54..be68b75 100644
--- a/Mac/Modules/dlg/Dlgmodule.c
+++ b/Mac/Modules/dlg/Dlgmodule.c
@@ -9,6 +9,15 @@
#include "pymactoolbox.h"
#include <Dialogs.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
@@ -1468,7 +1477,7 @@ static PyMethodDef Dlg_methods[] = {
/* Return the WindowPtr corresponding to a DialogObject */
-
+#if 0
WindowPtr
DlgObj_ConvertToWindow(self)
PyObject *self;
@@ -1477,6 +1486,7 @@ DlgObj_ConvertToWindow(self)
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
+#endif
/* Return the object corresponding to the dialog, or None */
PyObject *
@@ -1516,6 +1526,10 @@ void initDlg()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert);
+
m = Py_InitModule("Dlg", Dlg_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index 594b7a8..460d3b9 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -32,6 +32,15 @@ EventMask = Type("EventMask", "H")
includestuff = includestuff + """
#include <Dialogs.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_DlgObj_New(DialogRef);
+extern PyObject *_DlgObj_WhichDialog(DialogRef);
+extern int _DlgObj_Convert(PyObject *, DialogRef *);
+
+#define DlgObj_New _DlgObj_New
+#define DlgObj_WhichDialog _DlgObj_WhichDialog
+#define DlgObj_Convert _DlgObj_Convert
+#endif
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
#define GetDialogTextEditHandle(dlg) (((DialogPeek)(dlg))->textH)
@@ -139,7 +148,7 @@ extern PyMethodChain WinObj_chain;
finalstuff = finalstuff + """
/* Return the WindowPtr corresponding to a DialogObject */
-
+#if 0
WindowPtr
DlgObj_ConvertToWindow(self)
PyObject *self;
@@ -148,6 +157,7 @@ DlgObj_ConvertToWindow(self)
return GetDialogWindow(((DialogObject *)self)->ob_itself);
return NULL;
}
+#endif
/* Return the object corresponding to the dialog, or None */
PyObject *
@@ -180,6 +190,12 @@ DlgObj_WhichDialog(d)
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert);
+"""
+
# Define a class which specializes our object definition
class MyObjectDefinition(GlobalObjectDefinition):