From d02aea22bba1f455c63fe948898e22c8fc2c3ea0 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Wed, 3 Jun 2015 09:36:12 -0500 Subject: [PATCH] Retain compatibility with isl 14/barvinok --- gen_wrap.py | 26 ++++++++++++++++++++++---- isl | 2 +- src/wrapper/wrap_isl.cpp | 2 ++ src/wrapper/wrap_isl.hpp | 2 ++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gen_wrap.py b/gen_wrap.py index e3ffb0a..a9b43c8 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -507,7 +507,13 @@ def get_callback(cb_name, cb): %(body)s py::object retval = py_cb(%(passed_args)s); if (retval.ptr() == Py_None) - return isl_stat_ok; + { + #if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) + return isl_stat_ok; + #else + return 0; + #endif + } else return py::extract<%(ret_type)s>(retval); } @@ -516,7 +522,11 @@ def get_callback(cb_name, cb): std::cout << "[islpy warning] A Python exception occurred in " "a call back function, ignoring:" << std::endl; PyErr_Print(); - return isl_stat_error; + #if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) + return isl_stat_error; + #else + return -1; + #endif } catch (std::exception &e) { @@ -524,7 +534,11 @@ def get_callback(cb_name, cb): "a Python callback query:" << std::endl << e.what() << std::endl; std::cout << "[islpy] Aborting now." << std::endl; - return isl_stat_error; + #if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) + return isl_stat_error; + #else + return -1; + #endif } } """ % dict( @@ -826,7 +840,11 @@ def write_wrapper(outf, meth): if meth.return_base_type in ["int", "isl_stat"] and not meth.return_ptr: body.append(""" - if (result == isl_stat_error) + #if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) + if (result == isl_stat_error) + #else + if (result == -1) + #endif { throw isl::error("call to isl_%(cls)s_%(name)s failed"); }""" % {"cls": meth.cls, "name": meth.name}) diff --git a/isl b/isl index 34a816a..3916fbc 160000 --- a/isl +++ b/isl @@ -1 +1 @@ -Subproject commit 34a816af373253fca8dfd0f69a5424f02895af64 +Subproject commit 3916fbc5f0bab03d03ab886dde3fa4328a113af6 diff --git a/src/wrapper/wrap_isl.cpp b/src/wrapper/wrap_isl.cpp index 483ea9f..fbea3ee 100644 --- a/src/wrapper/wrap_isl.cpp +++ b/src/wrapper/wrap_isl.cpp @@ -54,6 +54,7 @@ BOOST_PYTHON_MODULE(_isl) } */ +#if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) py::enum_("error") .ENUM_VALUE(isl_error_, none) .ENUM_VALUE(isl_error_, abort) @@ -67,6 +68,7 @@ BOOST_PYTHON_MODULE(_isl) .ENUM_VALUE(isl_stat_, error) .ENUM_VALUE(isl_stat_, ok) ; +#endif py::enum_("dim_type") .ENUM_VALUE(isl_dim_, cst) diff --git a/src/wrapper/wrap_isl.hpp b/src/wrapper/wrap_isl.hpp index 47e244a..e852589 100644 --- a/src/wrapper/wrap_isl.hpp +++ b/src/wrapper/wrap_isl.hpp @@ -16,7 +16,9 @@ #include #include #include +#if !defined(ISLPY_ISL_VERSION) || (ISLPY_ISL_VERSION >= 15) #include +#endif #include #include #include -- GitLab