Exemplo n.º 1
0
def op_noif(vm, instr):
    executed = all(vm.cond_stack)
    if executed:
        if (len(vm.stack) < 1):
            raise Exception("OP_NOTIF: Missing argument")
        expr = cast_to_bool(vm.stack.pop())
        vm.cond_stack.append(not expr)
    else:
        vm.cond_stack.append(False)
Exemplo n.º 2
0
def op_noif(vm, instr):
    executed = all(vm.cond_stack)
    if executed:
        if (len(vm.stack) < 1):
            raise Exception("OP_NOTIF: Missing argument")
        expr = cast_to_bool(vm.stack.pop())
        vm.cond_stack.append(not expr)
    else:
        vm.cond_stack.append(False)
Exemplo n.º 3
0
 def is_true(self):
     return len(self.stack) > 0 and cast_to_bool(self.stack[-1])
Exemplo n.º 4
0
def op_verify(vm, instr):
    if (not vm.stack):
        raise Exception("OP_VERIFY: Missing argument")
    if cast_to_bool(vm.stack[-1]) != True:
        raise Exception("OP_VERIFY: False")
    vm.stack.pop()
Exemplo n.º 5
0
def op_ifdup(vm, instr):
    if len(vm.stack) < 1:
        raise Exception("OP_IFDUP: Not enought arguments")
    if cast_to_bool(vm.stack[-1]):
        vm.stack.append(vm.stack[-1])
Exemplo n.º 6
0
def op_verify(vm, instr):
    if (not vm.stack):
        raise Exception("OP_VERIFY: Missing argument")
    if cast_to_bool(vm.stack[-1]) != True:
        raise Exception("OP_VERIFY: False")
    vm.stack.pop()