From: John Snow <jsnow@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Enum String Generator
Date: Mon, 16 Feb 2015 12:37:47 -0500 [thread overview]
Message-ID: <54E22AEB.7020907@redhat.com> (raw)
In-Reply-To: <20150215023746.GA16159@fam-t430.nay.redhat.com>
On 02/14/2015 09:37 PM, Fam Zheng wrote:
> On Fri, 02/13 19:33, John Snow wrote:
>> Just a stupid question: We don't have a macro facility in the current
>> codebase that generates both an enum and string table / lookup function
>> simultaneously, do we?
>>
>> Some things really do just wind up looking grossly inelegant in C, and this
>> is one of them.
>>
>
> There is in QAPI:
>
> fam@fam-t430:~/build/last$ grep -A 4 NewImageMode_lookup qapi-types.c
> const char *NewImageMode_lookup[] = {
> "existing",
> "absolute-paths",
> NULL,
> };
>
> fam@fam-t430:~/build/last$ grep -C 10 -e NEW_IMAGE qapi-types.h
> ...
>
> extern const char *NewImageMode_lookup[];
> typedef enum NewImageMode
> {
> NEW_IMAGE_MODE_EXISTING = 0,
> NEW_IMAGE_MODE_ABSOLUTE_PATHS = 1,
> NEW_IMAGE_MODE_MAX = 2,
> } NewImageMode;
>
> ...
>
> Is that what you want?
>
> Fam
>
More or less; though I wasn't intending on working in QAPI (I'm inside
of qtest at the moment) and I assume people wouldn't appreciate the QAPI
clutter with qtest junk.
Was just trying to figure out the best way to add a bunch of tables to
allow some test permutations -- without it being grossly redundant.
the GLib test framework doesn't seem to allow for a test matrix /
permutations particularly well. I see cases of some 2D iterations in
existing qtests, but nobody appears to have implemented some 3D+ options
structure for iterating through combinations.
prev parent reply other threads:[~2015-02-16 17:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-14 0:33 [Qemu-devel] Enum String Generator John Snow
2015-02-15 2:37 ` Fam Zheng
2015-02-16 17:37 ` John Snow [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E22AEB.7020907@redhat.com \
--to=jsnow@redhat.com \
--cc=famz@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.