def op_unpack(engine): items = PushData.pop_array(engine) l = len(items) for i in range(l - 1, -1, -1): PushData.push(engine, items[i]) PushData.push_data(engine, l) return VMState.NONE
def op_over(engine): x2 = PushData.pop_stack_item(engine) x1 = PushData.peek_stack_item(engine) PushData.peek_stack_item(engine) PushData.push(engine, x2) PushData.push(engine, x1) return VMState.NONE
def op_tuck(engine): x2 = PushData.pop_stack_item(engine) x1 = PushData.pop_stack_item(engine) PushData.push(engine, x2) PushData.push(engine, x1) PushData.push(engine, x2) return VMState.NONE
def op_rot(engine): x3 = PushData.pop_stack_item(engine) x2 = PushData.pop_stack_item(engine) x1 = PushData.pop_stack_item(engine) PushData.push(engine, x2) PushData.push(engine, x3) PushData.push(engine, x1) return VMState.NONE
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
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
def op_to_dup_from_alt_stack(engine): PushData.push(engine, engine.alt_stack.peek(0)) return VMState.NONE
def op_nip(engine): x2 = PushData.pop_stack_item(engine) PushData.peek_stack_item(engine) PushData.push(engine, x2) return VMState.NONE
def op_dup(engine): items = PushData.peek_stack_item(engine) PushData.push(engine, items) return VMState.NONE
def op_from_alt_stack(engine): items = engine.alt_stack.pop() PushData.push(engine, items) return VMState.NONE