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.)
7 BGENDIR
=os
.path
.join(sys
.prefix
, ':Tools:bgen:bgen')
8 sys
.path
.append(BGENDIR
)
9 from bgenlocations
import TOOLBOXDIR
11 from scantools
import Scanner
16 defsoutput
= TOOLBOXDIR
+ "Sound.py"
17 scanner
= SoundScanner(input, output
, defsoutput
)
20 print "=== Done scanning and generating, now doing 'import sndsupport' ==="
22 print "=== Done. It's up to you to compile Sndmodule.c ==="
24 class SoundScanner(Scanner
):
26 def destination(self
, type, name
, arglist
):
27 classname
= "SndFunction"
28 listname
= "functions"
31 if t
== "SndChannelPtr" and m
== "InMode":
32 classname
= "SndMethod"
33 listname
= "sndmethods"
34 return classname
, listname
36 def writeinitialdefs(self
):
37 self
.defsfile
.write("def FOUR_CHAR_CODE(x): return x\n")
39 def makeblacklistnames(self
):
41 'SndDisposeChannel', # automatic on deallocation
42 'SndAddModifier', # for internal use only
43 'SndPlayDoubleBuffer', # very low level routine
48 # These do not work for cfm68k:
55 # And old calls that are no longer supported
61 def makeblacklisttypes(self
):
66 # Don't have the time to dig into this...
69 "SoundComponentDataPtr",
71 "SoundComponentData_ptr",
76 def makerepairinstructions(self
):
78 ([("Str255", "*", "InMode")],
79 [("*", "*", "OutMode")]),
81 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
82 [("InBuffer", "*", "*")]),
84 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
85 ("long", "*", "OutMode")],
86 [("VarVarOutBuffer", "*", "InOutMode")]),
88 ([("SCStatusPtr", "*", "InMode")],
89 [("SCStatus", "*", "OutMode")]),
91 ([("SMStatusPtr", "*", "InMode")],
92 [("SMStatus", "*", "OutMode")]),
94 ([("CompressionInfoPtr", "*", "InMode")],
95 [("CompressionInfo", "*", "OutMode")]),
97 # For SndPlay's SndListHandle argument
98 ([("Handle", "sndHdl", "InMode")],
99 [("SndListHandle", "*", "*")]),
101 # For SndStartFilePlay
102 ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
103 [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
106 ([("void_ptr", "inBuffer", "InMode"),
107 ("void", "outBuffer", "OutMode"),
108 ("unsigned_long", "cnt", "InMode")],
109 [("InOutBuffer", "buffer", "InOutMode")]),
112 ## ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
113 ## [("InOutBuf128", "state", "InOutMode")]),
114 ([("StateBlockPtr", "inState", "InMode"), ("StateBlockPtr", "outState", "InMode")],
115 [("StateBlock", "state", "InOutMode")]),
117 # Catch-all for the last couple of void pointers
118 ([("void", "*", "OutMode")],
119 [("void_ptr", "*", "InMode")]),
122 if __name__
== "__main__":