ยปCore Development>Code coverage>Mac/Modules/scrap/scrapscan.py

Python code coverage for Mac/Modules/scrap/scrapscan.py

#countcontent
1n/a# Scan an Apple header file, generating a Python file of generator calls.
2n/a#
3n/a# Note that the scrap-manager include file is so weird that this
4n/a# generates a boilerplate to be edited by hand.
5n/a
6n/aimport sys
7n/afrom bgenlocations import TOOLBOXDIR, BGENDIR
8n/asys.path.append(BGENDIR)
9n/afrom scantools import Scanner
10n/a
11n/aLONG = "Scrap"
12n/aSHORT = "scrap"
13n/a
14n/adef main():
15n/a input = "Scrap.h"
16n/a output = SHORT + "gen.py"
17n/a defsoutput = "@Scrap.py"
18n/a scanner = MyScanner(input, output, defsoutput)
19n/a scanner.scan()
20n/a scanner.close()
21n/a## print "=== Testing definitions output code ==="
22n/a## execfile(defsoutput, {}, {})
23n/a print "=== Done scanning and generating, now importing the generated code... ==="
24n/a exec "import " + SHORT + "support"
25n/a print "=== Done. It's up to you to compile it now! ==="
26n/a
27n/aclass MyScanner(Scanner):
28n/a
29n/a def destination(self, type, name, arglist):
30n/a classname = "Function"
31n/a listname = "functions"
32n/a if arglist:
33n/a t, n, m = arglist[0]
34n/a if t == 'ScrapRef' and m == "InMode":
35n/a classname = "Method"
36n/a listname = "methods"
37n/a return classname, listname
38n/a
39n/a def makeblacklistnames(self):
40n/a return [
41n/a "GetScrapFlavorInfoList",
42n/a 'InfoScrap',
43n/a 'GetScrap',
44n/a 'ZeroScrap',
45n/a 'PutScrap',
46n/a ]
47n/a
48n/a def makeblacklisttypes(self):
49n/a return [
50n/a 'ScrapPromiseKeeperUPP',
51n/a ]
52n/a
53n/a def makerepairinstructions(self):
54n/a return [
55n/a ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]),
56n/a ([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]),
57n/a ]
58n/a
59n/aif __name__ == "__main__":
60n/a main()