[C++-sig] pyste defect: expanding typedefs in generated code

paul.bridger paul.bridger at paradise.net.nz
Tue Jun 1 07:51:34 CEST 2004


Nicodemus wrote:
> Actually, I believe that now GCCXML exports the declarated type of a 
> typedef, instead of the expanded name. If that's true, only the file 
> declarations.py must be changed, and little at that.

I had a look at this, but didn't really understand what was going on 
sufficiently to fix the problem. From the looks of things I will be gradually 
becoming more acquainted with Pyste's inner child, hopefully at some point I 
will have an opportunity to fix this.

However, I have a fix for another issue I encountered. :)
What is annoying in this case is that I cannot work out the first cause of 
pystes failure. There is a class 'Vector3' that is fairly simple, and defines 
some static member data:

/* Vector3.h */
class Vector3
{
//...
// special points
static const Vector3 ZERO;
static const Vector3 UNIT_X;
static const Vector3 UNIT_Y;
static const Vector3 UNIT_Z;
//...
};

/* Vector3.cpp */
const Vector3 Vector3::ZERO( 0, 0, 0 );
//...

These are exported fine except for an additional 'empty' member. The 
generated code is:
.def_readonly("", &Ogre::Vector3::)
.def_readonly("ZERO", &Ogre::Vector3::ZERO)
.def_readonly("UNIT_X", &Ogre::Vector3::UNIT_X)
.def_readonly("UNIT_Y", &Ogre::Vector3::UNIT_Y)
.def_readonly("UNIT_Z", &Ogre::Vector3::UNIT_Z)

Which obviously fails to compile.
I would guess the original error is in the use of GCCXML output, but the best 
I can do (without a hint or two as to where to look) for a fix is to change 
ClassExporter.py:288 (in ExportVariables) from this:
if self.info[var.name].exclude:
	continue

to this:
if self.info[var.name].exclude or var.name == '':
	continue

Paul Bridger




More information about the Cplusplus-sig mailing list