blob: 8201b2c46c57671dc48e3f7380bf79e35516f933 [file] [log] [blame]
Guido van Rossum17448e21995-01-30 11:53:55 +00001# 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.)
4
Jack Jansenb81cf9d1995-06-06 13:08:40 +00005import addpack
6addpack.addpack(':Tools:bgen:bgen')
7
Guido van Rossum17448e21995-01-30 11:53:55 +00008from scantools import Scanner
9
10def main():
11 input = "Sound.h"
12 output = "sndgen.py"
13 defsoutput = "Sound.py"
14 scanner = SoundScanner(input, output, defsoutput)
15 scanner.scan()
16 scanner.close()
17 print "=== Done scanning and generating, now doing 'import sndsupport' ==="
18 import sndsupport
19 print "=== Done. It's up to you to compile Sndmodule.c ==="
20
21class SoundScanner(Scanner):
22
23 def destination(self, type, name, arglist):
24 classname = "SndFunction"
25 listname = "functions"
26 if arglist:
27 t, n, m = arglist[0]
28 if t == "SndChannelPtr" and m == "InMode":
29 classname = "SndMethod"
30 listname = "sndmethods"
31 return classname, listname
32
33 def makeblacklistnames(self):
34 return [
35 'SndDisposeChannel', # automatic on deallocation
36 'SndAddModifier', # for internal use only
37 'SndPlayDoubleBuffer', # very low level routine
38 # Obsolete:
39 'StartSound',
40 'StopSound',
41 'SoundDone',
Jack Jansenb81cf9d1995-06-06 13:08:40 +000042 # These are soundMgr 3.0 routines that I can't seem to find...
43 'GetSoundPreference',
44 'SetSoundPreference',
45 'GetCompressionInfo',
Guido van Rossum17448e21995-01-30 11:53:55 +000046
47 ]
48
49 def makeblacklisttypes(self):
50 return [
Guido van Rossum97842951995-02-19 15:59:49 +000051 "GetSoundVol",
52 "SetSoundVol",
Jack Jansenb81cf9d1995-06-06 13:08:40 +000053 "UnsignedFixed",
Guido van Rossum17448e21995-01-30 11:53:55 +000054 ]
55
56 def makerepairinstructions(self):
57 return [
58 ([("Str255", "*", "InMode")],
59 [("*", "*", "OutMode")]),
60
61 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
62 [("InBuffer", "*", "*")]),
63
64 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
65 ("long", "*", "OutMode")],
66 [("VarVarOutBuffer", "*", "InOutMode")]),
67
68 ([("SCStatusPtr", "*", "InMode")],
69 [("SCStatus", "*", "OutMode")]),
70
71 ([("SMStatusPtr", "*", "InMode")],
72 [("SMStatus", "*", "OutMode")]),
Jack Jansenb81cf9d1995-06-06 13:08:40 +000073
74 ([("CompressionInfoPtr", "*", "InMode")],
75 [("CompressionInfo", "*", "OutMode")]),
Guido van Rossum17448e21995-01-30 11:53:55 +000076
77 # For SndPlay's SndListHandle argument
78 ([("Handle", "sndHdl", "InMode")],
79 [("SndListHandle", "*", "*")]),
80
81 # For SndStartFilePlay
82 ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
83 [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
84
85 # For Comp3to1 etc.
86 ([("void_ptr", "inBuffer", "InMode"),
87 ("void", "outBuffer", "OutMode"),
88 ("unsigned_long", "cnt", "InMode")],
89 [("InOutBuffer", "buffer", "InOutMode")]),
90
91 # Ditto
92 ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
93 [("InOutBuf128", "state", "InOutMode")]),
94 ]
95
96if __name__ == "__main__":
97 main()