1 # Scan an Apple header file, generating a Python file of generator calls.
5 from bgenlocations
import TOOLBOXDIR
, BGENDIR
6 sys
.path
.append(BGENDIR
)
8 from scantools
import Scanner
10 LONG
= "HtmlRendering"
12 OBJECT
= "HRReference"
15 ## input = LONG + ".h"
16 input = "Macintosh HD:ufs:jack:SWdev:Universal:Interfaces:CIncludes:HTMLRendering.h"
17 output
= SHORT
+ "gen.py"
18 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
19 scanner
= MyScanner(input, output
, defsoutput
)
22 print "=== Testing definitions output code ==="
23 execfile(defsoutput
, {}, {})
24 print "=== Done scanning and generating, now importing the generated code... ==="
25 exec "import " + SHORT
+ "support"
26 print "=== Done. It's up to you to compile it now! ==="
28 class MyScanner(Scanner
):
30 def destination(self
, type, name
, arglist
):
31 classname
= "Function"
32 listname
= "functions"
35 if t
== OBJECT
and m
== "InMode":
38 return classname
, listname
40 def makeblacklistnames(self
):
45 def makeblacklisttypes(self
):
52 def makerepairinstructions(self
):
54 ([('char', '*', 'OutMode'), ('UInt32', '*', 'InMode')],
55 [('InBuffer', '*', 'InMode')]),
58 def writeinitialdefs(self
):
59 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
62 if __name__
== "__main__":