[ctypes-commit] ctypes/sandbox/tools/codegen xml2py.py,1.2,1.3
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-12-17 08:06:01
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5406 Modified Files: xml2py.py Log Message: Command line option changes. -s 'symbol' symbol to generate, -r 'regexp' symbols to generate, multiple -s and -r options allowed. Index: xml2py.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/xml2py.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xml2py.py 2 Dec 2004 12:56:16 -0000 1.2 --- xml2py.py 17 Dec 2004 08:05:51 -0000 1.3 *************** *** 1,5 **** # bugs: # packing of structures/unions with bitfields? See '##XXX FIXME' ! import sys from codegenerator import generate_code --- 1,6 ---- # bugs: # packing of structures/unions with bitfields? See '##XXX FIXME' ! import sys, re ! from optparse import OptionParser from codegenerator import generate_code *************** *** 9,13 **** if args is None: args = sys.argv - from optparse import OptionParser def windows_dlls(option, opt, value, parser): --- 10,13 ---- *************** *** 25,30 **** parser.add_option("-s", dest="symbols", ! help="comma separated list of symbols to include " ! "(if not specified, all symbols will be included)", default=None) parser.add_option("-o", --- 25,39 ---- parser.add_option("-s", dest="symbols", ! metavar="SYMBOL", ! action="append", ! help="symbol to include " ! "(if neither symbols nor expressions are specified, everything will be included)", ! default=None) ! parser.add_option("-r", ! dest="expressions", ! metavar="EXPRESSION", ! action="append", ! help="regular expression for symbol to include " ! "(if neither symbols nor expressions are specified, everything will be included)", default=None) parser.add_option("-o", *************** *** 42,46 **** stream = open(options.output, "w") ! generate_code(files[0], stream, symbols=options.symbols) --- 51,63 ---- stream = open(options.output, "w") ! if options.expressions: ! options.expressions = map(re.compile, options.expressions) ! ! stream.write("# generated by 'xml2py'\n") ! stream.write("# flags '%s'\n" % " ".join(sys.argv[1:])) ! ! generate_code(files[0], stream, ! symbols=options.symbols, ! expressions=options.expressions) |