Commit 69561f2c authored by Jack Jansen's avatar Jack Jansen

Added support for the Carbon scrap manager (finally).

parent a5548e7c
This diff is collapsed.
......@@ -5,7 +5,10 @@
import sys
import os
BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
if os.sep == ':':
BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
else:
BGENDIR="../../../Tools/bgen/bgen"
sys.path.append(BGENDIR)
from scantools import Scanner
from bgenlocations import TOOLBOXDIR
......@@ -29,10 +32,16 @@ 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",
]
def makegreylist(self):
......@@ -50,7 +59,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
"ScrapRef", # For now -- This is the Carbon scrap main object
'ScrapPromiseKeeperUPP',
]
def makerepairinstructions(self):
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment