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.)
10 from bgenlocations
import TOOLBOXDIR
, BGENDIR
11 sys
.path
.append(BGENDIR
)
13 from scantools
import Scanner
18 defsoutput
= TOOLBOXDIR
+ "Resources.py"
19 scanner
= ResourcesScanner(input, output
, defsoutput
)
22 print "=== Testing definitions output code ==="
23 execfile(defsoutput
, {}, {})
24 print "=== Done scanning and generating, now doing 'import ressupport' ==="
26 print "=== Done 'import ressupport'. It's up to you to compile Resmodule.c ==="
28 class ResourcesScanner(Scanner
):
30 def destination(self
, type, name
, arglist
):
31 classname
= "ResFunction"
32 listname
= "functions"
35 if t
== "Handle" and m
== "InMode":
36 classname
= "ResMethod"
37 listname
= "resmethods"
38 return classname
, listname
40 def makeblacklistnames(self
):
42 "ReadPartialResource",
43 "WritePartialResource",
45 ## "RmveResource", # RemoveResource
46 ## "SizeResource", # GetResourceSizeOnDisk
47 ## "MaxSizeRsrc", # GetMaxResourceSize
57 def makeblacklisttypes(self
):
61 def makerepairinstructions(self
):
63 ([("Str255", "*", "InMode")],
64 [("*", "*", "OutMode")]),
66 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
67 [("InBuffer", "*", "*")]),
69 ([("void", "*", "OutMode"), ("long", "*", "InMode")],
70 [("InOutBuffer", "*", "*")]),
72 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
73 ("long", "*", "OutMode")],
74 [("OutBuffer", "*", "InOutMode")]),
76 ([("SInt8", "*", "*")],
77 [("SignedByte", "*", "*")]),
80 ([("UniCharCount", "*", "InMode"), ("UniChar_ptr", "*", "InMode")],
81 [("UnicodeReverseInBuffer", "*", "*")]),
84 if __name__
== "__main__":