From c7cfb9555974e2e3789a629f1b7509eaa73ee2c6 Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Mon, 5 Jun 1995 22:34:12 +0000 Subject: Rather massive changes: - Make the stuff run on Jack's machine (and hopefully all machines) in stead of Guido's only (addpack stuff) - Use the Universal Headers in stead of the Think headers - Fixed the test programs to use the new routine names --- Mac/Lib/test/echo.py | 2 +- Mac/Lib/toolbox/AppleEvents.py | 48 +++--- Mac/Lib/toolbox/aetools.py | 2 +- Mac/Modules/ae/AEmodule.c | 374 ++++++++++++----------------------------- Mac/Modules/ae/aegen.py | 86 +++------- Mac/Modules/ae/aescan.py | 7 + Mac/Modules/ae/aesupport.py | 5 + 7 files changed, 165 insertions(+), 359 deletions(-) diff --git a/Mac/Lib/test/echo.py b/Mac/Lib/test/echo.py index 20b1d77..d48434f 100644 --- a/Mac/Lib/test/echo.py +++ b/Mac/Lib/test/echo.py @@ -7,7 +7,7 @@ can have (without having to rely on Apple's implementation). """ import addpack -addpack.addpack('Demo') +addpack.addpack('Tools') addpack.addpack('bgen') addpack.addpack('ae') addpack.addpack('evt') diff --git a/Mac/Lib/toolbox/AppleEvents.py b/Mac/Lib/toolbox/AppleEvents.py index 0e1e069..5114c72 100644 --- a/Mac/Lib/toolbox/AppleEvents.py +++ b/Mac/Lib/toolbox/AppleEvents.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:AppleEvents.h' typeBoolean = 'bool' typeChar = 'TEXT' @@ -28,6 +28,8 @@ typeKeyword = 'keyw' typeSectionH = 'sect' typeWildCard = '****' typeApplSignature = 'sign' +typeQDRectangle = 'qdrt' +typeFixed = 'fixd' typeSessionID = 'ssid' typeTargetID = 'targ' typeProcessSerialNumber = 'psn ' @@ -79,26 +81,24 @@ kAnyTransactionID = 0 kAEDefaultTimeout = -1 kNoTimeOut = -2 kAENoDispatch = 0 -kAEUseStandardDispatch = -1 -errAECoercionFail = -1700 -errAEDescNotFound = -1701 -errAECorruptData = -1702 -errAEWrongDataType = -1703 -errAENotAEDesc = -1704 -errAEBadListItem = -1705 -errAENewerVersion = -1706 -errAENotAppleEvent = -1707 -errAEEventNotHandled = -1708 -errAEReplyNotValid = -1709 -errAEUnknownSendMode = -1710 -errAEWaitCanceled = -1711 -errAETimeout = -1712 -errAENoUserInteraction = -1713 -errAENotASpecialFunction = -1714 -errAEParamMissed = -1715 -errAEUnknownAddressType = -1716 -errAEHandlerNotFound = -1717 -errAEReplyNotArrived = -1718 -errAEIllegalIndex = -1719 -errAEUnknownObjectType = -1731 -errAERecordingIsAlreadyOn = -1732 +kAEUseStandardDispatch = 0xFFFFFFFF +kAEDoNotIgnoreHandler = 0x00000000 +kAEIgnoreAppPhacHandler = 0x00000001 +kAEIgnoreAppEventHandler = 0x00000002 +kAEIgnoreSysPhacHandler = 0x00000004 +kAEIgnoreSysEventHandler = 0x00000008 +kAEIngoreBuiltInEventHandler = 0x00000010 +kAEDontDisposeOnResume = 0x80000000 +kAEInteractWithSelf = 0 +kAEInteractWithLocal = 1 +kAEInteractWithAll = 2 +kAEUnknownSource = 0 +kAEDirectCall = 1 +kAESameProcess = 2 +kAELocalProcess = 3 +kAERemoteProcess = 4 +kAEDataArray = 0 +kAEPackedArray = 1 +kAEHandleArray = 2 +kAEDescArray = 3 +kAEKeyDescArray = 4 diff --git a/Mac/Lib/toolbox/aetools.py b/Mac/Lib/toolbox/aetools.py index e91449a..bb0d20f 100644 --- a/Mac/Lib/toolbox/aetools.py +++ b/Mac/Lib/toolbox/aetools.py @@ -68,7 +68,7 @@ def pack(x, forcetype = None): if t == DictionaryType: record = AE.AECreateList('', 1) for key, value in x.items(): - record.AEPutKeyDesc(key, pack(value)) + record.AEPutParamDesc(key, pack(value)) return record if t == InstanceType and hasattr(x, '__aepack__'): return x.__aepack__() diff --git a/Mac/Modules/ae/AEmodule.c b/Mac/Modules/ae/AEmodule.c index dc2fc7d..6bb9dfb 100644 --- a/Mac/Modules/ae/AEmodule.c +++ b/Mac/Modules/ae/AEmodule.c @@ -62,7 +62,7 @@ AEEventHandlerUPP upp_GenericEventHandler; static pascal Boolean AEIdleProc(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn) { - (void) PyMac_Idle(); + PyMac_Yield(); return 0; } @@ -164,55 +164,6 @@ static PyObject *AEDesc_AECountItems(_self, _args) return _res; } -static PyObject *AEDesc_AEPutPtr(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - long index; - DescType typeCode; - char *dataPtr__in__; - long dataPtr__len__; - int dataPtr__in_len__; - if (!PyArg_ParseTuple(_args, "lO&s#", - &index, - PyMac_GetOSType, &typeCode, - &dataPtr__in__, &dataPtr__in_len__)) - return NULL; - dataPtr__len__ = dataPtr__in_len__; - _err = AEPutPtr(&_self->ob_itself, - index, - typeCode, - dataPtr__in__, dataPtr__len__); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - dataPtr__error__: ; - return _res; -} - -static PyObject *AEDesc_AEPutDesc(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - long index; - AEDesc theAEDesc; - if (!PyArg_ParseTuple(_args, "lO&", - &index, - AEDesc_Convert, &theAEDesc)) - return NULL; - _err = AEPutDesc(&_self->ob_itself, - index, - &theAEDesc); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *AEDesc_AEGetNthPtr(_self, _args) AEDescObject *_self; PyObject *_args; @@ -302,174 +253,6 @@ static PyObject *AEDesc_AESizeOfNthItem(_self, _args) return _res; } -static PyObject *AEDesc_AEDeleteItem(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - long index; - if (!PyArg_ParseTuple(_args, "l", - &index)) - return NULL; - _err = AEDeleteItem(&_self->ob_itself, - index); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *AEDesc_AEPutKeyPtr(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - DescType typeCode; - char *dataPtr__in__; - long dataPtr__len__; - int dataPtr__in_len__; - if (!PyArg_ParseTuple(_args, "O&O&s#", - PyMac_GetOSType, &theAEKeyword, - PyMac_GetOSType, &typeCode, - &dataPtr__in__, &dataPtr__in_len__)) - return NULL; - dataPtr__len__ = dataPtr__in_len__; - _err = AEPutKeyPtr(&_self->ob_itself, - theAEKeyword, - typeCode, - dataPtr__in__, dataPtr__len__); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - dataPtr__error__: ; - return _res; -} - -static PyObject *AEDesc_AEPutKeyDesc(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - AEDesc theAEDesc; - if (!PyArg_ParseTuple(_args, "O&O&", - PyMac_GetOSType, &theAEKeyword, - AEDesc_Convert, &theAEDesc)) - return NULL; - _err = AEPutKeyDesc(&_self->ob_itself, - theAEKeyword, - &theAEDesc); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - -static PyObject *AEDesc_AEGetKeyPtr(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - DescType desiredType; - DescType typeCode; - char *dataPtr__out__; - long dataPtr__len__; - int dataPtr__in_len__; - if (!PyArg_ParseTuple(_args, "O&O&i", - PyMac_GetOSType, &theAEKeyword, - PyMac_GetOSType, &desiredType, - &dataPtr__in_len__)) - return NULL; - if ((dataPtr__out__ = malloc(dataPtr__in_len__)) == NULL) - { - PyErr_NoMemory(); - goto dataPtr__error__; - } - dataPtr__len__ = dataPtr__in_len__; - _err = AEGetKeyPtr(&_self->ob_itself, - theAEKeyword, - desiredType, - &typeCode, - dataPtr__out__, dataPtr__len__, &dataPtr__len__); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&s#", - PyMac_BuildOSType, typeCode, - dataPtr__out__, (int)dataPtr__len__); - free(dataPtr__out__); - dataPtr__error__: ; - return _res; -} - -static PyObject *AEDesc_AEGetKeyDesc(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - DescType desiredType; - AEDesc result; - if (!PyArg_ParseTuple(_args, "O&O&", - PyMac_GetOSType, &theAEKeyword, - PyMac_GetOSType, &desiredType)) - return NULL; - _err = AEGetKeyDesc(&_self->ob_itself, - theAEKeyword, - desiredType, - &result); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - AEDesc_New, &result); - return _res; -} - -static PyObject *AEDesc_AESizeOfKeyDesc(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - DescType typeCode; - Size dataSize; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetOSType, &theAEKeyword)) - return NULL; - _err = AESizeOfKeyDesc(&_self->ob_itself, - theAEKeyword, - &typeCode, - &dataSize); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&l", - PyMac_BuildOSType, typeCode, - dataSize); - return _res; -} - -static PyObject *AEDesc_AEDeleteKeyDesc(_self, _args) - AEDescObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AEKeyword theAEKeyword; - if (!PyArg_ParseTuple(_args, "O&", - PyMac_GetOSType, &theAEKeyword)) - return NULL; - _err = AEDeleteKeyDesc(&_self->ob_itself, - theAEKeyword); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; -} - static PyObject *AEDesc_AEPutParamPtr(_self, _args) AEDescObject *_self; PyObject *_args; @@ -817,19 +600,33 @@ static PyObject *AEDesc_AEResumeTheCurrentEvent(_self, _args) PyObject *_res = NULL; OSErr _err; AppleEvent reply; - AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler; - PyObject *dispatcher; - if (!PyArg_ParseTuple(_args, "O&O", + long handlerRefcon; + if (!PyArg_ParseTuple(_args, "O&l", AEDesc_Convert, &reply, - &dispatcher)) + &handlerRefcon)) return NULL; _err = AEResumeTheCurrentEvent(&_self->ob_itself, &reply, - dispatcher__proc__, (long)dispatcher); + upp_GenericEventHandler, + handlerRefcon); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; +} + +static PyObject *AEDesc_AEGetTheCurrentEvent(_self, _args) + AEDescObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = AEGetTheCurrentEvent(&_self->ob_itself); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; - Py_INCREF(dispatcher); /* XXX leak, but needed */ return _res; } @@ -855,30 +652,12 @@ static PyMethodDef AEDesc_methods[] = { "() -> (AEDesc result)"}, {"AECountItems", (PyCFunction)AEDesc_AECountItems, 1, "() -> (long theCount)"}, - {"AEPutPtr", (PyCFunction)AEDesc_AEPutPtr, 1, - "(long index, DescType typeCode, Buffer dataPtr) -> None"}, - {"AEPutDesc", (PyCFunction)AEDesc_AEPutDesc, 1, - "(long index, AEDesc theAEDesc) -> None"}, {"AEGetNthPtr", (PyCFunction)AEDesc_AEGetNthPtr, 1, "(long index, DescType desiredType, Buffer dataPtr) -> (AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr)"}, {"AEGetNthDesc", (PyCFunction)AEDesc_AEGetNthDesc, 1, "(long index, DescType desiredType) -> (AEKeyword theAEKeyword, AEDesc result)"}, {"AESizeOfNthItem", (PyCFunction)AEDesc_AESizeOfNthItem, 1, "(long index) -> (DescType typeCode, Size dataSize)"}, - {"AEDeleteItem", (PyCFunction)AEDesc_AEDeleteItem, 1, - "(long index) -> None"}, - {"AEPutKeyPtr", (PyCFunction)AEDesc_AEPutKeyPtr, 1, - "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, - {"AEPutKeyDesc", (PyCFunction)AEDesc_AEPutKeyDesc, 1, - "(AEKeyword theAEKeyword, AEDesc theAEDesc) -> None"}, - {"AEGetKeyPtr", (PyCFunction)AEDesc_AEGetKeyPtr, 1, - "(AEKeyword theAEKeyword, DescType desiredType, Buffer dataPtr) -> (DescType typeCode, Buffer dataPtr)"}, - {"AEGetKeyDesc", (PyCFunction)AEDesc_AEGetKeyDesc, 1, - "(AEKeyword theAEKeyword, DescType desiredType) -> (AEDesc result)"}, - {"AESizeOfKeyDesc", (PyCFunction)AEDesc_AESizeOfKeyDesc, 1, - "(AEKeyword theAEKeyword) -> (DescType typeCode, Size dataSize)"}, - {"AEDeleteKeyDesc", (PyCFunction)AEDesc_AEDeleteKeyDesc, 1, - "(AEKeyword theAEKeyword) -> None"}, {"AEPutParamPtr", (PyCFunction)AEDesc_AEPutParamPtr, 1, "(AEKeyword theAEKeyword, DescType typeCode, Buffer dataPtr) -> None"}, {"AEPutParamDesc", (PyCFunction)AEDesc_AEPutParamDesc, 1, @@ -908,7 +687,9 @@ static PyMethodDef AEDesc_methods[] = { {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, "() -> None"}, {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, - "(AppleEvent reply, EventHandler dispatcher) -> None"}, + "(AppleEvent reply, long handlerRefcon) -> None"}, + {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, + "() -> None"}, {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, "() -> None"}, {NULL, NULL, 0} @@ -1040,6 +821,76 @@ static PyObject *AE_AECreateList(_self, _args) return _res; } +static PyObject *AE_AEPutPtr(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + AEDescList theAEDescList; + long index; + DescType typeCode; + char *dataPtr__in__; + long dataPtr__len__; + int dataPtr__in_len__; + if (!PyArg_ParseTuple(_args, "lO&s#", + &index, + PyMac_GetOSType, &typeCode, + &dataPtr__in__, &dataPtr__in_len__)) + return NULL; + dataPtr__len__ = dataPtr__in_len__; + _err = AEPutPtr(&theAEDescList, + index, + typeCode, + dataPtr__in__, dataPtr__len__); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + AEDesc_New, &theAEDescList); + dataPtr__error__: ; + return _res; +} + +static PyObject *AE_AEPutDesc(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + AEDescList theAEDescList; + long index; + AEDesc theAEDesc; + if (!PyArg_ParseTuple(_args, "lO&", + &index, + AEDesc_Convert, &theAEDesc)) + return NULL; + _err = AEPutDesc(&theAEDescList, + index, + &theAEDesc); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + AEDesc_New, &theAEDescList); + return _res; +} + +static PyObject *AE_AEDeleteItem(_self, _args) + PyObject *_self; + PyObject *_args; +{ + PyObject *_res = NULL; + OSErr _err; + AEDescList theAEDescList; + long index; + if (!PyArg_ParseTuple(_args, "l", + &index)) + return NULL; + _err = AEDeleteItem(&theAEDescList, + index); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + AEDesc_New, &theAEDescList); + return _res; +} + static PyObject *AE_AECreateAppleEvent(_self, _args) PyObject *_self; PyObject *_args; @@ -1088,22 +939,6 @@ static PyObject *AE_AEProcessAppleEvent(_self, _args) return _res; } -static PyObject *AE_AEGetTheCurrentEvent(_self, _args) - PyObject *_self; - PyObject *_args; -{ - PyObject *_res = NULL; - OSErr _err; - AppleEvent theAppleEvent; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = AEGetTheCurrentEvent(&theAppleEvent); - if (_err != noErr) return PyMac_Error(_err); - _res = Py_BuildValue("O&", - AEDesc_New, &theAppleEvent); - return _res; -} - static PyObject *AE_AEGetInteractionAllowed(_self, _args) PyObject *_self; PyObject *_args; @@ -1164,21 +999,20 @@ static PyObject *AE_AEInstallEventHandler(_self, _args) OSErr _err; AEEventClass theAEEventClass; AEEventID theAEEventID; - AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler; - PyObject *handler; - if (!PyArg_ParseTuple(_args, "O&O&O", + long handlerRefcon; + if (!PyArg_ParseTuple(_args, "O&O&l", PyMac_GetOSType, &theAEEventClass, PyMac_GetOSType, &theAEEventID, - &handler)) + &handlerRefcon)) return NULL; _err = AEInstallEventHandler(theAEEventClass, theAEEventID, - handler__proc__, (long)handler, + upp_GenericEventHandler, + handlerRefcon, 0); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; - Py_INCREF(handler); /* XXX leak, but needed */ return _res; } @@ -1230,12 +1064,16 @@ static PyMethodDef AE_methods[] = { "(DescType typeCode, Buffer dataPtr, DescType toType) -> (AEDesc result)"}, {"AECreateList", (PyCFunction)AE_AECreateList, 1, "(Buffer factoringPtr, Boolean isRecord) -> (AEDescList resultList)"}, + {"AEPutPtr", (PyCFunction)AE_AEPutPtr, 1, + "(long index, DescType typeCode, Buffer dataPtr) -> (AEDescList theAEDescList)"}, + {"AEPutDesc", (PyCFunction)AE_AEPutDesc, 1, + "(long index, AEDesc theAEDesc) -> (AEDescList theAEDescList)"}, + {"AEDeleteItem", (PyCFunction)AE_AEDeleteItem, 1, + "(long index) -> (AEDescList theAEDescList)"}, {"AECreateAppleEvent", (PyCFunction)AE_AECreateAppleEvent, 1, "(AEEventClass theAEEventClass, AEEventID theAEEventID, AEAddressDesc target, short returnID, long transactionID) -> (AppleEvent result)"}, {"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1, "(EventRecord theEventRecord) -> None"}, - {"AEGetTheCurrentEvent", (PyCFunction)AE_AEGetTheCurrentEvent, 1, - "() -> (AppleEvent theAppleEvent)"}, {"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1, "() -> (AEInteractAllowed level)"}, {"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1, @@ -1243,7 +1081,7 @@ static PyMethodDef AE_methods[] = { {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, "(long timeOutInTicks) -> None"}, {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, - "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"}, + "(AEEventClass theAEEventClass, AEEventID theAEEventID, long handlerRefcon) -> None"}, {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"}, {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, diff --git a/Mac/Modules/ae/aegen.py b/Mac/Modules/ae/aegen.py index 221ef97..49f891e 100644 --- a/Mac/Modules/ae/aegen.py +++ b/Mac/Modules/ae/aegen.py @@ -1,4 +1,4 @@ -# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:AppleEvents.h' +# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:AppleEvents.h' f = AEFunction(OSErr, 'AECreateDesc', (DescType, 'typeCode', InMode), @@ -41,20 +41,20 @@ f = AEMethod(OSErr, 'AECountItems', ) aedescmethods.append(f) -f = AEMethod(OSErr, 'AEPutPtr', - (AEDescList_ptr, 'theAEDescList', InMode), +f = AEFunction(OSErr, 'AEPutPtr', + (AEDescList, 'theAEDescList', OutMode), (long, 'index', InMode), (DescType, 'typeCode', InMode), (InBuffer, 'dataPtr', InMode), ) -aedescmethods.append(f) +functions.append(f) -f = AEMethod(OSErr, 'AEPutDesc', - (AEDescList_ptr, 'theAEDescList', InMode), +f = AEFunction(OSErr, 'AEPutDesc', + (AEDescList, 'theAEDescList', OutMode), (long, 'index', InMode), (AEDesc_ptr, 'theAEDesc', InMode), ) -aedescmethods.append(f) +functions.append(f) f = AEMethod(OSErr, 'AEGetNthPtr', (AEDescList_ptr, 'theAEDescList', InMode), @@ -83,57 +83,11 @@ f = AEMethod(OSErr, 'AESizeOfNthItem', ) aedescmethods.append(f) -f = AEMethod(OSErr, 'AEDeleteItem', - (AEDescList_ptr, 'theAEDescList', InMode), +f = AEFunction(OSErr, 'AEDeleteItem', + (AEDescList, 'theAEDescList', OutMode), (long, 'index', InMode), ) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AEPutKeyPtr', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), - (DescType, 'typeCode', InMode), - (InBuffer, 'dataPtr', InMode), -) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AEPutKeyDesc', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), - (AEDesc_ptr, 'theAEDesc', InMode), -) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AEGetKeyPtr', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), - (DescType, 'desiredType', InMode), - (DescType, 'typeCode', OutMode), - (VarVarOutBuffer, 'dataPtr', InOutMode), -) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AEGetKeyDesc', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), - (DescType, 'desiredType', InMode), - (AEDesc, 'result', OutMode), -) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AESizeOfKeyDesc', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), - (DescType, 'typeCode', OutMode), - (Size, 'dataSize', OutMode), -) -aedescmethods.append(f) - -f = AEMethod(OSErr, 'AEDeleteKeyDesc', - (AERecord_ptr, 'theAERecord', InMode), - (AEKeyword, 'theAEKeyword', InMode), -) -aedescmethods.append(f) +functions.append(f) f = AEMethod(OSErr, 'AEPutParamPtr', (AppleEvent_ptr, 'theAppleEvent', InMode), @@ -237,8 +191,8 @@ f = AEMethod(OSErr, 'AESend', (AESendMode, 'sendMode', InMode), (AESendPriority, 'sendPriority', InMode), (long, 'timeOutInTicks', InMode), - (IdleProcPtr, 'idleProc', InMode), - (EventFilterProcPtr, 'filterProc', InMode), + (AEIdleUPP, 'idleProc', InMode), + (AEFilterUPP, 'filterProc', InMode), ) aedescmethods.append(f) @@ -260,14 +214,15 @@ aedescmethods.append(f) f = AEMethod(OSErr, 'AEResumeTheCurrentEvent', (AppleEvent_ptr, 'theAppleEvent', InMode), (AppleEvent_ptr, 'reply', InMode), - (EventHandler, 'dispatcher', InMode), + (AEEventHandlerUPP, 'dispatcher', InMode), + (long, 'handlerRefcon', InMode), ) aedescmethods.append(f) -f = AEFunction(OSErr, 'AEGetTheCurrentEvent', - (AppleEvent, 'theAppleEvent', OutMode), +f = AEMethod(OSErr, 'AEGetTheCurrentEvent', + (AppleEvent_ptr, 'theAppleEvent', InMode), ) -functions.append(f) +aedescmethods.append(f) f = AEMethod(OSErr, 'AESetTheCurrentEvent', (AppleEvent_ptr, 'theAppleEvent', InMode), @@ -287,14 +242,15 @@ functions.append(f) f = AEFunction(OSErr, 'AEInteractWithUser', (long, 'timeOutInTicks', InMode), (NMRecPtr, 'nmReqPtr', InMode), - (IdleProcPtr, 'idleProc', InMode), + (AEIdleUPP, 'idleProc', InMode), ) functions.append(f) f = AEFunction(OSErr, 'AEInstallEventHandler', (AEEventClass, 'theAEEventClass', InMode), (AEEventID, 'theAEEventID', InMode), - (EventHandler, 'handler', InMode), + (AEEventHandlerUPP, 'handler', InMode), + (long, 'handlerRefcon', InMode), (AlwaysFalse, 'isSysHandler', InMode), ) functions.append(f) @@ -302,7 +258,7 @@ functions.append(f) f = AEFunction(OSErr, 'AERemoveEventHandler', (AEEventClass, 'theAEEventClass', InMode), (AEEventID, 'theAEEventID', InMode), - (EventHandlerProcPtr, 'handler', InMode), + (AEEventHandlerUPP, 'handler', InMode), (AlwaysFalse, 'isSysHandler', InMode), ) functions.append(f) diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py index 75003ec..8e74e18 100644 --- a/Mac/Modules/ae/aescan.py +++ b/Mac/Modules/ae/aescan.py @@ -2,6 +2,8 @@ # Then run aesupport to generate AEmodule.c. 0# (Should learn how to tell the compiler to compile it as well.) +import addpack +addpack.addpack(':Tools:bgen:bgen') import sys import os import string @@ -46,6 +48,8 @@ class AppleEventsScanner(Scanner): return [ "ProcPtr", "AEArrayType", + "AECoercionHandlerUPP", + "UniversalProcPtr", ] def makerepairinstructions(self): @@ -65,6 +69,9 @@ class AppleEventsScanner(Scanner): ([("void", "*", "OutMode"), ("Size", "*", "InMode"), ("Size", "*", "OutMode")], [("VarVarOutBuffer", "*", "InOutMode")]), + + ([("AppleEvent", "theAppleEvent", "OutMode")], + [("AppleEvent_ptr", "*", "InMode")]), ] if __name__ == "__main__": diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py index a11e873..8e4c7a3 100644 --- a/Mac/Modules/ae/aesupport.py +++ b/Mac/Modules/ae/aesupport.py @@ -3,6 +3,8 @@ # It execs the file aegen.py which contain the function definitions # (aegen.py was generated by aescan.py, scanning the header file). +import addpack +addpack.addpack(':Tools:bgen:bgen') from macsupport import * @@ -65,9 +67,12 @@ EventHandlerNoRefCon = EHNoRefConType() IdleProcPtr = FakeType("upp_AEIdleProc") +AEIdleUPP = IdleProcPtr EventFilterProcPtr = FakeType("(AEFilterUPP)0") +AEFilterUPP = EventFilterProcPtr NMRecPtr = FakeType("(NMRecPtr)0") EventHandlerProcPtr = FakeType("upp_GenericEventHandler") +AEEventHandlerUPP = EventHandlerProcPtr AlwaysFalse = FakeType("0") -- cgit v0.12