Missing code updates in the previous commit.

Also improved __repr__() so that the .getName() is no longer necessary in user-defined
Function0D and Function1D subclasses.
This commit is contained in:
2013-02-22 02:48:41 +00:00
parent 33f34e1a7b
commit a4a7341aef
18 changed files with 93 additions and 162 deletions

View File

@@ -119,7 +119,7 @@ static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble* self)
static PyObject * UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_double->getName().c_str(), self->uf0D_double);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_double);
}
static PyObject * UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds)

View File

@@ -63,7 +63,7 @@ static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature*
static PyObject * UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_edgenature->getName().c_str(), self->uf0D_edgenature);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_edgenature);
}
static PyObject * UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds)

View File

@@ -93,7 +93,7 @@ static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat* self)
static PyObject * UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_float->getName().c_str(), self->uf0D_float);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_float);
}
static PyObject * UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds)

View File

@@ -63,7 +63,7 @@ static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId* self)
static PyObject * UnaryFunction0DId___repr__(BPy_UnaryFunction0DId* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_id->getName().c_str(), self->uf0D_id);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_id);
}
static PyObject * UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds)

View File

@@ -64,7 +64,7 @@ static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial* sel
static PyObject * UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_material->getName().c_str(), self->uf0D_material);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_material);
}
static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds)
@@ -87,7 +87,6 @@ static PyObject * UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *
return NULL;
}
return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result);
}
static PyMethodDef BPy_UnaryFunction0DMaterial_methods[] = {

View File

@@ -63,7 +63,7 @@ static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned* sel
static PyObject * UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_unsigned->getName().c_str(), self->uf0D_unsigned);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_unsigned);
}
static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds)
@@ -86,7 +86,6 @@ static PyObject * UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *
return NULL;
}
return PyLong_FromLong(self->uf0D_unsigned->result);
}
static PyMethodDef BPy_UnaryFunction0DUnsigned_methods[] = {

View File

@@ -51,7 +51,9 @@ static char UnaryFunction0DVec2f___doc__[] =
static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f* self, PyObject *args, PyObject *kwds)
{
if ( !PyArg_ParseTuple(args, "") )
static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->uf0D_vec2f = new UnaryFunction0D<Vec2f>();
self->uf0D_vec2f->py_uf0D = (PyObject *)self;
@@ -67,31 +69,15 @@ static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f* self)
static PyObject * UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec2f->getName().c_str(), self->uf0D_vec2f );
}
static char UnaryFunction0DVec2f_getName___doc__[] =
".. method:: getName()\n"
"\n"
" Returns the name of the unary 0D predicate.\n"
"\n"
" :return: The name of the unary 0D predicate.\n"
" :rtype: str\n";
static PyObject * UnaryFunction0DVec2f_getName( BPy_UnaryFunction0DVec2f *self )
{
return PyUnicode_FromString( self->uf0D_vec2f->getName().c_str() );
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec2f);
}
static PyObject * UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"it", NULL};
PyObject *obj;
if( kwds != NULL ) {
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
return NULL;
if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D<Vec2f>)) {
@@ -106,12 +92,9 @@ static PyObject * UnaryFunction0DVec2f___call__( BPy_UnaryFunction0DVec2f *self,
return NULL;
}
return Vector_from_Vec2f(self->uf0D_vec2f->result);
}
/*----------------------UnaryFunction0DVec2f instance definitions ----------------------------*/
static PyMethodDef BPy_UnaryFunction0DVec2f_methods[] = {
{"getName", ( PyCFunction ) UnaryFunction0DVec2f_getName, METH_NOARGS, UnaryFunction0DVec2f_getName___doc__},
{NULL, NULL, 0, NULL}
};

View File

@@ -45,7 +45,9 @@ static char UnaryFunction0DVec3f___doc__[] =
static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f* self, PyObject *args, PyObject *kwds)
{
if ( !PyArg_ParseTuple(args, "") )
static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->uf0D_vec3f = new UnaryFunction0D<Vec3f>();
self->uf0D_vec3f->py_uf0D = (PyObject *)self;
@@ -61,31 +63,15 @@ static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f* self)
static PyObject * UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vec3f->getName().c_str(), self->uf0D_vec3f );
}
static char UnaryFunction0DVec3f_getName___doc__[] =
".. method:: getName()\n"
"\n"
" Returns the name of the unary 0D predicate.\n"
"\n"
" :return: The name of the unary 0D predicate.\n"
" :rtype: str\n";
static PyObject * UnaryFunction0DVec3f_getName( BPy_UnaryFunction0DVec3f *self )
{
return PyUnicode_FromString( self->uf0D_vec3f->getName().c_str() );
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec3f);
}
static PyObject * UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"it", NULL};
PyObject *obj;
if( kwds != NULL ) {
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
return NULL;
if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D<Vec3f>)) {
@@ -100,12 +86,9 @@ static PyObject * UnaryFunction0DVec3f___call__( BPy_UnaryFunction0DVec3f *self,
return NULL;
}
return Vector_from_Vec3f(self->uf0D_vec3f->result);
}
/*----------------------UnaryFunction0DVec3f instance definitions ----------------------------*/
static PyMethodDef BPy_UnaryFunction0DVec3f_methods[] = {
{"getName", ( PyCFunction ) UnaryFunction0DVec3f_getName, METH_NOARGS, UnaryFunction0DVec3f_getName___doc__},
{NULL, NULL, 0, NULL}
};

