barvinok 0.41.8
[barvinok.git] / interface / isl.py.top.no_pet
blob801c160fc0e25770e5247db38f029ef5f5644e8a
1 from ctypes import *
3 isl = cdll.LoadLibrary("libbarvinok.so")
4 libc = cdll.LoadLibrary("libc.so.6")
6 class Error(Exception):
7     pass
9 class Context:
10     defaultInstance = None
12     def __init__(self):
13         ptr = isl.isl_ctx_alloc()
14         self.ptr = ptr
16     def __del__(self):
17         isl.isl_ctx_free(self)
19     def from_param(self):
20         return c_void_p(self.ptr)
22     @staticmethod
23     def getDefaultInstance():
24         if Context.defaultInstance == None:
25             Context.defaultInstance = Context()
26         return Context.defaultInstance
28 isl.isl_ctx_alloc.restype = c_void_p
29 isl.isl_ctx_free.argtypes = [Context]