about summary refs log tree commit diff stats
path: root/cpp/020run
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-24 00:28:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-24 00:28:24 -0700
commit8c9e97ae0183e79accbcb1afc57499f83c0b5406 (patch)
tree2411df7fd69a386046f65266ecff9304075e51c1 /cpp/020run
parent01152aa268e54aebade352965ce1200b49fc8f4f (diff)
downloadmu-8c9e97ae0183e79accbcb1afc57499f83c0b5406.tar.gz
1155 - three phases of mu: load, transform, run
Each phase implicitly calls previous phases.
Most C++ scenarios implicitly call one, two or three of the phases.
More clear now that 'load' does more than just add recipes.
Diffstat (limited to 'cpp/020run')
-rw-r--r--cpp/020run12
1 files changed, 6 insertions, 6 deletions
diff --git a/cpp/020run b/cpp/020run
index 3e993f95..a9afb460 100644
--- a/cpp/020run
+++ b/cpp/020run
@@ -1,4 +1,4 @@
-//: Once a recipe is loaded, we need to run it.
+//: Phase 3: Start running a loaded and transformed recipe.
 //:
 //: So far we've seen recipes as lists of instructions, and instructions point
 //: at other recipes. To kick things off mu needs to know how to run certain
@@ -101,7 +101,7 @@ inline bool done(routine& rr) {
 :(before "End Commandline Parsing")
 if (argc > 1) {
   for (int i = 1; i < argc; ++i) {
-    load(argv[i]);
+    load_and_transform(argv[i]);
   }
 }
 
@@ -118,14 +118,14 @@ if (!Run_tests) {
 }
 
 :(code)
-void load(string filename) {
+void load_and_transform(string filename) {
   ifstream fin(filename.c_str());
   if (!fin) {
     raise << "no such file " << filename << '\n';
     return;
   }
   fin >> std::noskipws;
-  add_recipes(fin);
+  load(fin);
   transform_all();
   fin.close();
   // freeze everything so it doesn't get cleared by tests
@@ -135,12 +135,12 @@ void load(string filename) {
 
 //:: On startup, load everything in core.mu
 :(before "End Load Recipes")
-load("core.mu");
+load_and_transform("core.mu");
 
 :(code)
 // helper for tests
 void run(string form) {
-  vector<recipe_number> tmp = add_recipes(form);
+  vector<recipe_number> tmp = load(form);
   transform_all();
   run(tmp.front());
 }