def main(): """Main function.""" args = _parser() printer = PrintGenericStubs() api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) printer.Print(api)
def main(): """Main function.""" args = _parser() api = gl_XML.parse_GL_API(args.file_name) printer = PrintGlRemap() printer.Print(api)
def main(): """Main function.""" args = _parser() api = gl_XML.parse_GL_API(args.file_name) if args.es is not None: api.filter_functions_by_api(args.es) printer = PrintGlRemap() printer.Print(api)
def abi_parse_xml(xml): """Parse a GLAPI XML file for ABI entries.""" import os GLAPI = "./%s/../glapi/gen" % (os.path.dirname(sys.argv[0])) sys.path.append(GLAPI) import gl_XML, glX_XML api = gl_XML.parse_GL_API(xml, glX_XML.glx_item_factory()) entry_dict = {} for func in api.functionIterateByOffset(): # make sure func.name appear first entry_points = func.entry_points[:] entry_points.remove(func.name) entry_points.insert(0, func.name) for name in entry_points: attrs = { "slot": func.offset, "hidden": not func.is_static_entry_point(name), "alias": None if name == func.name else func.name, "handcode": bool(func.has_different_protocol(name)), } # post-process attrs if attrs["alias"]: try: alias = entry_dict[attrs["alias"]] except KeyError: raise Exception("failed to alias %s" % attrs["alias"]) if alias.alias: raise Exception("recursive alias %s" % ent.name) attrs["alias"] = alias if attrs["handcode"]: attrs["handcode"] = func.static_glx_name(name) else: attrs["handcode"] = None if entry_dict.has_key(name): raise Exception("%s is duplicated" % (name)) cols = [] cols.append(func.return_type) cols.append(name) params = func.get_parameter_string(name) cols.extend([p.strip() for p in params.split(",")]) ent = ABIEntry(cols, attrs) entry_dict[ent.name] = ent entries = entry_dict.values() entries.sort() return entries
def main(): """Main function.""" args = _parser() api = gl_XML.parse_GL_API(args.file_name) if args.mode == "table": printer = PrintGlTable() elif args.mode == "remap_table": printer = PrintRemapTable() printer.Print(api)
def main(): """Main function.""" args = _parser() if args.mode == "dispatch_c": printer = PrintGlxDispatchFunctions(args.swap) elif args.mode == "dispatch_h": printer = PrintGlxDispatch_h() api = gl_XML.parse_GL_API( args.filename, glX_proto_common.glx_proto_item_factory()) printer.Print(api)
def abi_parse_xml(xml): """Parse a GLAPI XML file for ABI entries.""" import gl_XML, glX_XML api = gl_XML.parse_GL_API(xml, glX_XML.glx_item_factory()) entry_dict = {} for func in api.functionIterateByOffset(): # make sure func.name appear first entry_points = func.entry_points[:] entry_points.remove(func.name) entry_points.insert(0, func.name) for name in entry_points: attrs = { 'slot': func.offset, 'hidden': not func.is_static_entry_point(name), 'alias': None if name == func.name else func.name, 'handcode': bool(func.has_different_protocol(name)), } # post-process attrs if attrs['alias']: try: alias = entry_dict[attrs['alias']] except KeyError: raise Exception('failed to alias %s' % attrs['alias']) if alias.alias: raise Exception('recursive alias %s' % ent.name) attrs['alias'] = alias if attrs['handcode']: attrs['handcode'] = func.static_glx_name(name) else: attrs['handcode'] = None if entry_dict.has_key(name): raise Exception('%s is duplicated' % (name)) cols = [] cols.append(func.return_type) cols.append(name) params = func.get_parameter_string(name) cols.extend([p.strip() for p in params.split(',')]) ent = ABIEntry(cols, attrs) entry_dict[ent.name] = ent entries = entry_dict.values() entries.sort() return entries
def main(): """Main function.""" args = _parser() api = gl_XML.parse_GL_API(args.file_name) if args.mode == "table": printer = PrintGlTable(args.es) elif args.mode == "remap_table": printer = PrintRemapTable(args.es) if args.es is not None: api.filter_functions_by_api(args.es) printer.Print(api)
def main(): """Main function.""" args = _parser() if args.mode == "proto": printer = PrintGlxProtoStubs() elif args.mode == "init_c": printer = PrintGlxProtoInit_c() elif args.mode == "init_h": printer = PrintGlxProtoInit_h() printer.debug = args.debug api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) printer.Print( api )
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 args.mode == "reqsize_h": printer = PrintGlxReqSize_h() api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) printer.Print(api)
def main(): args = _parser() api_list = [gl_XML.parse_GL_API(args.input_file)] printer = PrintGlEnums() printer.Print(api_list)
def parseAPI(): glapi_path = os.environ['GLAPI_PATH'] return gl_XML.parse_GL_API(glapi_path + "/gl_API.xml")
if not f.ignore and f.vectorequiv == None: if f.glx_rop != 0: self.rop_functions.append(f.glx_rop, f) if f.glx_sop != 0: self.sop_functions.append(f.glx_sop, f) if f.glx_vendorpriv != 0: self.vop_functions.append(f.glx_vendorpriv, f) self.sop_functions.Print() self.rop_functions.Print() self.vop_functions.Print() return def _parser(): """Parse arguments and return namespace.""" parser = argparse.ArgumentParser() parser.add_argument('-f', dest='filename', default='gl_API.xml', help='An XML file describing an API.') return parser.parse_args() if __name__ == '__main__': args = _parser() printer = PrintGlxDispatchTables() api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) printer.Print(api)
def main(): """Main function.""" args = _parser() printer = PrintCode() api = gl_XML.parse_GL_API(args.filename) printer.Print(api)
def show_usage(): print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] sys.exit(1) if __name__ == '__main__': file_name = "gl_API.xml" mode = "generic" try: (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") except Exception, e: show_usage() for (arg, val) in args: if arg == '-m': mode = val elif arg == "-f": file_name = val if mode == "generic": printer = PrintGenericStubs() else: print "ERROR: Invalid mode \"%s\" specified." % mode show_usage() api = gl_XML.parse_GL_API(file_name) printer.Print(api)
def main(): args = _parser() printer = PrintGenericStubs() api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory()) printer.Print(api)
self.printInitDispatch(api) self.printAliasedTable(api) return def show_usage(): print "Usage: %s [-f input_file_name] [-c]" % sys.argv[0] print "-c Enable compatibility with OpenGL ES." sys.exit(1) if __name__ == "__main__": file_name = "gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:c") except Exception, e: show_usage() es = False for (arg, val) in args: if arg == "-f": file_name = val elif arg == "-c": es = True api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) printer = PrintGlOffsets(es) printer.Print(api)
show_usage() if len(args) != 0: show_usage() api_desc_file = "" for opt_name, opt_val in opts: if opt_name == "-f": api_desc_file = opt_val if not api_desc_file: die("missing descriptor file (-f)\n") # generate the code for all APIs enabled_apis = set( ["GLES", "GLES2", "GLES3", "GLES31", "GLES32", "GL", "GL_CORE"]) try: api_desc = gl_XML.parse_GL_API(api_desc_file) except Exception: die("couldn't parse API specification file %s\n" % api_desc_file) (params, hash_tables) = generate_hash_tables(api_desc.enums_by_name, enabled_apis, get_hash_params.descriptor) print_header() print_params(params) print_tables(hash_tables)
for func in api.functionIterateByOffset(): for n in func.entry_points: self.printFunction(func, n) self.printInitDispatch(api) self.printAliasedTable(api) return def show_usage(): print "Usage: %s [-f input_file_name]" % sys.argv[0] sys.exit(1) if __name__ == "__main__": file_name = "gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") except Exception, e: show_usage() for (arg, val) in args: if arg == "-f": file_name = val api = gl_XML.parse_GL_API(file_name) printer = PrintGlOffsets() printer.Print(api)
if __name__ == '__main__': file_name = "gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s") except Exception, e: show_usage() mode = "dispatch_c" do_swap = 0 for (arg, val) in args: if arg == "-f": file_name = val elif arg == "-m": mode = val elif arg == "-s": do_swap = 1 if mode == "dispatch_c": printer = PrintGlxDispatchFunctions(do_swap) elif mode == "dispatch_h": printer = PrintGlxDispatch_h() else: show_usage() api = gl_XML.parse_GL_API(file_name, glX_proto_common.glx_proto_item_factory()) printer.Print(api)
print '{' for func in api.functionIterateAll(): flavor = func.marshal_flavor() if flavor in ('skip', 'sync'): continue print ' DISPATCH_CMD_{0},'.format(func.name) print '};' def show_usage(): print 'Usage: %s [-f input_file_name]' % sys.argv[0] sys.exit(1) if __name__ == '__main__': file_name = 'gl_API.xml' try: (args, trail) = getopt.getopt(sys.argv[1:], 'm:f:') except Exception,e: show_usage() for (arg,val) in args: if arg == '-f': file_name = val printer = PrintCode() api = gl_XML.parse_GL_API(file_name, marshal_XML.marshal_item_factory()) printer.Print(api)
op, file1, file2 = args if op not in ops: show_usage(ops) skips = [] for opt, val in options: if opt == "-k": skips = val.split(",") for elt in skips: try: elts.remove(elt) except ValueError: show_usage(ops) api1 = gl_XML.parse_GL_API(file1, glX_XML.glx_item_factory()) api2 = gl_XML.parse_GL_API(file2, glX_XML.glx_item_factory()) set = ApiSet(api1, elts) func = getattr(set, op) result = func(api2) if not is_api_empty(result): cat_name = "%s_of_%s_and_%s" \ % (op, os.path.basename(file1), os.path.basename(file2)) print '<?xml version="1.0"?>' print '<!DOCTYPE OpenGLAPI SYSTEM "%s/gl_API.dtd">' % GLAPI print print '<OpenGLAPI>' print
if __name__ == '__main__': file_name = "gl_API.xml" try: (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s") except Exception,e: show_usage() mode = "dispatch_c" do_swap = 0 for (arg,val) in args: if arg == "-f": file_name = val elif arg == "-m": mode = val elif arg == "-s": do_swap = 1 if mode == "dispatch_c": printer = PrintGlxDispatchFunctions(do_swap) elif mode == "dispatch_h": printer = PrintGlxDispatch_h() else: show_usage() api = gl_XML.parse_GL_API( file_name, glX_proto_common.glx_proto_item_factory() ) printer.Print( api )
enum = self.enum_table[obj.value] name = "GL_" + obj.name priority = obj.priority() already_in = False for n, p in enum: if n == name: already_in = True if not already_in: enum.append([name, priority]) def show_usage(): print "Usage: %s [-f input_file_name]" % sys.argv[0] sys.exit(1) if __name__ == '__main__': try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") except Exception, e: show_usage() api_list = [] for (arg, val) in args: if arg == "-f": api = gl_XML.parse_GL_API(val) api_list.append(api) printer = PrintGlEnums() printer.Print(api_list)
enum = self.enum_table[ obj.value ] name = "GL_" + obj.name priority = obj.priority() already_in = False; for n, p in enum: if n == name: already_in = True if not already_in: enum.append( [name, priority] ) def show_usage(): print "Usage: %s [-f input_file_name]" % sys.argv[0] sys.exit(1) if __name__ == '__main__': try: (args, trail) = getopt.getopt(sys.argv[1:], "f:") except Exception,e: show_usage() api_list = [] for (arg,val) in args: if arg == "-f": api = gl_XML.parse_GL_API( val ) api_list.append(api); printer = PrintGlEnums() printer.Print( api_list )
def show_usage(): print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0] sys.exit(1) if __name__ == '__main__': file_name = "gl_API.xml" mode = "generic" try: (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") except Exception, e: show_usage() for (arg, val) in args: if arg == '-m': mode = val elif arg == "-f": file_name = val if mode == "generic": printer = PrintGenericStubs() else: print "ERROR: Invalid mode \"%s\" specified." % mode show_usage() api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory()) printer.Print(api)
def main(): """Main function.""" args = _parser() api = gl_XML.parse_GL_API(args.file_name, glX_XML.glx_item_factory()) PrintGlProcs(args.es).Print(api)
enabled_apis = set([]) api_desc_file = "" for opt_name, opt_val in opts: if opt_name == "-f": api_desc_file = opt_val if opt_name == "-a": apis = opt_to_apis(opt_val.upper()) if not apis: die("invalid API %s\n" % opt_val) enabled_apis |= apis if not api_desc_file: die("missing descriptor file (-f)\n") if len(enabled_apis) == 0: die("need at least a single enabled API\n") try: api_desc = gl_XML.parse_GL_API(api_desc_file) except Exception: die("couldn't parse API specification file %s\n" % api_desc_file) (params, hash_tables) = generate_hash_tables(api_desc.enums_by_name, enabled_apis, get_hash_params.descriptor) print_header() print_params(params) print_tables(hash_tables)
elif flavor == 'sync': self.print_sync_body(func) def show_usage(): print('Usage: %s [-f input_file_name]' % sys.argv[0]) sys.exit(1) if __name__ == '__main__': file_name = 'gl_API.xml' try: (args, trail) = getopt.getopt(sys.argv[1:], 'm:f:i:n:') except Exception: show_usage() for (arg, val) in args: if arg == '-f': file_name = val elif arg == '-i': file_index = int(val) elif arg == '-n': file_count = int(val) assert file_index < file_count printer = PrintCode() api = gl_XML.parse_GL_API(file_name, marshal_XML.marshal_item_factory()) printer.Print(api)