3 #include <isl/constraint.h>
6 struct _isl_constraint_list
{
10 typedef struct _isl_constraint_list _isl_constraint_list
;
12 int _isl_isl_basic_set_add_constraint_list(__isl_take isl_constraint
*c
,
14 _isl_constraint_list
*list
;
17 list
= (_isl_constraint_list
*) user
;
18 value
= PyLong_FromVoidPtr(c
);
22 PyList_SET_ITEM(list
->constraints
, list
->cursor
++, value
);
26 static PyObject
* _isl_isl_basic_set_constraints(PyObject
*self
,
31 PyObject
*constraints
;
32 _isl_constraint_list
*list
;
34 if (!PyArg_ParseTuple(args
, "l", &ptr
))
36 bset
= (isl_basic_set
*) ptr
;
37 n
= isl_basic_set_n_constraint(bset
);
39 PyErr_SetString(PyExc_RuntimeError
,
40 "an error occurred in isl_basic_set_n_constraint");
43 constraints
= PyList_New(n
);
44 if (constraints
== NULL
) {
47 list
= malloc(sizeof(_isl_constraint_list
));
49 Py_DECREF(constraints
);
50 return PyErr_NoMemory();
53 list
->constraints
= constraints
;
54 n
= isl_basic_set_foreach_constraint(bset
,
55 _isl_isl_basic_set_add_constraint_list
, list
);
58 PyErr_SetString(PyExc_RuntimeError
,
59 "an error occurred in isl_basic_set_foreach_constraint");
60 Py_DECREF(constraints
);
66 static PyMethodDef _isl_methods
[] = {
67 {"isl_basic_set_constraints", _isl_isl_basic_set_constraints
, METH_VARARGS
, NULL
},
71 static struct PyModuleDef _islmodule
= {
72 PyModuleDef_HEAD_INIT
,
79 PyMODINIT_FUNC
PyInit__isl(void) {
81 m
= PyModule_Create(&_islmodule
);
86 if (PyModule_AddObject(m
, "isl_dim_set", PyLong_FromLong(isl_dim_set
)) == -1) {