Exemple #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)
Exemple #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)
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #6
0
 def oof(ch):
     return ootype.oostring(ch, -1)
Exemple #7
0
 def f(n):
     s = ootype.oostring(n, -1)
     return s.ll_hash()
Exemple #8
0
 def _ll_1_oostring_root_foldable(s):
     return ootype.oostring(s, -1)
Exemple #9
0
 def _ll_1_oostring_char_foldable(ch):
     return ootype.oostring(ch, -1)
Exemple #10
0
 def oofakeimpl(fmt, x):
     return ootype.oostring(rarithmetic.formatd(fmt._str, x), -1)
Exemple #11
0
 def fn(i):
     s = ootype.oostring(42, -1)
     meth = s.ll_stritem_nonneg
     args = (i, )
     return meth(*args)
Exemple #12
0
def ll_int2dec(i):
    return oostring(i, 10)
Exemple #13
0
def ll_float_str(repr, f):
    return oostring(f, -1)
Exemple #14
0
 def f(n):
     s = ootype.oostring(n, -1)
     return s.ll_hash()
Exemple #15
0
 def _ll_2_oostring_signed_foldable(n, base):
     return ootype.oostring(n, base)
Exemple #16
0
 def oofakeimpl(fmt, x):
     return ootype.oostring(rarithmetic.formatd(fmt._str, x), -1)
Exemple #17
0
 def _ll_1_oostring_unsigned_foldable(n):
     return ootype.oostring(n, -1)
Exemple #18
0
 def to_rstr(s):
     if s is None:
         return ootype.null(ootype.String)
     return ootype.oostring(s, -1)
Exemple #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)
Exemple #20
0
 def fn(i):
     s = ootype.oostring(42, -1)
     meth = s.ll_stritem_nonneg
     args = (i,)
     return meth(*args)
Exemple #21
0
 def _ll_2_oostring_signed_foldable(n, base):
     return ootype.oostring(n, base)
Exemple #22
0
 def oofakeimpl(x, code, precision, flags):
     return ootype.oostring(rfloat.formatd(x, code, precision, flags), -1)
Exemple #23
0
 def _ll_1_oostring_unsigned_foldable(n):
     return ootype.oostring(n, -1)
Exemple #24
0
 def oof():
     return ootype.oostring(42, -1)
Exemple #25
0
 def ll_str(self, instance):
     return ootype.oostring(instance, -1)
Exemple #26
0
 def oof(ch):
     return ootype.oostring(ch, -1)
Exemple #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()
Exemple #28
0
 def to_rstr(s):
     return ootype.oostring(s, -1)
Exemple #29
0
 def oof():
     return ootype.oostring(42, -1)
Exemple #30
0
 def op_oostring(self, obj, base):
     return ootype.oostring(obj, base)
Exemple #31
0
 def ll_str(self, val):
     return ootype.oostring(self.name, -1)
Exemple #32
0
 def to_rstr(s):
     if s is None:
         return ootype.null(ootype.String)
     return ootype.oostring(s, -1)
Exemple #33
0
 def _ll_1_oostring_char_foldable(ch):
     return ootype.oostring(ch, -1)
Exemple #34
0
 def ll_chr2str(ch):
     return ootype.oostring(ch, -1)
Exemple #35
0
 def _ll_1_oostring_root_foldable(s):
     return ootype.oostring(s, -1)
Exemple #36
0
 def op_oostring(self, obj, base):
     return ootype.oostring(obj, base)
Exemple #37
0
 def ll_chr2str(ch):
     return ootype.oostring(ch, -1)
Exemple #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)
Exemple #39
0
 def ll_str(self, instance):
     return ootype.oostring(instance, -1)
Exemple #40
0
 def to_rstr(s):
     return ootype.oostring(s, -1)