1 # Scan an Apple header file, generating a Python file of generator calls.
4 addpack
.addpack(':tools:bgen:bgen')
5 from scantools
import Scanner
13 output
= SHORT
+ "gen.py"
14 defsoutput
= LONG
+ ".py"
15 scanner
= MyScanner(input, output
, defsoutput
)
18 print "=== Done scanning and generating, now importing the generated code... ==="
19 exec "import " + SHORT
+ "support"
20 print "=== Done. It's up to you to compile it now! ==="
22 class MyScanner(Scanner
):
24 def destination(self
, type, name
, arglist
):
25 classname
= "Function"
26 listname
= "functions"
29 # This is non-functional today
30 if t
== OBJECT
and m
== "InMode":
33 return classname
, listname
35 def makeblacklistnames(self
):
38 "GetEventMask", # I cannot seem to find this routine...
41 def makeblacklisttypes(self
):
46 def makerepairinstructions(self
):
48 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
49 [("InBuffer", "*", "*")]),
51 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
52 ("long", "*", "OutMode")],
53 [("VarVarOutBuffer", "*", "InOutMode")]),
55 ([("void", "wStorage", "OutMode")],
56 [("NullStorage", "*", "InMode")]),
59 ([('KeyMap', 'theKeys', 'InMode')],
60 [('*', '*', 'OutMode')]),
63 ([('unsigned long', '*', '*')],
64 [('unsigned_long', '*', '*')]),
67 if __name__
== "__main__":