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 ' kAEAND = 'AND '
kAEOR = 'OR ' 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' cAEList = 'list'
cApplication = 'capp' 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' typeBoolean = 'bool'
typeChar = 'TEXT' typeChar = 'TEXT'

View File

@ -667,18 +667,19 @@ static PyObject *AEDesc_AEResumeTheCurrentEvent(_self, _args)
PyObject *_res = NULL; PyObject *_res = NULL;
OSErr _err; OSErr _err;
AppleEvent reply; AppleEvent reply;
long handlerRefcon; AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler;
if (!PyArg_ParseTuple(_args, "O&l", PyObject *dispatcher;
if (!PyArg_ParseTuple(_args, "O&O",
AEDesc_Convert, &reply, AEDesc_Convert, &reply,
&handlerRefcon)) &dispatcher))
return NULL; return NULL;
_err = AEResumeTheCurrentEvent(&_self->ob_itself, _err = AEResumeTheCurrentEvent(&_self->ob_itself,
&reply, &reply,
upp_GenericEventHandler, dispatcher__proc__, (long)dispatcher);
handlerRefcon);
if (_err != noErr) return PyMac_Error(_err); if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
Py_INCREF(dispatcher); /* XXX leak, but needed */
return _res; return _res;
} }
@ -760,7 +761,7 @@ static PyMethodDef AEDesc_methods[] = {
{"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1, {"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
"() -> None"}, "() -> None"},
{"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1, {"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1,
"(AppleEvent reply, long handlerRefcon) -> None"}, "(AppleEvent reply, EventHandler dispatcher) -> None"},
{"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1, {"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1,
"() -> None"}, "() -> None"},
{"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1, {"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1,
@ -1002,20 +1003,21 @@ static PyObject *AE_AEInstallEventHandler(_self, _args)
OSErr _err; OSErr _err;
AEEventClass theAEEventClass; AEEventClass theAEEventClass;
AEEventID theAEEventID; AEEventID theAEEventID;
long handlerRefcon; AEEventHandlerUPP handler__proc__ = upp_GenericEventHandler;
if (!PyArg_ParseTuple(_args, "O&O&l", PyObject *handler;
if (!PyArg_ParseTuple(_args, "O&O&O",
PyMac_GetOSType, &theAEEventClass, PyMac_GetOSType, &theAEEventClass,
PyMac_GetOSType, &theAEEventID, PyMac_GetOSType, &theAEEventID,
&handlerRefcon)) &handler))
return NULL; return NULL;
_err = AEInstallEventHandler(theAEEventClass, _err = AEInstallEventHandler(theAEEventClass,
theAEEventID, theAEEventID,
upp_GenericEventHandler, handler__proc__, (long)handler,
handlerRefcon,
0); 0);
if (_err != noErr) return PyMac_Error(_err); if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None); Py_INCREF(Py_None);
_res = Py_None; _res = Py_None;
Py_INCREF(handler); /* XXX leak, but needed */
return _res; return _res;
} }
@ -1041,6 +1043,30 @@ static PyObject *AE_AERemoveEventHandler(_self, _args)
return _res; 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) static PyObject *AE_AEManagerInfo(_self, _args)
PyObject *_self; PyObject *_self;
PyObject *_args; PyObject *_args;
@ -1078,9 +1104,11 @@ static PyMethodDef AE_methods[] = {
{"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1, {"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1,
"(long timeOutInTicks) -> None"}, "(long timeOutInTicks) -> None"},
{"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1, {"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID, long handlerRefcon) -> None"}, "(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"},
{"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1, {"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"}, "(AEEventClass theAEEventClass, AEEventID theAEEventID) -> None"},
{"AEGetEventHandler", (PyCFunction)AE_AEGetEventHandler, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID) -> (EventHandler handler)"},
{"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1, {"AEManagerInfo", (PyCFunction)AE_AEManagerInfo, 1,
"(AEKeyword keyWord) -> (long result)"}, "(AEKeyword keyWord) -> (long result)"},
{NULL, NULL, 0} {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', f = AEFunction(OSErr, 'AECreateDesc',
(DescType, 'typeCode', InMode), (DescType, 'typeCode', InMode),
@ -214,8 +214,7 @@
f = AEMethod(OSErr, 'AEResumeTheCurrentEvent', f = AEMethod(OSErr, 'AEResumeTheCurrentEvent',
(AppleEvent_ptr, 'theAppleEvent', InMode), (AppleEvent_ptr, 'theAppleEvent', InMode),
(AppleEvent_ptr, 'reply', InMode), (AppleEvent_ptr, 'reply', InMode),
(AEEventHandlerUPP, 'dispatcher', InMode), (EventHandler, 'dispatcher', InMode),
(long, 'handlerRefcon', InMode),
) )
aedescmethods.append(f) aedescmethods.append(f)
@ -249,8 +248,7 @@
f = AEFunction(OSErr, 'AEInstallEventHandler', f = AEFunction(OSErr, 'AEInstallEventHandler',
(AEEventClass, 'theAEEventClass', InMode), (AEEventClass, 'theAEEventClass', InMode),
(AEEventID, 'theAEEventID', InMode), (AEEventID, 'theAEEventID', InMode),
(AEEventHandlerUPP, 'handler', InMode), (EventHandler, 'handler', InMode),
(long, 'handlerRefcon', InMode),
(AlwaysFalse, 'isSysHandler', InMode), (AlwaysFalse, 'isSysHandler', InMode),
) )
functions.append(f) functions.append(f)
@ -263,6 +261,14 @@
) )
functions.append(f) 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', f = AEFunction(OSErr, 'AEManagerInfo',
(AEKeyword, 'keyWord', InMode), (AEKeyword, 'keyWord', InMode),
(long, 'result', OutMode), (long, 'result', OutMode),

View File

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