about summary refs log tree commit diff stats
path: root/081run_interactive.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-08 11:43:59 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-08 12:50:07 -0700
commit260c3de2bfad49c0587547b8af1be5bc3e2dacd5 (patch)
tree2b80d1217be2dc5af051194d7f91a2a3d444b0ee /081run_interactive.cc
parenta2372bee56a110e7dfd83c3b52f430c75b2cf0e7 (diff)
downloadmu-260c3de2bfad49c0587547b8af1be5bc3e2dacd5.tar.gz
1721 - hide warnings inside interactive routines
We will need many other forms of isolation for these. For starters we're
going to have to replace most asserts with warnings that can be traced
so that the environment doesn't crash because of illegal code typed into
it.

New test is still failing. Just getting it to fail right was hard
enough.
Diffstat (limited to '081run_interactive.cc')
-rw-r--r--081run_interactive.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc
index 5e6f3f1a..abb67b17 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -71,6 +71,7 @@ case RUN_INTERACTIVE: {
 // reads a string. if it's a variable, stores its value as a string and returns false.
 // if it's lines of code, calls them and returns true (no result available yet to be stored)
 bool run_interactive(long long int address, long long int* result) {
+//?   cerr << "run interactive\n"; //? 1
   long long int size = Memory[address];
   if (size == 0) {
 //?     trace(1, "foo") << "AAA"; //? 2
@@ -99,9 +100,17 @@ bool run_interactive(long long int address, long long int* result) {
   }
 //?   trace(1, "foo") << "DDD"; //? 2
   Recipe.erase(Recipe_ordinal["interactive"]);
+//?   trace("foo") << "hiding warnings\n"; //? 2
+  Hide_warnings = true;
   // call run(string) but without the scheduling
   load("recipe interactive [\n"+command+"\n]\n");
   transform_all();
+  if (trace_count("warn") > 0) {
+    Hide_warnings = false;
+    *result = 0;
+    return false;
+  }
+//?   cerr << "call interactive: " << Current_routine->calls.size() << '\n'; //? 1
   Current_routine->calls.push_front(call(Recipe_ordinal["interactive"]));
   *result = 0;
   return true;