Exemplo n.º 1
0
 def get_y(n):
     if not helper.inst:
         helper.inst = Y()
         helper.inst.x = 101
         helper.pinned = True
         check(rgc.pin(helper.inst))
     elif n < 100 and helper.pinned:
         rgc.unpin(helper.inst)
         helper.pinned = False
     #
     if helper.pinned:
         check(rgc._is_pinned(helper.inst))
         helper.count_pinned += 1
     else:
         check(not rgc._is_pinned(helper.inst))
         helper.count_unpinned += 1
     return helper.inst
Exemplo n.º 2
0
 def get_y():
     if not helper.inst:
         helper.inst = Y()
         helper.inst.x = 101
         check(rgc.pin(helper.inst))
     else:
         check(rgc._is_pinned(helper.inst))
     return helper.inst
Exemplo n.º 3
0
 def get_y(n):
     if not helper.inst:
         helper.inst = Y()
         helper.inst.x = 101
         helper.pinned = True
         check(rgc.pin(helper.inst))
     elif n < 100 and helper.pinned:
         rgc.unpin(helper.inst)
         helper.pinned = False
     #
     if helper.pinned:
         check(rgc._is_pinned(helper.inst))
         helper.count_pinned += 1
     else:
         check(not rgc._is_pinned(helper.inst))
         helper.count_unpinned += 1
     return helper.inst
Exemplo n.º 4
0
 def get_y():
     if not helper.inst:
         helper.inst = Y()
         helper.inst.x = 101
         check(rgc.pin(helper.inst))
     else:
         check(rgc._is_pinned(helper.inst))
     return helper.inst
Exemplo n.º 5
0
 def fn(n):
     from rpython.rlib.debug import debug_print
     s = str(n)
     if not rgc.can_move(s):
         return 13
     res = int(rgc.pin(s))
     if res:
         res += int(rgc._is_pinned(s))
         rgc.unpin(s)
     return res
Exemplo n.º 6
0
 def get_instances():
     if not helper.initialised:
         helper.inst1 = Y()
         helper.inst1.x = 101
         check(rgc.pin(helper.inst1))
         #
         helper.inst2 = Y()
         helper.inst2.x = 102
         #
         helper.inst3 = Y()
         helper.inst3.x = 103
         check(rgc.pin(helper.inst3))
         #
         helper.initialised = True
     #
     check(rgc._is_pinned(helper.inst1))
     check(not rgc._is_pinned(helper.inst2))
     check(rgc._is_pinned(helper.inst3))
     return (helper.inst1, helper.inst2, helper.inst3)
Exemplo n.º 7
0
 def get_instances():
     if not helper.initialised:
         helper.inst1 = Y()
         helper.inst1.x = 101
         check(rgc.pin(helper.inst1))
         #
         helper.inst2 = Y()
         helper.inst2.x = 102
         #
         helper.inst3 = Y()
         helper.inst3.x = 103
         check(rgc.pin(helper.inst3))
         #
         helper.initialised = True
     #
     check(rgc._is_pinned(helper.inst1))
     check(not rgc._is_pinned(helper.inst2))
     check(rgc._is_pinned(helper.inst3))
     return (helper.inst1, helper.inst2, helper.inst3)
Exemplo n.º 8
0
 def fn(n):
     from rpython.rlib.debug import debug_print
     s = str(n)
     if not rgc.can_move(s):
         return 13
     res = int(rgc.pin(s))
     if res:
         res += int(rgc._is_pinned(s))
         rgc.unpin(s)
     return res