[GCC-XML] c++ parsing

Roberto Gori r.gori at cineca.it
Wed Aug 2 09:16:37 EDT 2006


i wrote a file called test.h containing:

        void foo(int a, char b,  void (*f)(int), double g[], float c=5);

and i invoked gcc-xml in the following way:

        gccxml.exe  test.h -fxml=test.xml

test.xml looks like

<?xml version="1.0" ?> 
- <GCC_XML>
  <Namespace id="_1" name="::" members="_3" mangled="_Z2::" /> 
  <Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std" /> 
- <Function id="_3" name="foo" returns="_4" context="_1" mangled="_Z3fooicPFviEPdf" location="f0:1" file="f0" line="1" extern="1">
  <Argument type="_5" /> 
  <Argument type="_6" /> 
  <Argument type="_7" /> 
  <Argument type="_8" /> 
  <Argument type="_9" default="5" /> 
  </Function>
  <FundamentalType id="_4" name="void" /> 
  <FundamentalType id="_5" name="int" /> 
  <FundamentalType id="_6" name="char" /> 
  <PointerType id="_7" type="_10" /> 
  <PointerType id="_8" type="_11" /> 
  <FundamentalType id="_9" name="float" /> 
  <FundamentalType id="_11" name="double" /> 
- <FunctionType id="_10" returns="_4">
  <Argument type="_5" /> 
  </FunctionType>
  <File id="f0" name="prova.h" /> 
  </GCC_XML>

so the output  contains the type of the function arguments and not the identifiers (but maybe gcc-xml is not interested to output them).
Does exists a C or a C++ plus function that i could call to obtain types and identifiers, avoiding to parse the XML output or to invoke the python interpreter?  
  ----- Original Message ----- 
  From: Roman Yakovenko 
  To: Roberto Gori 
  Cc: gccxml at gccxml.org 
  Sent: Wednesday, August 02, 2006 1:18 PM
  Subject: Re: [GCC-XML] c++ parsing


  On 8/2/06, Roberto Gori <r.gori at cineca.it> wrote:
  >
  >
  >
  > Dear gccxml team,
  >
  > i need to parse a generic c++ function arguments list like this:
  >
  > int a, char b,  void (*f)(int), double g[], float c=5
  >
  > and i would like to write a function to obtain the names of the identifiers
  > (a, b, f, g, c) and eventually  the corresponding types also.
  >
  > i've puzzled for long time with this problem without finding a good
  > solution.
  >
  > Could you give me some advice, please?

  Take a look on pygccxml project(
  http://language-binding.net/pygccxml/pygccxml.html )
  It will help you to evalutae quickly whether GCC-XML is the right
  tool, for what you are
  trying to do.

  -- 
  Roman Yakovenko
  C++ Python language binding
  http://www.language-binding.net/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20060802/2e3fe5f5/attachment-0001.html>


More information about the gccxml mailing list