From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUfLR-0001Id-Qh for qemu-devel@nongnu.org; Mon, 31 Mar 2014 12:46:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUfLN-0001k2-9g for qemu-devel@nongnu.org; Mon, 31 Mar 2014 12:45:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:18753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUfLM-0001jp-WE for qemu-devel@nongnu.org; Mon, 31 Mar 2014 12:45:53 -0400 Message-ID: <53399BB8.4000600@redhat.com> Date: Mon, 31 Mar 2014 10:45:44 -0600 From: Eric Blake MIME-Version: 1.0 References: <1396023932-17642-1-git-send-email-benoit.canet@irqsave.net> <1396023932-17642-4-git-send-email-benoit.canet@irqsave.net> In-Reply-To: <1396023932-17642-4-git-send-email-benoit.canet@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ipbXkil1E3CHe4o5kwOIXsTVq6ETJQfE7" Subject: Re: [Qemu-devel] [PATCH V3 3/3] qapi: Create an include directive for use in the JSON description files. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: Benoit Canet , armbru@redhat.com, lcapitulino@redhat.com, anthony@codemonkey.ws, =?UTF-8?B?TGx1?= =?UTF-8?B?w61zIFZpbGFub3Zh?= , wenchaoqemu@gmail.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ipbXkil1E3CHe4o5kwOIXsTVq6ETJQfE7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/28/2014 10:25 AM, Beno=C3=AEt Canet wrote: > The new directive in the form { 'include': 'path/to/file.json' } will t= rigger the > parsing of path/to/file.json. > The directive will be replaced by the result of the parsing. >=20 > This will allow for easy modularisation of qapi JSON descriptions files= =2E >=20 > Signed-off-by: Benoit Canet Just noticed that your S-o-B is in plain ASCII, while your From: uses Beno=C3=AEt. Git handles UTF-8 names just fine, so you should feel welco= me to update your git config to use the same spelling in both places (of course, since my own name doesn't have non-ASCII bytes, I don't quite know the pain of getting my name munged by various tools...) > +++ b/docs/qapi-code-gen.txt > @@ -180,6 +180,20 @@ An example command is: > 'data': { 'arg1': 'str', '*arg2': 'str' }, > 'returns': 'str' } > =20 > +=3D=3D=3D Includes =3D=3D=3D > + > +A schema file can include other sub schema files with the include > +directive. > + > +An example of include directive is: > + > +{ 'include': 'path/to/sub_schema.json' } > + > +The include path is relative to the current schema file. > +The include parsing method is recursive. > +The expressions resulting from the parsing of the sub schema are injec= ted > +in place of the include directive like a C #include would do. > + Contrast to Llu=C3=ADs' version: > > +The QAPI schema definitions can be modularized using the 'include' directive: > + > + { 'include': 'path/to/file.json'} > + > +Include paths are relative to the file using the directive. > + > + I like that your version has an actual section on this (since you are introducing a new top-level key, similar to existing top-level keys for types, structs, unions, and Wenchao's work on events). I also like your explicit mention that include parsing is recursive (making it clear that a sub-schema can also use include). But I like Llu=C3=ADs wording better= , in part because it gets to the point in fewer words, and in part because "relative to the file using the directive" is more precise than "relative to the current schema file" (especially since the phrase "injected in place of the include directive" made it fuzzy to me whether the "current schema file" is the one specified on the command line after contents have been injected). Basically, I don't think the last sentence, in comparing to a C #include, added any value. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ipbXkil1E3CHe4o5kwOIXsTVq6ETJQfE7 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTOZu4AAoJEKeha0olJ0NqS6cIAKW3uaZgLsoq1JbCIHzaIK0w YAx9gYSt/t6+zMzUF7s2ti4REd3SuejKUnvpM0nuyB0d0oEjS8M0OxC3MvvGmSQf n3BSe10QSwcNlGOJruld4DGSR2F5j1GW/xQa9Cfw5ArU7xw+DsNhXZ+UHPvh2sve TCYJpK7TAi6qL8T+M3xU/yVPM3RE6Xit9gi8D77o4iJbKlwMCBjKxmRPZKsveXdK tTmXci7cz/yNXEFhaKIEHG/J6v1H3wuBwHnEdHANuJYP2/ahfKB3z2clyn+JMngx 23Kb4dOhXtm+nxLw8IIICZCcpSlHM+Ixlm9fb/hItbmrIdAAjs8miFRRaBAlKyI= =OTGU -----END PGP SIGNATURE----- --ipbXkil1E3CHe4o5kwOIXsTVq6ETJQfE7--