Added support for the Carbon scrap manager (finally).

This commit is contained in:
Jack Jansen 2001-12-31 14:52:03 +00:00
parent 7633593683
commit 420ed40344
3 changed files with 315 additions and 76 deletions

View file

@ -11,15 +11,19 @@ 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
# 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
INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner
OUTPUTFILE = '@' + MODNAME + "module.c" # The file generated by this program
from macsupport import *
# Create the type objects
ScrapRef = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX)
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS
@ -44,21 +48,31 @@ SCRRec_New(itself)
ScrapStuffPtr = OpaqueByValueType('ScrapStuffPtr', 'SCRRec')
ScrapFlavorType = OSTypeType('ScrapFlavorType')
ScrapFlavorFlags = Type('ScrapFlavorFlags', 'l')
#ScrapFlavorInfo = OpaqueType('ScrapFlavorInfo', 'ScrapFlavorInfo')
putscrapbuffer = FixedInputBufferType('void *')
class MyObjectDefinition(GlobalObjectDefinition):
pass
# Create the generator groups and link them
module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
module.addobject(object)
# Create the generator classes used to populate the lists
Function = OSErrFunctionGenerator
Method = OSErrMethodGenerator
# Create and populate the lists
functions = []
methods = []
execfile(INPUTFILE)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for f in functions: module.add(f)
for f in methods: object.add(f)
# generate output (open the output file as late as possible)
SetOutputFileName(OUTPUTFILE)