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 23:10:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-08 23:12:18 -0700
commitf0eb35562a623c642af7ae5b9427ea85755cf3cd (patch)
tree31f5ffe7ce4793a37a7c8a9d05d33b4db12776bd /081run_interactive.cc
parent5e2569f302cf293d200221942bb0e19643b66667 (diff)
downloadmu-f0eb35562a623c642af7ae5b9427ea85755cf3cd.tar.gz
1733 - load all recipes before running sandboxes
This is starting to look good! I need to add some tests for
render-string, but we'll see.
Diffstat (limited to '081run_interactive.cc')
-rw-r--r--081run_interactive.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/081run_interactive.cc b/081run_interactive.cc
index 6d12e368..e9f42041 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -15,6 +15,8 @@ recipe main [
 # result is null
 +mem: storing 0 in location 1
 
+//: run code in 'interactive mode', i.e. with warnings off, and recording
+//: output in case we want to print it to screen
 :(before "End Primitive Recipe Declarations")
 RUN_INTERACTIVE,
 :(before "End Primitive Recipe Numbers")
@@ -213,3 +215,21 @@ long long int warnings_from_trace() {
   assert(!out.str().empty());
   return new_string(out.str());
 }
+
+//: simpler version of run-interactive: doesn't do any running, just loads
+//: recipes and reports warnings.
+:(before "End Primitive Recipe Declarations")
+RELOAD,
+:(before "End Primitive Recipe Numbers")
+Recipe_ordinal["reload"] = RELOAD;
+:(before "End Primitive Recipe Implementations")
+case RELOAD: {
+  assert(scalar(ingredients.at(0)));
+  Hide_warnings = true;
+  load(to_string(ingredients.at(0).at(0)));
+  transform_all();
+  Hide_warnings = false;
+  products.resize(1);
+  products.at(0).push_back(warnings_from_trace());
+  break;
+}