aboutsummaryrefslogtreecommitdiff
path: root/scripts/qapi/common.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-02-26 13:50:08 -0600
committerEric Blake <eblake@redhat.com>2018-03-02 13:14:10 -0600
commit71b3f0459c460c9e16a47372ccddbfa6e2c7aadf (patch)
treecd09eb26b84f76dbe839460bdb55a45e3f269dbc /scripts/qapi/common.py
parent834a3f349806e543db5c347feef5ef8de0a78559 (diff)
qapi: Make code-generating visitors use QAPIGen more
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 <armbru@redhat.com> Message-Id: <20180211093607.27351-20-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> [eblake: rebase to earlier guardstart cleanup] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'scripts/qapi/common.py')
-rw-r--r--scripts/qapi/common.py13
1 files changed, 13 insertions, 0 deletions
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')