aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/gentypes.py
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-07-14 13:22:36 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-07-14 13:22:36 +0100
commit12073e5a6946c2ce7ac31f5acc1b530cb2d8d995 (patch)
treed2672312a07b7e47580d8bcd18d9611af47e6ca3 /tools/libxl/gentypes.py
parentf5f648c46210811975bd8ba7552302d07f7fd1e2 (diff)
downloadxen-12073e5a6946c2ce7ac31f5acc1b530cb2d8d995.tar.gz
xen-12073e5a6946c2ce7ac31f5acc1b530cb2d8d995.tar.bz2
xen-12073e5a6946c2ce7ac31f5acc1b530cb2d8d995.zip
libxl: IDL: add helper to generate references to Aggregate type members.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxl/gentypes.py')
-rw-r--r--tools/libxl/gentypes.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
index d6db145f18..8c8ffc26df 100644
--- a/tools/libxl/gentypes.py
+++ b/tools/libxl/gentypes.py
@@ -76,27 +76,21 @@ def libxl_C_type_define(ty, indent = ""):
return s.replace("\n", "\n%s" % indent)
def libxl_C_type_destroy(ty, v, indent = " ", parent = None):
- if parent is None:
- deref = v + "->"
- else:
- deref = v + "."
s = ""
if isinstance(ty, libxltypes.KeyedUnion):
if parent is None:
raise Exception("KeyedUnion type must have a parent")
for f in ty.fields:
+ (nparent,fexpr) = ty.member(v, f, parent is None)
keyvar_expr = f.keyvar_expr % (parent + ty.keyvar_name)
s += "if (" + keyvar_expr + ") {\n"
- s += libxl_C_type_destroy(f.type, deref + f.name, indent + " ", deref)
+ s += libxl_C_type_destroy(f.type, fexpr, indent + " ", nparent)
s += "}\n"
elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.destructor_fn is None):
for f in [f for f in ty.fields if not f.const]:
-
- if f.name is None: # Anonymous struct
- s += libxl_C_type_destroy(f.type, deref, "", deref)
- else:
- s += libxl_C_type_destroy(f.type, deref + f.name, "", deref)
+ (nparent,fexpr) = ty.member(v, f, parent is None)
+ s += libxl_C_type_destroy(f.type, fexpr, "", nparent)
else:
if ty.destructor_fn is not None:
s += "%s(%s);\n" % (ty.destructor_fn, ty.pass_arg(v, parent is None))