[GCC-XML] trying to generate c++ header from xml output

Bryan Ischo bji-gccxml at ischo.com
Wed Apr 23 09:26:53 EDT 2008


> Hi,
>
> Is there any tools that may help me for generate c++ header from gccxml
> outputs?
>
> I know it will not be exactly the original header (already precompiled,
> etc...), but I need it :)

Can you explain what you are trying to do with such a tool?  Since
gccxml's input is the header file, why would you need to re-output the
contents of the header file?  Couldn't you just use the original header
file for anything you need?

I do have a tool which does what you want, but perhaps not exactly
according to your needs; I'll need your answer to the above question
before I can know for sure.

I wrote a tool called xrttigen that generates a C++ object hierarchy
representing the gccxml output.  Using this tool, your program can use C++
APIs to examine the output of gccxml instead of having to parse the XML
output of gccxml.  As a test case, I wrote a little program that takes
this information and generates a header file with all of the original
declarations generated by gccxml turned back into C++.  I use this to test
that my tool works correctly by ensuring that the header file it generates
is identical to the original header file (with some differences of course,
such as comments being removed, and the order of declarations possibly
being different, and so on).

If you want, I could probably make this tool available to you.  But I
don't know if it's exactly what you need.  It just takes a header file and
uses gccxml to read it, and then outputs a generates header file which has
all of the content of the original header file.  If you want to read from
gccxml's output files directly instead of starting with a header, you'd
have to modify my code to have it skip the step where it runs gccxml on
the input header file.

You can read about xrtti at:

http://www.ischo.com/xrtti

I have a new version of xrtti that I have not released yet which will
replace what you see there when I get around to doing the release.  It:

* Does not depend on the 'Essential' C++ data structure and portability
library that I wrote; instead, I have switched to using STL for data
structures (despite the fact that I think STL is an extremely lame API;
but it is the standard after all)

* Fixes some minor bugs

Let me know if you are interested.  I am travelling right now and might
not be able to respond as quickly as I would like.  But I will try to help
as much as I can.

Thanks, and best wishes,
Bryan

------------------------------------------------------------------------
Bryan Ischo                bryan at ischo.com            2001 Mazda 626 GLX
Hamilton, New Zealand      http://www.ischo.com     RedHat Fedora Core 5
------------------------------------------------------------------------





More information about the gccxml mailing list