projects
/
linpy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unitary tests for Polyhedron, very incomplete
[linpy.git]
/
pypol
/
_isl.c
diff --git
a/pypol/_isl.c
b/pypol/_isl.c
index
b9d6092
..
1b086dc
100644
(file)
--- a/
pypol/_isl.c
+++ b/
pypol/_isl.c
@@
-3,33
+3,31
@@
#include <isl/constraint.h>
#include <isl/set.h>
#include <isl/constraint.h>
#include <isl/set.h>
-struct
_isl_constraint
_list {
+struct
pointer
_list {
int cursor;
int cursor;
- PyObject *
constraint
s;
+ PyObject *
pointer
s;
};
};
-typedef struct
_isl_constraint_list _isl_constraint
_list;
+typedef struct
pointer_list pointer
_list;
-int _isl_isl_basic_set_add_constraint_list(__isl_take isl_constraint *c,
- void *user) {
- _isl_constraint_list *list;
+static int pointer_list_append_constraint(isl_constraint *c, void *user) {
+ pointer_list *list;
PyObject *value;
PyObject *value;
- list = (
_isl_constraint
_list *) user;
+ list = (
pointer
_list *) user;
value = PyLong_FromVoidPtr(c);
if (value == NULL) {
return -1;
}
value = PyLong_FromVoidPtr(c);
if (value == NULL) {
return -1;
}
- PyList_SET_ITEM(list->
constraint
s, list->cursor++, value);
+ PyList_SET_ITEM(list->
pointer
s, list->cursor++, value);
return 0;
}
return 0;
}
-static PyObject * _isl_isl_basic_set_constraints(PyObject *self,
- PyObject* args) {
+static PyObject * basic_set_constraints(PyObject *self, PyObject* args) {
long ptr;
isl_basic_set *bset;
int n;
long ptr;
isl_basic_set *bset;
int n;
- PyObject *
constraint
s;
-
_isl_constraint
_list *list;
+ PyObject *
pointer
s;
+
pointer
_list *list;
if (!PyArg_ParseTuple(args, "l", &ptr))
return NULL;
if (!PyArg_ParseTuple(args, "l", &ptr))
return NULL;
@@
-40,31
+38,31
@@
static PyObject * _isl_isl_basic_set_constraints(PyObject *self,
"an error occurred in isl_basic_set_n_constraint");
return NULL;
}
"an error occurred in isl_basic_set_n_constraint");
return NULL;
}
-
constraint
s = PyList_New(n);
- if (
constraint
s == NULL) {
+
pointer
s = PyList_New(n);
+ if (
pointer
s == NULL) {
return NULL;
}
return NULL;
}
- list = malloc(sizeof(
_isl_constraint
_list));
+ list = malloc(sizeof(
pointer
_list));
if (list == NULL) {
if (list == NULL) {
- Py_DECREF(
constraint
s);
+ Py_DECREF(
pointer
s);
return PyErr_NoMemory();
}
list->cursor = 0;
return PyErr_NoMemory();
}
list->cursor = 0;
- list->
constraints = constraint
s;
- n = isl_basic_set_foreach_constraint(bset,
-
_isl_isl_basic_set_add_constraint_list,
list);
+ list->
pointers = pointer
s;
+ n = isl_basic_set_foreach_constraint(bset,
pointer_list_append_constraint,
+ list);
free(list);
if (n == -1) {
PyErr_SetString(PyExc_RuntimeError,
"an error occurred in isl_basic_set_foreach_constraint");
free(list);
if (n == -1) {
PyErr_SetString(PyExc_RuntimeError,
"an error occurred in isl_basic_set_foreach_constraint");
- Py_DECREF(
constraint
s);
+ Py_DECREF(
pointer
s);
return NULL;
}
return NULL;
}
- return
constraint
s;
+ return
pointer
s;
}
static PyMethodDef _isl_methods[] = {
}
static PyMethodDef _isl_methods[] = {
- {"
isl_basic_set_constraints", _isl_isl_
basic_set_constraints, METH_VARARGS, NULL},
+ {"
basic_set_constraints",
basic_set_constraints, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
{NULL, NULL, 0, NULL}
};
@@
-83,7
+81,7
@@
PyMODINIT_FUNC PyInit__isl(void) {
return NULL;
}
return NULL;
}
- if (PyModule_AddObject(m, "
isl_
dim_set", PyLong_FromLong(isl_dim_set)) == -1) {
+ if (PyModule_AddObject(m, "dim_set", PyLong_FromLong(isl_dim_set)) == -1) {
return NULL;
}
return NULL;
}