X-Git-Url: https://scm.cri.mines-paristech.fr/git/linpy.git/blobdiff_plain/34f5424e5e4fef9ffeb2934ce2e62c0a906ca9e0..2c6add2e9a2fbc48a6421ecd22f2f7fa9cbb15a0:/pypol/_islhelper.c?ds=inline diff --git a/pypol/_islhelper.c b/pypol/_islhelper.c index bc62968..7e2408e 100644 --- a/pypol/_islhelper.c +++ b/pypol/_islhelper.c @@ -36,7 +36,6 @@ static PyObject * isl_basic_set_constraints(PyObject *self, PyObject* args) { return NULL; } bset = (isl_basic_set *) ptr; - bset = isl_basic_set_finalize(bset); n = isl_basic_set_n_constraint(bset); if (n == -1) { PyErr_SetString(PyExc_RuntimeError, @@ -120,9 +119,46 @@ static PyObject * isl_set_basic_sets(PyObject *self, PyObject *args) { } +static int pointer_list_append_point(isl_point *point, void *user) { + PyObject *pointers, *value; + + pointers = (PyObject *) user; + value = PyLong_FromVoidPtr(point); + if (value == NULL) { + return -1; + } + return PyList_Append(pointers, value); +} + +static PyObject * isl_set_points(PyObject *self, PyObject *args) { + long ptr; + isl_set *set; + int n; + PyObject *pointers; + + if (!PyArg_ParseTuple(args, "l", &ptr)) { + return NULL; + } + set = (isl_set *) ptr; + pointers = PyList_New(0); + if (pointers == NULL) { + return NULL; + } + n = isl_set_foreach_point(set, pointer_list_append_point, pointers); + if (n == -1) { + PyErr_SetString(PyExc_RuntimeError, + "an error occurred in isl_set_foreach_point"); + Py_DECREF(pointers); + return NULL; + } + return pointers; +} + + static PyMethodDef _islhelper_methods[] = { {"isl_basic_set_constraints", isl_basic_set_constraints, METH_VARARGS, NULL}, {"isl_set_basic_sets", isl_set_basic_sets, METH_VARARGS, NULL}, + {"isl_set_points", isl_set_points, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} };