From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40444) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upyc4-0007hn-QX for qemu-devel@nongnu.org; Fri, 21 Jun 2013 06:30:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Upyc3-0004yC-9J for qemu-devel@nongnu.org; Fri, 21 Jun 2013 06:30:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upyc2-0004y3-OL for qemu-devel@nongnu.org; Fri, 21 Jun 2013 06:30:39 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5LAUbG8028227 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Jun 2013 06:30:38 -0400 Message-ID: <51C42B2A.6040607@redhat.com> Date: Fri, 21 Jun 2013 11:30:02 +0100 From: Eric Blake MIME-Version: 1.0 References: <1371659287-14331-1-git-send-email-kwolf@redhat.com> <1371659287-14331-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1371659287-14331-3-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2VCELALQPRBQEQGGXPXSR" Subject: Re: [Qemu-devel] [PATCH 2/3] qapi.py: Allow top-level type reference for command definitions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: lcapitulino@redhat.com, Amos Kong , qemu-devel@nongnu.org, stefanha@redhat.com, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2VCELALQPRBQEQGGXPXSR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 06/19/2013 05:28 PM, Kevin Wolf wrote: > If 'data' for a command definition isn't a dict, but a string, it is > taken as a (struct) type name and the fields of this struct are directl= y > used as parameters. I like it! I suspect it may cause conflicts with Amos' work on adding introspection, but it is still worth doing. > =20 > def parse_args(typeinfo): > + if isinstance(typeinfo, basestring): > + struct =3D find_struct(typeinfo) > + assert struct !=3D None > + typeinfo =3D struct['data'] > + Does this mean that .json files must be written in topological order (in that we can't use 'data':'Type' unless 'Type' was declared earlier in the file)? As the .json file gets larger, I've been wondering if enforcing alphabetical ordering would make it easier to manage; but if topological sorting is required, alphabetical sorting might not always be possible. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2VCELALQPRBQEQGGXPXSR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRxCsqAAoJEKeha0olJ0NqSyYH/32nKpyHCletbRqSIK8qxAGC 16wdWuDheJ83nNli6/WAMtaW/fKUI45Sg9QbdcfDYKKclIt3yJrB02ZY+krsp7eH U/9/PTfPTyfZJo++bcYv5m1LL4gbp7XW35MtdIbuccR+5HoNDC/i+ZS2kVyPGNv1 PSnBgPoB3KxbnZNye8cZPRF8VZn9J4cxqQTn2xtAXr7y8TqW/cKEW4YTuZDoilhK Dq3WXFntszvinxHmMnMj7NQFX88j1AYg6soVI6veRKzhOxianGc8MSYuJtp5KnGP ABULjisblj9Ta15wSyHnNe3gq1OsfCRghfQqcbYZsK7R63BsA1lfr8h0lm1P5j4= =gVJ2 -----END PGP SIGNATURE----- ------enig2VCELALQPRBQEQGGXPXSR--