1 # Scan an Apple header file, generating a Python file of generator calls.
3 addpack
.addpack(':Tools:bgen:bgen')
5 from scantools
import Scanner
10 defsoutput
= "Windows.py"
11 scanner
= MyScanner(input, output
, defsoutput
)
14 print "=== Done scanning and generating, now importing the generated code... ==="
16 print "=== Done. It's up to you to compile it now! ==="
18 class MyScanner(Scanner
):
20 def destination(self
, type, name
, arglist
):
21 classname
= "Function"
22 listname
= "functions"
25 if t
in ("WindowPtr", "WindowPeek", "WindowRef") and m
== "InMode":
28 return classname
, listname
30 def makeblacklistnames(self
):
32 'DisposeWindow', # Implied when the object is deleted
36 def makeblacklisttypes(self
):
48 def makerepairinstructions(self
):
52 ([("Str255", "*", "InMode")],
53 [("*", "*", "OutMode")]),
55 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
56 [("InBuffer", "*", "*")]),
58 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
59 ("long", "*", "OutMode")],
60 [("VarVarOutBuffer", "*", "InOutMode")]),
62 ([("void", "wStorage", "OutMode")],
63 [("NullStorage", "*", "InMode")]),
65 ([("WindowPtr", "*", "OutMode")],
66 [("ExistingWindowPtr", "*", "*")]),
67 ([("WindowRef", "*", "OutMode")], # Same, but other style headerfiles
68 [("ExistingWindowPtr", "*", "*")]),
70 ([("WindowPtr", "FrontWindow", "ReturnMode")],
71 [("ExistingWindowPtr", "*", "*")]),
72 ([("WindowRef", "FrontWindow", "ReturnMode")], # Ditto
73 [("ExistingWindowPtr", "*", "*")]),
76 if __name__
== "__main__":