2 ** This module is a one-trick pony: given an FSSpec it gets the aeut
3 ** resources. It was written by Donovan Preston and slightly modified
6 ** It should be considered a placeholder, it will probably be replaced
7 ** by a full interface to OpenScripting.
12 #ifdef WITHOUT_FRAMEWORKS
13 #include <OpenScripting.h>
15 #include <Carbon/Carbon.h>
19 PyOSA_GetAppTerminology(PyObject
* self
, PyObject
* args
)
21 AEDesc theDesc
= {0,0};
23 ComponentInstance defaultComponent
= NULL
;
24 SInt16 defaultTerminology
= 0;
25 Boolean didLaunch
= 0;
29 if (!PyArg_ParseTuple(args
, "O&|i", PyMac_GetFSSpec
, &fss
, &modeFlags
))
32 defaultComponent
= OpenDefaultComponent (kOSAComponentType
, 'ascr');
33 err
= GetComponentInstanceError (defaultComponent
);
34 if (err
) return PyMac_Error(err
);
35 err
= OSAGetCurrentDialect(defaultComponent
, &defaultTerminology
);
36 if (err
) return PyMac_Error(err
);
37 err
= OSAGetAppTerminology (
45 if (err
) return PyMac_Error(err
);
46 return Py_BuildValue("O&i", AEDesc_New
, &theDesc
, didLaunch
);
50 PyOSA_GetSysTerminology(PyObject
* self
, PyObject
* args
)
52 AEDesc theDesc
= {0,0};
54 ComponentInstance defaultComponent
= NULL
;
55 SInt16 defaultTerminology
= 0;
56 Boolean didLaunch
= 0;
60 if (!PyArg_ParseTuple(args
, "O&|i", PyMac_GetFSSpec
, &fss
, &modeFlags
))
63 defaultComponent
= OpenDefaultComponent (kOSAComponentType
, 'ascr');
64 err
= GetComponentInstanceError (defaultComponent
);
65 if (err
) return PyMac_Error(err
);
66 err
= OSAGetCurrentDialect(defaultComponent
, &defaultTerminology
);
67 if (err
) return PyMac_Error(err
);
68 err
= OSAGetAppTerminology (
76 if (err
) return PyMac_Error(err
);
77 return Py_BuildValue("O&i", AEDesc_New
, &theDesc
, didLaunch
);
81 * List of methods defined in the module
83 static struct PyMethodDef OSATerminology_methods
[] =
86 (PyCFunction
) PyOSA_GetAppTerminology
,
88 "Get an applications terminology, as an AEDesc object."},
90 (PyCFunction
) PyOSA_GetSysTerminology
,
92 "Get an applications system terminology, as an AEDesc object."},
93 {NULL
, (PyCFunction
) NULL
, 0, NULL
}
98 initOSATerminology(void)
100 Py_InitModule("OSATerminology", OSATerminology_methods
);