3 #include <isl/constraint.h>
10 typedef struct pointer_list pointer_list
;
12 static int pointer_list_append_constraint(isl_constraint
*c
, void *user
) {
16 list
= (pointer_list
*) user
;
17 value
= PyLong_FromVoidPtr(c
);
21 PyList_SET_ITEM(list
->pointers
, list
->cursor
++, value
);
25 static PyObject
* basic_set_constraints(PyObject
*self
, PyObject
* args
) {
32 if (!PyArg_ParseTuple(args
, "l", &ptr
))
34 bset
= (isl_basic_set
*) ptr
;
35 n
= isl_basic_set_n_constraint(bset
);
37 PyErr_SetString(PyExc_RuntimeError
,
38 "an error occurred in isl_basic_set_n_constraint");
41 pointers
= PyList_New(n
);
42 if (pointers
== NULL
) {
45 list
= malloc(sizeof(pointer_list
));
48 return PyErr_NoMemory();
51 list
->pointers
= pointers
;
52 n
= isl_basic_set_foreach_constraint(bset
, pointer_list_append_constraint
,
56 PyErr_SetString(PyExc_RuntimeError
,
57 "an error occurred in isl_basic_set_foreach_constraint");
64 static PyMethodDef _isl_methods
[] = {
65 {"basic_set_constraints", basic_set_constraints
, METH_VARARGS
, NULL
},
69 static struct PyModuleDef _islmodule
= {
70 PyModuleDef_HEAD_INIT
,
77 PyMODINIT_FUNC
PyInit__isl(void) {
79 m
= PyModule_Create(&_islmodule
);
84 if (PyModule_AddObject(m
, "dim_set", PyLong_FromLong(isl_dim_set
)) == -1) {