diff options
Diffstat (limited to 'Mac/Modules/scrap')
-rw-r--r-- | Mac/Modules/scrap/scrapscan.py | 84 | ||||
-rw-r--r-- | Mac/Modules/scrap/scrapsupport.py | 25 |
2 files changed, 54 insertions, 55 deletions
diff --git a/Mac/Modules/scrap/scrapscan.py b/Mac/Modules/scrap/scrapscan.py index 0b173a4c88..1fc8191265 100644 --- a/Mac/Modules/scrap/scrapscan.py +++ b/Mac/Modules/scrap/scrapscan.py @@ -13,49 +13,49 @@ LONG = "Scrap" SHORT = "scrap" def main(): - input = "Scrap.h" - output = SHORT + "gen.py" - defsoutput = "@Scrap.py" - scanner = MyScanner(input, output, defsoutput) - scanner.scan() - scanner.close() -## print "=== Testing definitions output code ===" -## execfile(defsoutput, {}, {}) - print "=== Done scanning and generating, now importing the generated code... ===" - exec "import " + SHORT + "support" - print "=== Done. It's up to you to compile it now! ===" + input = "Scrap.h" + output = SHORT + "gen.py" + defsoutput = "@Scrap.py" + scanner = MyScanner(input, output, defsoutput) + scanner.scan() + scanner.close() +## print "=== Testing definitions output code ===" +## execfile(defsoutput, {}, {}) + print "=== Done scanning and generating, now importing the generated code... ===" + exec "import " + SHORT + "support" + print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner): - def destination(self, type, name, arglist): - classname = "Function" - listname = "functions" - if arglist: - t, n, m = arglist[0] - if t == 'ScrapRef' and m == "InMode": - classname = "Method" - listname = "methods" - return classname, listname - - def makeblacklistnames(self): - return [ - "GetScrapFlavorInfoList", - 'InfoScrap', - 'GetScrap', - 'ZeroScrap', - 'PutScrap', - ] - - def makeblacklisttypes(self): - return [ - 'ScrapPromiseKeeperUPP', - ] - - def makerepairinstructions(self): - return [ - ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]), - ([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]), - ] - + def destination(self, type, name, arglist): + classname = "Function" + listname = "functions" + if arglist: + t, n, m = arglist[0] + if t == 'ScrapRef' and m == "InMode": + classname = "Method" + listname = "methods" + return classname, listname + + def makeblacklistnames(self): + return [ + "GetScrapFlavorInfoList", + 'InfoScrap', + 'GetScrap', + 'ZeroScrap', + 'PutScrap', + ] + + def makeblacklisttypes(self): + return [ + 'ScrapPromiseKeeperUPP', + ] + + def makerepairinstructions(self): + return [ + ([('void', '*', 'OutMode')], [('putscrapbuffer', '*', 'InMode')]), + ([('void_ptr', '*', 'InMode')], [('putscrapbuffer', '*', 'InMode')]), + ] + if __name__ == "__main__": - main() + main() diff --git a/Mac/Modules/scrap/scrapsupport.py b/Mac/Modules/scrap/scrapsupport.py index 634a43988f..84a75d22a7 100644 --- a/Mac/Modules/scrap/scrapsupport.py +++ b/Mac/Modules/scrap/scrapsupport.py @@ -9,16 +9,16 @@ import string # Declarations that change for each manager -MACHEADERFILE = 'Scrap.h' # The Apple header file -MODNAME = '_Scrap' # The name of the module -OBJECTNAME = 'Scrap' # The basic name of the objects used here +MACHEADERFILE = 'Scrap.h' # The Apple header file +MODNAME = '_Scrap' # The name of the module +OBJECTNAME = 'Scrap' # The basic name of the objects used here # The following is *usually* unchanged but may still require tuning -MODPREFIX = 'Scrap' # The prefix for module-wide routines -OBJECTTYPE = OBJECTNAME + 'Ref' # The C type used to represent them -OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods +MODPREFIX = 'Scrap' # The prefix for module-wide routines +OBJECTTYPE = OBJECTNAME + 'Ref' # 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 -OUTPUTFILE = '@' + MODNAME + "module.c" # The file generated by this program +OUTPUTFILE = '@' + MODNAME + "module.c" # The file generated by this program from macsupport import * @@ -33,12 +33,12 @@ includestuff = includestuff + """ */ static PyObject * SCRRec_New(itself) - ScrapStuff *itself; + ScrapStuff *itself; { - return Py_BuildValue("lO&hhO&", itself->scrapSize, - ResObj_New, itself->scrapHandle, itself->scrapCount, itself->scrapState, - PyMac_BuildStr255, itself->scrapName); + return Py_BuildValue("lO&hhO&", itself->scrapSize, + ResObj_New, itself->scrapHandle, itself->scrapCount, itself->scrapState, + PyMac_BuildStr255, itself->scrapName); } """ @@ -49,7 +49,7 @@ ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l') putscrapbuffer = FixedInputBufferType('void *') class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition): - pass + pass # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) @@ -73,4 +73,3 @@ for f in methods: object.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() - |