From 71b3f0459c460c9e16a47372ccddbfa6e2c7aadf Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 26 Feb 2018 13:50:08 -0600 Subject: qapi: Make code-generating visitors use QAPIGen more MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Message-Id: <20180211093607.27351-20-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Marc-André Lureau Reviewed-by: Michael Roth [eblake: rebase to earlier guardstart cleanup] Signed-off-by: Eric Blake --- scripts/qapi/common.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'scripts/qapi/common.py') diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 2c5c40ec0a..23437b558f 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -2050,3 +2050,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') -- cgit 1.4.1