about summary refs log tree commit diff stats
path: root/cpp/035call
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-24 20:52:06 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-24 20:52:06 -0700
commit5eb49929b0ccc3b1660e9d7d26ba5adec363fb68 (patch)
tree551cbff0c6139ed6b8aee9ed559f946ddb85a11c /cpp/035call
parent0d7b60ed1dd71d48777b86d01849767f69fd2511 (diff)
downloadmu-5eb49929b0ccc3b1660e9d7d26ba5adec363fb68.tar.gz
1179
Diffstat (limited to 'cpp/035call')
-rw-r--r--cpp/035call11
1 files changed, 6 insertions, 5 deletions
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<instruction>& 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<instruction>& steps()")
-inline vector<instruction>& 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<instruction>& 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