qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/10] Introduce qmisc module


From: Luiz Capitulino
Subject: Re: [Qemu-devel] [PATCH 01/10] Introduce qmisc module
Date: Thu, 15 Oct 2009 14:17:32 -0300

On Thu, 15 Oct 2009 10:35:16 -0500
Anthony Liguori <address@hidden> wrote:

> Luiz Capitulino wrote:
> >>> +/**
> >>> + * qobject_from_fmt(): build QObjects from a specified format.
> >>> + *
> >>> + * Valid characters of the format:
> >>> + *
> >>> + * i   integer, map to QInt
> >>> + * s   string, map to QString
> >>> + * []  list, map to QList
> >>> + * {}  dictionary, map to QDict
> >>> + *
> >>> + * Examples:
> >>> + *
> >>> + * - Create a QInt
> >>> + *
> >>> + *      qobject_from_fmt("i", 42);
> >>> + *
> >>> + * - Create a QList of QStrings
> >>> + *
> >>> + *      qobject_from_fmt("[ i, i, i ]", 0, 1 , 2);
> >>> + *
> >>> + * - Create a QDict with mixed data-types
> >>> + *
> >>> + *      qobject_from_fmt("{ s: [ i, s ], s: i }", ... );
> >>> + *
> >>> + * Return a strong reference to a QObject on success, NULL otherwise.
> >>> + */
> >>>   
> >>>       
> >> But my real objection is that we should make this "{%s: [%d, %s], %s: 
> >> %d}" so that we can mark it as a printf formatted function and get type 
> >> checking.  You'll probably have to support both "%d" and "%" PRId64 for 
> >> sanity sake.
> >>     
> >
> >  Trivial to do if we ignore the '%' characters. :))
> >   
> Okay, I'd like to see that and I'd like to see string parsing.  We can 
> rewrite the parser later.

 Great!

 I have some concerns about string parsing though, can we make it very
simple? Like, only valid as keys and not expect anything fancy inside
the string delimiters?

 Otherwise I think it would be easier to make it part of a grammar, 
which sounds like a good future improvement.




reply via email to

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