From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyTxV-000374-9B for qemu-devel@nongnu.org; Thu, 15 Oct 2009 13:17:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyTxQ-00035O-8p for qemu-devel@nongnu.org; Thu, 15 Oct 2009 13:17:48 -0400 Received: from [199.232.76.173] (port=43808 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyTxQ-00035C-1y for qemu-devel@nongnu.org; Thu, 15 Oct 2009 13:17:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13133) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyTxP-00023p-Md for qemu-devel@nongnu.org; Thu, 15 Oct 2009 13:17:43 -0400 Date: Thu, 15 Oct 2009 14:17:32 -0300 From: Luiz Capitulino Subject: Re: [Qemu-devel] [PATCH 01/10] Introduce qmisc module Message-ID: <20091015141732.2eb9328b@doriath> In-Reply-To: <4AD74134.3080506@codemonkey.ws> References: <1255037747-3340-1-git-send-email-lcapitulino@redhat.com> <1255037747-3340-2-git-send-email-lcapitulino@redhat.com> <4AD72B88.2040107@codemonkey.ws> <20091015122622.1f93ea2d@doriath> <4AD74134.3080506@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Thu, 15 Oct 2009 10:35:16 -0500 Anthony Liguori 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.