qemu-devel
[Top][All Lists]
Advanced

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 19/29] qapi: Make code-generating visitors use QAPIGen more
Date: Fri, 23 Feb 2018 18:35:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Michael Roth <address@hidden> 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 <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?

Perhaps.  If they had more in common, the case for an abstract super
class would be clearer.

> Reviewed-by: Michael Roth <address@hidden>

Thanks!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]