summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/evt
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-06-06 13:08:40 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-06-06 13:08:40 (GMT)
commitb81cf9d61c71f9b5949b9424cec1f59ac4a426e8 (patch)
tree2b8fdc1f0dfd48b31a650f5a41864a8dc0b5ea7e /Mac/Modules/evt
parentae8a68f40cd56aa952520260970ebd5b9d3fb95c (diff)
downloadcpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.zip
cpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.tar.gz
cpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.tar.bz2
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
Diffstat (limited to 'Mac/Modules/evt')
-rw-r--r--Mac/Modules/evt/Evtmodule.c183
-rw-r--r--Mac/Modules/evt/evtgen.py58
-rw-r--r--Mac/Modules/evt/evtscan.py10
-rw-r--r--Mac/Modules/evt/evtsupport.py1
4 files changed, 248 insertions, 4 deletions
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 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
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 @@ static PyObject *Evt_GetKeys(_self, _args)
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 @@ static PyObject *Evt_SystemClick(_self, _args)
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 @@ static PyMethodDef Evt_methods[] = {
"() -> (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 @@ void initEvt()
/* ========================= End module Evt ========================= */
-
diff --git a/Mac/Modules/evt/evtgen.py b/Mac/Modules/evt/evtgen.py
index fd61c4d..deac64e 100644
--- a/Mac/Modules/evt/evtgen.py
+++ b/Mac/Modules/evt/evtgen.py
@@ -1,4 +1,17 @@
-# Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Events.h'
+# Generated from 'Moes:CW5 GOLD \304:Metrowerks C/C++ \304:Headers \304:Universal Headers 2.0a3 \304:Events.h'
+
+f = Function(long, 'GetDblTime',
+)
+functions.append(f)
+
+f = Function(long, 'GetCaretTime',
+)
+functions.append(f)
+
+f = Function(void, 'SetEventMask',
+ (short, 'value', InMode),
+)
+functions.append(f)
f = Function(Boolean, 'GetNextEvent',
(short, 'eventMask', InMode),
@@ -42,3 +55,46 @@ f = Function(void, 'GetKeys',
)
functions.append(f)
+f = Function(unsigned_long, 'TickCount',
+)
+functions.append(f)
+
+f = Function(OSErr, 'PostEvent',
+ (short, 'eventNum', InMode),
+ (long, 'eventMsg', InMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'OSEventAvail',
+ (short, 'mask', InMode),
+ (EventRecord, 'theEvent', OutMode),
+)
+functions.append(f)
+
+f = Function(Boolean, 'GetOSEvent',
+ (short, 'mask', InMode),
+ (EventRecord, 'theEvent', OutMode),
+)
+functions.append(f)
+
+f = Function(void, 'FlushEvents',
+ (short, 'whichMask', InMode),
+ (short, 'stopMask', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'SystemClick',
+ (EventRecord_ptr, 'theEvent', InMode),
+ (WindowPtr, 'theWindow', InMode),
+)
+functions.append(f)
+
+f = Function(void, 'SystemTask',
+)
+functions.append(f)
+
+f = Function(Boolean, 'SystemEvent',
+ (EventRecord_ptr, 'theEvent', InMode),
+)
+functions.append(f)
+
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
index 517db71..70a9df9 100644
--- a/Mac/Modules/evt/evtscan.py
+++ b/Mac/Modules/evt/evtscan.py
@@ -1,5 +1,7 @@
# Scan an Apple header file, generating a Python file of generator calls.
+import addpack
+addpack.addpack(':tools:bgen:bgen')
from scantools import Scanner
LONG = "Events"
@@ -32,10 +34,12 @@ class MyScanner(Scanner):
def makeblacklistnames(self):
return [
+ "KeyTranslate"
]
def makeblacklisttypes(self):
return [
+ "EvQElPtr", "QHdrPtr"
]
def makerepairinstructions(self):
@@ -53,7 +57,11 @@ class MyScanner(Scanner):
# GetKeys
([('KeyMap', 'theKeys', 'InMode')],
[('*', '*', 'OutMode')]),
+
+ # GetTicker
+ ([('unsigned long', '*', '*')],
+ [('unsigned_long', '*', '*')]),
]
-
+
if __name__ == "__main__":
main()
diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py
index 6f59b8b..0a6950b 100644
--- a/Mac/Modules/evt/evtsupport.py
+++ b/Mac/Modules/evt/evtsupport.py
@@ -63,7 +63,6 @@ Function = OSErrFunctionGenerator
functions = []
##methods = []
execfile(INPUTFILE)
-execfile("evtedit.py")
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)