blob: 08a6a04b766b1ad49cb80789cfe70866ce393aed [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001# Scan <Menus.h>, generating menugen.py.
Jack Jansenb81cf9d1995-06-06 13:08:40 +00002import addpack
3addpack.addpack(':Tools:bgen:bgen')
Guido van Rossum17448e21995-01-30 11:53:55 +00004
5from scantools import Scanner
6
7def main():
8 input = "Menus.h"
9 output = "menugen.py"
10 defsoutput = "Menus.py"
11 scanner = MyScanner(input, output, defsoutput)
12 scanner.scan()
13 scanner.close()
14 print "=== Done scanning and generating, now doing 'import menusupport' ==="
15 import menusupport
16 print "=== Done. It's up to you to compile Menumodule.c ==="
17
18class MyScanner(Scanner):
19
20 def destination(self, type, name, arglist):
21 classname = "Function"
22 listname = "functions"
23 if arglist:
24 t, n, m = arglist[0]
Jack Jansenb81cf9d1995-06-06 13:08:40 +000025 if t in ("MenuHandle", "MenuRef") and m == "InMode":
Guido van Rossum17448e21995-01-30 11:53:55 +000026 classname = "Method"
27 listname = "methods"
28 return classname, listname
29
30 def makeblacklistnames(self):
31 return [
32 ]
33
34 def makeblacklisttypes(self):
35 return [
36 'MCTableHandle',
37 'MCEntryPtr',
38 'MCTablePtr',
39 ]
40
41 def makerepairinstructions(self):
42 return [
43 ([("Str255", "itemString", "InMode")],
44 [("*", "*", "OutMode")]),
45
46 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
47 [("InBuffer", "*", "*")]),
48
49 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
50 ("long", "*", "OutMode")],
51 [("VarVarOutBuffer", "*", "InOutMode")]),
52 ]
53
54if __name__ == "__main__":
55 main()