summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/res
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/res
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/res')
-rw-r--r--Mac/Modules/res/Resmodule.c15
-rw-r--r--Mac/Modules/res/ressupport.py15
2 files changed, 30 insertions, 0 deletions
diff --git a/Mac/Modules/res/Resmodule.c b/Mac/Modules/res/Resmodule.c
index bd6a42d..26007b4 100644
--- a/Mac/Modules/res/Resmodule.c
+++ b/Mac/Modules/res/Resmodule.c
@@ -11,6 +11,17 @@
#include <Resources.h>
#include <string.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
/* Function to dispose a resource, with a "normal" calling sequence */
static void
PyMac_AutoDisposeHandle(Handle h)
@@ -1678,6 +1689,10 @@ void initRes()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert);
m = Py_InitModule("Res", Res_methods);
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
index fcee62e..cdbb778 100644
--- a/Mac/Modules/res/ressupport.py
+++ b/Mac/Modules/res/ressupport.py
@@ -26,6 +26,17 @@ includestuff = includestuff + """
#include <Resources.h>
#include <string.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_ResObj_New(Handle);
+extern int _ResObj_Convert(PyObject *, Handle *);
+extern PyObject *_OptResObj_New(Handle);
+extern int _OptResObj_Convert(PyObject *, Handle *);
+#define ResObj_New _ResObj_New
+#define ResObj_Convert _ResObj_Convert
+#define OptResObj_New _OptResObj_New
+#define OptResObj_Convert _OptResObj_Convert
+#endif
+
/* Function to dispose a resource, with a "normal" calling sequence */
static void
PyMac_AutoDisposeHandle(Handle h)
@@ -75,6 +86,10 @@ OptResObj_Convert(v, p_itself)
"""
initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert);
"""
module = MacModule('Res', 'Res', includestuff, finalstuff, initstuff)