[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 42/61] qapi-types/visit.py: Pass whole expr dict for
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 42/61] qapi-types/visit.py: Pass whole expr dict for structs |
Date: |
Fri, 11 Oct 2013 17:05:32 +0200 |
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
scripts/qapi-types.py | 11 ++++++++---
scripts/qapi-visit.py | 8 ++++++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index 5222463..566fe5e 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -71,7 +71,7 @@ def generate_struct_fields(members):
c_name=c_var(argname))
if structured:
push_indent()
- ret += generate_struct("", argname, argentry)
+ ret += generate_struct({ "field": argname, "data": argentry})
pop_indent()
else:
ret += mcgen('''
@@ -81,7 +81,12 @@ def generate_struct_fields(members):
return ret
-def generate_struct(structname, fieldname, members):
+def generate_struct(expr):
+
+ structname = expr.get('type', "")
+ fieldname = expr.get('field', "")
+ members = expr['data']
+
ret = mcgen('''
struct %(name)s
{
@@ -417,7 +422,7 @@ if do_builtins:
for expr in exprs:
ret = "\n"
if expr.has_key('type'):
- ret += generate_struct(expr['type'], "", expr['data']) + "\n"
+ ret += generate_struct(expr) + "\n"
ret += generate_type_cleanup_decl(expr['type'] + "List")
fdef.write(generate_type_cleanup(expr['type'] + "List") + "\n")
ret += generate_type_cleanup_decl(expr['type'])
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 597cca4..1e44004 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -120,7 +120,11 @@ if (!err) {
''')
return ret
-def generate_visit_struct(name, members):
+def generate_visit_struct(expr):
+
+ name = expr['type']
+ members = expr['data']
+
ret = generate_visit_struct_fields(name, "", "", members)
ret += mcgen('''
@@ -472,7 +476,7 @@ if do_builtins:
for expr in exprs:
if expr.has_key('type'):
- ret = generate_visit_struct(expr['type'], expr['data'])
+ ret = generate_visit_struct(expr)
ret += generate_visit_list(expr['type'], expr['data'])
fdef.write(ret)
--
1.8.1.4
- [Qemu-devel] [PULL 31/61] qcow2: Evaluate overlap check options, (continued)
- [Qemu-devel] [PULL 31/61] qcow2: Evaluate overlap check options, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 30/61] qcow2: Add more overlap check bitmask macros, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 32/61] block/raw_bsd: Employ error parameter, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 33/61] block/raw-win32: Employ error parameter, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 34/61] blkdebug: Employ error parameter, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 35/61] blkverify: Employ error parameter, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 36/61] qemu-iotests: move blank lines of output in case 059, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 37/61] block/raw-posix: Employ error parameter, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 38/61] tests: build the helper program by default, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 39/61] build: add command check-clean, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 42/61] qapi-types/visit.py: Pass whole expr dict for structs,
Kevin Wolf <=
- [Qemu-devel] [PULL 40/61] vmdk: convert error code to use errp, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 43/61] qapi-types/visit.py: Inheritance for structs, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 41/61] vmdk: refuse enabling zeroed grain with flat images, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 44/61] blockdev: Introduce DriveInfo.enable_auto_del, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 45/61] blockdev: 'blockdev-add' QMP command, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 47/61] blockdev: Pass QDict to blockdev_init(), Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 46/61] blockdev: Separate ID generation from DriveInfo creation, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 48/61] blockdev: Move parsing of 'media' option to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 49/61] blockdev: Move parsing of 'if' option to drive_init, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 50/61] blockdev: Moving parsing of geometry options to drive_init, Kevin Wolf, 2013/10/11