aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/gentypes.py
diff options
context:
space:
mode:
authorWei Liu <liuw@liuw.name>2011-07-19 16:02:36 +0100
committerWei Liu <liuw@liuw.name>2011-07-19 16:02:36 +0100
commit1b86994afeb2a7f751fc3d01a83573d7a002db0c (patch)
treeeabe62c18b1d8711204f5286ef5f101c4495aa1d /tools/libxl/gentypes.py
parentb2c448b55c7f31c9b18a02630cc6c9852afdfebc (diff)
downloadxen-1b86994afeb2a7f751fc3d01a83573d7a002db0c.tar.gz
xen-1b86994afeb2a7f751fc3d01a83573d7a002db0c.tar.bz2
xen-1b86994afeb2a7f751fc3d01a83573d7a002db0c.zip
libxl: clean up trailing whitespaces in code.
Commit exactly the results of running find \! -iname '*.txt' -type f -print0 | xargs -0 perl -p -i.bak -E 's/\s+\n/\n/' Signed-off-by: Wei Liu <liuw@liuw.name> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r--tools/libxl/gentypes.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index 23406fceac..c66a33c25e 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -17,7 +17,7 @@ def format_comment(level, comment):
s += "%s */" % indent
s += "\n"
return s
-
+
def libxl_C_instance_of(ty, instancename):
if isinstance(ty, libxltypes.Aggregate) and ty.typename is None:
if instancename is None:
@@ -33,7 +33,7 @@ def libxl_C_type_define(ty, indent = ""):
if isinstance(ty, libxltypes.Enumeration):
if ty.comment is not None:
s += format_comment(0, ty.comment)
-
+
if ty.typename is None:
s += "enum {\n"
else:
@@ -76,12 +76,12 @@ def libxl_C_type_define(ty, indent = ""):
return s.replace("\n", "\n%s" % indent)
def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
-
+
s = ""
if isinstance(ty, libxltypes.KeyedUnion):
if parent is None:
raise Exception("KeyedUnion type must have a parent")
- s += "switch (%s) {\n" % (parent + ty.keyvar_name)
+ s += "switch (%s) {\n" % (parent + ty.keyvar_name)
for f in ty.fields:
(nparent,fexpr) = ty.member(v, f, parent is None)
s += "case %s:\n" % f.enumname
@@ -95,7 +95,7 @@ def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
else:
if ty.destructor_fn is not None:
s += "%s(%s);\n" % (ty.destructor_fn, ty.pass_arg(v, parent is None))
-
+
if s != "":
s = indent + s
return s.replace("\n", "\n%s" % indent).rstrip(indent)
@@ -122,7 +122,7 @@ def libxl_C_enum_strings(ty, indent=""):
s += " { NULL, -1 },\n"
s += "};\n"
s += "\n"
-
+
if s != "":
s = indent + s
return s.replace("\n", "\n%s" % indent).rstrip(indent)
@@ -131,11 +131,11 @@ def libxl_C_enum_from_string(ty, str, e, indent = " "):
s = ""
s += "return libxl__enum_from_string(%s_string_table,\n" % ty.typename
s += " %s, (int *)%s);\n" % (str, e)
-
+
if s != "":
s = indent + s
return s.replace("\n", "\n%s" % indent).rstrip(indent)
-
+
if __name__ == '__main__':
if len(sys.argv) != 4:
@@ -145,11 +145,11 @@ if __name__ == '__main__':
(_, idl, header, impl) = sys.argv
(_,types) = libxltypes.parse(idl)
-
+
print "outputting libxl type definitions to %s" % header
f = open(header, "w")
-
+
f.write("""#ifndef __LIBXL_TYPES_H
#define __LIBXL_TYPES_H
@@ -159,9 +159,9 @@ if __name__ == '__main__':
* This file is autogenerated by
* "%s"
*/
-
+
""" % " ".join(sys.argv))
-
+
for ty in types:
f.write(libxl_C_type_define(ty) + ";\n")
if ty.destructor_fn is not None:
@@ -174,7 +174,7 @@ if __name__ == '__main__':
f.write("""#endif /* __LIBXL_TYPES_H */\n""")
f.close()
-
+
print "outputting libxl type implementations to %s" % impl
f = open(impl, "w")
@@ -213,11 +213,11 @@ if __name__ == '__main__':
f.write("}\n")
f.write("\n")
- f.write(libxl_C_enum_strings(ty))
+ f.write(libxl_C_enum_strings(ty))
f.write("int %s_from_string(const char *s, %s *e)\n" % (ty.typename, ty.typename))
f.write("{\n")
- f.write(libxl_C_enum_from_string(ty, "s", "e"))
+ f.write(libxl_C_enum_from_string(ty, "s", "e"))
f.write("}\n")
f.write("\n")