Menu

How xbig deals with c++ macro ?

Help
soaringfr
2009-05-08
2013-04-24
  • soaringfr

    soaringfr - 2009-05-08

    hi, i'm currently evaluate xbig to make a tool for auto binding openscenegraph engine (maybe a next sourceforge project !).

    but after running xbig tests project successfully, i fall in error on openscenegraph binding generation in one way.

    some headers files used c++ macro in order to no rewrite declaration in several headers.

    this a simple of macro :
    ----------------------------------

    #define META_StateAttribute(library,name,type) \         virtual osg::Object* cloneType() const { return new name(); } \         virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new name (*this,copyop); } \         virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \         virtual const char* libraryName() const { return #library; } \         virtual const char* className() const { return #name; } \         virtual Type getType() const { return type; }

    this is the xbig code generated :
    ----------------------------------------------

    /** **/
        public META_StateAttribute(org.xbig.osg a1, org.xbig.osg.IAlphaFunc a2, org.xbig.osg.StateAttribute.Type a3);

    where "org.xbig.osg" is the namespace

    can you tell me how xbig deal with c++ macro cause i gess java code failed because of c++ macro are not strongly typed....

    if you can drive me in the right way...

    cheers

     
    • Christoph Nenning

      Hi,

      we use doxygen as C++ parser and I guess the problem lies there.

      A short overview how XBiG works:

      - let doxygen parse C++ headers and generate xml output
      - use "combine.xslt" generated by doxygen to combine all the xml files into one big file (all.xml)
      - transform all.xml into our own API description (meta.xml)
      - generate java and c++ code from meta.xml

      I would suggest to look what is in meta.xml. Instead of one function called "META_StateAttribute" there should be six functions:
      - cloneType
      - clone
      - ...

      You may want to create a simple header first (which reproduces this case) to deal with a smaller meta.xml file.

      If there is only one function in meta.xml you can try tweaking the doxygen config. That is located in:
      xbig/src/doxygen/xml.doxygen

       

Log in to post a comment.