ยปCore Development>Code coverage>Mac/Modules/evt/evtscan.py

Python code coverage for Mac/Modules/evt/evtscan.py

#countcontent
1n/a# Scan an Apple header file, generating a Python file of generator calls.
2n/a
3n/aimport sys
4n/afrom bgenlocations import TOOLBOXDIR, BGENDIR
5n/asys.path.append(BGENDIR)
6n/afrom scantools import Scanner
7n/a
8n/aLONG = "Events"
9n/aSHORT = "evt"
10n/aOBJECT = "NOTUSED"
11n/a
12n/adef main():
13n/a input = LONG + ".h"
14n/a output = SHORT + "gen.py"
15n/a defsoutput = TOOLBOXDIR + LONG + ".py"
16n/a scanner = MyScanner(input, output, defsoutput)
17n/a scanner.scan()
18n/a scanner.close()
19n/a print "=== Testing definitions output code ==="
20n/a execfile(defsoutput, {}, {})
21n/a print "=== Done scanning and generating, now importing the generated code... ==="
22n/a exec "import " + SHORT + "support"
23n/a print "=== Done. It's up to you to compile it now! ==="
24n/a
25n/aclass MyScanner(Scanner):
26n/a
27n/a def destination(self, type, name, arglist):
28n/a classname = "Function"
29n/a listname = "functions"
30n/a if arglist:
31n/a t, n, m = arglist[0]
32n/a # This is non-functional today
33n/a if t == OBJECT and m == "InMode":
34n/a classname = "Method"
35n/a listname = "methods"
36n/a return classname, listname
37n/a
38n/a def makeblacklistnames(self):
39n/a return [
40n/a "KeyTranslate",
41n/a "GetEventMask", # I cannot seem to find this routine...
42n/a "WaitNextEvent", # Manually generated because of optional region
43n/a # Constants with funny definitions
44n/a "osEvtMessageMask",
45n/a # OS8 calls
46n/a 'SystemEvent',
47n/a 'SystemTask',
48n/a 'SystemClick',
49n/a 'GetOSEvent',
50n/a 'OSEventAvail',
51n/a ]
52n/a
53n/a def makeblacklisttypes(self):
54n/a return [
55n/a "EvQElPtr", "QHdrPtr"
56n/a ]
57n/a
58n/a def makerepairinstructions(self):
59n/a return [
60n/a ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
61n/a [("InBuffer", "*", "*")]),
62n/a
63n/a ([("void", "*", "OutMode"), ("long", "*", "InMode"),
64n/a ("long", "*", "OutMode")],
65n/a [("VarVarOutBuffer", "*", "InOutMode")]),
66n/a
67n/a ([("void", "wStorage", "OutMode")],
68n/a [("NullStorage", "*", "InMode")]),
69n/a
70n/a # GetKeys
71n/a ([('KeyMap', 'theKeys', 'InMode')],
72n/a [('*', '*', 'OutMode')]),
73n/a
74n/a # GetTicker
75n/a ([('unsigned long', '*', '*')],
76n/a [('unsigned_long', '*', '*')]),
77n/a ]
78n/a
79n/aif __name__ == "__main__":
80n/a main()