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 if t
== "DialogPtr" and m
== "InMode":
30 return classname
, listname
32 def makeblacklistnames(self
):
36 # Dialogs are disposed when the object is deleted
47 def makeblacklisttypes(self
):
51 def makerepairinstructions(self
):
53 ([("Str255", "*", "InMode")],
54 [("*", "*", "OutMode")]),
56 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
57 [("InBuffer", "*", "*")]),
59 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
60 ("long", "*", "OutMode")],
61 [("VarVarOutBuffer", "*", "InOutMode")]),
64 ([("void", "*", "OutMode")],
65 [("NullStorage", "*", "InMode")]),
67 ([("DialogPtr", "*", "OutMode")],
68 [("ExistingDialogPtr", "*", "*")]),
71 if __name__
== "__main__":