Exemplo n.º 1
0
 def op_sub_str(engine):
     count = PushData.pop_int(engine)
     index = PushData.pop_int(engine)
     arr = PushData.pop_bytearray(engine)
     bs = arr[index:index + count]
     PushData.push_data(engine, bs)
     return VMState.NONE
 def op_bigint_comp(engine):
     print(engine.evaluation_stack.e[0].value)
     print(engine.evaluation_stack.e[1].value)
     x2 = PushData.pop_int(engine)
     x1 = PushData.pop_int(engine)
     b = PushData.bigint_multi_comp(x1, x2, engine.op_code)
     PushData.push_data(engine, b)
     return VMState.NONE
Exemplo n.º 3
0
 def op_new_array(engine):
     count = PushData.pop_int(engine)
     items = list()
     for i in range(count):
         items.append(BoolItem(False))
     PushData.push_data(engine, ArrayItem(items))
     return VMState.NONE
Exemplo n.º 4
0
 def op_pack(engine):
     size = PushData.pop_int(engine)
     items = list()
     for i in range(size):
         x = PushData.pop_stack_item(engine)
         items.append(x)
     PushData.push_data(engine, items)
     return VMState.NONE
 def op_sign(engine):
     x = PushData.pop_int(engine)
     if x < 0:
         PushData.push_data(engine, -1)
     elif x > 0:
         PushData.push_data(engine, 1)
     else:
         PushData.push_data(engine, 0)
     return VMState.NONE
 def op_within(engine):
     b = PushData.pop_int(engine)
     a = PushData.pop_int(engine)
     c = PushData.pop_int(engine)
     PushData.push_data(engine, PushData.within_op(c, a, b))
     return VMState.NONE
 def op_bigint_zip(engine):
     x2 = PushData.pop_int(engine)
     x1 = PushData.pop_int(engine)
     b = PushData.bigint_zip(x2, x1, engine.op_code)
     PushData.push_data(engine, b)
     return VMState.NONE
 def op_nz(engine):
     x = PushData.pop_int(engine)
     PushData.push_data(engine, PushData.bigint_comp(x, engine.op_code))
     return VMState.NONE
Exemplo n.º 9
0
 def op_invert(engine):
     i = PushData.pop_int()
     PushData.push_data(engine, i)
     return VMState.NONE
Exemplo n.º 10
0
 def op_right(engine):
     count = PushData.pop_int(engine)
     arr = PushData.pop_bytearray(engine)
     bs = arr[len(arr) - count:]
     PushData.push_data(engine, bs)
     return VMState.NONE
Exemplo n.º 11
0
 def op_left(engine):
     count = PushData.pop_int(engine)
     arr = PushData.pop_bytearray(engine)
     bs = arr[0:count]
     PushData.push_data(engine, bs)
     return VMState.NONE
Exemplo n.º 12
0
 def op_roll(engine):
     n = PushData.pop_int(engine)
     if n == 0:
         return VMState.NONE
     PushData.push(engine, engine.evaluation_stack.remove(n))
     return VMState.NONE
Exemplo n.º 13
0
 def op_pick(engine):
     n = PushData.pop_int(engine)
     if n == 0:
         return VMState.NONE
     PushData.push(engine, engine.evaluation_stack.peek(n))
     return VMState.NONE
Exemplo n.º 14
0
 def op_x_tuck(engine):
     n = PushData.pop_int(engine)
     engine.evaluation_stack.insert(n, PushData.peek_stack_item(engine))
     return VMState.NONE
Exemplo n.º 15
0
 def op_x_swap(engine):
     n = PushData.pop_int(engine)
     if n == 0:
         return VMState.NONE
     engine.evaluation_stack.swap(0, n)
     return VMState.NONE
Exemplo n.º 16
0
 def op_x_drop(engine):
     n = PushData.pop_int(engine)
     engine.alt_stack.remove(n)
     return VMState.NONE