1995-01-30 07:53:55 -04:00
|
|
|
# Scan Resources.h header file, generate resgen.py and Resources.py files.
|
|
|
|
# Then run ressupport to generate Resmodule.c.
|
|
|
|
# (Should learn how to tell the compiler to compile it as well.)
|
|
|
|
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import string
|
|
|
|
import MacOS
|
1998-04-17 11:07:56 -03:00
|
|
|
|
|
|
|
BGENDIR=os.path.join(sys.prefix, ':Tools:bgen:bgen')
|
|
|
|
sys.path.append(BGENDIR)
|
1996-04-12 13:29:23 -03:00
|
|
|
from bgenlocations import TOOLBOXDIR
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
from scantools import Scanner
|
|
|
|
|
|
|
|
def main():
|
|
|
|
input = "Resources.h"
|
|
|
|
output = "resgen.py"
|
1996-04-12 13:29:23 -03:00
|
|
|
defsoutput = TOOLBOXDIR + "Resources.py"
|
1995-01-30 07:53:55 -04:00
|
|
|
scanner = ResourcesScanner(input, output, defsoutput)
|
|
|
|
scanner.scan()
|
|
|
|
scanner.close()
|
|
|
|
print "=== Done scanning and generating, now doing 'import ressupport' ==="
|
|
|
|
import ressupport
|
|
|
|
print "=== Done 'import ressupport'. It's up to you to compile Resmodule.c ==="
|
|
|
|
|
|
|
|
class ResourcesScanner(Scanner):
|
|
|
|
|
|
|
|
def destination(self, type, name, arglist):
|
|
|
|
classname = "ResFunction"
|
|
|
|
listname = "functions"
|
|
|
|
if arglist:
|
|
|
|
t, n, m = arglist[0]
|
|
|
|
if t == "Handle" and m == "InMode":
|
|
|
|
classname = "ResMethod"
|
|
|
|
listname = "resmethods"
|
|
|
|
return classname, listname
|
|
|
|
|
|
|
|
def makeblacklistnames(self):
|
|
|
|
return [
|
|
|
|
"ReadPartialResource",
|
|
|
|
"WritePartialResource",
|
1995-06-09 17:56:31 -03:00
|
|
|
"TempInsertROMMap",
|
1995-03-10 10:42:57 -04:00
|
|
|
## "RmveResource", # RemoveResource
|
|
|
|
## "SizeResource", # GetResourceSizeOnDisk
|
|
|
|
## "MaxSizeRsrc", # GetMaxResourceSize
|
1995-01-30 07:53:55 -04:00
|
|
|
]
|
2000-06-02 18:35:07 -03:00
|
|
|
|
2001-12-18 11:39:38 -04:00
|
|
|
def makeblacklisttypes(self):
|
|
|
|
return [
|
|
|
|
"UniCharCount", #TBD
|
|
|
|
]
|
|
|
|
|
2000-06-02 18:35:07 -03:00
|
|
|
def makegreylist(self):
|
|
|
|
return [
|
2001-05-22 18:56:42 -03:00
|
|
|
('#if TARGET_API_MAC_OS8', [
|
2000-06-02 18:35:07 -03:00
|
|
|
'RGetResource',
|
|
|
|
'OpenResFile',
|
|
|
|
'CreateResFile',
|
|
|
|
'RsrcZoneInit',
|
|
|
|
'InitResources',
|
|
|
|
'RsrcMapEntry',
|
2000-12-12 18:10:21 -04:00
|
|
|
]),
|
|
|
|
('#if TARGET_API_MAC_CARBON', [
|
|
|
|
'GetNextResourceFile',
|
|
|
|
'GetTopResourceFile',
|
|
|
|
'FSpOpenOrphanResFile',
|
|
|
|
'DetachResourceFile',
|
|
|
|
'InsertResourceFile',
|
2001-03-02 12:32:03 -04:00
|
|
|
'FSpResourceFileAlreadyOpen',
|
2000-06-02 18:35:07 -03:00
|
|
|
])]
|
1995-01-30 07:53:55 -04:00
|
|
|
|
|
|
|
def makerepairinstructions(self):
|
|
|
|
return [
|
|
|
|
([("Str255", "*", "InMode")],
|
|
|
|
[("*", "*", "OutMode")]),
|
|
|
|
|
|
|
|
([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
|
|
|
|
[("InBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
([("void", "*", "OutMode"), ("long", "*", "InMode")],
|
|
|
|
[("InOutBuffer", "*", "*")]),
|
|
|
|
|
|
|
|
([("void", "*", "OutMode"), ("long", "*", "InMode"),
|
|
|
|
("long", "*", "OutMode")],
|
|
|
|
[("OutBuffer", "*", "InOutMode")]),
|
1995-06-06 10:08:40 -03:00
|
|
|
|
|
|
|
([("SInt8", "*", "*")],
|
|
|
|
[("SignedByte", "*", "*")])
|
1995-01-30 07:53:55 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|