Renaming in _isl.c
authorVivien Maisonneuve <v.maisonneuve@gmail.com>
Tue, 24 Jun 2014 06:28:59 +0000 (08:28 +0200)
committerVivien Maisonneuve <v.maisonneuve@gmail.com>
Tue, 24 Jun 2014 06:29:21 +0000 (08:29 +0200)
pypol/_isl.c
pypol/isl.py

index 06f63fe..1b086dc 100644 (file)
@@ -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 *constraints;
+    PyObject *pointers;
 };
 };
-typedef struct _isl_constraint_list _isl_constraint_list;
+typedef struct pointer_list pointer_list;
 
 
-static 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->constraints, list->cursor++, value);
+    PyList_SET_ITEM(list->pointers, 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 *constraints;
-    _isl_constraint_list *list;
+    PyObject *pointers;
+    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;
     }
-    constraints = PyList_New(n);
-    if (constraints == NULL) {
+    pointers = PyList_New(n);
+    if (pointers == NULL) {
         return NULL;
     }
         return NULL;
     }
-    list = malloc(sizeof(_isl_constraint_list));
+    list = malloc(sizeof(pointer_list));
     if (list == NULL) {
     if (list == NULL) {
-        Py_DECREF(constraints);
+        Py_DECREF(pointers);
         return PyErr_NoMemory();
     }
     list->cursor = 0;
         return PyErr_NoMemory();
     }
     list->cursor = 0;
-    list->constraints = constraints;
-    n = isl_basic_set_foreach_constraint(bset,
-        _isl_isl_basic_set_add_constraint_list, list);
+    list->pointers = pointers;
+    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(constraints);
+        Py_DECREF(pointers);
         return NULL;
     }
         return NULL;
     }
-    return constraints;
+    return pointers;
 }
 
 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;
     }
 
index a295e9f..0b9a485 100644 (file)
@@ -12,7 +12,7 @@ __all__ = [
 libisl = ctypes.CDLL(ctypes.util.find_library('isl'))
 
 libisl.isl_printer_get_str.restype = ctypes.c_char_p
 libisl = ctypes.CDLL(ctypes.util.find_library('isl'))
 
 libisl.isl_printer_get_str.restype = ctypes.c_char_p
-libisl.isl_dim_set = _isl.isl_dim_set
+libisl.isl_dim_set = _isl.dim_set
 
 
 class IslObject:
 
 
 class IslObject:
@@ -59,4 +59,4 @@ class BasicSet(IslObject):
         libisl.isl_basic_set_free(self)
 
     def constraints(self):
         libisl.isl_basic_set_free(self)
 
     def constraints(self):
-        return _isl.isl_basic_set_constraints(self._ptr)
+        return _isl.basic_set_constraints(self._ptr)