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 return PyList_SetItem(list
->constraints
, list
->cursor
++, value
);
25 static PyObject
* _isl_isl_basic_set_constraints(PyObject
*self
,
30 PyObject
*constraints
;
31 _isl_constraint_list
*list
;
33 if (!PyArg_ParseTuple(args
, "l", &ptr
))
35 bset
= (isl_basic_set
*) ptr
;
36 n
= isl_basic_set_n_constraint(bset
);
38 PyErr_SetString(PyExc_RuntimeError
,
39 "an error occurred in isl_basic_set_n_constraint");
42 constraints
= PyList_New(n
);
43 if (constraints
== NULL
) {
46 list
= malloc(sizeof(_isl_constraint_list
));
48 Py_DECREF(constraints
);
49 return PyErr_NoMemory();
52 list
->constraints
= constraints
;
53 n
= isl_basic_set_foreach_constraint(bset
,
54 _isl_isl_basic_set_add_constraint_list
, list
);
57 PyErr_SetString(PyExc_RuntimeError
,
58 "an error occurred in isl_basic_set_foreach_constraint");
59 Py_DECREF(constraints
);
65 static PyMethodDef _isl_methods
[] = {
66 {"isl_basic_set_constraints", _isl_isl_basic_set_constraints
, METH_VARARGS
, NULL
},
70 static struct PyModuleDef _islmodule
= {
71 PyModuleDef_HEAD_INIT
,
78 PyMODINIT_FUNC
PyInit__isl(void) {
80 m
= PyModule_Create(&_islmodule
);
85 if (PyModule_AddObject(m
, "isl_dim_set", PyLong_FromLong(isl_dim_set
)) == -1) {