Пример #1
0
 def command_print(cmd, extra):
     if extra == 'print-me':
         stuff = dbstate.stuff
     elif extra == '$0':
         stuff = dbstate.metavar
     elif extra == '2.35':
         val = rdtoa.strtod('2.35')
         valx, valy = math.modf(val)
         revdb.send_output(rdtoa.dtoa(valx) + '\n')
         revdb.send_output(rdtoa.dtoa(valy) + '\n')
         xx, yy = math.frexp(val)
         revdb.send_output(rdtoa.dtoa(xx) + '\n')
         revdb.send_output('%d\n' % yy)
         return
     elif extra == 'very-long-loop':
         i = 0
         total = 0
         while i < 2000000000:
             total += revdb.flag_io_disabled()
             i += 1
         revdb.send_output(str(total))
         return
     else:
         assert False
     uid = revdb.get_unique_id(stuff)
     ll_assert(uid > 0, "uid == 0")
     revdb.send_nextnid(uid)  # outputs '$NUM = '
     revdb.send_output('stuff\n')
     dbstate.printed_stuff = stuff
Пример #2
0
def _revdb_flag_io_disabled():
    # moved in its own function for the import statement
    from rpython.rlib import revdb
    return revdb.flag_io_disabled()