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.)
5 from scantools
import Scanner
10 defsoutput
= "Sound.py"
11 scanner
= SoundScanner(input, output
, defsoutput
)
14 print "=== Done scanning and generating, now doing 'import sndsupport' ==="
16 print "=== Done. It's up to you to compile Sndmodule.c ==="
18 class SoundScanner(Scanner
):
20 def destination(self
, type, name
, arglist
):
21 classname
= "SndFunction"
22 listname
= "functions"
25 if t
== "SndChannelPtr" and m
== "InMode":
26 classname
= "SndMethod"
27 listname
= "sndmethods"
28 return classname
, listname
30 def makeblacklistnames(self
):
32 'SndDisposeChannel', # automatic on deallocation
33 'SndAddModifier', # for internal use only
34 'SndPlayDoubleBuffer', # very low level routine
42 def makeblacklisttypes(self
):
48 def makerepairinstructions(self
):
50 ([("Str255", "*", "InMode")],
51 [("*", "*", "OutMode")]),
53 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
54 [("InBuffer", "*", "*")]),
56 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
57 ("long", "*", "OutMode")],
58 [("VarVarOutBuffer", "*", "InOutMode")]),
60 ([("SCStatusPtr", "*", "InMode")],
61 [("SCStatus", "*", "OutMode")]),
63 ([("SMStatusPtr", "*", "InMode")],
64 [("SMStatus", "*", "OutMode")]),
66 # For SndPlay's SndListHandle argument
67 ([("Handle", "sndHdl", "InMode")],
68 [("SndListHandle", "*", "*")]),
70 # For SndStartFilePlay
71 ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
72 [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
75 ([("void_ptr", "inBuffer", "InMode"),
76 ("void", "outBuffer", "OutMode"),
77 ("unsigned_long", "cnt", "InMode")],
78 [("InOutBuffer", "buffer", "InOutMode")]),
81 ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
82 [("InOutBuf128", "state", "InOutMode")]),
85 if __name__
== "__main__":