[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 19/29] qapi: Make code-generating visitors us
From: |
Michael Roth |
Subject: |
Re: [Qemu-devel] [PATCH v2 19/29] qapi: Make code-generating visitors use QAPIGen more |
Date: |
Mon, 19 Feb 2018 09:52:52 -0600 |
User-agent: |
alot/0.6 |
Quoting Markus Armbruster (2018-02-11 03:35:57)
> The use of QAPIGen is rather shallow so far: most of the output
> accumulation is not converted. Take the next step: convert output
> accumulation in the code-generating visitor classes. Helper functions
> outside these classes are not converted.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> scripts/qapi/commands.py | 71 ++++++++++++++++------------------------
> scripts/qapi/common.py | 13 ++++++++
> scripts/qapi/doc.py | 74 ++++++++++++++++++++----------------------
> scripts/qapi/events.py | 55 ++++++++++++-------------------
> scripts/qapi/introspect.py | 56 +++++++++++++-------------------
> scripts/qapi/types.py | 81
> +++++++++++++++++++---------------------------
> scripts/qapi/visit.py | 80 +++++++++++++++++++--------------------------
> 7 files changed, 188 insertions(+), 242 deletions(-)
>
<snip>
> diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py
> index 29d98ca934..31d2f73e7e 100644
> --- a/scripts/qapi/common.py
> +++ b/scripts/qapi/common.py
> @@ -2049,3 +2049,16 @@ class QAPIGenDoc(QAPIGen):
> def _top(self, fname):
> return (QAPIGen._top(self, fname)
> + '@c AUTOMATICALLY GENERATED, DO NOT MODIFY\n\n')
> +
> +
> +class QAPISchemaMonolithicCVisitor(QAPISchemaVisitor):
> +
> + def __init__(self, prefix, what, blurb, pydoc):
> + self._prefix = prefix
> + self._what = what
> + self._genc = QAPIGenC(blurb, pydoc)
> + self._genh = QAPIGenH(blurb, pydoc)
> +
> + def write(self, output_dir):
> + self._genc.write(output_dir, self._prefix + self._what + '.c')
> + self._genh.write(output_dir, self._prefix + self._what + '.h')
minor nit: since subclasses of QAPISchemaVisitor and
QAPISchemaMonolithicCVisitor all rely on .write() now, should we declare it
in the abstract QAPISchemaVisitor?
Reviewed-by: Michael Roth <address@hidden>
- Re: [Qemu-devel] [PATCH v2 18/29] qapi: Rename generated qmp-marshal.c to qmp-commands.c, (continued)
- [Qemu-devel] [PATCH v2 06/29] qapi: Reduce use of global variables in generators some, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 07/29] qapi: Turn generators into modules, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 19/29] qapi: Make code-generating visitors use QAPIGen more, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files, Markus Armbruster, 2018/02/11
- [Qemu-devel] [PATCH v2 15/29] qapi: Record 'include' directives in parse tree, Markus Armbruster, 2018/02/11