1 # Scan Sound.h header file, generate sndgen.py and Sound.py files.
2 # Then import sndsupport (which execs sndgen.py) to generate Sndmodule.c.
3 # (Should learn how to tell the compiler to compile it as well.)
6 addpack
.addpack(':Tools:bgen:bgen')
7 from bgenlocations
import TOOLBOXDIR
9 from scantools
import Scanner
14 defsoutput
= TOOLBOXDIR
+ "Sound.py"
15 scanner
= SoundScanner(input, output
, defsoutput
)
18 print "=== Done scanning and generating, now doing 'import sndsupport' ==="
20 print "=== Done. It's up to you to compile Sndmodule.c ==="
22 class SoundScanner(Scanner
):
24 def destination(self
, type, name
, arglist
):
25 classname
= "SndFunction"
26 listname
= "functions"
29 if t
== "SndChannelPtr" and m
== "InMode":
30 classname
= "SndMethod"
31 listname
= "sndmethods"
32 return classname
, listname
34 def writeinitialdefs(self
):
35 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
37 def makeblacklistnames(self
):
39 'SndDisposeChannel', # automatic on deallocation
40 'SndAddModifier', # for internal use only
41 'SndPlayDoubleBuffer', # very low level routine
46 # These do not work for cfm68k:
53 # And old calls that are no longer supported
59 def makeblacklisttypes(self
):
64 # Don't have the time to dig into this...
67 "SoundComponentDataPtr",
69 "SoundComponentData_ptr",
74 def makerepairinstructions(self
):
76 ([("Str255", "*", "InMode")],
77 [("*", "*", "OutMode")]),
79 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
80 [("InBuffer", "*", "*")]),
82 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
83 ("long", "*", "OutMode")],
84 [("VarVarOutBuffer", "*", "InOutMode")]),
86 ([("SCStatusPtr", "*", "InMode")],
87 [("SCStatus", "*", "OutMode")]),
89 ([("SMStatusPtr", "*", "InMode")],
90 [("SMStatus", "*", "OutMode")]),
92 ([("CompressionInfoPtr", "*", "InMode")],
93 [("CompressionInfo", "*", "OutMode")]),
95 # For SndPlay's SndListHandle argument
96 ([("Handle", "sndHdl", "InMode")],
97 [("SndListHandle", "*", "*")]),
99 # For SndStartFilePlay
100 ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
101 [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
104 ([("void_ptr", "inBuffer", "InMode"),
105 ("void", "outBuffer", "OutMode"),
106 ("unsigned_long", "cnt", "InMode")],
107 [("InOutBuffer", "buffer", "InOutMode")]),
110 ## ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
111 ## [("InOutBuf128", "state", "InOutMode")]),
112 ([("StateBlockPtr", "inState", "InMode"), ("StateBlockPtr", "outState", "InMode")],
113 [("StateBlock", "state", "InOutMode")]),
115 # Catch-all for the last couple of void pointers
116 ([("void", "*", "OutMode")],
117 [("void_ptr", "*", "InMode")]),
120 if __name__
== "__main__":