[Insight-users] Re: CableSwig and %rename or %extend

Zachary Pincus zpincus at stanford.edu
Mon Feb 6 13:44:50 EST 2006


> The right way to do this is to add a %xml(gccxml) directive to SWIG  
> itself that would allow specification of a gccxml output file to  
> load and insert in the SWIG parse tree.  Then the ITK wrapper  
> config files could just be the standard SWIG .i files with all the  
> directives supported.  One could also contribute the gccxml => swig  
> parser back to SWIG itself and then we could just get rid of  
> CableSwig altogether. This is a non-trivial undertaking, though,  
> which is why it has not been done.
>
> The short way to do this is to add a way to put SWIG directives  
> into the .cxx input files processed by GCC-XML that are currently  
> the config files.  I think there is a little precedent for this in  
> the "renames" namespace but I'm not sure.


Thanks for the suggestions Brad. I'll look into these, if I get a  
chance. I had also been considering one other option which seemed  
possibly easier, but somewhat more of a hack: writing essentially a  
replacement for cableidx that could parse gcc-xml output and (here's  
the best and/or worst part, depending) write out a .i file which can  
be parsed by the normal SWIG apparatus. This .i file, I imagine,  
would have all the template definitions and other troubling stuff  
flattened out and be simple for SWIG to read.

While not nearly as clean as adding an XML directive to SWIG itself,  
I think that this might work, and be a lot less work. I may (in my  
"ample" spare time) look into this if you think it has a chance of  
working. Tips, caveats, or don't-go-there's would of course be welcome.

Zach




More information about the Insight-users mailing list