1 # Scan an Apple header file, generating a Python file of generator calls.
5 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
6 sys
.path
.append(BGENDIR
)
7 from scantools
import Scanner
8 from bgenlocations
import TOOLBOXDIR
16 output
= SHORT
+ "gen.py"
17 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
18 scanner
= MyScanner(input, output
, defsoutput
)
21 print "=== Done scanning and generating, now importing the generated code... ==="
22 exec "import " + SHORT
+ "support"
23 print "=== Done. It's up to you to compile it now! ==="
25 class MyScanner(Scanner
):
27 def destination(self
, type, name
, arglist
):
28 classname
= "Function"
29 listname
= "functions"
32 # This is non-functional today
33 if t
== OBJECT
and m
== "InMode":
36 return classname
, listname
38 def makeblacklistnames(self
):
40 "LDispose", # Done by removing the object
41 "LSearch", # We don't want to handle procs just yet
42 "LGetCellDataLocation", # What does this do??
45 def makeblacklisttypes(self
):
49 def makerepairinstructions(self
):
51 ([('ListBounds_ptr', '*', 'InMode')],
52 [('Rect_ptr', '*', 'InMode')]),
54 ([("Cell", "theCell", "OutMode")],
55 [("Cell", "theCell", "InOutMode")]),
57 ([("void_ptr", "*", "InMode"), ("short", "*", "InMode")],
58 [("InBufferShortsize", "*", "*")]),
60 ([("void", "*", "OutMode"), ("short", "*", "OutMode")],
61 [("VarOutBufferShortsize", "*", "InOutMode")]),
63 # ([("void", "wStorage", "OutMode")],
64 # [("NullStorage", "*", "InMode")]),
67 # ([('KeyMap', 'theKeys', 'InMode')],
68 # [('*', '*', 'OutMode')]),
71 # ([('unsigned long', '*', '*')],
72 # [('unsigned_long', '*', '*')]),
75 def writeinitialdefs(self
):
76 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
79 if __name__
== "__main__":