Fixed incorrect call to InstallHandler and a few other things

This commit is contained in:
Jack Jansen 1995-07-29 13:58:41 +00:00
parent 21eb0b56a8
commit 5050199787
6 changed files with 61 additions and 21 deletions

View File

@ -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 '

View File

@ -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'

View File

@ -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'

View File

@ -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}

View File

@ -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 @@
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 @@
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 @@
)
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),

View File

@ -59,7 +59,7 @@ def destination(self, type, name, arglist):
def makeblacklistnames(self):
return [
"AEDisposeDesc",
"AEGetEventHandler",
# "AEGetEventHandler",
]
def makeblacklisttypes(self):
@ -84,6 +84,12 @@ def makerepairinstructions(self):
([("EventHandlerProcPtr", "*", "OutMode"), ("long", "*", "OutMode")],
[("EventHandler", "*", "*")]),
([("AEEventHandlerUPP", "*", "InMode"), ("long", "*", "InMode")],
[("EventHandler", "*", "*")]),
([("AEEventHandlerUPP", "*", "OutMode"), ("long", "*", "OutMode")],
[("EventHandler", "*", "*")]),
([("void", "*", "OutMode"), ("Size", "*", "InMode"),
("Size", "*", "OutMode")],
[("VarVarOutBuffer", "*", "InOutMode")]),