summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/te
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/te
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/te')
-rw-r--r--Mac/Modules/te/TEmodule.c11
-rw-r--r--Mac/Modules/te/tesupport.py13
2 files changed, 24 insertions, 0 deletions
diff --git a/Mac/Modules/te/TEmodule.c b/Mac/Modules/te/TEmodule.c
index 2bb447b..05b9b0c 100644
--- a/Mac/Modules/te/TEmodule.c
+++ b/Mac/Modules/te/TEmodule.c
@@ -10,6 +10,14 @@
#include <TextEdit.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
#define as_TE(h) ((TEHandle)h)
#define as_Resource(teh) ((Handle)teh)
@@ -1105,6 +1113,9 @@ void initTE()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert);
+
m = Py_InitModule("TE", TE_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index 337ac2b..5512be0 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -34,6 +34,14 @@ TextStyle_ptr = TextStyle
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TEObj_New(TEHandle);
+extern int _TEObj_Convert(PyObject *, TEHandle *);
+
+#define TEObj_New _TEObj_New
+#define TEObj_Convert _TEObj_Convert
+#endif
+
#define as_TE(h) ((TEHandle)h)
#define as_Resource(teh) ((Handle)teh)
@@ -65,6 +73,11 @@ TextStyle_Convert(v, p_itself)
}
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert);
+"""
+
class TEMethodGenerator(OSErrMethodGenerator):
"""Similar to MethodGenerator, but has self as last argument"""