logo       

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

programming.swig

Subject: RE: Problems with %rename (const)

I have been a fool. I mistook IMeshBuffer for SMeshBuffer.

But, the error remains, now I can just figure out more of what is wrong.

SMeshBuffer is a subclass of IMeshBuffer, thus it has (possibly) 4
functions (two regular, and two renamed to const).

Now, I looked into the -dump_tree again (this time the correct place).
And here is what I found:

[snip:parsetree]
|
+++ cdecl
----------------------------------------
| virtual:derived - "1"
| proxyfuncname -
"getBoundingBoxConst"
| imfuncname -
"SMeshBuffer_getBoundingBoxConst"
| name - "getBoundingBox"
| sym:symtab - 0x402a5c68
| tmap:jtype - "long"
| csym:nextSibling - 0x402a6748
| sym:name -
"getBoundingBoxConst"
| view -
"memberfunctionHandler"
| wrap:parms - 0x40600288
| decl - "q(const).f().r."
| tmap:jni - "jlong"
| tmap:out - "
*(irr::core::aabbox3d<irr::f32 > **)&jr..."
| feature:java:enum - "typesafe"
| tmap:javaout - "{\n return new
aabbox3df(JirrJNI.SMes..."
| wrap:action -
"{\nirr::core::aabbox3d<irr::f32 > const ..."
| type -
"q(const).irr::core::aabbox3d<(irr::f32)>"
| wrap:name -
"Java_net_sf_jirr_JirrJNI_SMeshBuffer_1ge..."
| code - "{\n\t\t\treturn
BoundingBox;\n\t\t}"
| qualifier - "q(const)."
| sym:overname - "__SWIG_0"
| storage - "virtual"
| tmap:jstype - "aabbox3df"
|
+++ cdecl
----------------------------------------
| virtual:derived - "1"
| proxyfuncname - "getBoundingBox"
| imfuncname -
"SMeshBuffer_getBoundingBox"
| name - "getBoundingBox"
| sym:symtab - 0x402a5c68
| tmap:jtype - "long"
| sym:name - "getBoundingBox"
| view -
"memberfunctionHandler"
| wrap:parms - 0x40600308
| decl - "f().r."
| tmap:jni - "jlong"
| tmap:out - "
*(irr::core::aabbox3d<irr::f32 > **)&jr..."
| feature:java:enum - "typesafe"
| tmap:javaout - "{\n return new
aabbox3df(JirrJNI.SMes..."
| wrap:action -
"{\nirr::core::aabbox3d<irr::f32 > &_resu..."
| type -
"irr::core::aabbox3d<(irr::f32)>"
| wrap:name -
"Java_net_sf_jirr_JirrJNI_SMeshBuffer_1ge..."
| code - "{\n\t\t\treturn
BoundingBox;\n\t\t}"
| sym:overname - "__SWIG_0"
| storage - "virtual"
| tmap:jstype - "aabbox3df"
|
...
... (more decls)
...
+++ cdecl
----------------------------------------
| proxyfuncname - "getBoundingBox"
| imfuncname -
"get_SMeshBuffer_BoundingBox"
| name - "BoundingBox"
| sym:symtab - 0x402a5c68
| tmap:jtype - "long"
| view - "variableHandler"
| sym:name - "BoundingBox"
| wrap:parms - 0x40605c08
| tmap:jni - "jlong"
| tmap:out - "
*(irr::core::aabbox3d<irr::f32 > **)&jr..."
| decl - ""
| feature:java:enum - "typesafe"
| tmap:javaout - "{\n long cPtr =
JirrJNI.get_SMeshBuff..."
| wrap:action - "result =
(irr::core::aabbox3d<irr::f32 >..."
| type -
"irr::core::aabbox3d<(irr::f32)>"
| wrap:name -
"Java_net_sf_jirr_JirrJNI_get_1SMeshBuffe..."
| sym:overname - "__SWIG_0"
| tmap:jstype - "aabbox3df"
|
+++ include ----------------------------------------
[/snip:parsetree]

There is is... the little sucker :) at the end of it all. dunno when the
error occurs (in the process, but it seems to me that the methods are
printed like this (from looking into .java-files):

[classdec] {
[constructer/desructors]
[member-methods] ?
[inherited-methods] ?
}

Now, it seems obvious that the last method is maybe inherited from
IMeshBuffer ?

Ok, I also did some printing to figure out what came out of swig... here
is something interesting.

[snip:debugcrap]
classHandler(Node SMeshBuffer)
OAKHACK (sym:name): new_SMeshBuffer
OAKHACK (sym:name): delete_SMeshBuffer
OAKHACK (sym:name): SMeshBuffer_getMaterialConst
OAKHACK:
(r.q(const).irr::video::SMaterial)(proxyfuncname):getMaterialConst
OAKHACK (sym:name): SMeshBuffer_getMaterial
OAKHACK: (r.irr::video::SMaterial)(proxyfuncname):getMaterial
OAKHACK (sym:name): SMeshBuffer_getVerticesConst
OAKHACK: (p.q(const).void)(proxyfuncname):getVerticesConst
OAKHACK (sym:name): SMeshBuffer_getVertices
OAKHACK: (p.void)(proxyfuncname):getVertices
OAKHACK (sym:name): SMeshBuffer_getVertexCount
OAKHACK: (irr::s32)(proxyfuncname):getVertexCount
OAKHACK (sym:name): SMeshBuffer_getIndicesConst
OAKHACK: (p.q(const).irr::u16)(proxyfuncname):getIndicesConst
OAKHACK (sym:name): SMeshBuffer_getIndices
OAKHACK: (p.irr::u16)(proxyfuncname):getIndices
OAKHACK (sym:name): SMeshBuffer_getIndexCount
OAKHACK: (irr::s32)(proxyfuncname):getIndexCount
OAKHACK (sym:name): SMeshBuffer_getBoundingBoxConst
OAKHACK:
(r.q(const).irr::core::aabbox3d<(irr::f32)>)(proxyfuncname):getBoundingBoxConst
OAKHACK (sym:name): SMeshBuffer_getBoundingBox
OAKHACK:
(r.irr::core::aabbox3d<(irr::f32)>)(proxyfuncname):getBoundingBox
OAKHACK (sym:name): SMeshBuffer_recalculateBoundingBox
OAKHACK: (void)(proxyfuncname):recalculateBoundingBox
OAKHACK (sym:name): SMeshBuffer_getVertexType
OAKHACK: (irr::video::E_VERTEX_TYPE)(proxyfuncname):getVertexType
OAKHACK (sym:name): set_SMeshBuffer_Material
OAKHACK: (void)(proxyfuncname):setMaterial
OAKHACK (sym:name): get_SMeshBuffer_Material
OAKHACK: (p.irr::video::SMaterial)(proxyfuncname):getMaterial
OAKHACK (sym:name): set_SMeshBuffer_Vertices
OAKHACK: (void)(proxyfuncname):setVertices
OAKHACK (sym:name): get_SMeshBuffer_Vertices
OAKHACK:
(p.irr::core::array<(irr::video::S3DVertex)>)(proxyfuncname):getVertices
OAKHACK (sym:name): set_SMeshBuffer_Indices
OAKHACK: (void)(proxyfuncname):setIndices
OAKHACK (sym:name): get_SMeshBuffer_Indices
OAKHACK: (p.irr::core::array<(irr::u16)>)(proxyfuncname):getIndices
OAKHACK (sym:name): set_SMeshBuffer_BoundingBox
OAKHACK: (void)(proxyfuncname):setBoundingBox
OAKHACK (sym:name): get_SMeshBuffer_BoundingBox
OAKHACK:
(p.irr::core::aabbox3d<(irr::f32)>)(proxyfuncname):getBoundingBox
[/snip:debugcrap]

Notice the difference in GetAttr(n,"type") on the first and last
getBoundingBox (proxyfuncname)-lines. one is (p.irr....) the other
(r.irr....) this could be why they are not ruled out as the same
function.

The debuglines were printed with the following code (placed in diffent
methods in JAVA.cxx):

[snip:c++]
...
virtual int classHandler(Node *n) {
Printf(stdout, "\nclassHandler(Node %s)\n", Getattr(n, "sym:name"));
...
...
void proxyClassFunctionHandler(Node *n) {
Printf(stdout, "OAKHACK: (%s)(proxyfuncname):%s\n",
Getattr(n,"type"), Getattr(n, "proxyfuncname"));
...
...
virtual int functionWrapper(Node *n) {
String *symname = Getattr(n,"sym:name");
Printf(stdout, "OAKHACK (sym:name): %s\n", symname);
...
...
void proxyClassFunctionHandler(Node *n) {
Printf(stdout, "OAKHACK: (%s)(proxyfuncname):%s\n",
Getattr(n,"type"), Getattr(n, "proxyfuncname"));
[/snip:c++]


Just for ref, here is the SMeshBuffer.h and IMeshBuffer.h

[code:SMeshBuffer.h]
1 // Copyright (C) 2002-2004 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in
Irrlicht.h
4
5 #ifndef __S_MESH_BUFFER_H_INCLUDED__
6 #define __S_MESH_BUFFER_H_INCLUDED__
7
8 #include "array.h"
9 #include "IMeshBuffer.h"
10
11 namespace irr
12 {
13 namespace scene
14 {
15 //! Simple implementation of the IMeshBuffer interface with S3DVertex
vertices.
16 struct SMeshBuffer : public IMeshBuffer
17 {
18 //! constructor
19 SMeshBuffer()
20 {
21 #ifdef _DEBUG
22 setDebugName("SMeshBuffer");
23 #endif
24 }
25
26 //! destructor
27 ~SMeshBuffer() {};
28
29 //! returns the material of this meshbuffer
30 virtual const video::SMaterial& getMaterial() const
31 {
32 return Material;
33 }
34
35 //! returns the material of this meshbuffer
36 virtual video::SMaterial& getMaterial()
37 {
38 return Material;
39 }
40
41 //! returns pointer to vertices
42 virtual const void* getVertices() const
43 {
44 return Vertices.const_pointer();
45 }
46
47 //! returns pointer to vertices
48 virtual void* getVertices()
49 {
50 return Vertices.pointer();
51 }
52
53 //! returns amount of vertices
54 virtual s32 getVertexCount() const
55 {
56 return Vertices.size();
57 }
58
59 //! returns pointer to Indices
60 virtual const u16* getIndices() const
61 {
62 return Indices.const_pointer();
63 }
64
65 //! returns pointer to Indices
66 virtual u16* getIndices()
67 {
68 return Indices.pointer();
69 }
70
71 //! returns amount of indices
72 virtual s32 getIndexCount() const
73 {
74 return Indices.size();
75 }
76
77 //! returns an axis aligned bounding box
78 virtual const core::aabbox3d<f32>& getBoundingBox() const
79 {
80 return BoundingBox;
81 }
82
83 //! returns an axis aligned bounding box
84 virtual core::aabbox3d<f32>& getBoundingBox()
85 {
86 return BoundingBox;
87 }
88
89 //! recalculates the bounding box. should be called if the mesh
changed.
90 void recalculateBoundingBox()
91 {
92 if (Vertices.empty())
93 BoundingBox.reset(0,0,0);
94 else
95 {
96 BoundingBox.reset(Vertices[0].Pos);
97 for (u32 i=1; i<Vertices.size(); ++i)
98 BoundingBox.addInternalPoint(Vertices[i].Pos);
99 }
100 }
101
102 //! returns which type of vertex data is stored.
103 virtual video::E_VERTEX_TYPE getVertexType() const
104 {
105 return video::EVT_STANDARD;
106 }
107
108 video::SMaterial Material; //! material for this
meshBuffer.
109 core::array<video::S3DVertex> Vertices; //! Array of vertices
110 core::array<u16> Indices; //! Array of the Indices.
111 core::aabbox3d<f32> BoundingBox;
112 };
113
114 } // end namespace scene
115 } // end namespace irr
116
117 #endif
118
[/code:SMeshBuffer.h]






[code:IMeshBuffer.h]
1 // Copyright (C) 2002-2004 Nikolaus Gebhardt
2 // This file is part of the "Irrlicht Engine".
3 // For conditions of distribution and use, see copyright notice in
Irrlicht.h
4
5 #ifndef __I_MESH_BUFFER_H_INCLUDED__
6 #define __I_MESH_BUFFER_H_INCLUDED__
7
8 #include "IUnknown.h"
9 #include "SMaterial.h"
10 #include "array.h"
11 #include "aabbox3d.h"
12 #include "S3DVertex.h"
13
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() {};
26
27 //! returns the material of this meshbuffer
28 virtual video::SMaterial& getMaterial() = 0;
29
30 //! returns the material of this meshbuffer
31 virtual const video::SMaterial& getMaterial() const = 0;
32
33 //! returns which type of vertex data is stored.
34 virtual video::E_VERTEX_TYPE getVertexType() const = 0;
35
36 //! returns pointer to vertex data. The data is a array of
vertices. Which vertex
37 //! type is used can be determinated with getVertexType().
38 virtual const void* getVertices() const = 0;
39
40 //! returns pointer to vertex data. The data is a array of
vertices. Which vertex
41 //! type is used can be determinated with getVertexType().
42 virtual void* getVertices() = 0;
43
44 //! returns amount of vertices
45 virtual s32 getVertexCount() const = 0;
46
47 //! returns pointer to Indices
48 virtual const u16* getIndices() const = 0;
49
50 //! returns pointer to Indices
51 virtual u16* getIndices() = 0;
52
53 //! returns amount of indices
54 virtual s32 getIndexCount() const = 0;
55
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 };
62
63 } // end namespace scene
64 } // end namespace irr
65
66 #endif
67
[/code:IMeshBuffer.h]



Hope we can figure this out :)
./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