3 #include <isl/constraint.h>
7 static inline int _append_pointer_to_list(void *pointer
, void *user
) {
9 list
= (PyObject
*) user
;
10 item
= PyLong_FromVoidPtr(pointer
);
14 return PyList_Append(list
, item
);
17 static int _append_constraint_to_list(isl_constraint
*constraint
, void *user
) {
18 return _append_pointer_to_list((void *) constraint
, user
);
21 static PyObject
* isl_basic_set_constraints(PyObject
*self
, PyObject
*args
) {
25 if (!PyArg_ParseTuple(args
, "l", &pointer
)) {
28 bset
= (isl_basic_set
*) pointer
;
33 if (isl_basic_set_foreach_constraint(bset
, _append_constraint_to_list
, list
) == -1) {
34 PyErr_SetString(PyExc_RuntimeError
,
35 "an error occurred in isl_basic_set_foreach_constraint");
42 static int _append_basic_set_to_list(isl_basic_set
*bset
, void *user
) {
43 return _append_pointer_to_list((void *) bset
, user
);
46 static PyObject
* isl_set_basic_sets(PyObject
*self
, PyObject
*args
) {
50 if (!PyArg_ParseTuple(args
, "l", &pointer
)) {
53 set
= (isl_set
*) pointer
;
58 if (isl_set_foreach_basic_set(set
, _append_basic_set_to_list
, list
) == -1) {
59 PyErr_SetString(PyExc_RuntimeError
,
60 "an error occurred in isl_set_foreach_basic_set");
67 static int _append_point_to_list(isl_point
*point
, void* user
) {
68 return _append_pointer_to_list((void *) point
, user
);
71 static PyObject
* isl_set_points(PyObject
*self
, PyObject
*args
) {
75 if (!PyArg_ParseTuple(args
, "l", &pointer
)) {
78 set
= (isl_set
*) pointer
;
83 if (isl_set_foreach_point(set
, _append_point_to_list
, list
) == -1) {
84 PyErr_SetString(PyExc_RuntimeError
,
85 "an error occurred in isl_set_foreach_point");
93 static PyMethodDef _islhelper_methods
[] = {
94 {"isl_basic_set_constraints", isl_basic_set_constraints
, METH_VARARGS
, NULL
},
95 {"isl_set_basic_sets", isl_set_basic_sets
, METH_VARARGS
, NULL
},
96 {"isl_set_points", isl_set_points
, METH_VARARGS
, NULL
},
100 static struct PyModuleDef _islhelpermodule
= {
101 PyModuleDef_HEAD_INIT
,
108 PyMODINIT_FUNC
PyInit__islhelper(void) {
110 m
= PyModule_Create(&_islhelpermodule
);
115 if (PyModule_AddObject(m
, "dim_set", PyLong_FromLong(isl_dim_set
)) == -1) {