[Top][All Lists]

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

Re: [Qemu-devel] Enum String Generator

From: John Snow
Subject: Re: [Qemu-devel] Enum String Generator
Date: Mon, 16 Feb 2015 12:37:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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:

address@hidden:~/build/last$ grep -A 4 NewImageMode_lookup qapi-types.c
const char *NewImageMode_lookup[] = {

address@hidden:~/build/last$ grep -C 10 -e NEW_IMAGE qapi-types.h

extern const char *NewImageMode_lookup[];
typedef enum NewImageMode
} NewImageMode;


Is that what you want?


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.

reply via email to

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