]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fixed incorrect call to InstallHandler and a few other things
authorJack Jansen <jack.jansen@cwi.nl>
Sat, 29 Jul 1995 13:58:41 +0000 (13:58 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sat, 29 Jul 1995 13:58:41 +0000 (13:58 +0000)
Mac/Lib/toolbox/AEObjects.py
Mac/Lib/toolbox/AERegistry.py
Mac/Lib/toolbox/AppleEvents.py
Mac/Modules/ae/AEmodule.c
Mac/Modules/ae/aegen.py
Mac/Modules/ae/aescan.py

index 3f36414a9884fb154ad5cfb7a5bd3fbccd540955..3e1db671d2e24afa5d3e3c0163a6c3e0dbd9d2c6 100644 (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  '
index 217e4b9194c47f66893bd8ec1267181ed018ebd4..716c5f837f94bd91efd39ea4bdc7cb23f5edd825 100644 (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'
index 272c44623b5b73ad596873f0b832e3987d55d723..e4668bcc7a74a38126cf92d291b817857860e3c0 100644 (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'
index 53467e4b26de0b95f38bb801b3d18dccebf0bf67..a4f56d6c3189b393d4ac293d4a740bba499c341a 100644 (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}
index 1769003b9bc9b07e62752c3edd297e3df2cbed43..5d3a6e88793848b46520f339ff0228b667e75cbb 100644 (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 @@ 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),
index e68c9aecd23e13e2a0722057c2ef458e06eed7ba..bc6cc588843bbb5d0ef1043ad99c98d887a64a50 100644 (file)
@@ -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")]),