diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-07-18 06:16:08 (GMT) |
commit | 182b5aca27d376b08a2904bed42b751496f932f3 (patch) | |
tree | df13115820dbc879c0fe2eae488c9f8c0215a7da /Mac/Modules/menu | |
parent | e6ddc8b20b493fef2e7cffb2e1351fe1d238857e (diff) | |
download | cpython-182b5aca27d376b08a2904bed42b751496f932f3.zip cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.gz cpython-182b5aca27d376b08a2904bed42b751496f932f3.tar.bz2 |
Whitespace normalization, via reindent.py.
Diffstat (limited to 'Mac/Modules/menu')
-rw-r--r-- | Mac/Modules/menu/menuedit.py | 1 | ||||
-rw-r--r-- | Mac/Modules/menu/menuscan.py | 158 | ||||
-rw-r--r-- | Mac/Modules/menu/menusupport.py | 42 |
3 files changed, 100 insertions, 101 deletions
diff --git a/Mac/Modules/menu/menuedit.py b/Mac/Modules/menu/menuedit.py index f613d8b..b74301d 100644 --- a/Mac/Modules/menu/menuedit.py +++ b/Mac/Modules/menu/menuedit.py @@ -121,4 +121,3 @@ f = Function(OSStatus, 'RemoveMenuCommandProperty', (OSType, 'inPropertyTag', InMode), ) functions.append(f) - diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py index 281cc86..ae9465e 100644 --- a/Mac/Modules/menu/menuscan.py +++ b/Mac/Modules/menu/menuscan.py @@ -7,91 +7,91 @@ sys.path.append(BGENDIR) from scantools import Scanner def main(): - input = "Menus.h" - output = "menugen.py" - defsoutput = TOOLBOXDIR + "Menus.py" - scanner = MyScanner(input, output, defsoutput) - scanner.scan() - scanner.close() - print "=== Testing definitions output code ===" - execfile(defsoutput, {}, {}) - print "=== Done scanning and generating, now doing 'import menusupport' ===" - import menusupport - print "=== Done. It's up to you to compile Menumodule.c ===" + input = "Menus.h" + output = "menugen.py" + defsoutput = TOOLBOXDIR + "Menus.py" + scanner = MyScanner(input, output, defsoutput) + scanner.scan() + scanner.close() + print "=== Testing definitions output code ===" + execfile(defsoutput, {}, {}) + print "=== Done scanning and generating, now doing 'import menusupport' ===" + import menusupport + print "=== Done. It's up to you to compile Menumodule.c ===" class MyScanner(Scanner): - def destination(self, type, name, arglist): - classname = "Function" - listname = "functions" - if arglist: - t, n, m = arglist[0] - if t in ("MenuHandle", "MenuRef") and m == "InMode": - classname = "Method" - listname = "methods" - return classname, listname + def destination(self, type, name, arglist): + classname = "Function" + listname = "functions" + if arglist: + t, n, m = arglist[0] + if t in ("MenuHandle", "MenuRef") and m == "InMode": + classname = "Method" + listname = "methods" + return classname, listname - def makeblacklistnames(self): - return [ -## "IsShowContextualMenuClick", # Can't find it in the library -## "InitContextualMenus", # ditto - "GetMenuItemProperty", # difficult for the moment - "GetMenuItemPropertySize", - "SetMenuItemProperty", - "RemoveMenuItemProperty", - "SetMenuCommandProperty", - "GetMenuCommandProperty", - "GetMenuTitle", # Funny arg/returnvalue - "SetMenuTitle", - "SetMenuTitleIcon", # void* - # OS8 calls: - 'GetMenuItemRefCon2', - 'SetMenuItemRefCon2', - 'EnableItem', - 'DisableItem', - 'CheckItem', - 'CountMItems', - 'OpenDeskAcc', - 'SystemEdit', - 'SystemMenu', - 'SetMenuFlash', - 'InitMenus', - 'InitProcMenu', - ] + def makeblacklistnames(self): + return [ +## "IsShowContextualMenuClick", # Can't find it in the library +## "InitContextualMenus", # ditto + "GetMenuItemProperty", # difficult for the moment + "GetMenuItemPropertySize", + "SetMenuItemProperty", + "RemoveMenuItemProperty", + "SetMenuCommandProperty", + "GetMenuCommandProperty", + "GetMenuTitle", # Funny arg/returnvalue + "SetMenuTitle", + "SetMenuTitleIcon", # void* + # OS8 calls: + 'GetMenuItemRefCon2', + 'SetMenuItemRefCon2', + 'EnableItem', + 'DisableItem', + 'CheckItem', + 'CountMItems', + 'OpenDeskAcc', + 'SystemEdit', + 'SystemMenu', + 'SetMenuFlash', + 'InitMenus', + 'InitProcMenu', + ] - def makeblacklisttypes(self): - return [ - 'MCTableHandle', - 'MCEntryPtr', - 'MCTablePtr', - 'AEDesc_ptr', # For now: doable, but not easy - 'ProcessSerialNumber', # ditto - "MenuDefSpecPtr", # Too difficult for now - "MenuDefSpec_ptr", # ditto - "MenuTrackingData", - "void_ptr", # Don't know yet. - "EventRef", # For now, not exported yet. - "MenuItemDataPtr", # Not yet. - "MenuItemDataRec_ptr", - ] + def makeblacklisttypes(self): + return [ + 'MCTableHandle', + 'MCEntryPtr', + 'MCTablePtr', + 'AEDesc_ptr', # For now: doable, but not easy + 'ProcessSerialNumber', # ditto + "MenuDefSpecPtr", # Too difficult for now + "MenuDefSpec_ptr", # ditto + "MenuTrackingData", + "void_ptr", # Don't know yet. + "EventRef", # For now, not exported yet. + "MenuItemDataPtr", # Not yet. + "MenuItemDataRec_ptr", + ] - def makerepairinstructions(self): - return [ - ([("Str255", "itemString", "InMode")], - [("*", "*", "OutMode")]), - - ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")], - [("InBuffer", "*", "*")]), - - ([("void", "*", "OutMode"), ("long", "*", "InMode"), - ("long", "*", "OutMode")], - [("VarVarOutBuffer", "*", "InOutMode")]), - ([("MenuRef", 'outHierMenu', "OutMode")], - [("OptMenuRef", 'outHierMenu', "OutMode")]), - ] + def makerepairinstructions(self): + return [ + ([("Str255", "itemString", "InMode")], + [("*", "*", "OutMode")]), - def writeinitialdefs(self): - self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") + ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")], + [("InBuffer", "*", "*")]), + + ([("void", "*", "OutMode"), ("long", "*", "InMode"), + ("long", "*", "OutMode")], + [("VarVarOutBuffer", "*", "InOutMode")]), + ([("MenuRef", 'outHierMenu', "OutMode")], + [("OptMenuRef", 'outHierMenu', "OutMode")]), + ] + + def writeinitialdefs(self): + self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") if __name__ == "__main__": - main() + main() diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py index 7c4ae0d..a04b755 100644 --- a/Mac/Modules/menu/menusupport.py +++ b/Mac/Modules/menu/menusupport.py @@ -6,17 +6,17 @@ import string # Declarations that change for each manager -MACHEADERFILE = 'Menus.h' # The Apple header file -MODNAME = '_Menu' # The name of the module -OBJECTNAME = 'Menu' # The basic name of the objects used here +MACHEADERFILE = 'Menus.h' # The Apple header file +MODNAME = '_Menu' # The name of the module +OBJECTNAME = 'Menu' # The basic name of the objects used here # The following is *usually* unchanged but may still require tuning -MODPREFIX = 'Menu' # The prefix for module-wide routines -OBJECTTYPE = OBJECTNAME + 'Handle' # The C type used to represent them -OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods +MODPREFIX = 'Menu' # The prefix for module-wide routines +OBJECTTYPE = OBJECTNAME + 'Handle' # The C type used to represent them +OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner EXTRAFILE = string.lower(MODPREFIX) + 'edit.py' # A similar file but hand-made -OUTPUTFILE = MODNAME + "module.c" # The file generated by this program +OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * @@ -48,7 +48,7 @@ extern PyObject *_MenuObj_New(MenuHandle); extern int _MenuObj_Convert(PyObject *, MenuHandle *); #define MenuObj_New _MenuObj_New -#define MenuObj_Convert _MenuObj_Convert +#define MenuObj_Convert _MenuObj_Convert #endif #define as_Menu(h) ((MenuHandle)h) @@ -58,31 +58,31 @@ extern int _MenuObj_Convert(PyObject *, MenuHandle *); /* Alternative version of MenuObj_New, which returns None for NULL argument */ PyObject *OptMenuObj_New(MenuRef itself) { - if (itself == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return MenuObj_New(itself); + if (itself == NULL) { + Py_INCREF(Py_None); + return Py_None; + } + return MenuObj_New(itself); } /* Alternative version of MenuObj_Convert, which returns NULL for a None argument */ int OptMenuObj_Convert(PyObject *v, MenuRef *p_itself) { - if ( v == Py_None ) { - *p_itself = NULL; - return 1; - } - return MenuObj_Convert(v, p_itself); + if ( v == Py_None ) { + *p_itself = NULL; + return 1; + } + return MenuObj_Convert(v, p_itself); } """ initstuff = initstuff + """ - PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); """ class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition): - pass + pass # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) |