3 from ctypes.util import find_library
5 isl_dyld_library_path = os.environ.get('ISL_DYLD_LIBRARY_PATH')
6 if isl_dyld_library_path != None:
7 os.environ['DYLD_LIBRARY_PATH'] = isl_dyld_library_path
9 isl = cdll.LoadLibrary(isl_dlname)
11 isl = cdll.LoadLibrary(find_library("isl"))
12 libc = cdll.LoadLibrary(find_library("c"))
14 class Error(Exception):
18 defaultInstance = None
21 ptr = isl.isl_ctx_alloc()
25 isl.isl_ctx_free(self)
28 return c_void_p(self.ptr)
31 def getDefaultInstance():
32 if Context.defaultInstance == None:
33 Context.defaultInstance = Context()
34 return Context.defaultInstance
36 @CFUNCTYPE(None, py_object)
38 pythonapi.Py_DecRef(py_object(user))
40 isl.isl_ctx_alloc.restype = c_void_p
41 isl.isl_ctx_free.argtypes = [Context]
42 isl.isl_id_alloc.restype = c_void_p
43 isl.isl_id_alloc.argtypes = [Context, c_char_p, py_object]
44 isl.isl_id_set_free_user.restype = c_void_p
45 isl.isl_id_set_free_user.argtypes = [c_void_p, c_void_p]
46 isl.isl_id_get_free_user.restype = c_void_p
47 isl.isl_id_get_free_user.argtypes = [c_void_p]
48 isl.isl_id_get_user.restype = py_object
49 isl.isl_id_get_user.argtypes = [c_void_p]