summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/qt
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/qt
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/qt')
-rw-r--r--Mac/Modules/qt/Qtmodule.c40
-rw-r--r--Mac/Modules/qt/qtsupport.py42
2 files changed, 82 insertions, 0 deletions
diff --git a/Mac/Modules/qt/Qtmodule.c b/Mac/Modules/qt/Qtmodule.c
index 20f10cc..20ba370 100644
--- a/Mac/Modules/qt/Qtmodule.c
+++ b/Mac/Modules/qt/Qtmodule.c
@@ -10,6 +10,33 @@
#include <Movies.h>
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
/* Macro to allow us to GetNextInterestingTime without duration */
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) GetMediaNextInterestingTime(media, flags, time, rate, rv, NULL)
@@ -9160,6 +9187,19 @@ void initQt()
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert);
+
m = Py_InitModule("Qt", Qt_methods);
d = PyModule_GetDict(m);
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 3d26673..02ce57e 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -26,6 +26,33 @@ from macsupport import *
includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
+#ifdef USE_TOOLBOX_OBJECT_GLUE
+extern PyObject *_TrackObj_New(Track);
+extern int _TrackObj_Convert(PyObject *, Track *);
+extern PyObject *_MovieObj_New(Movie);
+extern int _MovieObj_Convert(PyObject *, Movie *);
+extern PyObject *_MovieCtlObj_New(MovieController);
+extern int _MovieCtlObj_Convert(PyObject *, MovieController *);
+extern PyObject *_TimeBaseObj_New(TimeBase);
+extern int _TimeBaseObj_Convert(PyObject *, TimeBase *);
+extern PyObject *_UserDataObj_New(UserData);
+extern int _UserDataObj_Convert(PyObject *, UserData *);
+extern PyObject *_MediaObj_New(Media);
+extern int _MediaObj_Convert(PyObject *, Media *);
+
+#define TrackObj_New _TrackObj_New
+#define TrackObj_Convert _TrackObj_Convert
+#define MovieObj_New _MovieObj_New
+#define MovieObj_Convert _MovieObj_Convert
+#define MovieCtlObj_New _MovieCtlObj_New
+#define MovieCtlObj_Convert _MovieCtlObj_Convert
+#define TimeBaseObj_New _TimeBaseObj_New
+#define TimeBaseObj_Convert _TimeBaseObj_Convert
+#define UserDataObj_New _UserDataObj_New
+#define UserDataObj_Convert _UserDataObj_Convert
+#define MediaObj_New _MediaObj_New
+#define MediaObj_Convert _MediaObj_Convert
+#endif
/* Macro to allow us to GetNextInterestingTime without duration */
#define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \
@@ -67,6 +94,21 @@ QtTimeRecord_Convert(v, p_itself)
"""
+initstuff = initstuff + """
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert);
+ PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New);
+ PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert);
+"""
+
# Our (opaque) objects
Movie = OpaqueByValueType('Movie', 'MovieObj')
NullMovie = FakeType("(Movie)0")