summaryrefslogtreecommitdiff
path: root/Mac/Modules/cm
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-05-17 21:58:34 +0000
committerJack Jansen <jack.jansen@cwi.nl>2001-05-17 21:58:34 +0000
commit6785df78ce5eb8bb14f59ff85c1d8102ef20d63a (patch)
treee8fe57d6688e9001304fbc74c143bcb828b4a1e5 /Mac/Modules/cm
parent25a209cf04df253de5c03f81ea648c81d0a5e1f5 (diff)
downloadcpython-6785df78ce5eb8bb14f59ff85c1d8102ef20d63a.tar.gz
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/cm')
-rw-r--r--Mac/Modules/cm/Cmmodule.c16
-rw-r--r--Mac/Modules/cm/cmsupport.py18
2 files changed, 34 insertions, 0 deletions
diff --git a/Mac/Modules/cm/Cmmodule.c b/Mac/Modules/cm/Cmmodule.c
index 93a3e09841..5e8a17c443 100644
--- a/Mac/Modules/cm/Cmmodule.c
+++ b/Mac/Modules/cm/Cmmodule.c
@@ -9,6 +9,17 @@
#include "pymactoolbox.h"
#include <Components.h>
+#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
@@ -825,6 +836,11 @@ void initCm()
+ 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);
+
m = Py_InitModule("Cm", Cm_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
index 598b51de2f..5681c8130a 100644
--- a/Mac/Modules/cm/cmsupport.py
+++ b/Mac/Modules/cm/cmsupport.py
@@ -22,6 +22,17 @@ from macsupport import *
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
@@ -52,6 +63,13 @@ CmpDesc_Convert(v, p_itself)
"""
+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);
+"""
+
ComponentDescription = OpaqueType('ComponentDescription', 'CmpDesc')
Component = OpaqueByValueType('Component', C_OBJECTPREFIX)
ComponentInstance = OpaqueByValueType('ComponentInstance', CI_OBJECTPREFIX)