Пример #1
0
 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)
Пример #2
0
 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,
                     }
                 ),
             )
         )
Пример #3
0
 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)
Пример #4
0
 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,
                 })))
Пример #5
0
 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 = {}
Пример #6
0
 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 = {}
Пример #7
0
 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 = {}
Пример #8
0
 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 = {}
Пример #9
0
 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 = {}
Пример #10
0
 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 = {}
Пример #11
0
 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 = {}
Пример #12
0
 def _externalvsinternal(self, rtyper, item_repr):
     return rmodel.externalvsinternal(self.rtyper, item_repr)
Пример #13
0
 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)
Пример #14
0
 def _externalvsinternal(self, rtyper, item_repr):
     return rmodel.externalvsinternal(self.rtyper, item_repr)
Пример #15
0
 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)