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