1 # Scan an Apple header file, generating a Python file of generator calls.
3 from scantools
import Scanner
11 output
= SHORT
+ "gen.py"
12 defsoutput
= LONG
+ ".py"
13 scanner
= MyScanner(input, output
, defsoutput
)
16 print "=== Done scanning and generating, now importing the generated code... ==="
17 exec "import " + SHORT
+ "support"
18 print "=== Done. It's up to you to compile it now! ==="
20 class MyScanner(Scanner
):
22 def destination(self
, type, name
, arglist
):
23 classname
= "Function"
24 listname
= "functions"
27 # This is non-functional today
28 if t
== OBJECT
and m
== "InMode":
31 return classname
, listname
33 def makeblacklistnames(self
):
37 def makeblacklisttypes(self
):
41 def makerepairinstructions(self
):
43 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
44 [("InBuffer", "*", "*")]),
46 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
47 ("long", "*", "OutMode")],
48 [("VarVarOutBuffer", "*", "InOutMode")]),
50 ([("void", "wStorage", "OutMode")],
51 [("NullStorage", "*", "InMode")]),
54 ([('KeyMap', 'theKeys', 'InMode')],
55 [('*', '*', 'OutMode')]),
58 if __name__
== "__main__":