* Added matrix module

* Moved the function EXPP_tuple_repr from vector.c to gen_utils.[ch]
* Matrix functionality should work now in Object module.
* Fixed compilation warning about implicit declaration of M_World_Init.
  Added the declaration to modules.h
This commit is contained in:
2003-06-22 20:14:11 +00:00
parent ab9e15b75d
commit 61e41f6817
7 changed files with 209 additions and 43 deletions

View File

@@ -188,3 +188,34 @@ int EXPP_check_sequence_consistency(PyObject *seq, PyTypeObject *against)
}
return 1;
}
PyObject *EXPP_tuple_repr(PyObject *self, int size)
{
PyObject *repr, *comma, *item;
int i;
/*@ note: a value must be built because the list is decrefed!
* otherwise we have nirvana pointers inside python.. */
repr = PyString_FromString("(");
if (!repr) return 0;
item = PySequence_GetItem(self, 0);
PyString_ConcatAndDel(&repr, PyObject_Repr(item));
Py_DECREF(item);
comma = PyString_FromString(", ");
for (i = 1; i < size; i++) {
PyString_Concat(&repr, comma);
item = PySequence_GetItem(self, i);
PyString_ConcatAndDel(&repr, PyObject_Repr(item));
Py_DECREF(item);
}
PyString_ConcatAndDel(&repr, PyString_FromString(")"));
Py_DECREF(comma);
return repr;
}