qemu/scripts/qapi
Markus Armbruster c6cd7e4151 qapi/commands: Simplify command registry generation
QAPISchemaGenCommandVisitor.visit_command() needs to generate the
marshalling function into the current module, and also generate its
registration into the ./init system module.  The latter is done
somewhat awkwardly: .__init__() creates a QAPIGenCCode that will not
be written out, each .visit_command() adds its registration to it, and
.visit_end() copies its contents into the ./init module it creates.

Instead provide the means to temporarily switch to another module.
Create the ./init module in .visit_begin(), and generate its initial
part.  Add registrations to it in .visit_command().  Finish it in
.visit_end().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20210201193747.2169670-14-jsnow@redhat.com>
2021-02-08 14:15:58 +01:00
..
__init__.py
.flake8 qapi: delint using flake8 2020-10-10 11:37:47 +02:00
.isort.cfg qapi: enforce import order/styling with isort 2020-10-10 11:37:47 +02:00
commands.py qapi/commands: Simplify command registry generation 2021-02-08 14:15:58 +01:00
common.py qapi/common.py: move build_params into gen.py 2020-10-10 11:37:48 +02:00
error.py qapi: Use super() now we have Python 3 2020-03-05 09:24:11 +01:00
events.py qapi/gen: Combine ._add_[user|system]_module 2021-02-08 14:15:58 +01:00
expr.py qapi: enforce import order/styling with isort 2020-10-10 11:37:47 +02:00
gen.py qapi/gen: Support switching to another module temporarily 2021-02-08 14:15:58 +01:00
introspect.py qapi: enforce import order/styling with isort 2020-10-10 11:37:47 +02:00
main.py qapi/main: handle theoretical None-return from re.match() 2021-02-08 14:15:58 +01:00
mypy.ini qapi/visit.py: add type hint annotations 2020-10-10 11:37:49 +02:00
parser.py qapi: enforce import order/styling with isort 2020-10-10 11:37:47 +02:00
pylintrc qapi/visit.py: remove unused parameters from gen_visit_object 2020-10-10 11:37:49 +02:00
schema.py qapi: centralize the built-in module name definition 2021-02-08 14:15:58 +01:00
source.py qapi/source.py: delint with pylint 2020-10-10 11:37:48 +02:00
types.py qapi/gen: Replace ._begin_system_module() 2021-02-08 14:15:58 +01:00
visit.py qapi/gen: Replace ._begin_system_module() 2021-02-08 14:15:58 +01:00