From 5eb49929b0ccc3b1660e9d7d26ba5adec363fb68 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 24 Apr 2015 20:52:06 -0700 Subject: 1179 --- cpp/035call | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'cpp/035call') diff --git a/cpp/035call b/cpp/035call index 9aee3db8..2f9b0f15 100644 --- a/cpp/035call +++ b/cpp/035call @@ -45,6 +45,7 @@ struct routine { // End routine Fields routine(recipe_number r); bool completed() const; + const vector& steps() const; }; :(code) routine::routine(recipe_number r) { @@ -61,10 +62,6 @@ inline size_t& current_step_index() { inline const string& current_recipe_name() { return Recipe[Current_routine->calls.top().running_recipe].name; } -:(replace{} "inline vector& steps()") -inline vector& steps() { - return Recipe[Current_routine->calls.top().running_recipe].steps; -} :(replace{} "inline const instruction& current_instruction()") inline const instruction& current_instruction() { return Recipe[Current_routine->calls.top().running_recipe].steps[Current_routine->calls.top().running_step_index]; @@ -88,10 +85,14 @@ inline bool routine::completed() const { return calls.empty(); } +inline const vector& routine::steps() const { + return Recipe[calls.top().running_recipe].steps; +} + :(before "Running One Instruction") // when we reach the end of one call, we may reach the end of the one below // it, and the one below that, and so on -while (current_step_index() >= steps().size()) { +while (current_step_index() >= Current_routine->steps().size()) { Current_routine->calls.pop(); if (Current_routine->calls.empty()) return; // todo: no results returned warning -- cgit 1.4.1-2-gfad0