I have a twenty year old legacy application and want to connect it to a web front end. I need to pass a rather large deeply nested data structure that is defined in C structs. We are currently planing to do that in XML. The total number of struct definitions is around 150. These all nest into one huge data structure. I would like to find a program that would scan the header files and generate an XML Schema that I could then tailor to my needs. Does anyone know of such a tool?
We have C structures in header files and we want to have an XML schema generated from the header files
1.2k views Asked by J Edward Ellis At
2
There exist a tool called GCC XML which transform the internal representation of a program compiled by GCC into some XML, but it is not maintained any more.
A possibility could be to use GCC 4.6 plugin abilities, that it to code a plugin (in C) for GCC which would process the Tree (that is the internal AST) of the structure declaration. You can also use GCC MELT, a higher-level domain specific language to extend GCC. But in either cases, you'll need to understand the Tree (& Gimple) internal representations of GCC (and it might not worth it if you have just 150 structures). However, if your legacy application is large enough, learning these (and using MELT) might be worthwhile, because such new skills (of extending GCC) can be used for other tasks on that legacy application.
At last, you might also look into the (rather small, by today's standards) tools related to RPC-XDR, they contains a parser of C-like struct declarations.