1 # Scan <Menus.h>, generating menugen.py.
3 from bgenlocations
import TOOLBOXDIR
, BGENDIR
4 sys
.path
.append(BGENDIR
)
6 from scantools
import Scanner
11 defsoutput
= TOOLBOXDIR
+ "Menus.py"
12 scanner
= MyScanner(input, output
, defsoutput
)
15 print "=== Testing definitions output code ==="
16 execfile(defsoutput
, {}, {})
17 print "=== Done scanning and generating, now doing 'import menusupport' ==="
19 print "=== Done. It's up to you to compile Menumodule.c ==="
21 class MyScanner(Scanner
):
23 def destination(self
, type, name
, arglist
):
24 classname
= "Function"
25 listname
= "functions"
28 if t
in ("MenuHandle", "MenuRef") and m
== "InMode":
31 return classname
, listname
33 def makeblacklistnames(self
):
35 ## "IsShowContextualMenuClick", # Can't find it in the library
36 ## "InitContextualMenus", # ditto
37 "GetMenuItemProperty", # difficult for the moment
38 "GetMenuItemPropertySize",
39 "SetMenuItemProperty",
40 "RemoveMenuItemProperty",
41 "SetMenuCommandProperty",
42 "GetMenuCommandProperty",
43 "GetMenuTitle", # Funny arg/returnvalue
45 "SetMenuTitleIcon", # void*
61 def makeblacklisttypes(self
):
66 'AEDesc_ptr', # For now: doable, but not easy
67 'ProcessSerialNumber', # ditto
68 "MenuDefSpecPtr", # Too difficult for now
69 "MenuDefSpec_ptr", # ditto
71 "void_ptr", # Don't know yet.
72 "EventRef", # For now, not exported yet.
73 "MenuItemDataPtr", # Not yet.
74 "MenuItemDataRec_ptr",
77 def makerepairinstructions(self
):
79 ([("Str255", "itemString", "InMode")],
80 [("*", "*", "OutMode")]),
82 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
83 [("InBuffer", "*", "*")]),
85 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
86 ("long", "*", "OutMode")],
87 [("VarVarOutBuffer", "*", "InOutMode")]),
88 ([("MenuRef", 'outHierMenu', "OutMode")],
89 [("OptMenuRef", 'outHierMenu', "OutMode")]),
92 def writeinitialdefs(self
):
93 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
95 if __name__
== "__main__":