1 # Scan an Apple header file, generating a Python file of generator calls.
4 addpack
.addpack(':tools:bgen:bgen')
5 from scantools
import Scanner
6 from bgenlocations
import TOOLBOXDIR
14 output
= SHORT
+ "gen.py"
15 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
16 scanner
= MyScanner(input, output
, defsoutput
)
19 print "=== Done scanning and generating, now importing the generated code... ==="
20 exec "import " + SHORT
+ "support"
21 print "=== Done. It's up to you to compile it now! ==="
23 class MyScanner(Scanner
):
25 def destination(self
, type, name
, arglist
):
26 classname
= "Function"
27 listname
= "functions"
30 # This is non-functional today
31 if t
== OBJECT
and m
== "InMode":
34 return classname
, listname
36 def makeblacklistnames(self
):
39 "GetEventMask", # I cannot seem to find this routine...
42 def makeblacklisttypes(self
):
47 def makerepairinstructions(self
):
49 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
50 [("InBuffer", "*", "*")]),
52 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
53 ("long", "*", "OutMode")],
54 [("VarVarOutBuffer", "*", "InOutMode")]),
56 ([("void", "wStorage", "OutMode")],
57 [("NullStorage", "*", "InMode")]),
60 ([('KeyMap', 'theKeys', 'InMode')],
61 [('*', '*', 'OutMode')]),
64 ([('unsigned long', '*', '*')],
65 [('unsigned_long', '*', '*')]),
68 if __name__
== "__main__":