ยปCore Development>Code coverage>Mac/Modules/osa/osascan.py

Python code coverage for Mac/Modules/osa/osascan.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 = "OSAconst"
9n/aSHORT = "osa"
10n/a
11n/adef main():
12n/a input = "OSA.h"
13n/a output = SHORT + "gen.py"
14n/a defsoutput = TOOLBOXDIR + LONG + ".py"
15n/a scanner = MyScanner(input, output, defsoutput)
16n/a scanner.scan()
17n/a scanner.close()
18n/a scanner.gentypetest(SHORT+"typetest.py")
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 if t == "ComponentInstance" and m == "InMode":
33n/a classname = "Method"
34n/a listname = "methods"
35n/a return classname, listname
36n/a
37n/a def writeinitialdefs(self):
38n/a self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
39n/a self.defsfile.write("from Carbon.AppleEvents import *\n")
40n/a self.defsfile.write("kAEUseStandardDispatch = -1\n")
41n/a
42n/a def makeblacklistnames(self):
43n/a return [
44n/a "OSACopyScript",
45n/a ]
46n/a
47n/a def makeblacklisttypes(self):
48n/a return [
49n/a "OSALocalOrGlobal",
50n/a "OSACreateAppleEventUPP",
51n/a "OSAActiveUPP",
52n/a "AEEventHandlerUPP",
53n/a "OSASendUPP",
54n/a ]
55n/a
56n/a def makerepairinstructions(self):
57n/a return [
58n/a ]
59n/a
60n/aif __name__ == "__main__":
61n/a main()