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.
Okay. I'll examine it.
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
It makes sense if this tool is suitable.
Regards,
Shi Lei