mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
qapi: add 'ifcond' to visitor methods
Modify the test visitor to check correct passing of values. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20180703155648.11933-5-marcandre.lureau@redhat.com> [Accidental change to roms/seabios dropped] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
4fca21c1b0
commit
fbf09a2fa4
9 changed files with 62 additions and 40 deletions
|
@ -23,12 +23,13 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
|
|||
def visit_include(self, name, info):
|
||||
print('include %s' % name)
|
||||
|
||||
def visit_enum_type(self, name, info, values, prefix):
|
||||
def visit_enum_type(self, name, info, ifcond, values, prefix):
|
||||
print('enum %s %s' % (name, values))
|
||||
if prefix:
|
||||
print(' prefix %s' % prefix)
|
||||
self._print_if(ifcond)
|
||||
|
||||
def visit_object_type(self, name, info, base, members, variants):
|
||||
def visit_object_type(self, name, info, ifcond, base, members, variants):
|
||||
print('object %s' % name)
|
||||
if base:
|
||||
print(' base %s' % base.name)
|
||||
|
@ -36,21 +37,25 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
|
|||
print(' member %s: %s optional=%s' % \
|
||||
(m.name, m.type.name, m.optional))
|
||||
self._print_variants(variants)
|
||||
self._print_if(ifcond)
|
||||
|
||||
def visit_alternate_type(self, name, info, variants):
|
||||
def visit_alternate_type(self, name, info, ifcond, variants):
|
||||
print('alternate %s' % name)
|
||||
self._print_variants(variants)
|
||||
self._print_if(ifcond)
|
||||
|
||||
def visit_command(self, name, info, arg_type, ret_type, gen,
|
||||
def visit_command(self, name, info, ifcond, arg_type, ret_type, gen,
|
||||
success_response, boxed, allow_oob, allow_preconfig):
|
||||
print('command %s %s -> %s' % \
|
||||
(name, arg_type and arg_type.name, ret_type and ret_type.name))
|
||||
print(' gen=%s success_response=%s boxed=%s oob=%s preconfig=%s' % \
|
||||
(gen, success_response, boxed, allow_oob, allow_preconfig))
|
||||
self._print_if(ifcond)
|
||||
|
||||
def visit_event(self, name, info, arg_type, boxed):
|
||||
def visit_event(self, name, info, ifcond, arg_type, boxed):
|
||||
print('event %s %s' % (name, arg_type and arg_type.name))
|
||||
print(' boxed=%s' % boxed)
|
||||
self._print_if(ifcond)
|
||||
|
||||
@staticmethod
|
||||
def _print_variants(variants):
|
||||
|
@ -59,6 +64,11 @@ class QAPISchemaTestVisitor(QAPISchemaVisitor):
|
|||
for v in variants.variants:
|
||||
print(' case %s: %s' % (v.name, v.type.name))
|
||||
|
||||
@staticmethod
|
||||
def _print_if(ifcond, indent=4):
|
||||
if ifcond:
|
||||
print('%sif %s' % (' ' * indent, ifcond))
|
||||
|
||||
|
||||
try:
|
||||
schema = QAPISchema(sys.argv[1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue