diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-06 18:55:56 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-03-12 15:14:07 +0100 |
commit | dc8fb6df5a13f7231f88c78966f8a6c5306840b5 (patch) | |
tree | 61758a14593144f91c5ab01258f072e58020d786 /scripts/qapi-types.py | |
parent | 622d241998b6a981483594712b039190ee94eff8 (diff) | |
download | hqemu-dc8fb6df5a13f7231f88c78966f8a6c5306840b5.zip hqemu-dc8fb6df5a13f7231f88c78966f8a6c5306840b5.tar.gz |
qapi: complete implementation of unions
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'scripts/qapi-types.py')
-rw-r--r-- | scripts/qapi-types.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index b56225b..727fb77 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -117,6 +117,7 @@ struct %(name)s { %(name)sKind kind; union { + void *data; ''', name=name) @@ -269,6 +270,7 @@ for expr in exprs: elif expr.has_key('union'): ret += generate_fwd_struct(expr['union'], expr['data']) + "\n" ret += generate_enum('%sKind' % expr['union'], expr['data'].keys()) + fdef.write(generate_enum_lookup('%sKind' % expr['union'], expr['data'].keys())) else: continue fdecl.write(ret) @@ -283,6 +285,10 @@ for expr in exprs: fdef.write(generate_type_cleanup(expr['type']) + "\n") elif expr.has_key('union'): ret += generate_union(expr['union'], expr['data']) + ret += generate_type_cleanup_decl(expr['union'] + "List") + fdef.write(generate_type_cleanup(expr['union'] + "List") + "\n") + ret += generate_type_cleanup_decl(expr['union']) + fdef.write(generate_type_cleanup(expr['union']) + "\n") else: continue fdecl.write(ret) |