blob: ff2de327e356e7091dea496033ab162de0d46c9a [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
Jack Jansenaaebdd62002-08-05 15:39:30 +00005from bgenlocations import TOOLBOXDIR, BGENDIR
Jack Jansenebd01062000-05-14 22:05:36 +00006sys.path.append(BGENDIR)
7
8from scantools import Scanner
Jack Jansenebd01062000-05-14 22:05:36 +00009
10LONG = "HtmlRendering"
11SHORT = "html"
12OBJECT = "HRReference"
13
14def main():
15## input = LONG + ".h"
Jack Jansend9c01a52000-05-15 15:36:52 +000016 input = "Macintosh HD:ufs:jack:SWdev:Universal:Interfaces:CIncludes:HTMLRendering.h"
Jack Jansenebd01062000-05-14 22:05:36 +000017 output = SHORT + "gen.py"
18 defsoutput = TOOLBOXDIR + LONG + ".py"
19 scanner = MyScanner(input, output, defsoutput)
20 scanner.scan()
21 scanner.close()
22 print "=== Done scanning and generating, now importing the generated code... ==="
23 exec "import " + SHORT + "support"
24 print "=== Done. It's up to you to compile it now! ==="
25
26class MyScanner(Scanner):
27
28 def destination(self, type, name, arglist):
29 classname = "Function"
30 listname = "functions"
31 if arglist:
32 t, n, m = arglist[0]
33 if t == OBJECT and m == "InMode":
34 classname = "Method"
35 listname = "methods"
36 return classname, listname
37
38 def makeblacklistnames(self):
39 return [
Jack Jansend9c01a52000-05-15 15:36:52 +000040 "HRDisposeReference",
Jack Jansenebd01062000-05-14 22:05:36 +000041 ]
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()