Exemplo n.º 1
0
 def __init__(self, ptr=None):
     # FIXME: Rename this to ptr or context_ptr to be consistent with other
     #        API objects
     self.external_ptr = True
     if ptr is None:
         self.external_ptr = False
         ptr = libcoreir_c.CORENewContext()
     self.context = ptr
     self.global_namespace = Namespace(
         libcoreir_c.COREGetGlobal(self.context), self)
     self.named_types = NamedTypesDict(self)
Exemplo n.º 2
0
 def load_library(self, name):
     lib = load_coreir_lib(name)
     func = getattr(lib, "CORELoadLibrary_{}".format(name))
     func.argtypes = [COREContext_p]
     func.restype = CORENamespace_p
     return Namespace(func(self.context), self)
Exemplo n.º 3
0
 def new_namespace(self, name):
     ns = libcoreir_c.CORENewNamespace(self.context,
                                       ct.c_char_p(str.encode(name)))
     return Namespace(ns, self)
Exemplo n.º 4
0
 def __init__(self):
     # FIXME: Rename this to ptr or context_ptr to be consistent with other
     #        API objects
     self.context = libcoreir_c.CORENewContext()
     self.G = Namespace(libcoreir_c.COREGetGlobal(self.context), self)