diff options
Diffstat (limited to '036call_ingredient.cc')
-rw-r--r-- | 036call_ingredient.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/036call_ingredient.cc b/036call_ingredient.cc index b07c2d3b..a6fbb181 100644 --- a/036call_ingredient.cc +++ b/036call_ingredient.cc @@ -28,12 +28,12 @@ index_t next_ingredient_to_process; :(replace{} "call(recipe_number r)") call(recipe_number r) :running_recipe(r), running_step_index(0), next_ingredient_to_process(0) {} -:(replace "Current_routine->calls.push(call(current_instruction().operation))" following "End Primitive Recipe Implementations") +:(replace "Current_routine->calls.push_front(call(current_instruction().operation))" following "End Primitive Recipe Implementations") call callee(current_instruction().operation); for (size_t i = 0; i < ingredients.size(); ++i) { callee.ingredient_atoms.push_back(ingredients.at(i)); } -Current_routine->calls.push(callee); +Current_routine->calls.push_front(callee); :(before "End Primitive Recipe Declarations") NEXT_INGREDIENT, @@ -41,12 +41,13 @@ NEXT_INGREDIENT, Recipe_number["next-ingredient"] = NEXT_INGREDIENT; :(before "End Primitive Recipe Implementations") case NEXT_INGREDIENT: { - if (Current_routine->calls.top().next_ingredient_to_process < Current_routine->calls.top().ingredient_atoms.size()) { + assert(!Current_routine->calls.empty()); + if (Current_routine->calls.front().next_ingredient_to_process < Current_routine->calls.front().ingredient_atoms.size()) { products.push_back( - Current_routine->calls.top().ingredient_atoms.at(Current_routine->calls.top().next_ingredient_to_process)); + Current_routine->calls.front().ingredient_atoms.at(Current_routine->calls.front().next_ingredient_to_process)); assert(products.size() == 1); products.resize(2); // push a new vector products.at(1).push_back(1); - ++Current_routine->calls.top().next_ingredient_to_process; + ++Current_routine->calls.front().next_ingredient_to_process; } else { products.resize(2); @@ -77,7 +78,7 @@ REWIND_INGREDIENTS, Recipe_number["rewind-ingredients"] = REWIND_INGREDIENTS; :(before "End Primitive Recipe Implementations") case REWIND_INGREDIENTS: { - Current_routine->calls.top().next_ingredient_to_process = 0; + Current_routine->calls.front().next_ingredient_to_process = 0; break; } @@ -100,13 +101,13 @@ Recipe_number["ingredient"] = INGREDIENT; case INGREDIENT: { assert(isa_literal(current_instruction().ingredients.at(0))); assert(ingredients.at(0).size() == 1); // scalar - if (static_cast<index_t>(ingredients.at(0).at(0)) < Current_routine->calls.top().ingredient_atoms.size()) { - Current_routine->calls.top().next_ingredient_to_process = ingredients.at(0).at(0); + if (static_cast<index_t>(ingredients.at(0).at(0)) < Current_routine->calls.front().ingredient_atoms.size()) { + Current_routine->calls.front().next_ingredient_to_process = ingredients.at(0).at(0); products.push_back( - Current_routine->calls.top().ingredient_atoms.at(Current_routine->calls.top().next_ingredient_to_process)); + Current_routine->calls.front().ingredient_atoms.at(Current_routine->calls.front().next_ingredient_to_process)); assert(products.size() == 1); products.resize(2); // push a new vector products.at(1).push_back(1); - ++Current_routine->calls.top().next_ingredient_to_process; + ++Current_routine->calls.front().next_ingredient_to_process; } else { if (current_instruction().products.size() > 1) { |