diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2012-01-31 16:34:38 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2012-01-31 16:34:38 +0000 |
commit | a6beb5286e7ca1d478ef391396be49b4f6d2ca35 (patch) | |
tree | e649090f00988dde2ca2b569980a1b8f5f330131 /tools/libxl/gentypes.py | |
parent | 15873321439d3588e0276c7cfddb0a11f71c897d (diff) | |
download | xen-a6beb5286e7ca1d478ef391396be49b4f6d2ca35.tar.gz xen-a6beb5286e7ca1d478ef391396be49b4f6d2ca35.tar.bz2 xen-a6beb5286e7ca1d478ef391396be49b4f6d2ca35.zip |
libxl: Rename libxl IDL infrastructure.
Originally libxltypes.py provided the infrastructure and libxl.idl provided the
specific types.
In 23887:a543e10211f7 libxl.idl became libxl_types.idl (to allow for
libxl_types_internal.idl) which means we now have libxl_types.FOO and
libxltypes.FOO providing different things and annoying people in tab
completion.
Rename the infrastructure as idl.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r-- | tools/libxl/gentypes.py | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 7ecc11d572..ae4a6b6a7a 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -3,10 +3,10 @@ import sys import re -import libxltypes +import idl def libxl_C_instance_of(ty, instancename): - if isinstance(ty, libxltypes.Aggregate) and ty.typename is None: + if isinstance(ty, idl.Aggregate) and ty.typename is None: if instancename is None: return libxl_C_type_define(ty) else: @@ -16,7 +16,7 @@ def libxl_C_instance_of(ty, instancename): def libxl_C_type_define(ty, indent = ""): s = "" - if isinstance(ty, libxltypes.Enumeration): + if isinstance(ty, idl.Enumeration): if ty.typename is None: s += "enum {\n" else: @@ -31,7 +31,7 @@ def libxl_C_type_define(ty, indent = ""): else: s += "} %s" % ty.typename - elif isinstance(ty, libxltypes.Aggregate): + elif isinstance(ty, idl.Aggregate): if ty.typename is None: s += "%s {\n" % ty.kind else: @@ -53,7 +53,7 @@ def libxl_C_type_define(ty, indent = ""): def libxl_C_type_dispose(ty, v, indent = " ", parent = None): s = "" - if isinstance(ty, libxltypes.KeyedUnion): + if isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") s += "switch (%s) {\n" % (parent + ty.keyvar_name) @@ -63,7 +63,7 @@ def libxl_C_type_dispose(ty, v, indent = " ", parent = None): s += libxl_C_type_dispose(f.type, fexpr, indent + " ", nparent) s += " break;\n" s += "}\n" - elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.dispose_fn is None): + elif isinstance(ty, idl.Struct) and (parent is None or ty.dispose_fn is None): for f in [f for f in ty.fields if not f.const]: (nparent,fexpr) = ty.member(v, f, parent is None) s += libxl_C_type_dispose(f.type, fexpr, "", nparent) @@ -79,11 +79,11 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s = "" if parent is None: s += "yajl_gen_status s;\n" - if isinstance(ty, libxltypes.Enumeration): + if isinstance(ty, idl.Enumeration): s += "s = libxl__yajl_gen_enum(hand, %s_to_string(%s));\n" % (ty.typename, ty.pass_arg(v, parent is None)) s += "if (s != yajl_gen_status_ok)\n" s += " goto out;\n" - elif isinstance(ty, libxltypes.KeyedUnion): + elif isinstance(ty, idl.KeyedUnion): if parent is None: raise Exception("KeyedUnion type must have a parent") s += "switch (%s) {\n" % (parent + ty.keyvar_name) @@ -93,7 +93,7 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): s += libxl_C_type_gen_json(f.type, fexpr, indent + " ", nparent) s += " break;\n" s += "}\n" - elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.json_fn is None): + elif isinstance(ty, idl.Struct) and (parent is None or ty.json_fn is None): s += "s = yajl_gen_map_open(hand);\n" s += "if (s != yajl_gen_status_ok)\n" s += " goto out;\n" @@ -123,7 +123,7 @@ def libxl_C_type_gen_json(ty, v, indent = " ", parent = None): def libxl_C_type_to_json(ty, v, indent = " "): s = "" gen = "(libxl__gen_json_callback)&%s_gen_json" % ty.typename - s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=libxltypes.PASS_BY_REFERENCE)) + s += "return libxl__object_to_json(ctx, \"%s\", %s, (void *)%s);\n" % (ty.typename, gen, ty.pass_arg(v, passby=idl.PASS_BY_REFERENCE)) if s != "": s = indent + s @@ -171,9 +171,9 @@ if __name__ == '__main__': print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-json> <implementation>" sys.exit(1) - (_, idl, header, header_json, impl) = sys.argv + (_, idlname, header, header_json, impl) = sys.argv - (builtins,types) = libxltypes.parse(idl) + (builtins,types) = idl.parse(idlname) print "outputting libxl type definitions to %s" % header @@ -198,9 +198,9 @@ if __name__ == '__main__': f.write("void %s(%s);\n" % (ty.dispose_fn, ty.make_arg("p"))) if ty.json_fn is not None: f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" % (ty.typename, ty.make_arg("p"))) - if isinstance(ty, libxltypes.Enumeration): + if isinstance(ty, idl.Enumeration): f.write("const char *%s_to_string(%s);\n" % (ty.typename, ty.make_arg("p"))) - f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=libxltypes.PASS_BY_REFERENCE))) + f.write("int %s_from_string(const char *s, %s);\n" % (ty.typename, ty.make_arg("e", passby=idl.PASS_BY_REFERENCE))) f.write("extern libxl_enum_string_table %s_string_table[];\n" % (ty.typename)) f.write("\n") @@ -225,7 +225,7 @@ if __name__ == '__main__': """ % (header_json_define, header_json_define, " ".join(sys.argv))) for ty in [ty for ty in types+builtins if ty.json_fn is not None]: - f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE))) + f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s);\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE))) f.write("\n") f.write("""#endif /* %s */\n""" % header_json_define) @@ -262,7 +262,7 @@ if __name__ == '__main__': f.write("}\n") f.write("\n") - for ty in [t for t in types if isinstance(t,libxltypes.Enumeration)]: + for ty in [t for t in types if isinstance(t,idl.Enumeration)]: f.write("const char *%s_to_string(%s e)\n" % (ty.typename, ty.typename)) f.write("{\n") f.write(libxl_C_enum_to_string(ty, "e")) @@ -278,7 +278,7 @@ if __name__ == '__main__': f.write("\n") for ty in [t for t in types if t.json_fn is not None]: - f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=libxltypes.PASS_BY_REFERENCE))) + f.write("yajl_gen_status %s_gen_json(yajl_gen hand, %s)\n" % (ty.typename, ty.make_arg("p", passby=idl.PASS_BY_REFERENCE))) f.write("{\n") f.write(libxl_C_type_gen_json(ty, "p")) f.write("}\n") |