diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2001-05-17 21:58:34 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2001-05-17 21:58:34 (GMT) |
commit | 0e04eecdbf8467cf3fe055e41e96fa48507b998c (patch) | |
tree | 0c3373b79a29ab55b8c542fd06ddbc9d78dd9d39 /Mac/Modules/ae | |
parent | 99f9baa33190482784900970fd3e1c76e7cb48d6 (diff) | |
download | cpython-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/ae')
-rw-r--r-- | Mac/Modules/ae/AEmodule.c | 10 | ||||
-rw-r--r-- | Mac/Modules/ae/aesupport.py | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index e0ce470..d4aab79 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -11,6 +11,14 @@ #include <AppleEvents.h> #include <AEObjects.h> +#ifdef USE_TOOLBOX_OBJECT_GLUE +extern PyObject *_AEDesc_New(AEDesc *); +extern int _AEDesc_Convert(PyObject *, AEDesc *); + +#define AEDesc_New _AEDesc_New +#define AEDesc_Convert _AEDesc_Convert +#endif + static pascal OSErr GenericEventHandler(); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; @@ -1331,6 +1339,8 @@ void initAE() upp_AEIdleProc = NewAEIdleProc(AEIdleProc); upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); + PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); m = Py_InitModule("AE", AE_methods); diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py index 86f2094..094a309 100644 --- a/Mac/Modules/ae/aesupport.py +++ b/Mac/Modules/ae/aesupport.py @@ -85,6 +85,14 @@ includestuff = includestuff + """ #include <AppleEvents.h> #include <AEObjects.h> +#ifdef USE_TOOLBOX_OBJECT_GLUE +extern PyObject *_AEDesc_New(AEDesc *); +extern int _AEDesc_Convert(PyObject *, AEDesc *); + +#define AEDesc_New _AEDesc_New +#define AEDesc_Convert _AEDesc_Convert +#endif + static pascal OSErr GenericEventHandler(); /* Forward */ AEEventHandlerUPP upp_GenericEventHandler; @@ -138,6 +146,8 @@ GenericEventHandler(const AppleEvent *request, AppleEvent *reply, unsigned long initstuff = initstuff + """ upp_AEIdleProc = NewAEIdleProc(AEIdleProc); upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); + PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); """ module = MacModule('AE', 'AE', includestuff, finalstuff, initstuff) |