From e66c171545301da1055bc96f19393de0f7b5a5e0 Mon Sep 17 00:00:00 2001
From: Vivien Maisonneuve <v.maisonneuve@gmail.com>
Date: Fri, 4 Jul 2014 16:13:25 +0200
Subject: [PATCH] Add helper function islhelper.isl_vertices_vertices()

---
 pypol/_islhelper.c | 27 +++++++++++++++++++++++++++
 pypol/islhelper.py |  1 +
 2 files changed, 28 insertions(+)

diff --git a/pypol/_islhelper.c b/pypol/_islhelper.c
index a7b4f33..47ee1be 100644
--- a/pypol/_islhelper.c
+++ b/pypol/_islhelper.c
@@ -2,6 +2,7 @@
 
 #include <isl/constraint.h>
 #include <isl/set.h>
+#include <isl/vertices.h>
 
 
 static inline int _append_pointer_to_list(void *pointer, void *user) {
@@ -89,11 +90,37 @@ static PyObject * isl_set_points(PyObject *self, PyObject *args) {
     return list;
 }
 
+static int _append_vertex_to_list(isl_vertex *vertex, void* user) {
+    return _append_pointer_to_list((void *) vertex, user);
+}
+
+static PyObject * isl_vertices_vertices(PyObject *self, PyObject *args) {
+    long pointer;
+    isl_vertices *vertices;
+    PyObject *list;
+    if (!PyArg_ParseTuple(args, "l", &pointer)) {
+        return NULL;
+    }
+    vertices = (isl_vertices *) pointer;
+    list = PyList_New(0);
+    if (list == NULL) {
+        return NULL;
+    }
+    if (isl_vertices_foreach_vertex(vertices, _append_vertex_to_list, list) == -1) {
+        PyErr_SetString(PyExc_RuntimeError,
+            "an error occurred in isl_vertices_foreach_vertex");
+        Py_DECREF(list);
+        return NULL;
+    }
+    return list;
+}
+
 
 static PyMethodDef _islhelper_methods[] = {
     {"isl_basic_set_constraints", isl_basic_set_constraints, METH_VARARGS, NULL},
     {"isl_set_basic_sets", isl_set_basic_sets, METH_VARARGS, NULL},
     {"isl_set_points", isl_set_points, METH_VARARGS, NULL},
+    {"isl_vertices_vertices", isl_vertices_vertices, METH_VARARGS, NULL},
     {NULL, NULL, 0, NULL}
 };
 
diff --git a/pypol/islhelper.py b/pypol/islhelper.py
index e796618..21bd5b9 100644
--- a/pypol/islhelper.py
+++ b/pypol/islhelper.py
@@ -12,6 +12,7 @@ __all__ = [
     'isl_basic_set_to_str', 'isl_basic_set_constraints',
     'isl_set_to_str', 'isl_set_basic_sets',
     'isl_set_points',
+    'isl_vertices_vertices',
 ]
 
 
-- 
2.20.1