From a767dbd3338af1d3cc69e3c200341fff8e08fc4b Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 24 Apr 2015 20:37:55 -0700 Subject: 1176 --- cpp/020run | 4 ++-- cpp/023jump | 12 ++++++------ cpp/035call | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'cpp') diff --git a/cpp/020run b/cpp/020run index 1ac4ce57..738545ee 100644 --- a/cpp/020run +++ b/cpp/020run @@ -53,8 +53,8 @@ void run_current_routine() { // Running One Instruction. size_t& pc = current_step_index(); - if (current_instruction().is_label) { ++pc; continue; } - trace("run") << "instruction " << current_recipe_name() << '/' << pc; + if (current_instruction().is_label) { ++current_step_index(); continue; } + trace("run") << "instruction " << current_recipe_name() << '/' << current_step_index(); //? cout << "operation " << current_instruction().operation << '\n'; //? 3 switch (current_instruction().operation) { // Primitive Recipe Implementations diff --git a/cpp/023jump b/cpp/023jump index d4dd6094..932d0da8 100644 --- a/cpp/023jump +++ b/cpp/023jump @@ -7,8 +7,8 @@ Recipe_number["jump"] = JUMP; :(before "End Primitive Recipe Implementations") case JUMP: { trace("run") << "ingredient 0 is " << current_instruction().ingredients[0].value; - pc += current_instruction().ingredients[0].value; - trace("run") << "jumping to instruction " << pc+1; + current_step_index() += current_instruction().ingredients[0].value; + trace("run") << "jumping to instruction " << current_step_index()+1; break; } @@ -47,8 +47,8 @@ case JUMP_IF: { break; } trace("run") << "ingredient 1 is " << current_instruction().ingredients[1].name; - pc += current_instruction().ingredients[1].value; - trace("run") << "jumping to instruction " << pc+1; + current_step_index() += current_instruction().ingredients[1].value; + trace("run") << "jumping to instruction " << current_step_index()+1; break; } @@ -87,8 +87,8 @@ case JUMP_UNLESS: { break; } trace("run") << "ingredient 1 is " << current_instruction().ingredients[1].name; - pc += current_instruction().ingredients[1].value; - trace("run") << "jumping to instruction " << pc+1; + current_step_index() += current_instruction().ingredients[1].value; + trace("run") << "jumping to instruction " << current_step_index()+1; break; } diff --git a/cpp/035call b/cpp/035call index 4e59430c..3db1a10a 100644 --- a/cpp/035call +++ b/cpp/035call @@ -78,7 +78,7 @@ default: { break; } Current_routine->calls.push(call(current_instruction().operation)); - continue; // not done with caller; don't increment pc + continue; // not done with caller; don't increment current_step_index() } //:: finally, we need to fix the termination conditions for the run loop -- cgit 1.4.1-2-gfad0