From: Eric Blake <eblake@redhat.com>
To: "Lluís Vilanova" <vilanova@ac.upc.edu>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/2] qapi: Add a primitive to include other files from a QAPI schema file
Date: Mon, 10 Feb 2014 13:30:04 -0700 [thread overview]
Message-ID: <52F936CC.201@redhat.com> (raw)
In-Reply-To: <20140210195828.3495.73534.stgit@fimbulvetr.bsc.es>
[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]
On 02/10/2014 12:58 PM, Lluís Vilanova wrote:
> Adds the "include(...)" primitive to the syntax of QAPI schema files.
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
> scripts/qapi.py | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
>
> + elif self.tok == 'i':
> + include_src = self.src[self.cursor-1:]
> + include_match = include_cre.match(include_src)
> + if include_match is not None:
> + include_path = os.path.join(self.input_dir,
> + include_match.group(1))
> + if not os.path.isfile(include_path):
> + raise QAPISchemaError(
> + self,
> + 'Non-existing included file "%s"' % include_path)
Should you also check against loops, and gracefully fail if a file tries
to include itself, or if file A includes B while B includes A?
This changes the code generator, but not the documentation. For this
patch to be complete, you need to edit somewhere in the docs tree,
probably docs/qapi-code-gen.txt, to describe how to use includes.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-02-10 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-10 19:58 [Qemu-devel] [PATCH v2 0/2] qapi: Allow modularization of QAPI schema files Lluís Vilanova
2014-02-10 19:58 ` [Qemu-devel] [PATCH v2 1/2] qapi: Use an explicit input file Lluís Vilanova
2014-02-10 20:10 ` Eric Blake
2014-02-10 19:58 ` [Qemu-devel] [PATCH v2 2/2] qapi: Add a primitive to include other files from a QAPI schema file Lluís Vilanova
2014-02-10 20:30 ` Eric Blake [this message]
2014-02-11 8:40 ` [Qemu-devel] [PATCH v2 0/2] qapi: Allow modularization of QAPI schema files Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52F936CC.201@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vilanova@ac.upc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).