ยปCore Development>Code coverage>Mac/Modules/help/helpscan.py

Python code coverage for Mac/Modules/help/helpscan.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 = "MacHelp"
9n/aSHORT = "help"
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 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 ]
44n/a
45n/a def makeblacklisttypes(self):
46n/a return [
47n/a## "TipFunctionUPP",
48n/a## "HMMessageRecord",
49n/a## "HMMessageRecord_ptr",
50n/a "HMWindowContentUPP",
51n/a "HMMenuTitleContentUPP",
52n/a "HMControlContentUPP",
53n/a "HMMenuItemContentUPP",
54n/a # For the moment
55n/a "HMHelpContentRec",
56n/a "HMHelpContentRec_ptr",
57n/a ]
58n/a
59n/a def makerepairinstructions(self):
60n/a return [
61n/a## ([("WindowPtr", "*", "OutMode")],
62n/a## [("ExistingWindowPtr", "*", "*")]),
63n/a ]
64n/a
65n/aif __name__ == "__main__":
66n/a main()