diff options
author | Guido van Rossum <guido@python.org> | 1995-01-30 11:53:55 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-01-30 11:53:55 (GMT) |
commit | 17448e24081eb713ac00d7bcb681f4f0d8abfcbf (patch) | |
tree | 4f9d6768ef326173e1141b1a92af63247a42b13a /Mac/Modules/snd/sndscan.py | |
parent | 80ffd6683ca7b06ed743c629459b06b07defbfb3 (diff) | |
download | cpython-17448e24081eb713ac00d7bcb681f4f0d8abfcbf.zip cpython-17448e24081eb713ac00d7bcb681f4f0d8abfcbf.tar.gz cpython-17448e24081eb713ac00d7bcb681f4f0d8abfcbf.tar.bz2 |
Committed a more or less working version.
Diffstat (limited to 'Mac/Modules/snd/sndscan.py')
-rw-r--r-- | Mac/Modules/snd/sndscan.py | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py new file mode 100644 index 0000000..b63691b --- /dev/null +++ b/Mac/Modules/snd/sndscan.py @@ -0,0 +1,84 @@ +# Scan Sound.h header file, generate sndgen.py and Sound.py files. +# Then import sndsupport (which execs sndgen.py) to generate Sndmodule.c. +# (Should learn how to tell the compiler to compile it as well.) + +from scantools import Scanner + +def main(): + input = "Sound.h" + output = "sndgen.py" + defsoutput = "Sound.py" + scanner = SoundScanner(input, output, defsoutput) + scanner.scan() + scanner.close() + print "=== Done scanning and generating, now doing 'import sndsupport' ===" + import sndsupport + print "=== Done. It's up to you to compile Sndmodule.c ===" + +class SoundScanner(Scanner): + + def destination(self, type, name, arglist): + classname = "SndFunction" + listname = "functions" + if arglist: + t, n, m = arglist[0] + if t == "SndChannelPtr" and m == "InMode": + classname = "SndMethod" + listname = "sndmethods" + return classname, listname + + def makeblacklistnames(self): + return [ + 'SndDisposeChannel', # automatic on deallocation + 'SndAddModifier', # for internal use only + 'SndPlayDoubleBuffer', # very low level routine + # Obsolete: + 'StartSound', + 'StopSound', + 'SoundDone', + + ] + + def makeblacklisttypes(self): + return [ + ] + + def makerepairinstructions(self): + return [ + ([("Str255", "*", "InMode")], + [("*", "*", "OutMode")]), + + ([("void_ptr", "*", "InMode"), ("long", "*", "InMode")], + [("InBuffer", "*", "*")]), + + ([("void", "*", "OutMode"), ("long", "*", "InMode"), + ("long", "*", "OutMode")], + [("VarVarOutBuffer", "*", "InOutMode")]), + + ([("SCStatusPtr", "*", "InMode")], + [("SCStatus", "*", "OutMode")]), + + ([("SMStatusPtr", "*", "InMode")], + [("SMStatus", "*", "OutMode")]), + + # For SndPlay's SndListHandle argument + ([("Handle", "sndHdl", "InMode")], + [("SndListHandle", "*", "*")]), + + # For SndStartFilePlay + ([("long", "bufferSize", "InMode"), ("void", "theBuffer", "OutMode")], + [("*", "*", "*"), ("FakeType('0')", "*", "InMode")]), + + # For Comp3to1 etc. + ([("void_ptr", "inBuffer", "InMode"), + ("void", "outBuffer", "OutMode"), + ("unsigned_long", "cnt", "InMode")], + [("InOutBuffer", "buffer", "InOutMode")]), + + # Ditto + ([("void_ptr", "inState", "InMode"), ("void", "outState", "OutMode")], + [("InOutBuf128", "state", "InOutMode")]), + ] + +if __name__ == "__main__": + main() |