void bhvm::exec_instruction (const std::string& instruction) { if (instruction == "pop") { exec_pop(); } else if (instruction == "nop") { exec_nop(); } else if (instruction == "calle") { exec_calle(); } else if (instruction == "jump") { exec_jump(); } else if (instruction.substr(0, 5) == "push ") { exec_push(instruction.substr(5)); } else throw Alarm(MTK_HERE, "bhvm", MTK_SS("unknown command " << instruction), alPriorCritic); }
struct t_value * exec_i_jmp(struct t_exec *exec, struct t_icode *jmp) { if (exec_jump(exec, jmp->operand->intval) < 0) { return NULL; } return &nullvalue; }
/* * Jump to location identified by the top of stack. */ struct t_value * exec_i_jst(struct t_exec *exec, struct t_icode *jmp) { struct t_value *ret = &nullvalue; ret = list_pop(&exec->stack); assert(ret); exec_jump(exec, ret->intval); return ret; }