about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-08 13:26:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-08 13:37:43 -0700
commit2e8c5d39157d1178ad453c86d94d4e1830d8dfe6 (patch)
tree7fe460af6045a8fa161c19acb2021f46ec9cdb46
parent6dc1379b5ab74bbd081a4e059cd04257ba7272c3 (diff)
downloadmu-2e8c5d39157d1178ad453c86d94d4e1830d8dfe6.tar.gz
1723
Some reorg before we start plumbing 'reply' from 'run-interactive' to
return a string containing the results.
-rw-r--r--034call.cc5
-rw-r--r--036call_reply.cc5
-rw-r--r--081run_interactive.cc15
3 files changed, 13 insertions, 12 deletions
diff --git a/034call.cc b/034call.cc
index 6d820809..45251b52 100644
--- a/034call.cc
+++ b/034call.cc
@@ -107,10 +107,7 @@ inline const vector<instruction>& routine::steps() const {
 // 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() >= SIZE(Current_routine->steps())) {
-  if (current_recipe_name() == "interactive") {
-//?     trace("foo") << "showing warnings again"; //? 1
-    Hide_warnings = false;
-  }
+  // Falling Through End Of Recipe
   --Callstack_depth;
 //?   cerr << "reply " << Current_routine->calls.size() << '\n'; //? 2
   Current_routine->calls.pop_front();
diff --git a/036call_reply.cc b/036call_reply.cc
index d09763fe..71aa4991 100644
--- a/036call_reply.cc
+++ b/036call_reply.cc
@@ -18,12 +18,9 @@ REPLY,
 Recipe_ordinal["reply"] = REPLY;
 :(before "End Primitive Recipe Implementations")
 case REPLY: {
+  // Starting Reply
   const instruction& reply_inst = current_instruction();  // save pointer into recipe before pop
   const string& callee = current_recipe_name();
-  if (callee == "interactive") {
-    trace("foo") << "showing warnings again";
-    Hide_warnings = true;
-  }
   --Callstack_depth;
 //?   if (tb_is_active()) { //? 1
 //?     tb_clear(); //? 1
diff --git a/081run_interactive.cc b/081run_interactive.cc
index fd076c06..bf995c39 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -36,13 +36,11 @@ case RUN_INTERACTIVE: {
 }
 
 :(code)
-// reads a string, tries to call it as code.
+// reads a string, tries to call it as code, saving all warnings.
 // returns true if successfully called (no errors found during load and transform)
 bool run_interactive(long long int address) {
   long long int size = Memory[address];
-  if (size == 0) {
-    return false;
-  }
+  if (size == 0) return false;
   ostringstream tmp;
   for (long long int curr = address+1; curr <= address+size; ++curr) {
     // todo: unicode
@@ -65,6 +63,15 @@ bool run_interactive(long long int address) {
   return true;
 }
 
+:(after "Starting Reply")
+if (current_recipe_name() == "interactive") clean_up_interactive();
+:(after "Falling Through End Of Recipe")
+if (current_recipe_name() == "interactive") clean_up_interactive();
+:(code)
+void clean_up_interactive() {
+  Hide_warnings = false;
+}
+
 string strip_comments(string in) {
   ostringstream result;
   for (long long int i = 0; i < SIZE(in); ++i) {