qapi: Turn generators into modules
The next commit will introduce a common driver program for all generators. The generators need to be modules for that. qapi2texi.py already is. Make the other generators follow suit. The changes are actually trivial. Obvious in the diffs once you view them with whitespace changes ignored. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180211093607.27351-8-armbru@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> [eblake: minor tweak to keep 'blurb' one line] Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
93b564c444
commit
26df4e7fab
|
@ -255,6 +255,7 @@ class QAPISchemaGenCommandVisitor(QAPISchemaVisitor):
|
|||
self._regy += gen_register_command(name, success_response)
|
||||
|
||||
|
||||
def main(argv):
|
||||
(input_file, output_dir, do_c, do_h, prefix, opts) = parse_command_line()
|
||||
|
||||
blurb = ' * Schema-defined QAPI/QMP commands'
|
||||
|
@ -297,3 +298,7 @@ if do_c:
|
|||
genc.write(output_dir, prefix + 'qmp-marshal.c')
|
||||
if do_h:
|
||||
genh.write(output_dir, prefix + 'qmp-commands.h')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
|
|
@ -171,6 +171,7 @@ class QAPISchemaGenEventVisitor(QAPISchemaVisitor):
|
|||
self._event_names.append(name)
|
||||
|
||||
|
||||
def main(argv):
|
||||
(input_file, output_dir, do_c, do_h, prefix, dummy) = parse_command_line()
|
||||
|
||||
blurb = ' * Schema-defined QAPI/QMP events'
|
||||
|
@ -208,3 +209,7 @@ if do_c:
|
|||
genc.write(output_dir, prefix + 'qapi-event.c')
|
||||
if do_h:
|
||||
genh.write(output_dir, prefix + 'qapi-event.h')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
|
|
@ -167,6 +167,8 @@ const char %(c_name)s[] = %(c_string)s;
|
|||
arg_type = arg_type or self._schema.the_empty_object_type
|
||||
self._gen_json(name, 'event', {'arg-type': self._use_type(arg_type)})
|
||||
|
||||
|
||||
def main(argv):
|
||||
# Debugging aid: unmask QAPI schema's type names
|
||||
# We normally mask them, because they're not QMP wire ABI
|
||||
opt_unmask = False
|
||||
|
@ -200,3 +202,7 @@ if do_c:
|
|||
genc.write(output_dir, prefix + 'qmp-introspect.c')
|
||||
if do_h:
|
||||
genh.write(output_dir, prefix + 'qmp-introspect.h')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
|
|
@ -240,6 +240,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaVisitor):
|
|||
self.decl += gen_object(name, None, [variants.tag_member], variants)
|
||||
self._gen_type_cleanup(name)
|
||||
|
||||
|
||||
def main(argv):
|
||||
# If you link code generated from multiple schemata, you want only one
|
||||
# instance of the code for built-in types. Generate it only when
|
||||
# opt_builtins, enabled by command line option -b. See also
|
||||
|
@ -280,3 +282,7 @@ if do_c:
|
|||
genc.write(output_dir, prefix + 'qapi-types.c')
|
||||
if do_h:
|
||||
genh.write(output_dir, prefix + 'qapi-types.h')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
|
|
@ -323,6 +323,8 @@ class QAPISchemaGenVisitVisitor(QAPISchemaVisitor):
|
|||
self.decl += gen_visit_decl(name)
|
||||
self.defn += gen_visit_alternate(name, variants)
|
||||
|
||||
|
||||
def main(argv):
|
||||
# If you link code generated from multiple schemata, you want only one
|
||||
# instance of the code for built-in types. Generate it only when
|
||||
# opt_builtins, enabled by command line option -b. See also
|
||||
|
@ -367,3 +369,7 @@ if do_c:
|
|||
genc.write(output_dir, prefix + 'qapi-visit.c')
|
||||
if do_h:
|
||||
genh.write(output_dir, prefix + 'qapi-visit.h')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
||||
|
|
Loading…
Reference in New Issue