[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 08/18] qapi.py: Maintain a list of union types
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 08/18] qapi.py: Maintain a list of union types |
Date: |
Fri, 26 Jul 2013 22:20:22 +0200 |
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
scripts/qapi.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index baf1321..3a54c7f 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -105,6 +105,7 @@ def parse_schema(fp):
if expr_eval.has_key('enum'):
add_enum(expr_eval['enum'])
elif expr_eval.has_key('union'):
+ add_union(expr_eval)
add_enum('%sKind' % expr_eval['union'])
elif expr_eval.has_key('type'):
add_struct(expr_eval)
@@ -188,6 +189,7 @@ def type_name(name):
enum_types = []
struct_types = []
+union_types = []
def add_struct(definition):
global struct_types
@@ -200,6 +202,17 @@ def find_struct(name):
return struct
return None
+def add_union(definition):
+ global union_types
+ union_types.append(definition)
+
+def find_union(name):
+ global union_types
+ for union in union_types:
+ if union['union'] == name:
+ return union
+ return None
+
def add_enum(name):
global enum_types
enum_types.append(name)
--
1.8.1.4
- [Qemu-devel] [PULL 00/18] Block patches, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 01/18] qapi-types.py: Implement 'base' for unions, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 02/18] qapi-visit.py: Split off generate_visit_struct_fields(), Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 03/18] qapi-visit.py: Implement 'base' for unions, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 04/18] docs: Document QAPI union types, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 05/18] qapi: Add visitor for implicit structs, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 06/18] qapi: Flat unions with arbitrary discriminator, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 07/18] qapi: Add consume argument to qmp_input_get_object(), Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 08/18] qapi.py: Maintain a list of union types,
Kevin Wolf <=
- [Qemu-devel] [PULL 09/18] qapi: Anonymous unions, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 10/18] block: Allow "driver" option on the top level, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 11/18] QemuOpts: Add qemu_opt_unset(), Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 12/18] blockdev: Rename I/O throttling options for QMP, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 13/18] qcow2: Use dashes instead of underscores in options, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 14/18] blockdev: Rename 'readonly' option to 'read-only', Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 15/18] blockdev: Split up 'cache' option, Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 16/18] Implement qdict_flatten(), Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 17/18] Implement sync modes for drive-backup., Kevin Wolf, 2013/07/26
- [Qemu-devel] [PULL 18/18] Add tests for sync modes 'TOP' and 'NONE', Kevin Wolf, 2013/07/26