Example #1
0
 def f(n):
     obj1 = ootype.new(A)
     obj2 = ootype.new(B)
     s1 = ootype.oostring(obj1, -1)
     s2 = ootype.oostring(obj2, -1)
     ch1 = s1.ll_stritem_nonneg(1)
     ch2 = s2.ll_stritem_nonneg(1)
     return ord(ch1) + ord(ch2)
Example #2
0
 def f(n):
     obj1 = ootype.new(A)
     obj2 = ootype.new(B)
     s1 = ootype.oostring(obj1, -1)
     s2 = ootype.oostring(obj2, -1)
     ch1 = s1.ll_stritem_nonneg(1)
     ch2 = s2.ll_stritem_nonneg(1)
     return ord(ch1) + ord(ch2)
Example #3
0
def ll_int2oct(i, addPrefix):
    if not addPrefix or i==0:
        return oostring(i, 8)

    buf = new(StringBuilder)
    if i<0:
        if i == SPECIAL_VALUE:
            return SPECIAL_VALUE_OCT
        i = -i
        buf.ll_append_char('-')

    buf.ll_append_char('0')
    buf.ll_append(oostring(i, 8))
    return buf.ll_build()
Example #4
0
def ll_int2hex(i, addPrefix):
    if not addPrefix:
        return oostring(i, 16)

    buf = new(StringBuilder)
    if i<0:
        if i == SPECIAL_VALUE:
            return SPECIAL_VALUE_HEX
        i = -i
        buf.ll_append_char('-')

    buf.ll_append_char('0')
    buf.ll_append_char('x')
    buf.ll_append(oostring(i, 16))
    return buf.ll_build()
Example #5
0
    def test_oohash(self):
        def f(n):
            s = ootype.oostring(n, -1)
            return s.ll_hash()

        res = self.interp_operations(f, [5])
        assert res == ootype.oostring(5, -1).ll_hash()
Example #6
0
 def oof(ch):
     return ootype.oostring(ch, -1)
Example #7
0
 def f(n):
     s = ootype.oostring(n, -1)
     return s.ll_hash()
Example #8
0
 def _ll_1_oostring_root_foldable(s):
     return ootype.oostring(s, -1)
Example #9
0
 def _ll_1_oostring_char_foldable(ch):
     return ootype.oostring(ch, -1)
Example #10
0
 def oofakeimpl(fmt, x):
     return ootype.oostring(rarithmetic.formatd(fmt._str, x), -1)
Example #11
0
 def fn(i):
     s = ootype.oostring(42, -1)
     meth = s.ll_stritem_nonneg
     args = (i, )
     return meth(*args)
Example #12
0
def ll_int2dec(i):
    return oostring(i, 10)
Example #13
0
def ll_float_str(repr, f):
    return oostring(f, -1)
Example #14
0
 def f(n):
     s = ootype.oostring(n, -1)
     return s.ll_hash()
Example #15
0
 def _ll_2_oostring_signed_foldable(n, base):
     return ootype.oostring(n, base)
Example #16
0
 def oofakeimpl(fmt, x):
     return ootype.oostring(rarithmetic.formatd(fmt._str, x), -1)
Example #17
0
 def _ll_1_oostring_unsigned_foldable(n):
     return ootype.oostring(n, -1)
Example #18
0
 def to_rstr(s):
     if s is None:
         return ootype.null(ootype.String)
     return ootype.oostring(s, -1)
Example #19
0
 def fn(c):
     s1 = ootype.oostring("xy", -1)
     s2 = ootype.oostring("x" + chr(c), -1)
     assert (hash_whatever(ootype.typeOf(s1), s1) ==
             hash_whatever(ootype.typeOf(s2), s2))
     assert equal_whatever(ootype.typeOf(s1), s1, s2)
Example #20
0
 def fn(i):
     s = ootype.oostring(42, -1)
     meth = s.ll_stritem_nonneg
     args = (i,)
     return meth(*args)
Example #21
0
 def _ll_2_oostring_signed_foldable(n, base):
     return ootype.oostring(n, base)
Example #22
0
 def oofakeimpl(x, code, precision, flags):
     return ootype.oostring(rfloat.formatd(x, code, precision, flags), -1)
Example #23
0
 def _ll_1_oostring_unsigned_foldable(n):
     return ootype.oostring(n, -1)
Example #24
0
 def oof():
     return ootype.oostring(42, -1)
Example #25
0
 def ll_str(self, instance):
     return ootype.oostring(instance, -1)
Example #26
0
 def oof(ch):
     return ootype.oostring(ch, -1)
Example #27
0
 def test_oohash(self):
     def f(n):
         s = ootype.oostring(n, -1)
         return s.ll_hash()
     res = self.interp_operations(f, [5])
     assert res == ootype.oostring(5, -1).ll_hash()
Example #28
0
 def to_rstr(s):
     return ootype.oostring(s, -1)
Example #29
0
 def oof():
     return ootype.oostring(42, -1)
Example #30
0
 def op_oostring(self, obj, base):
     return ootype.oostring(obj, base)
Example #31
0
 def ll_str(self, val):
     return ootype.oostring(self.name, -1)
Example #32
0
 def to_rstr(s):
     if s is None:
         return ootype.null(ootype.String)
     return ootype.oostring(s, -1)
Example #33
0
 def _ll_1_oostring_char_foldable(ch):
     return ootype.oostring(ch, -1)
Example #34
0
 def ll_chr2str(ch):
     return ootype.oostring(ch, -1)
Example #35
0
 def _ll_1_oostring_root_foldable(s):
     return ootype.oostring(s, -1)
Example #36
0
 def op_oostring(self, obj, base):
     return ootype.oostring(obj, base)
Example #37
0
 def ll_chr2str(ch):
     return ootype.oostring(ch, -1)
Example #38
0
 def fn(c):
     s1 = ootype.oostring("xy", -1)
     s2 = ootype.oostring("x" + chr(c), -1)
     assert (hash_whatever(ootype.typeOf(s1),
                           s1) == hash_whatever(ootype.typeOf(s2), s2))
     assert equal_whatever(ootype.typeOf(s1), s1, s2)
Example #39
0
 def ll_str(self, instance):
     return ootype.oostring(instance, -1)
Example #40
0
 def to_rstr(s):
     return ootype.oostring(s, -1)