qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/9] qapi: move gen_if/gen_endif to IfCond


From: Marc-André Lureau
Subject: Re: [PATCH 2/9] qapi: move gen_if/gen_endif to IfCond
Date: Tue, 3 Nov 2020 23:54:22 +0400

Hi

On Wed, Oct 28, 2020 at 1:32 AM John Snow <jsnow@redhat.com> wrote:
On 10/15/20 12:52 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> Move the generating function to the IfCond class.
> (avoid cluttering and potential missuse of global functions, allow
> access to private members etc)
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>   scripts/qapi/common.py     | 22 ++++++++++------------
>   scripts/qapi/gen.py        |  6 ++----
>   scripts/qapi/introspect.py |  6 ++----
>   scripts/qapi/types.py      | 22 ++++++++++------------
>   scripts/qapi/visit.py      | 14 ++++++--------
>   5 files changed, 30 insertions(+), 40 deletions(-)
>

Seems straightforward enough, though I guess your 'Ifcond' object
becomes something more of a code generator class than a pure abstract
representation by absorbing C generation functions, yeah?

Right, in its current form (https://github.com/elmarco/qemu/blob/qapi-rs/scripts/qapi/common.py#L283), it has  "def gen_if(self) -> str" & "def gen_endif(self) -> str" (for C), as well as "def gen_rs_cfg(self) -> str" (for Rust).

I didn't bother doing a visitor or other fancy design, as it's easy to iterate later if needed, imho.

--
Marc-André Lureau

reply via email to

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