From e8d5e7c4bb11f7fcb0a4ba5c13f43e7929849a2f Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 15 Jun 2015 20:27:26 +0200 Subject: fontconfig libX11 libxcb xcb-proto mesa pixman xserver xkeyboard-config git update 15 June 2015 xserver commit fa12f2c150b2f50de9dac4a2b09265f13af353af libxcb commit f85661c3bca97faa72431df92a3867be39a74e23 libxcb/xcb-proto commit fef8a4cdc2cacd9541a656026371a3d338dadb8e xkeyboard-config commit 61fb58a95a071cc1c212f6d3808908c086219fe0 libX11 commit f0286b2770ece10aef5e2e8c004260217f12fd25 pixman commit eebc1b78200aff075dbcae9c8d00edad1f830d91 fontconfig commit f6d61c9beed856a925bd60c025b55284b2d88161 mesa commit 932d1613d1e15ec22555e5ec09105c49eb850e36 --- mesalib/src/mapi/glapi/gen/glX_proto_size.py | 99 +++++++++++++++------------- 1 file changed, 52 insertions(+), 47 deletions(-) (limited to 'mesalib/src/mapi/glapi/gen/glX_proto_size.py') diff --git a/mesalib/src/mapi/glapi/gen/glX_proto_size.py b/mesalib/src/mapi/glapi/gen/glX_proto_size.py index 4737fbf71..75fc26f5d 100644 --- a/mesalib/src/mapi/glapi/gen/glX_proto_size.py +++ b/mesalib/src/mapi/glapi/gen/glX_proto_size.py @@ -25,9 +25,11 @@ # Authors: # Ian Romanick +import argparse +import sys, string + import gl_XML, glX_XML import license -import sys, getopt, copy, string class glx_enum_function(object): @@ -650,54 +652,57 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common): return alias -def show_usage(): - print "Usage: %s [-f input_file_name] -m output_mode [--only-get | --only-set] [--get-alias-set]" % sys.argv[0] - print " -m output_mode Output mode can be one of 'size_c' or 'size_h'." - print " --only-get Only emit 'get'-type functions." - print " --only-set Only emit 'set'-type functions." - print "" - print "By default, both 'get' and 'set'-type functions are emitted." - sys.exit(1) - - -if __name__ == '__main__': - file_name = "gl_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "f:m:h:", ["only-get", "only-set", "header-tag"]) - except Exception,e: - show_usage() - - mode = None - header_tag = None - which_functions = PrintGlxSizeStubs_common.do_get | PrintGlxSizeStubs_common.do_set - - for (arg,val) in args: - if arg == "-f": - file_name = val - elif arg == "-m": - mode = val - elif arg == "--only-get": - which_functions = PrintGlxSizeStubs_common.do_get - elif arg == "--only-set": - which_functions = PrintGlxSizeStubs_common.do_set - elif (arg == '-h') or (arg == "--header-tag"): - header_tag = val - - if mode == "size_c": - printer = PrintGlxSizeStubs_c( which_functions ) - elif mode == "size_h": - printer = PrintGlxSizeStubs_h( which_functions ) - if header_tag: - printer.header_tag = header_tag - elif mode == "reqsize_c": +def _parser(): + """Parse arguments and return a namespace.""" + parser = argparse.ArgumentParser() + parser.set_defaults(which_functions=(PrintGlxSizeStubs_common.do_get | + PrintGlxSizeStubs_common.do_set)) + parser.add_argument('-f', + dest='filename', + default='gl_API.xml', + help='an XML file describing an OpenGL API.') + parser.add_argument('-m', + dest='mode', + choices=['size_c', 'size_h', 'reqsize_c', 'reqsize_h'], + help='Which file to generate') + getset = parser.add_mutually_exclusive_group() + getset.add_argument('--only-get', + dest='which_functions', + action='store_const', + const=PrintGlxSizeStubs_common.do_get, + help='only emit "get-type" functions') + getset.add_argument('--only-set', + dest='which_functions', + action='store_const', + const=PrintGlxSizeStubs_common.do_set, + help='only emit "set-type" functions') + parser.add_argument('--header-tag', + dest='header_tag', + action='store', + default=None, + help='set header tag value') + return parser.parse_args() + + +def main(): + """Main function.""" + args = _parser() + + if args.mode == "size_c": + printer = PrintGlxSizeStubs_c(args.which_functions) + elif args.mode == "size_h": + printer = PrintGlxSizeStubs_h(args.which_functions) + if args.header_tag is not None: + printer.header_tag = args.header_tag + elif args.mode == "reqsize_c": printer = PrintGlxReqSize_c() - elif mode == "reqsize_h": + elif args.mode == "reqsize_h": printer = PrintGlxReqSize_h() - else: - show_usage() - api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() ) + api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) + + printer.Print(api) - printer.Print( api ) +if __name__ == '__main__': + main() -- cgit v1.2.3