コード例 #1
0
def main():
    """Main function."""
    args = _parser()
    printer = PrintGenericStubs()

    api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
    printer.Print(api)
コード例 #2
0
ファイル: remap_helper.py プロジェクト: chemecse/mesa
def main():
    """Main function."""
    args = _parser()

    api = gl_XML.parse_GL_API(args.file_name)

    printer = PrintGlRemap()
    printer.Print(api)
コード例 #3
0
ファイル: remap_helper.py プロジェクト: theqvd/vcxsrv
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)
コード例 #4
0
ファイル: mapi_abi.py プロジェクト: iquiw/xsrc
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
コード例 #5
0
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)
コード例 #6
0
ファイル: glX_proto_recv.py プロジェクト: Distrotech/Mesa
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)
コード例 #7
0
ファイル: mapi_abi.py プロジェクト: venkatarajasekhar/Qt
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
コード例 #8
0
ファイル: gl_table.py プロジェクト: Acidburn0zzz/mesa
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)
コード例 #9
0
ファイル: glX_proto_send.py プロジェクト: Distrotech/Mesa
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 )
コード例 #10
0
ファイル: glX_proto_size.py プロジェクト: freedesktop/mesa
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)
コード例 #11
0
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)
コード例 #12
0
def main():
    args = _parser()
    api_list = [gl_XML.parse_GL_API(args.input_file)]

    printer = PrintGlEnums()
    printer.Print(api_list)
コード例 #13
0
def parseAPI():
    glapi_path = os.environ['GLAPI_PATH']
    return gl_XML.parse_GL_API(glapi_path + "/gl_API.xml")
コード例 #14
0
            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)
コード例 #15
0
ファイル: gl_genexec.py プロジェクト: chewitt/mesa
def main():
    """Main function."""
    args = _parser()
    printer = PrintCode()
    api = gl_XML.parse_GL_API(args.filename)
    printer.Print(api)
コード例 #16
0
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)
コード例 #17
0
ファイル: gl_x86_asm.py プロジェクト: Sawndip/xsrc-1
def main():
    args = _parser()
    printer = PrintGenericStubs()

    api = gl_XML.parse_GL_API(args.filename, glX_XML.glx_item_factory())
    printer.Print(api)
コード例 #18
0
ファイル: gl_apitemp.py プロジェクト: ashmew2/kolibriosSVN
        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)
コード例 #19
0
        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)
コード例 #20
0
ファイル: gl_apitemp.py プロジェクト: mikedep333/nx-libs
        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)
コード例 #21
0
ファイル: glX_proto_recv.py プロジェクト: Sawndip/xsrc-1
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)
コード例 #22
0
ファイル: gl_marshal_h.py プロジェクト: ndesh26/Mesa
        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)
コード例 #23
0
ファイル: gl_compare.py プロジェクト: Havok380/chromium-test
    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
コード例 #24
0
ファイル: glX_proto_recv.py プロジェクト: CSRedRat/mesa-1

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 )
コード例 #25
0
ファイル: glX_server_table.py プロジェクト: dhanna11/OpenGPU
            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)
コード例 #26
0
            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 )
コード例 #28
0
ファイル: gl_enums.py プロジェクト: Acidburn0zzz/mesa
def main():
    args = _parser()
    api_list = [gl_XML.parse_GL_API(args.input_file)]

    printer = PrintGlEnums()
    printer.Print(api_list)
コード例 #29
0

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)
コード例 #30
0
ファイル: gl_procs.py プロジェクト: xdcs100/mesa
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)
コード例 #31
0
   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)
コード例 #32
0
ファイル: gl_procs.py プロジェクト: ChristophHaag/mesa-mesa
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)
コード例 #33
0
ファイル: gl_marshal.py プロジェクト: chewitt/mesa
            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)
コード例 #34
0
    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