[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/3] qapi.py: Allow top-level type reference for
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/3] qapi.py: Allow top-level type reference for command definitions |
Date: |
Fri, 21 Jun 2013 11:30:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 |
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 directly
> used as parameters.
I like it! I suspect it may cause conflicts with Amos' work on adding
introspection, but it is still worth doing.
>
> def parse_args(typeinfo):
> + if isinstance(typeinfo, basestring):
> + struct = find_struct(typeinfo)
> + assert struct != None
> + typeinfo = 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.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature