From: Vivien Maisonneuve Date: Wed, 18 Jun 2014 16:16:34 +0000 (+0200) Subject: Rename islhelper into _isl X-Git-Tag: 1.0~248 X-Git-Url: https://scm.cri.ensmp.fr/git/linpy.git/commitdiff_plain/3b1b3560c8880ef25995a18b6e365e0d730a2df2 Rename islhelper into _isl --- diff --git a/pypol/.gitignore b/pypol/.gitignore index 1476115..7951d19 100644 --- a/pypol/.gitignore +++ b/pypol/.gitignore @@ -1 +1 @@ -/islhelper.*.so +/_isl.*.so diff --git a/pypol/islhelper.c b/pypol/_isl.c similarity index 56% rename from pypol/islhelper.c rename to pypol/_isl.c index 38f249d..974b0c0 100644 --- a/pypol/islhelper.c +++ b/pypol/_isl.c @@ -1,21 +1,21 @@ #include #include -static PyMethodDef islhelper_methods[] = { +static PyMethodDef _isl_methods[] = { {NULL, NULL, 0, NULL} }; -static struct PyModuleDef islhelpermodule = { +static struct PyModuleDef _islmodule = { PyModuleDef_HEAD_INIT, - "islhelper", + "_isl", NULL, -1, - islhelper_methods + _isl_methods }; -PyMODINIT_FUNC PyInit_islhelper(void) { +PyMODINIT_FUNC PyInit__isl(void) { PyObject *m; - m = PyModule_Create(&islhelpermodule); + m = PyModule_Create(&_islmodule); if (m == NULL) return NULL; diff --git a/pypol/isl.py b/pypol/isl.py index 0513358..5a20514 100644 --- a/pypol/isl.py +++ b/pypol/isl.py @@ -10,10 +10,13 @@ import numbers import operator import re +from . import _isl + 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 class IslObject: diff --git a/pypol/linear.py b/pypol/linear.py index 07c6293..8e96f35 100644 --- a/pypol/linear.py +++ b/pypol/linear.py @@ -4,8 +4,8 @@ import numbers from fractions import Fraction, gcd -from . import isl, islhelper -from .isl import libisl, Context, BasicSet +from . import isl +from .isl import libisl __all__ = [ @@ -42,7 +42,7 @@ def _polymorphic_operator(func): return wrapper -_main_ctx = Context() +_main_ctx = isl.Context() class Expression: @@ -516,7 +516,7 @@ class Polyhedron: for eq in coeff_eq: num = coeff_eq.get(eq) iden = symbols.index(eq) - ceq = libisl.isl_constraint_set_coefficient_si(ceq, islhelper.isl_dim_set, iden, num) #use 3 for type isl_dim_set + ceq = libisl.isl_constraint_set_coefficient_si(ceq, libisl.isl_dim_set, iden, num) #use 3 for type isl_dim_set bset = libisl.isl_basic_set_add_constraint(bset, ceq) if list(self.inequalities): #check if any inequalities exist for ineq in self.inequalities: @@ -527,9 +527,9 @@ class Polyhedron: for ineq in coeff_in: num = coeff_in.get(ineq) iden = symbols.index(ineq) - cin = libisl.isl_constraint_set_coefficient_si(cin, islhelper.isl_dim_set, iden, num) #use 3 for type isl_dim_set + cin = libisl.isl_constraint_set_coefficient_si(cin, libisl.isl_dim_set, iden, num) #use 3 for type isl_dim_set bset = libisl.isl_basic_set_add_constraint(bset, cin) - bset = BasicSet(bset) + bset = isl.BasicSet(bset) return bset def from_isl(self, bset): diff --git a/setup.py b/setup.py index 57aa813..caeacb5 100755 --- a/setup.py +++ b/setup.py @@ -8,6 +8,6 @@ setup( author='MINES ParisTech', packages=['pypol'], ext_modules = [ - Extension('pypol.islhelper', sources=['pypol/islhelper.c']) + Extension('pypol._isl', sources=['pypol/_isl.c']) ] )