1 # Scan an Apple header file, generating a Python file of generator calls.
4 addpack
.addpack(':tools:bgen:bgen')
5 from scantools
import Scanner
6 from bgenlocations
import TOOLBOXDIR
8 WASTEDIR
=":::::Waste 1.2 distribution:"
12 OBJECT
= "WEReference"
13 OBJECT2
= "WEObjectReference"
16 input = WASTEDIR
+ "WASTE C/C++ Headers:WASTE.h"
17 output
= SHORT
+ "gen.py"
18 defsoutput
= TOOLBOXDIR
+ "WASTEconst.py"
19 scanner
= MyScanner(input, output
, defsoutput
)
21 ## scanner.gentypetest(SHORT+"typetest.py")
23 print "=== Done scanning and generating, now importing the generated code... ==="
24 exec "import " + SHORT
+ "support"
25 print "=== Done. It's up to you to compile it now! ==="
27 class MyScanner(Scanner
):
29 def destination(self
, type, name
, arglist
):
30 classname
= "Function"
31 listname
= "functions"
34 # This is non-functional today
35 if t
== OBJECT
and m
== "InMode":
40 if t
== OBJECT2
and m
== "InMode":
43 return classname
, listname
45 def makeblacklistnames(self
):
48 "WESetInfo", # Argument type unknown...
50 "WEVersion", # Unfortunately...
53 def makeblacklisttypes(self
):
55 "DragReference", # For now...
59 def makerepairinstructions(self
):
61 ([("void_ptr", "*", "InMode"), ("SInt32", "*", "InMode")],
62 [("InBuffer", "*", "*")]),
65 ([("WEStyleMode", "mode", "OutMode"), ("TextStyle", "ts", "OutMode")],
66 [("WEStyleMode", "mode", "InOutMode"), ("TextStyle", "ts", "OutMode")]),
69 ([('Handle', 'hText', 'InMode'), ('StScrpHandle', 'hStyles', 'InMode'),
70 ('WESoupHandle', 'hSoup', 'InMode')],
71 [('OptHandle', 'hText', 'InMode'), ('OptStScrpHandle', 'hStyles', 'InMode'),
72 ('OptSoupHandle', 'hSoup', 'InMode')]),
75 ([('StScrpHandle', 'hStyles', 'InMode'), ('WESoupHandle', 'hSoup', 'InMode')],
76 [('OptStScrpHandle', 'hStyles', 'InMode'), ('OptSoupHandle', 'hSoup', 'InMode')]),
80 [('WEReference', '*', 'ReturnMode')],
81 [('ExistingWEReference', '*', 'ReturnMode')])
85 if __name__
== "__main__":