blob: d568a73e49cc8e0a44193562ede5daa403260ac3 [file] [log] [blame]
Jack Jansenb9968561995-11-30 15:03:09 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import addpack
4addpack.addpack(':tools:bgen:bgen')
5from scantools import Scanner
6
7LONG = "Components"
8SHORT = "Cm"
9
10def main():
11 input = "Components.h"
12 output = SHORT + "gen.py"
13 defsoutput = LONG + ".py"
14 scanner = MyScanner(input, output, defsoutput)
15 scanner.scan()
16 scanner.close()
17 print "=== Done scanning and generating, now importing the generated code... ==="
18 exec "import " + SHORT + "support"
19 print "=== Done. It's up to you to compile it now! ==="
20
21class MyScanner(Scanner):
22
23 def destination(self, type, name, arglist):
24 classname = "Function"
25 listname = "functions"
26 if arglist:
27 t, n, m = arglist[0]
28 #
29 # FindNextComponent is a special case, since it call also be called
30 # with None as the argument. Hence, we make it a function
31 #
32 if t == "Component" and m == "InMode" and name != "FindNextComponent":
33 classname = "Method"
34 listname = "c_methods"
35 elif t == "ComponentInstance" and m == "InMode":
36 classname = "Method"
37 listname = "ci_methods"
38 return classname, listname
39
40 def makeblacklistnames(self):
41 return [
42 # "GetComponentInfo" # XXXX I dont know how the Handle args are expected...
43 ]
44
45 def makeblacklisttypes(self):
46 return [
47 "ResourceSpec",
48 "ComponentResource",
49 "ComponentPlatformInfo",
50 "ComponentResourceExtension",
51 "ComponentPlatformInfoArray",
52 "ExtComponentResource",
53 "ComponentParameters",
54
55 "ComponentRoutineUPP",
56 ]
57
58 def makerepairinstructions(self):
59 return [
60 ([('ComponentDescription', 'looking', 'OutMode')],
61 [('ComponentDescription', '*', 'InMode')]),
62 ]
63
64if __name__ == "__main__":
65 main()