aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/events.py
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-12-13 16:37:04 +0400
committerMarkus Armbruster <armbru@redhat.com>2018-12-13 19:20:11 +0100
commit1962bd39d567e8b44646e558b07b2742a5a61339 (patch)
tree0e9ed5c1470126b4547db126d9286b3d9dbb92af /scripts/qapi/events.py
parent9c2f56e9f9d5a1f9ddac77dda35f997738e85d11 (diff)
downloadqemu-1962bd39d567e8b44646e558b07b2742a5a61339.zip
qemu-1962bd39d567e8b44646e558b07b2742a5a61339.tar.gz
qemu-1962bd39d567e8b44646e558b07b2742a5a61339.tar.bz2
qapi: change enum visitor and gen_enum* to take QAPISchemaMember
This will allow to add and access more properties associated with enum values/members, like the associated 'if' condition. We may want to have a specialized type QAPISchemaEnumMember, for now this will do. Modify gen_enum() and gen_enum_lookup() for the same reason. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20181213123724.4866-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi/events.py')
-rw-r--r--scripts/qapi/events.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py
index 2ed7902..f1b88d8 100644
--- a/scripts/qapi/events.py
+++ b/scripts/qapi/events.py
@@ -143,8 +143,8 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
QAPISchemaModularCVisitor.__init__(
self, prefix, 'qapi-events',
' * Schema-defined QAPI/QMP events', __doc__)
- self._enum_name = c_name(prefix + 'QAPIEvent', protect=False)
- self._event_names = []
+ self._event_enum_name = c_name(prefix + 'QAPIEvent', protect=False)
+ self._event_enum_members = []
def _begin_module(self, name):
types = self._module_basename('qapi-types', name)
@@ -170,15 +170,16 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
def visit_end(self):
(genc, genh) = self._module[self._main_module]
- genh.add(gen_enum(self._enum_name, self._event_names))
- genc.add(gen_enum_lookup(self._enum_name, self._event_names))
+ genh.add(gen_enum(self._event_enum_name, self._event_enum_members))
+ genc.add(gen_enum_lookup(self._event_enum_name,
+ self._event_enum_members))
def visit_event(self, name, info, ifcond, arg_type, boxed):
with ifcontext(ifcond, self._genh, self._genc):
self._genh.add(gen_event_send_decl(name, arg_type, boxed))
self._genc.add(gen_event_send(name, arg_type, boxed,
- self._enum_name))
- self._event_names.append(name)
+ self._event_enum_name))
+ self._event_enum_members.append(QAPISchemaMember(name))
def gen_events(schema, output_dir, prefix):