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.)
8 from bgenlocations
import TOOLBOXDIR
, BGENDIR
9 sys
.path
.append(BGENDIR
)
11 from scantools
import Scanner
16 defsoutput
= TOOLBOXDIR
+ "Resources.py"
17 scanner
= ResourcesScanner(input, output
, defsoutput
)
20 print "=== Testing definitions output code ==="
21 execfile(defsoutput
, {}, {})
22 print "=== Done scanning and generating, now doing 'import ressupport' ==="
24 print "=== Done 'import ressupport'. It's up to you to compile Resmodule.c ==="
26 class ResourcesScanner(Scanner
):
28 def destination(self
, type, name
, arglist
):
29 classname
= "ResFunction"
30 listname
= "functions"
33 if t
== "Handle" and m
== "InMode":
34 classname
= "ResMethod"
35 listname
= "resmethods"
36 return classname
, listname
38 def makeblacklistnames(self
):
40 "ReadPartialResource",
41 "WritePartialResource",
43 ## "RmveResource", # RemoveResource
44 ## "SizeResource", # GetResourceSizeOnDisk
45 ## "MaxSizeRsrc", # GetMaxResourceSize
55 def makeblacklisttypes(self
):
59 def makerepairinstructions(self
):
61 ([("Str255", "*", "InMode")],
62 [("*", "*", "OutMode")]),
64 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
65 [("InBuffer", "*", "*")]),
67 ([("void", "*", "OutMode"), ("long", "*", "InMode")],
68 [("InOutBuffer", "*", "*")]),
70 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
71 ("long", "*", "OutMode")],
72 [("OutBuffer", "*", "InOutMode")]),
74 ([("SInt8", "*", "*")],
75 [("SignedByte", "*", "*")]),
78 ([("UniCharCount", "*", "InMode"), ("UniChar_ptr", "*", "InMode")],
79 [("UnicodeReverseInBuffer", "*", "*")]),
82 if __name__
== "__main__":