1 # Scan Resources.h header file, generate resgen.py and Resources.py files.
2 # Then run ressupport to generate Resmodule.c.
3 # (Should learn how to tell the compiler to compile it as well.)
12 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
13 sys
.path
.append(BGENDIR
)
14 from bgenlocations
import TOOLBOXDIR
16 from scantools
import Scanner
21 defsoutput
= TOOLBOXDIR
+ "Resources.py"
22 scanner
= ResourcesScanner(input, output
, defsoutput
)
25 print "=== Done scanning and generating, now doing 'import ressupport' ==="
27 print "=== Done 'import ressupport'. It's up to you to compile Resmodule.c ==="
29 class ResourcesScanner(Scanner
):
31 def destination(self
, type, name
, arglist
):
32 classname
= "ResFunction"
33 listname
= "functions"
36 if t
== "Handle" and m
== "InMode":
37 classname
= "ResMethod"
38 listname
= "resmethods"
39 return classname
, listname
41 def makeblacklistnames(self
):
43 "ReadPartialResource",
44 "WritePartialResource",
46 ## "RmveResource", # RemoveResource
47 ## "SizeResource", # GetResourceSizeOnDisk
48 ## "MaxSizeRsrc", # GetMaxResourceSize
51 def makerepairinstructions(self
):
53 ([("Str255", "*", "InMode")],
54 [("*", "*", "OutMode")]),
56 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
57 [("InBuffer", "*", "*")]),
59 ([("void", "*", "OutMode"), ("long", "*", "InMode")],
60 [("InOutBuffer", "*", "*")]),
62 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
63 ("long", "*", "OutMode")],
64 [("OutBuffer", "*", "InOutMode")]),
66 ([("SInt8", "*", "*")],
67 [("SignedByte", "*", "*")])
70 if __name__
== "__main__":