diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-03-06 23:02:04 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-03-06 23:02:04 (GMT) |
commit | 86f25fb1d26eabaa8520ffbbbf449733440533b8 (patch) | |
tree | fb6dbbb845332019d52dd5af39628cd63de6e9da /Mac/Modules | |
parent | 1930949a8aa2e5e2d220857a18ac5e1ebd03b750 (diff) | |
download | cpython-86f25fb1d26eabaa8520ffbbbf449733440533b8.zip cpython-86f25fb1d26eabaa8520ffbbbf449733440533b8.tar.gz cpython-86f25fb1d26eabaa8520ffbbbf449733440533b8.tar.bz2 |
Module to get OSA terminology description through the "official channels",
in stead of manually getting the AETE/AEUT resource. Donated by Donovan
Preston. This is his original code (but with the filename changed) checked
in for reference only.
Diffstat (limited to 'Mac/Modules')
-rw-r--r-- | Mac/Modules/OSATerminology.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Mac/Modules/OSATerminology.c b/Mac/Modules/OSATerminology.c new file mode 100644 index 0000000..f76f49e --- /dev/null +++ b/Mac/Modules/OSATerminology.c @@ -0,0 +1,70 @@ +#include <Python/Python.h> +#include <Carbon/Carbon.h> +#include <Python/pymactoolbox.h> + +PyObject * PyOSA_GetAppTerminology(PyObject* self, PyObject* args) { + AEDesc temp; + FSSpec tempFSSpec; + + ComponentInstance defaultComponent; + ScriptingComponentSelector theType; + SInt16 defaultTerminology; + Boolean didLaunch; + + OSAError err; + + PyObject * returnVal; + + if (!PyArg_ParseTuple(args, "O&", PyMac_GetFSSpec, &tempFSSpec)) return NULL; + + defaultComponent = OpenDefaultComponent (kOSAComponentType, + 'ascr'); +// kOSAGenericScriptingComponentSubtype); + + err = GetComponentInstanceError (defaultComponent); + printf("OpenDefaultComponent: %d\n", err); + err = OSAGetCurrentDialect(defaultComponent, &defaultTerminology); + printf("getcurrentdialect: %d\n", err); + err = OSAGetAppTerminology ( + defaultComponent, + kOSAModeNull, + &tempFSSpec, + defaultTerminology, + &didLaunch, + &temp + ); + +/* err = ASGetAppTerminology ( + defaultComponent, + &tempFSSpec, + defaultTerminology, + &didLaunch, + &temp + );*/ + + printf("getappterminology: %d\n", err); + + returnVal = Py_BuildValue("O&i", + AEDesc_New, &temp, didLaunch); + return returnVal; +} + +/* + * List of methods defined in the module + */ +static struct PyMethodDef PyOSA_methods[] = +{ + {"GetAppTerminology", + (PyCFunction) PyOSA_GetAppTerminology, + METH_VARARGS, + "Get an applications terminology, as an AEDesc object."}, + + {NULL, (PyCFunction) NULL, 0, NULL} +}; + + +void +initPyOSA(void) +{ + Py_InitModule("PyOSA", PyOSA_methods); +}
\ No newline at end of file |