1 # Scan an Apple header file, generating a Python file of generator calls.
3 from scantools
import Scanner
8 defsoutput
= "Windows.py"
9 scanner
= MyScanner(input, output
, defsoutput
)
12 print "=== Done scanning and generating, now importing the generated code... ==="
14 print "=== Done. It's up to you to compile it now! ==="
16 class MyScanner(Scanner
):
18 def destination(self
, type, name
, arglist
):
19 classname
= "Function"
20 listname
= "functions"
23 if t
in ("WindowPtr", "WindowPeek") and m
== "InMode":
26 return classname
, listname
28 def makeblacklistnames(self
):
30 'DisposeWindow', # Implied when the object is deleted
34 def makeblacklisttypes(self
):
46 def makerepairinstructions(self
):
50 ([("Str255", "*", "InMode")],
51 [("*", "*", "OutMode")]),
53 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
54 [("InBuffer", "*", "*")]),
56 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
57 ("long", "*", "OutMode")],
58 [("VarVarOutBuffer", "*", "InOutMode")]),
60 ([("void", "wStorage", "OutMode")],
61 [("NullStorage", "*", "InMode")]),
63 ([("WindowPtr", "*", "OutMode")],
64 [("ExistingWindowPtr", "*", "*")]),
66 ([("WindowPtr", "FrontWindow", "ReturnMode")],
67 [("ExistingWindowPtr", "*", "*")]),
70 if __name__
== "__main__":