From fabd00fa91277d2536d97d033e0f7ac561c65fab Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Sat, 1 Sep 2001 23:39:58 +0000 Subject: Added glue routine for PyMac_BuildFSSpec, PyMac_GetFSRef and PyMac_BuildFSRef. Moved the declarations to pymactoolbox.h. --- Include/pymactoolbox.h | 6 +++++- Mac/Include/macglue.h | 7 ------- Mac/Modules/macfsmodule.c | 9 +++++++++ Python/mactoolboxglue.c | 4 ++++ 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Include/pymactoolbox.h b/Include/pymactoolbox.h index 9e4a3e4..defa2be 100644 --- a/Include/pymactoolbox.h +++ b/Include/pymactoolbox.h @@ -88,7 +88,11 @@ PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */ #endif /* USE_TOOLBOX_OBJECT_GLUE */ /* macfs exports */ -extern int PyMac_GetFSSpec(PyObject *, FSSpec *); +int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ +PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ + +int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ +PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ /* AE exports */ extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ diff --git a/Mac/Include/macglue.h b/Mac/Include/macglue.h index 6f29a20..8057c28 100644 --- a/Mac/Include/macglue.h +++ b/Mac/Include/macglue.h @@ -102,13 +102,6 @@ void PyMac_Initialize(void); /* Initialize function for embedding Python */ short PyMac_OpenPrefFile(void); /* From macgetpath.c, open and return preference file */ #endif -/* from macfsmodule.c: */ -int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ -PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ - -int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ -PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ - /* From macfiletype.c: */ diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c index 6204cee..19724cd 100644 --- a/Mac/Modules/macfsmodule.c +++ b/Mac/Modules/macfsmodule.c @@ -41,7 +41,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef USE_TOOLBOX_OBJECT_GLUE extern int _PyMac_GetFSSpec(PyObject *, FSSpec *); +extern PyObject *_PyMac_BuildFSRef(FSRef *); +extern int _PyMac_GetFSSpec(PyObject *, FSSpec *); +extern PyObject *_PyMac_BuildFSRef(FSRef *); #define PyMac_GetFSSpec _PyMac_GetFSSpec +#define PyMac_BuildFSSpec _PyMac_BuildFSSpec +#define PyMac_GetFSRef _PyMac_GetFSRef +#define PyMac_BuildFSRef _PyMac_BuildFSRef #endif static PyObject *ErrorObject; @@ -1207,6 +1213,9 @@ initmacfs(void) PyObject *m, *d; PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSSpec, PyMac_GetFSSpec); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef); + PyMac_INIT_TOOLBOX_OBJECT_NEW(FSSpec *, PyMac_BuildFSSpec); + PyMac_INIT_TOOLBOX_OBJECT_NEW(FSRef *, PyMac_BuildFSRef); /* Create the module and add the functions */ m = Py_InitModule("macfs", mfs_methods); diff --git a/Python/mactoolboxglue.c b/Python/mactoolboxglue.c index 739d99e..0781a3b 100644 --- a/Python/mactoolboxglue.c +++ b/Python/mactoolboxglue.c @@ -346,7 +346,11 @@ int routinename(PyObject *pyobj, object *cobj) { \ } \ return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ } + +GLUE_NEW(FSSpec *, PyMac_BuildFSSpec, "macfs") GLUE_CONVERT(FSSpec, PyMac_GetFSSpec, "macfs") +GLUE_NEW(FSRef *, PyMac_BuildFSRef, "macfs") +GLUE_CONVERT(FSRef, PyMac_GetFSRef, "macfs") GLUE_NEW(AppleEvent *, AEDesc_New, "Carbon.AE") /* XXXX Why by address? */ GLUE_CONVERT(AppleEvent, AEDesc_Convert, "Carbon.AE") -- cgit v0.12