1 # Scan an Apple header file, generating a Python file of generator calls.
5 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
6 sys
.path
.append(BGENDIR
)
8 from scantools
import Scanner
9 from bgenlocations
import TOOLBOXDIR
11 LONG
= "HtmlRendering"
13 OBJECT
= "HRReference"
16 ## input = LONG + ".h"
17 input = "Macintosh HD:ufs:jack:SWdev:Universal:Interfaces:CIncludes:HTMLRendering.h"
18 output
= SHORT
+ "gen.py"
19 defsoutput
= TOOLBOXDIR
+ LONG
+ ".py"
20 scanner
= MyScanner(input, output
, defsoutput
)
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 if t
== OBJECT
and m
== "InMode":
37 return classname
, listname
39 def makeblacklistnames(self
):
44 def makeblacklisttypes(self
):
51 def makerepairinstructions(self
):
53 ([('char', '*', 'OutMode'), ('UInt32', '*', 'InMode')],
54 [('InBuffer', '*', 'InMode')]),
57 def writeinitialdefs(self
):
58 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
61 if __name__
== "__main__":