ยปCore Development>Code coverage>Mac/Modules/app/appscan.py

Python code coverage for Mac/Modules/app/appscan.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 = "Appearance"
9n/aSHORT = "app"
10n/aOBJECT = "ThemeDrawingState"
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 writeinitialdefs(self):
39n/a self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
40n/a
41n/a def makeblacklistnames(self):
42n/a return [
43n/a "GetThemeFont", # Funny stringbuffer in/out parameter, I think...
44n/a # Constants with funny definitions
45n/a "appearanceBadBrushIndexErr",
46n/a "appearanceProcessRegisteredErr",
47n/a "appearanceProcessNotRegisteredErr",
48n/a "appearanceBadTextColorIndexErr",
49n/a "appearanceThemeHasNoAccents",
50n/a "appearanceBadCursorIndexErr",
51n/a ]
52n/a
53n/a def makeblacklisttypes(self):
54n/a return [
55n/a "MenuTitleDrawingUPP",
56n/a "MenuItemDrawingUPP",
57n/a "ThemeIteratorUPP",
58n/a "ThemeTabTitleDrawUPP",
59n/a# "ThemeEraseUPP",
60n/a# "ThemeButtonDrawUPP",
61n/a "WindowTitleDrawingUPP",
62n/a "ProcessSerialNumber_ptr", # Too much work for now.
63n/a "ThemeTrackDrawInfo_ptr", # Too much work
64n/a# "ThemeButtonDrawInfo_ptr", # ditto
65n/a "ThemeWindowMetrics_ptr", # ditto
66n/a# "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
67n/a "Collection", # No interface to collection mgr yet.
68n/a "BytePtr", # Not yet.
69n/a ]
70n/a
71n/a def makerepairinstructions(self):
72n/a return [
73n/a ([("void", 'inContext', "OutMode")],
74n/a [("NULL", 'inContext', "InMode")]),
75n/a ([("Point", 'ioBounds', "OutMode")],
76n/a [("Point", 'ioBounds', "InOutMode")]),
77n/a ]
78n/a
79n/aif __name__ == "__main__":
80n/a main()