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
):
37 "LDispose", # Done by removing the object
38 "LSearch", # We don't want to handle procs just yet
39 "LGetCellDataLocation", # What does this do??
42 def makeblacklisttypes(self
):
46 def makerepairinstructions(self
):
48 ([('ListBounds_ptr', '*', 'InMode')],
49 [('Rect_ptr', '*', 'InMode')]),
51 ([("Cell", "theCell", "OutMode")],
52 [("Cell", "theCell", "InOutMode")]),
54 ([("void_ptr", "*", "InMode"), ("short", "*", "InMode")],
55 [("InBufferShortsize", "*", "*")]),
57 ([("void", "*", "OutMode"), ("short", "*", "OutMode")],
58 [("VarOutBufferShortsize", "*", "InOutMode")]),
60 # ([("void", "wStorage", "OutMode")],
61 # [("NullStorage", "*", "InMode")]),
64 # ([('KeyMap', 'theKeys', 'InMode')],
65 # [('*', '*', 'OutMode')]),
68 # ([('unsigned long', '*', '*')],
69 # [('unsigned_long', '*', '*')]),
72 if __name__
== "__main__":