def _setup_repr(self): if 'item_repr' not in self.__dict__: self.external_item_repr, self.item_repr = externalvsinternal(self.rtyper, self._item_repr_computer()) if isinstance(self.LIST, GcForwardReference): ITEM = self.item_repr.lowleveltype ITEMARRAY = self.get_itemarray_lowleveltype() self.LIST.become(ITEMARRAY)
def _setup_repr(self): if "item_repr" not in self.__dict__: self.external_item_repr, self.item_repr = externalvsinternal(self.rtyper, self._item_repr_computer()) if isinstance(self.LIST, GcForwardReference): ITEM = self.item_repr.lowleveltype ITEMARRAY = self.get_itemarray_lowleveltype() # XXX we might think of turning length stuff into Unsigned self.LIST.become( GcStruct( "list", ("length", Signed), ("items", Ptr(ITEMARRAY)), adtmeths=ADTIList( { "ll_newlist": ll_newlist, "ll_newlist_hint": ll_newlist_hint, "ll_newemptylist": ll_newemptylist, "ll_length": ll_length, "ll_items": ll_items, ##"list_builder": self.list_builder, "ITEM": ITEM, "ll_getitem_fast": ll_getitem_fast, "ll_setitem_fast": ll_setitem_fast, "_ll_resize_ge": _ll_list_resize_ge, "_ll_resize_le": _ll_list_resize_le, "_ll_resize": _ll_list_resize, } ), ) )
def _setup_repr(self): if 'item_repr' not in self.__dict__: self.external_item_repr, self.item_repr = externalvsinternal( self.rtyper, self._item_repr_computer()) if isinstance(self.LIST, GcForwardReference): ITEMARRAY = self.get_itemarray_lowleveltype() self.LIST.become(ITEMARRAY)
def _setup_repr(self): if 'item_repr' not in self.__dict__: self.external_item_repr, self.item_repr = externalvsinternal( self.rtyper, self._item_repr_computer()) if isinstance(self.LIST, GcForwardReference): ITEM = self.item_repr.lowleveltype ITEMARRAY = self.get_itemarray_lowleveltype() # XXX we might think of turning length stuff into Unsigned self.LIST.become( GcStruct( "list", ("length", Signed), ("items", Ptr(ITEMARRAY)), adtmeths=ADTIList({ "ll_newlist": ll_newlist, "ll_newlist_hint": ll_newlist_hint, "ll_newemptylist": ll_newemptylist, "ll_length": ll_length, "ll_items": ll_items, ##"list_builder": self.list_builder, "ITEM": ITEM, "ll_getitem_fast": ll_getitem_fast, "ll_setitem_fast": ll_setitem_fast, "_ll_resize_ge": _ll_list_resize_ge, "_ll_resize_le": _ll_list_resize_le, "_ll_resize": _ll_list_resize, })))
def __init__(self, rtyper, item_repr, listitem=None, known_maxlength=False): self.rtyper = rtyper self.LIST = GcForwardReference() self.lowleveltype = Ptr(self.LIST) if not isinstance(item_repr, Repr): # not computed yet, done by setup() assert callable(item_repr) self._item_repr_computer = item_repr else: self.external_item_repr, self.item_repr = externalvsinternal(rtyper, item_repr) self.listitem = listitem self.list_cache = {}
def __init__(self, rtyper, items_r): self.items_r = [] self.external_items_r = [] for item_r in items_r: external_repr, internal_repr = externalvsinternal(rtyper, item_r) self.items_r.append(internal_repr) self.external_items_r.append(external_repr) items_r = self.items_r self.fieldnames = ['item%d' % i for i in range(len(items_r))] self.lltypes = [r.lowleveltype for r in items_r] self.tuple_cache = {}
def __init__(self, rtyper, item_repr, listitem=None): self.rtyper = rtyper if not isinstance(item_repr, Repr): assert callable(item_repr) self._item_repr_computer = item_repr else: self.external_item_repr, self.item_repr = \ externalvsinternal(rtyper, item_repr) self.LIST = ootype.List() self.lowleveltype = self.LIST self.listitem = listitem self.list_cache = {}
def __init__(self, rtyper, item_repr, listitem=None): self.rtyper = rtyper self.LIST = GcForwardReference() self.lowleveltype = Ptr(self.LIST) if not isinstance(item_repr, Repr): # not computed yet, done by setup() assert callable(item_repr) self._item_repr_computer = item_repr else: self.external_item_repr, self.item_repr = externalvsinternal( rtyper, item_repr) self.listitem = listitem self.list_cache = {}
def __init__(self, rtyper, item_repr, listitem=None, known_maxlength=False): self.rtyper = rtyper if not isinstance(item_repr, Repr): assert callable(item_repr) self._item_repr_computer = item_repr else: self.external_item_repr, self.item_repr = \ externalvsinternal(rtyper, item_repr) self.known_maxlength = known_maxlength self.LIST = self._make_empty_type() self.lowleveltype = self.LIST self.listitem = listitem self.list_cache = {}
def _externalvsinternal(self, rtyper, item_repr): return rmodel.externalvsinternal(self.rtyper, item_repr)
def pickrepr(self, item_repr): if self.eq_func_repr and self.hash_func_repr: return item_repr, item_repr else: return externalvsinternal(self.rtyper, item_repr)