Trying again to check it in. Changes to:
- Use Universal Headers as input
- Change addpack calls to not depend on Guido's disklayout
- Checkge testprograms to use new names for some functions
diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c
index 42d55b4..7169b59 100644
--- a/Mac/Modules/evt/Evtmodule.c
+++ b/Mac/Modules/evt/Evtmodule.c
@@ -39,6 +39,49 @@
static PyObject *Evt_Error;
+static PyObject *Evt_GetDblTime(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDblTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetCaretTime(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCaretTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_SetEventMask(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short value;
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ SetEventMask(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Evt_GetNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -171,6 +214,96 @@
return _res;
}
+static PyObject *Evt_TickCount(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TickCount();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_PostEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short eventNum;
+ long eventMsg;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &eventNum,
+ &eventMsg))
+ return NULL;
+ _err = PostEvent(eventNum,
+ eventMsg);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_OSEventAvail(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mask))
+ return NULL;
+ _rv = OSEventAvail(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_GetOSEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mask))
+ return NULL;
+ _rv = GetOSEvent(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_FlushEvents(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short whichMask;
+ short stopMask;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &whichMask,
+ &stopMask))
+ return NULL;
+ FlushEvents(whichMask,
+ stopMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Evt_SystemClick(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -189,7 +322,42 @@
return _res;
}
+static PyObject *Evt_SystemTask(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SystemTask();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_SystemEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = SystemEvent(&theEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
static PyMethodDef Evt_methods[] = {
+ {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
+ "() -> (long _rv)"},
+ {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
+ "() -> (long _rv)"},
+ {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
+ "(short value) -> None"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(short eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
@@ -206,8 +374,22 @@
"() -> (Boolean _rv)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
"() -> (KeyMap theKeys)"},
+ {"TickCount", (PyCFunction)Evt_TickCount, 1,
+ "() -> (unsigned long _rv)"},
+ {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
+ "(short eventNum, long eventMsg) -> None"},
+ {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1,
+ "(short mask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1,
+ "(short mask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
+ "(short whichMask, short stopMask) -> None"},
{"SystemClick", (PyCFunction)Evt_SystemClick, 1,
"(EventRecord theEvent, WindowPtr theWindow) -> None"},
+ {"SystemTask", (PyCFunction)Evt_SystemTask, 1,
+ "() -> None"},
+ {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1,
+ "(EventRecord theEvent) -> (Boolean _rv)"},
{NULL, NULL, 0}
};
@@ -232,4 +414,3 @@
/* ========================= End module Evt ========================= */
-