added comparison function to many python types so you can do == and =!

This commit is contained in:
2006-10-06 16:48:28 +00:00
parent aaaae78527
commit dda63a9dde
21 changed files with 122 additions and 41 deletions

View File

@@ -124,8 +124,10 @@ static PyMethodDef BPy_Action_methods[] = {
static void Action_dealloc( BPy_Action * bone );
static PyObject *Action_getAttr( BPy_Action * bone, char *name );
static int Action_setAttr( BPy_Action * bone, char *name, PyObject * v );
static int Action_compare( BPy_Action * a, BPy_Action * b );
static PyObject *Action_repr( BPy_Action * bone );
/*****************************************************************************/
/* Python TypeAction structure definition: */
/*****************************************************************************/
@@ -140,7 +142,7 @@ PyTypeObject Action_Type = {
0, /* tp_print */
( getattrfunc ) Action_getAttr, /* tp_getattr */
( setattrfunc ) Action_setAttr, /* tp_setattr */
0, /* tp_compare */
( cmpfunc ) Action_compare, /* tp_compare */
( reprfunc ) Action_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
@@ -495,6 +497,13 @@ static int Action_setAttr( BPy_Action * self, char *name, PyObject * value )
return 0; /* normal exit */
}
/*----------------------------------------------------------------------*/
static int Action_compare( BPy_Action * a, BPy_Action * b )
{
return ( a->action == b->action ) ? 0 : -1;
}
/*----------------------------------------------------------------------*/
static PyObject *Action_repr( BPy_Action * self )
{