View File

@@ -46,7 +46,9 @@ static char UnaryFunction0DVectorViewShape___doc__[] =
static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape* self, PyObject *args, PyObject *kwds)
{
if ( !PyArg_ParseTuple(args, "") )
static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->uf0D_vectorviewshape = new UnaryFunction0D< std::vector<ViewShape*> >();
self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
@@ -62,31 +64,15 @@ static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVector
static PyObject * UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_vectorviewshape->getName().c_str(), self->uf0D_vectorviewshape );
}
static char UnaryFunction0DVectorViewShape_getName___doc__[] =
".. method:: getName()\n"
"\n"
" Returns the name of the unary 0D predicate.\n"
"\n"
" :return: The name of the unary 0D predicate.\n"
" :rtype: str\n";
static PyObject * UnaryFunction0DVectorViewShape_getName( BPy_UnaryFunction0DVectorViewShape *self )
{
return PyUnicode_FromString( self->uf0D_vectorviewshape->getName().c_str() );
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vectorviewshape);
}
static PyObject * UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVectorViewShape *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"it", NULL};
PyObject *obj;
if( kwds != NULL ) {
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
return NULL;
if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D< std::vector<ViewShape*> >)) {
@@ -116,9 +102,7 @@ static PyObject * UnaryFunction0DVectorViewShape___call__( BPy_UnaryFunction0DVe
return list;
}
/*----------------------UnaryFunction0DVectorViewShape instance definitions ----------------------------*/
static PyMethodDef BPy_UnaryFunction0DVectorViewShape_methods[] = {
{"getName", ( PyCFunction ) UnaryFunction0DVectorViewShape_getName, METH_NOARGS, UnaryFunction0DVectorViewShape_getName___doc__},
{NULL, NULL, 0, NULL}
};

View File

@@ -51,7 +51,9 @@ static char UnaryFunction0DViewShape___doc__[] =
static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape* self, PyObject *args, PyObject *kwds)
{
if ( !PyArg_ParseTuple(args, "") )
static const char *kwlist[] = {NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
return -1;
self->uf0D_viewshape = new UnaryFunction0D<ViewShape*>();
self->uf0D_viewshape->py_uf0D = (PyObject *)self;
@@ -67,31 +69,15 @@ static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape* s
static PyObject * UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf0D_viewshape->getName().c_str(), self->uf0D_viewshape );
}
static char UnaryFunction0DViewShape_getName___doc__[] =
".. method:: getName()\n"
"\n"
" Returns the name of the unary 0D predicate.\n"
"\n"
" :return: The name of the unary 0D predicate.\n"
" :rtype: str\n";
static PyObject * UnaryFunction0DViewShape_getName( BPy_UnaryFunction0DViewShape *self )
{
return PyUnicode_FromString( self->uf0D_viewshape->getName().c_str() );
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_viewshape);
}
static PyObject * UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"it", NULL};
PyObject *obj;
if( kwds != NULL ) {
PyErr_SetString(PyExc_TypeError, "keyword argument(s) not supported");
return NULL;
}
if(!PyArg_ParseTuple(args, "O!", &Interface0DIterator_Type, &obj))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
return NULL;
if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape*>)) {
@@ -106,12 +92,9 @@ static PyObject * UnaryFunction0DViewShape___call__( BPy_UnaryFunction0DViewShap
return NULL;
}
return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result));
}
/*----------------------UnaryFunction0DViewShape instance definitions ----------------------------*/
static PyMethodDef BPy_UnaryFunction0DViewShape_methods[] = {
{"getName", ( PyCFunction ) UnaryFunction0DViewShape_getName, METH_NOARGS, UnaryFunction0DViewShape_getName___doc__},
{NULL, NULL, 0, NULL}
};

View File

@@ -159,7 +159,7 @@ static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble* self)
static PyObject * UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_double->getName().c_str(), self->uf1D_double);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_double);
}
static PyObject * UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds)

View File

@@ -80,7 +80,7 @@ static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature*
static PyObject * UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_edgenature->getName().c_str(), self->uf1D_edgenature);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_edgenature);
}
static PyObject * UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds)

View File

@@ -73,7 +73,7 @@ static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat* self)
static PyObject * UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_float->getName().c_str(), self->uf1D_float);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_float);
}
static PyObject * UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds)

View File

@@ -80,7 +80,7 @@ static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned* sel
static PyObject * UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_unsigned->getName().c_str(), self->uf1D_unsigned);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_unsigned);
}
static PyObject * UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds)

View File

@@ -86,7 +86,7 @@ static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f* self)
static PyObject * UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec2f->getName().c_str(), self->uf1D_vec2f);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec2f);
}
static PyObject * UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds)

View File

@@ -80,7 +80,7 @@ static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f* self)
static PyObject * UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vec3f->getName().c_str(), self->uf1D_vec3f);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec3f);
}
static PyObject * UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds)

View File

@@ -93,7 +93,7 @@ static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVector
static PyObject * UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_vectorviewshape->getName().c_str(), self->uf1D_vectorviewshape);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vectorviewshape);
}
static PyObject * UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVectorViewShape *self, PyObject *args, PyObject *kwds)

View File

@@ -93,7 +93,7 @@ static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid* self)
static PyObject * UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid* self)
{
return PyUnicode_FromFormat("type: %s - address: %p", self->uf1D_void->getName().c_str(), self->uf1D_void);
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_void);
}
static PyObject * UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds)