Michael Roth <mdr...@linux.vnet.ibm.com> writes: > 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 <arm...@redhat.com> >> --- >> 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?
Perhaps. If they had more in common, the case for an abstract super class would be clearer. > Reviewed-by: Michael Roth <mdr...@linux.vnet.ibm.com> Thanks!