diff options
Diffstat (limited to 'Mac')
-rw-r--r-- | Mac/Lib/toolbox/AEObjects.py | 2 | ||||
-rw-r--r-- | Mac/Lib/toolbox/AERegistry.py | 2 | ||||
-rw-r--r-- | Mac/Lib/toolbox/AppleEvents.py | 2 | ||||
-rw-r--r-- | Mac/Modules/ae/AEmodule.c | 52 | ||||
-rw-r--r-- | Mac/Modules/ae/aegen.py | 16 | ||||
-rw-r--r-- | Mac/Modules/ae/aescan.py | 8 |
6 files changed, 61 insertions, 21 deletions
diff --git a/Mac/Lib/toolbox/AEObjects.py b/Mac/Lib/toolbox/AEObjects.py index 3f36414..3e1db67 100644 --- a/Mac/Lib/toolbox/AEObjects.py +++ b/Mac/Lib/toolbox/AEObjects.py @@ -1,4 +1,4 @@ -# Generated from 'Moes:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AEObjects.h' +# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AEObjects.h' kAEAND = 'AND ' kAEOR = 'OR ' diff --git a/Mac/Lib/toolbox/AERegistry.py b/Mac/Lib/toolbox/AERegistry.py index 217e4b9..716c5f8 100644 --- a/Mac/Lib/toolbox/AERegistry.py +++ b/Mac/Lib/toolbox/AERegistry.py @@ -1,4 +1,4 @@ -# Generated from 'Moes:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AERegistry.h' +# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AERegistry.h' cAEList = 'list' cApplication = 'capp' diff --git a/Mac/Lib/toolbox/AppleEvents.py b/Mac/Lib/toolbox/AppleEvents.py index 272c446..e4668bc 100644 --- a/Mac/Lib/toolbox/AppleEvents.py +++ b/Mac/Lib/toolbox/AppleEvents.py @@ -1,4 +1,4 @@ -# Generated from 'Moes:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AppleEvents.h' +# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AppleEvents.h' typeBoolean = 'bool' typeChar = 'TEXT' diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index 53467e4..a4f56d6 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -667,18 +667,19 @@ static PyObject *AEDesc_AEResumeTheCurrentEvent(_self, _args) PyObject *_res = NULL; OSErr _err; AppleEvent reply; - long handlerRefcon; - if (!PyArg_ParseTuple(_args, "O&l", + AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler; + PyObject *dispatcher; + if (!PyArg_ParseTuple(_args, "O&O", AEDesc_Convert, &reply, - &handlerRefcon)) + &dispatcher)) return NULL; _err = AEResumeTheCurrentEvent(&_self->ob_itself, &reply, - upp_GenericEventHandler, - handlerRefcon); + dispatcher__proc__, (long)dispatcher); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; + Py_INCREF(dispatcher); /* XXX leak, but needed */ return _res; } @@ -760,7 +761,7 @@ static PyMethodDef AEDesc_methods[] = { {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, "() -> None"}, {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, - "(AppleEvent reply, long handlerRefcon) -> None"}, + "(AppleEvent reply, EventHandler dispatcher) -> None"}, {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, "() -> None"}, {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, @@ -1002,20 +1003,21 @@ static PyObject *AE_AEInstallEventHandler(_self, _args) OSErr _err; AEEventClass theAEEventClass; AEEventID theAEEventID; - long handlerRefcon; - if (!PyArg_ParseTuple(_args, "O&O&l", + AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler; + PyObject *handler; + if (!PyArg_ParseTuple(_args, "O&O&O", PyMac_GetOSType, &theAEEventClass, PyMac_GetOSType, &theAEEventID, - &handlerRefcon)) + &handler)) return NULL; _err = AEInstallEventHandler(theAEEventClass, theAEEventID, - upp_GenericEventHandler, - handlerRefcon, + handler__proc__, (long)handler, 0); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; + Py_INCREF(handler); /* XXX leak, but needed */ return _res; } @@ -1041,6 +1043,30 @@ static PyObject *AE_AERemoveEventHandler(_self, _args) return _res; } +static PyObject *AE_AEGetEventHandler(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + AEEventClass theAEEventClass; + AEEventID theAEEventID; + long procptr, handlerptr; + + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetOSType, &theAEEventClass, + PyMac_GetOSType, &theAEEventID)) + return NULL; + _err = AEGetEventHandler(theAEEventClass, + theAEEventID, + (AEEventHandlerUPP *)&procptr, &handlerptr, + 0); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("ll", + (long)procptr, (long)handlerptr); + return _res; +} + static PyObject *AE_AEManagerInfo(_self, _args) PyObject *_self; PyObject *_args; @@ -1078,9 +1104,11 @@ static PyMethodDef AE_methods[] = { {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, "(long timeOutInTicks) -> None"}, {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, - "(AEEventClass theAEEventClass, AEEventID theAEEventID, long handlerRefcon) -> None"}, + "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"}, {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"}, + {"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1, + "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"}, {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, "(AEKeyword keyWord) -> (long result)"}, {NULL, NULL, 0} diff --git a/Mac/Modules/ae/aegen.py b/Mac/Modules/ae/aegen.py index 1769003..5d3a6e8 100644 --- a/Mac/Modules/ae/aegen.py +++ b/Mac/Modules/ae/aegen.py @@ -1,4 +1,4 @@ -# Generated from 'Moes:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AppleEvents.h' +# Generated from 'Sap:CodeWarrior6:Metrowerks C/C++:Headers:Universal Headers 2.0.1f:AppleEvents.h' f = AEFunction(OSErr, 'AECreateDesc', (DescType, 'typeCode', InMode), @@ -214,8 +214,7 @@ aedescmethods.append(f) f = AEMethod(OSErr, 'AEResumeTheCurrentEvent', (AppleEvent_ptr, 'theAppleEvent', InMode), (AppleEvent_ptr, 'reply', InMode), - (AEEventHandlerUPP, 'dispatcher', InMode), - (long, 'handlerRefcon', InMode), + (EventHandler, 'dispatcher', InMode), ) aedescmethods.append(f) @@ -249,8 +248,7 @@ functions.append(f) f = AEFunction(OSErr, 'AEInstallEventHandler', (AEEventClass, 'theAEEventClass', InMode), (AEEventID, 'theAEEventID', InMode), - (AEEventHandlerUPP, 'handler', InMode), - (long, 'handlerRefcon', InMode), + (EventHandler, 'handler', InMode), (AlwaysFalse, 'isSysHandler', InMode), ) functions.append(f) @@ -263,6 +261,14 @@ f = AEFunction(OSErr, 'AERemoveEventHandler', ) functions.append(f) +f = AEFunction(OSErr, 'AEGetEventHandler', + (AEEventClass, 'theAEEventClass', InMode), + (AEEventID, 'theAEEventID', InMode), + (EventHandler, 'handler', OutMode), + (AlwaysFalse, 'isSysHandler', InMode), +) +functions.append(f) + f = AEFunction(OSErr, 'AEManagerInfo', (AEKeyword, 'keyWord', InMode), (long, 'result', OutMode), diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py index e68c9ae..bc6cc58 100644 --- a/Mac/Modules/ae/aescan.py +++ b/Mac/Modules/ae/aescan.py @@ -59,7 +59,7 @@ class AppleEventsScanner(Scanner): def makeblacklistnames(self): return [ "AEDisposeDesc", - "AEGetEventHandler", +# "AEGetEventHandler", ] def makeblacklisttypes(self): @@ -84,6 +84,12 @@ class AppleEventsScanner(Scanner): ([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")], [("EventHandler", "*", "*")]), + ([("AEEventHandlerUPP", "*", "InMode"), ("long", "*", "InMode")], + [("EventHandler", "*", "*")]), + + ([("AEEventHandlerUPP", "*", "OutMode"), ("long", "*", "OutMode")], + [("EventHandler", "*", "*")]), + ([("void", "*", "OutMode"), ("Size", "*", "InMode"), ("Size", "*", "OutMode")], [("VarVarOutBuffer", "*", "InOutMode")]), |