blob: 6932793c5326a2c4d7d66c207f30d4ec3f80a5db [file] [log] [blame]
Jack Jansenbf2f6021997-09-09 13:52:47 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
Jack Jansen0c4d9471998-04-17 14:07:56 +00003import sys
4import os
5BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
6sys.path.append(BGENDIR)
Jack Jansenbf2f6021997-09-09 13:52:47 +00007from scantools import Scanner
8from bgenlocations import TOOLBOXDIR
9
10LONG = "Balloons"
11SHORT = "help"
12OBJECT = "NOTUSED"
13
14def main():
15 input = LONG + ".h"
16 output = SHORT + "gen.py"
17 defsoutput = TOOLBOXDIR + LONG + ".py"
18 scanner = MyScanner(input, output, defsoutput)
19 scanner.scan()
20 scanner.close()
21 print "=== Done scanning and generating, now importing the generated code... ==="
22 exec "import " + SHORT + "support"
23 print "=== Done. It's up to you to compile it now! ==="
24
25class MyScanner(Scanner):
26
27 def destination(self, type, name, arglist):
28 classname = "Function"
29 listname = "functions"
30 if arglist:
31 t, n, m = arglist[0]
32 # This is non-functional today
33 if t == OBJECT and m == "InMode":
34 classname = "Method"
35 listname = "methods"
36 return classname, listname
37
Jack Jansen21f96871998-02-20 16:02:09 +000038 def writeinitialdefs(self):
39 self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
40
Jack Jansenbf2f6021997-09-09 13:52:47 +000041 def makeblacklistnames(self):
42 return [
43 ]
44
45 def makeblacklisttypes(self):
46 return [
47 "TipFunctionUPP",
48 "HMMessageRecord",
49 "HMMessageRecord_ptr",
50 ]
51
52 def makerepairinstructions(self):
53 return [
Jack Jansend8b382d2000-08-25 22:04:24 +000054 ([("WindowPtr", "*", "OutMode")],
55 [("ExistingWindowPtr", "*", "*")]),
Jack Jansenbf2f6021997-09-09 13:52:47 +000056 ]
57
58if __name__ == "__main__":
59 main()