[RFC 00/29] RFC: Generate object-model code based on relax-ng files

Daniel P. Berrangé berrange at redhat.com
Wed Apr 22 08:48:12 UTC 2020

On Wed, Apr 22, 2020 at 01:51:10PM +0800, Shi Lei wrote:
> As you suggested, parsing C-structs plus some magic comments may be a good starting point.
> But parsing C is much more difficult than parsing xml or json. I think this job should base on
> some present tools or other basis. We can first refer to Clang or other light compiler front-end.
> Maybe we can utilize some output of the middle stage of these compilers.

FWIW, we already have a tool in libvirt that parsers C header files. The
scripts/apibuild.py file extracts info about our enums, structs, APIs and
uses it to build the public API documentation.

I wonder if we can refactor that tool to extract the code for parsing into
a module, so that we can more reasily re-use it for both the API docs and
for a new XML generator

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

More information about the libvir-list mailing list