From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoIgf-0004DI-Jh for qemu-devel@nongnu.org; Fri, 01 May 2015 17:41:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YoIgc-0004Nf-RI for qemu-devel@nongnu.org; Fri, 01 May 2015 17:41:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YoIgc-0004Na-LV for qemu-devel@nongnu.org; Fri, 01 May 2015 17:41:30 -0400 Message-ID: <5543F308.3010508@redhat.com> Date: Fri, 01 May 2015 15:41:28 -0600 From: Eric Blake MIME-Version: 1.0 References: <1427995743-7865-1-git-send-email-armbru@redhat.com> <1427995743-7865-20-git-send-email-armbru@redhat.com> In-Reply-To: <1427995743-7865-20-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GbvWoENFX5GHI1NRh9W9JOpji1grwvM54" Subject: Re: [Qemu-devel] [PATCH RFC 19/19] qapi: New QMP command query-schema for QMP schema introspection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, akong@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GbvWoENFX5GHI1NRh9W9JOpji1grwvM54 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/02/2015 11:29 AM, Markus Armbruster wrote: >=20 > * Implicit type definitions are made explicit, and given > auto-generated names. These names start with ':' so they don't > clash with the user's names. >=20 > Example: a simple union implicitly defines an enumeration type for > its discriminator. Given that I just tripped over a bug in my series where I failed to consider that '*name' and 'name' should be considered the same, I'm wondering if we should first update the parse engine to flatten shorthand into a canonical form (that is, get to a point where we have a list of all names and their C counterparts), rather than having to tweak lots of places in the backends to repeatedly make the same translations over and over again (stripping off leading '*', converting qapi 'default' into C 'q_default', converting qapi 'a-b' into C 'a_b', etc.). I bet some of the backend generator gets simpler if the front end reuses your work to get into a canonical form on initial parse. > +++ b/scripts/qapi-introspect.py > @@ -0,0 +1,430 @@ > + > +def make_implicit_enum_type(name, role, values): > + name =3D ':enum-%s-%s' % (name, role) Evidence of my python newbie-ness: Here, you are using string formatting (as in 'pattern' % arguments), in other patches, I've seen you use concatenation (would look like ':enum-' + name + '-' + role). Is there any rhyme or reason why one form should be considered over the other? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GbvWoENFX5GHI1NRh9W9JOpji1grwvM54 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVQ/MIAAoJEKeha0olJ0Nqc2kH/0BWsqklffyXIrkeU9R8M3Kr /waCbaHkiIFwdrrr8rYhonrqkGqkxEteVkrRLoNuAGeESNzCFLVAmcC5tygptQh0 51Q2/krQ7ySRJFQ+1LgWC+iTCsz84HB5VHYTN3gePxxsGEwCFXNrUI7V6kmqwVCa jg+PSllK89xJBBj3Q+LSufdO8PIFC7PN01H3KhELLxrIMa7YKBsdjxcONgC+gosI QQTGeLK4VSbnLyChMoCzrbrogMu8YEaz+hHtuTSdFIs87ixAeHroyZJJ9wVhWNww liTlMbb2wfxhbDb3Voe+WVmPY2aeJuhwPgpbNq97ayn/NpUHWbmR/KOVv8XX+20= =VuIV -----END PGP SIGNATURE----- --GbvWoENFX5GHI1NRh9W9JOpji1grwvM54--