blob: f52b7716b0dc48298182247de0101c967144ee29 [file] [log] [blame]
Jack Jansend59f8d02002-08-22 23:31:37 +00001# Scan an Apple header file, generating a Python file of generator calls.
2
3import sys
4import os
5from bgenlocations import TOOLBOXDIR, BGENDIR
6sys.path.append(BGENDIR)
7from scantools import Scanner_OSX
8
9LONG = "AppleHelp"
10SHORT = "ah"
11OBJECT = "NOTUSED"
12
13def main():
Tim Peters182b5ac2004-07-18 06:16:08 +000014 input = LONG + ".h"
15 output = SHORT + "gen.py"
16 defsoutput = TOOLBOXDIR + LONG + ".py"
17 scanner = MyScanner(input, output, defsoutput)
18 scanner.scan()
19 scanner.close()
Collin Wintere7bf59f2007-08-30 18:39:28 +000020 print("=== Testing definitions output code ===")
Neal Norwitz01688022007-08-12 00:43:29 +000021 exec(open(defsoutput).read(), {}, {})
Collin Wintere7bf59f2007-08-30 18:39:28 +000022 print("=== Done scanning and generating, now importing the generated code... ===")
Tim Peters182b5ac2004-07-18 06:16:08 +000023 exec "import " + SHORT + "support"
Collin Wintere7bf59f2007-08-30 18:39:28 +000024 print("=== Done. It's up to you to compile it now! ===")
Jack Jansend59f8d02002-08-22 23:31:37 +000025
26class MyScanner(Scanner_OSX):
27
Tim Peters182b5ac2004-07-18 06:16:08 +000028 def destination(self, type, name, arglist):
29 classname = "Function"
30 listname = "functions"
31 if arglist:
32 t, n, m = arglist[0]
33 # This is non-functional today
34 if t == OBJECT and m == "InMode":
35 classname = "Method"
36 listname = "methods"
37 return classname, listname
Jack Jansend59f8d02002-08-22 23:31:37 +000038
Tim Peters182b5ac2004-07-18 06:16:08 +000039 def makeblacklistnames(self):
40 return [
41 ]
Jack Jansend59f8d02002-08-22 23:31:37 +000042
Tim Peters182b5ac2004-07-18 06:16:08 +000043 def makeblacklisttypes(self):
44 return [
45 ]
Jack Jansend59f8d02002-08-22 23:31:37 +000046
Tim Peters182b5ac2004-07-18 06:16:08 +000047 def makerepairinstructions(self):
48 return [
49 ]
50
Jack Jansend59f8d02002-08-22 23:31:37 +000051if __name__ == "__main__":
Tim Peters182b5ac2004-07-18 06:16:08 +000052 main()