blob: ae31c377500ef26501cc6b9765b0fe40fc167ead [file] [log] [blame]
Jack Jansenebd01062000-05-14 22:05:36 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import sys
4import os
5BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6sys.path.append(BGENDIR)
7
8from scantools import Scanner
9from bgenlocations import TOOLBOXDIR
10
11LONG = "HtmlRendering"
12SHORT = "html"
13OBJECT = "HRReference"
14
15def main():
16## input = LONG + ".h"
17 input = "Macintosh HD:SWdev:Jack:Universal:Interfaces:CIncludes:HTMLRendering.h"
18 output = SHORT + "gen.py"
19 defsoutput = TOOLBOXDIR + LONG + ".py"
20 scanner = MyScanner(input, output, defsoutput)
21 scanner.scan()
22 scanner.close()
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! ==="
26
27class MyScanner(Scanner):
28
29 def destination(self, type, name, arglist):
30 classname = "Function"
31 listname = "functions"
32 if arglist:
33 t, n, m = arglist[0]
34 if t == OBJECT and m == "InMode":
35 classname = "Method"
36 listname = "methods"
37 return classname, listname
38
39 def makeblacklistnames(self):
40 return [
41 ]
42
43 def makeblacklisttypes(self):
44 return [
45 "HRNewURLUPP",
46 "HRURLToFSSpecUPP",
47 "HRWasURLVisitedUPP",
48 ]
49
50 def makerepairinstructions(self):
51 return [
52 ([('char', '*', 'OutMode'), ('UInt32', '*', 'InMode')],
53 [('InBuffer', '*', 'InMode')]),
54 ]
55
56 def writeinitialdefs(self):
57 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
58
59
60if __name__ == "__main__":
61 main()