logo       

RE: Problems with %rename (const): msg#00160

programming.swig

Subject: RE: Problems with %rename (const)

On Fri, 2004-09-24 at 12:30, William.Fulton@xxxxxxx wrote:
> Debugging SWIG is not for the faint hearted ;) , but the best way is to use
> swig -dump_tree to see the parse tree.

Well, it seems ok :D

> Are you using SWIG-1.3.22? I'd start with the following working example and
> modify it until it really looks like your real code and causes the same
> errors.

No using 1.3.23 (from CVS)

> William
>
> %module example
>
> %inline %{
> typedef float f32;
> namespace core {
> template<typename T> class aabbox3d {
> };
> }
> namespace irr
> {
> namespace scene
> {
> class IMeshBuffer /*: public IUnknown*/
> {
> public:
>
> virtual ~IMeshBuffer() {};
> virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
> virtual core::aabbox3d<f32>& getBoundingBox() = 0;
> };
> }
> }
> %}
>
> %template(aabbox3df) core::aabbox3d<f32>;
>
>
>
> >-----Original Message-----
> >From: swig-admin@xxxxxxxxxxxxxxx [mailto:swig-admin@xxxxxxxxxxxxxxx]On
> >Behalf Of Emanuel Greisen
> >Sent: 24 September 2004 11:05
> >To: Swig@xxxxxxxxxxxxxxx
> >Subject: Re: [Swig] Problems with %rename (const)
> >
> >
> >Well, I have been looking more into it. And I was wrong on one
> >point. It
> >does generate the xxxConst methods. BUT it generates two
> >non-const-methods in the JavaClass.
> >
> >[snip:java]
> > 71
> > 72 public aabbox3df getBoundingBoxConst() {
> > 73 return new
> >aabbox3df(JirrJNI.SMeshBuffer_getBoundingBoxConst(swigCPtr), false);
> > 74 }
> > 75
> > 76 public aabbox3df getBoundingBox() {
> > 77 return new
> >aabbox3df(JirrJNI.SMeshBuffer_getBoundingBox(swigCPtr), false);
> > 78 }
> >...
> > 119 public aabbox3df getBoundingBox() {
> > 120 long cPtr = JirrJNI.get_SMeshBuffer_BoundingBox(swigCPtr);
> > 121 return (cPtr == 0) ? null : new aabbox3df(cPtr, false);
> > 122 }
> > 123
> >[/snip:java]
> >
> >
> >These methods are generated from the Header-file of the IMeshBuffer
> >(iirlicht 3D engine). Here are all the methods (that have stuff to do
> >with getBoundingBox).
> >
> >[snip:c++]
> > 14 namespace irr
> > 15 {
> > 16 namespace scene
> > 17 {
> > 18 //! Struct for holding a mesh with a single material
> > 19 /** SMeshBuffer is a simple implementation of a
> >MeshBuffer. */
> > 20 class IMeshBuffer : public IUnknown
> > 21 {
> > 22 public:
> > 23
> > 24 //! destructor
> > 25 virtual ~IMeshBuffer() {};
> >...
> > 56 //! returns an axis aligned bounding box
> > 57 virtual const core::aabbox3d<f32>& getBoundingBox() const =
> >0;
> > 58
> > 59 //! returns an axis aligned bounding box
> > 60 virtual core::aabbox3d<f32>& getBoundingBox() = 0;
> > 61 };
> >
> >[/snip:c++]
> >
> >Ok, I see it's inheriting from IUnknown, and I looked into this class
> >(see if it had getBoundingBox-methods as well) it didn't. Nor did it
> >inherit from other classes.
> >
> >I am currently trying to debug SWIG, figure out where these
> >methods come
> >from, and maybe figuring out what is wrong. But its not my project, and
> >I spend a lot of time just figuring out how the app works :)
> >
> >Any help would be appreciated
> >
> >On Thu, 2004-09-23 at 22:39, William S Fulton wrote:
> >> Emanuel Greisen wrote:
> >> > I am currently trying to do a rename since I have some
> >overloaded C++
> >> > functions.
> >> >
> >> > Here is my renames:
> >> >
> >> > ...
> >> > 130 // RENAMING OF CONST-VARIANTS
> >> > 131 %rename(getMaterialConst) *::getMaterial() const;
> >> > 132 %rename(getBoundingBoxConst) getBoundingBox() const;
> >> > 133 //%ignore getBoundingBox() const;
> >> > 134 %rename(getVerticesConst) *::getVertices() const;
> >> > 135 %rename(getIndicesConst) *::getIndices() const;
> >> > 136 %rename(getLastConst) *::getLast() const;
> >> > ...
> >> >
> >> > I am not getting warnings about ignored methods (did
> >before I inserted
> >> > the %rename lines)
> >> >
> >> > But.... I get java compile errors about the methods being
> >duplicated.
> >> >
> >> > ...
> >> > src/java/net/sf/jirr/SMeshBuffer.java:92: getMaterial() is already
> >> > defined in net.sf.jirr.SMeshBuffer
> >> > public SMaterial getMaterial() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBuffer.java:101: getVertices() is already
> >> > defined in net.sf.jirr.SMeshBuffer
> >> > public SWIGTYPE_p_irr__core__arrayTirr__video__S3DVertex_t
> >> > getVertices() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBuffer.java:110: getIndices() is already
> >> > defined in net.sf.jirr.SMeshBuffer
> >> > public SWIGTYPE_p_irr__core__arrayTunsigned_short_t
> >getIndices() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBuffer.java:119:
> >getBoundingBox() is already
> >> > defined in net.sf.jirr.SMeshBuffer
> >> > public aabbox3df getBoundingBox() {
> >> > ^
> >> > src/java/net/sf/jirr/ILogger.java:56:
> >> >
> >log(java.lang.String,java.lang.String,net.sf.jirr.ELOG_LEVEL)
> >is already
> >> > defined in net.sf.jirr.ILogger
> >> > public void log(String text, String hint, ELOG_LEVEL ll) {
> >> > ^
> >> > src/java/net/sf/jirr/ILogger.java:60:
> >> > log(java.lang.String,net.sf.jirr.ELOG_LEVEL) is already defined in
> >> > net.sf.jirr.ILogger
> >> > public void log(String text, ELOG_LEVEL ll) {
> >> > ^
> >> > src/java/net/sf/jirr/SMesh.java:82: getBoundingBox() is
> >already defined
> >> > in net.sf.jirr.SMesh
> >> > public aabbox3df getBoundingBox() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBufferLightMap.java:92: getMaterial() is
> >> > already defined in net.sf.jirr.SMeshBufferLightMap
> >> > public SMaterial getMaterial() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBufferLightMap.java:101: getVertices() is
> >> > already defined in net.sf.jirr.SMeshBufferLightMap
> >> > public
> >SWIGTYPE_p_irr__core__arrayTirr__video__S3DVertex2TCoords_t
> >> > getVertices() {
> >> >
> > ^
> >> > src/java/net/sf/jirr/SMeshBufferLightMap.java:110: getIndices() is
> >> > already defined in net.sf.jirr.SMeshBufferLightMap
> >> > public SWIGTYPE_p_irr__core__arrayTunsigned_short_t
> >getIndices() {
> >> > ^
> >> > src/java/net/sf/jirr/SMeshBufferLightMap.java:119:
> >getBoundingBox() is
> >> > already defined in net.sf.jirr.SMeshBufferLightMap
> >> > public aabbox3df getBoundingBox() {
> >> > ...
> >> >
> >> >
> >> > Just for reference, here is some of the C++ source I am
> >trying to SWIG !
> >> >
> >> >
> >> > ...
> >> > //! returns pointer to vertex data. The data is a array of
> >vertices. Which vertex
> >> > //! type is used can be determinated with getVertexType().
> >> > virtual const void* getVertices() const = 0;
> >> >
> >> > //! returns pointer to vertex data. The data is a array of
> >vertices. Which vertex
> >> > //! type is used can be determinated with getVertexType().
> >> > virtual void* getVertices() = 0;
> >> > ...
> >> >
> >> Strange. Are you sure you are compiling the last Java files
> >that SWIG generated?
> >> Break it into a small example for us to look at if it really
> >is misbehaving. BTW
> >> the warning messages will disappear once you've renamed the
> >offending method as
> >> it will no longer be ignored but generated under the new name.
> >>
> >> William
> >--
> >./Emanuel
> >
> >_______________________________________________
> >Swig maillist - Swig@xxxxxxxxxxxxxxx
> >http://mailman.cs.uchicago.edu/mailman/listinfo/swig
> >
>
> Visit our website at http://www.ubs.com
>
> This message contains confidential information and is intended only
> for the individual named. If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail. Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission. If
> verification is required please request a hard-copy version. This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.
--
./Emanuel

_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise