18e888ba20577e63ae13e63b76f8fa94ec6ea16c
2 This file is part of Linpy.
4 Linpy is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Linpy is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Linpy. If not, see <http://www.gnu.org/licenses/>.
18 import ctypes
, ctypes
.util
20 from . import _islhelper
21 from ._islhelper
import *
29 'isl_basic_set_to_str', 'isl_basic_set_constraints',
30 'isl_set_to_str', 'isl_set_basic_sets',
32 'isl_vertices_vertices',
33 'isl_multi_aff_to_str',
37 libisl
= ctypes
.CDLL(ctypes
.util
.find_library('isl'))
38 libisl
.isl_dim_set
= _islhelper
.dim_set
40 libisl
.isl_version
.restype
= ctypes
.c_char_p
41 isl_version
= libisl
.isl_version().decode().strip()[len('isl-'):]
44 mainctx
= libisl
.isl_ctx_alloc()
47 libisl
.isl_printer_get_str
.restype
= ctypes
.c_char_p
49 def isl_val_to_int(islval
):
50 islpr
= libisl
.isl_printer_to_str(mainctx
)
51 islpr
= libisl
.isl_printer_print_val(islpr
, islval
)
52 string
= libisl
.isl_printer_get_str(islpr
).decode()
55 def isl_basic_set_to_str(islbset
):
56 islpr
= libisl
.isl_printer_to_str(mainctx
)
57 islpr
= libisl
.isl_printer_print_basic_set(islpr
, islbset
)
58 string
= libisl
.isl_printer_get_str(islpr
).decode()
61 def isl_set_to_str(islset
):
62 islpr
= libisl
.isl_printer_to_str(mainctx
)
63 islpr
= libisl
.isl_printer_print_set(islpr
, islset
)
64 string
= libisl
.isl_printer_get_str(islpr
).decode()
67 def isl_multi_aff_to_str(islmaff
):
68 islpr
= libisl
.isl_printer_to_str(mainctx
)
69 islpr
= libisl
.isl_printer_print_multi_aff(islpr
, islmaff
)
70 string
= libisl
.isl_printer_get_str(islpr
).decode()
73 # Copyright 2014 MINES ParisTech