diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2011-04-20 17:13:07 +0100 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2011-04-20 17:13:07 +0100 |
commit | 8b403a1dfdbd5bb06abbfca927097037a9ef8280 (patch) | |
tree | d0b377d65ee8923f617c7b2dd88e2d9ebf260b12 /tools/libxl/gentypes.py | |
parent | 2da839263c4dd02b1433115583b8771b6d0fff36 (diff) | |
download | xen-8b403a1dfdbd5bb06abbfca927097037a9ef8280.tar.gz xen-8b403a1dfdbd5bb06abbfca927097037a9ef8280.tar.bz2 xen-8b403a1dfdbd5bb06abbfca927097037a9ef8280.zip |
tools: libxl: add an Enumeration type to the IDL
The IDL requires a specific value for each enumerate, this make it
much easier to avoid (or at least track) ABI changes since they must
now be explicit.
I believe I have used the same values as would have been chosen
previoulsy but have not confirmed.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r-- | tools/libxl/gentypes.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index 20d403079a..099a3919f2 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -34,7 +34,28 @@ def libxl_C_instance_of(ty, instancename): def libxl_C_type_define(ty, indent = ""): s = "" - if isinstance(ty, libxltypes.Aggregate): + + 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: + s += "typedef enum %s {\n" % ty.typename + + for v in ty.values: + if v.comment is not None: + s += format_comment(4, v.comment) + x = "%s = %d" % (v.name, v.value) + x = x.replace("\n", "\n ") + s += " " + x + ",\n" + if ty.typename is None: + s += "}" + else: + s += "} %s" % ty.typename + + elif isinstance(ty, libxltypes.Aggregate): if ty.comment is not None: s += format_comment(0, ty.comment) |