blob: 8db540a662d7726c8b34ffb4d712db96e183a832 [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')
Jack Jansen46d9e791996-04-12 16:29:23 +00007from bgenlocations import TOOLBOXDIR
Jack Jansenb81cf9d1995-06-06 13:08:40 +00008
Guido van Rossum17448e21995-01-30 11:53:55 +00009from scantools import Scanner
10
11def main():
12 input = "Sound.h"
13 output = "sndgen.py"
Jack Jansen46d9e791996-04-12 16:29:23 +000014 defsoutput = TOOLBOXDIR + "Sound.py"
Guido van Rossum17448e21995-01-30 11:53:55 +000015 scanner = SoundScanner(input, output, defsoutput)
16 scanner.scan()
17 scanner.close()
18 print "=== Done scanning and generating, now doing 'import sndsupport' ==="
19 import sndsupport
20 print "=== Done. It's up to you to compile Sndmodule.c ==="
21
22class SoundScanner(Scanner):
23
24 def destination(self, type, name, arglist):
25 classname = "SndFunction"
26 listname = "functions"
27 if arglist:
28 t, n, m = arglist[0]
29 if t == "SndChannelPtr" and m == "InMode":
30 classname = "SndMethod"
31 listname = "sndmethods"
32 return classname, listname
33
34 def makeblacklistnames(self):
35 return [
36 'SndDisposeChannel', # automatic on deallocation
37 'SndAddModifier', # for internal use only
38 'SndPlayDoubleBuffer', # very low level routine
39 # Obsolete:
40 'StartSound',
41 'StopSound',
42 'SoundDone',
Jack Jansenb81cf9d1995-06-06 13:08:40 +000043 # These are soundMgr 3.0 routines that I can't seem to find...
44 'GetSoundPreference',
45 'SetSoundPreference',
46 'GetCompressionInfo',
Jack Jansen7d0bc831995-06-09 20:56:31 +000047 # And 3.1 calls, ditto...
48 'SndGetInfo',
49 'SndSetInfo',
Guido van Rossum17448e21995-01-30 11:53:55 +000050
51 ]
52
53 def makeblacklisttypes(self):
54 return [
Guido van Rossum97842951995-02-19 15:59:49 +000055 "GetSoundVol",
56 "SetSoundVol",
Jack Jansenb81cf9d1995-06-06 13:08:40 +000057 "UnsignedFixed",
Jack Jansend40f3c61995-10-09 23:12:22 +000058 # Don't have the time to dig into this...
59 "Component",
Guido van Rossum17448e21995-01-30 11:53:55 +000060 ]
61
62 def makerepairinstructions(self):
63 return [
64 ([("Str255", "*", "InMode")],
65 [("*", "*", "OutMode")]),
66
67 ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")],
68 [("InBuffer", "*", "*")]),
69
70 ([("void", "*", "OutMode"), ("long", "*", "InMode"),
71 ("long", "*", "OutMode")],
72 [("VarVarOutBuffer", "*", "InOutMode")]),
73
74 ([("SCStatusPtr", "*", "InMode")],
75 [("SCStatus", "*", "OutMode")]),
76
77 ([("SMStatusPtr", "*", "InMode")],
78 [("SMStatus", "*", "OutMode")]),
Jack Jansenb81cf9d1995-06-06 13:08:40 +000079
80 ([("CompressionInfoPtr", "*", "InMode")],
81 [("CompressionInfo", "*", "OutMode")]),
Guido van Rossum17448e21995-01-30 11:53:55 +000082
83 # For SndPlay's SndListHandle argument
84 ([("Handle", "sndHdl", "InMode")],
85 [("SndListHandle", "*", "*")]),
86
87 # For SndStartFilePlay
88 ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")],
89 [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]),
90
91 # For Comp3to1 etc.
92 ([("void_ptr", "inBuffer", "InMode"),
93 ("void", "outBuffer", "OutMode"),
94 ("unsigned_long", "cnt", "InMode")],
95 [("InOutBuffer", "buffer", "InOutMode")]),
96
97 # Ditto
Jack Jansen7d0bc831995-06-09 20:56:31 +000098## ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")],
99## [("InOutBuf128", "state", "InOutMode")]),
100 ([("StateBlockPtr", "inState", "InMode"), ("StateBlockPtr", "outState", "InMode")],
101 [("StateBlock", "state", "InOutMode")]),
102
Guido van Rossum17448e21995-01-30 11:53:55 +0000103 ]
104
105if __name__ == "__main__":
106 main()