about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--020run.cc11
-rw-r--r--038scheduler.cc1
-rw-r--r--050scenario.cc4
-rw-r--r--chessboard.mu23
4 files changed, 28 insertions, 11 deletions
diff --git a/020run.cc b/020run.cc
index cf4cab0c..2c069576 100644
--- a/020run.cc
+++ b/020run.cc
@@ -54,7 +54,7 @@ void run(recipe_number r) {
 
 void run_current_routine()
 {  // curly on a separate line, because later layers will modify header
-//?   cerr << "AAA 6\n"; //? 2
+//?   cerr << "AAA 6\n"; //? 3
   while (!Current_routine->completed())  // later layers will modify condition
   {
 //?     cerr << "AAA 7: " << current_step_index() << '\n'; //? 1
@@ -92,7 +92,7 @@ void run_current_routine()
     // End of Instruction
     ++current_step_index();
   }
-//?   cerr << "AAA 9\n"; //? 1
+//?   cerr << "AAA 9\n"; //? 2
   stop_running_current_routine:;
 }
 
@@ -164,13 +164,14 @@ load_permanently("core.mu");
 :(code)
 // helper for tests
 void run(string form) {
-//?   cerr << "AAA 2\n"; //? 1
+//?   cerr << "AAA 2\n"; //? 2
+//?   cerr << form << '\n'; //? 1
   vector<recipe_number> tmp = load(form);
   if (tmp.empty()) return;
   transform_all();
-//?   cerr << "AAA 3\n"; //? 1
+//?   cerr << "AAA 3\n"; //? 2
   run(tmp.front());
-//?   cerr << "YYY\n"; //? 1
+//?   cerr << "YYY\n"; //? 2
 }
 
 //:: Reading from memory, writing to memory.
diff --git a/038scheduler.cc b/038scheduler.cc
index 01eeb27b..0857fe58 100644
--- a/038scheduler.cc
+++ b/038scheduler.cc
@@ -44,6 +44,7 @@ long long int Current_routine_index = 0;
 long long int Scheduling_interval = 500;
 :(before "End Setup")
 Scheduling_interval = 500;
+Routines.clear();
 :(replace{} "void run(recipe_number r)")
 void run(recipe_number r) {
 //?   cerr << "AAA 4\n"; //? 1
diff --git a/050scenario.cc b/050scenario.cc
index fd59bf44..4a2384bf 100644
--- a/050scenario.cc
+++ b/050scenario.cc
@@ -132,14 +132,16 @@ const scenario* Current_scenario = NULL;
 void run_mu_scenario(const scenario& s) {
   Current_scenario = &s;
   bool not_already_inside_test = !Trace_stream;
-//?   cerr << s.name << '\n'; //? 1
+//?   cerr << s.name << '\n'; //? 3
   if (not_already_inside_test) {
     Trace_file = s.name;
     Trace_stream = new trace_stream;
     setup();
   }
 //?   cerr << '^' << s.to_run << "$\n"; //? 4
+  assert(Routines.empty());
   run("recipe "+s.name+" [ " + s.to_run + " ]");
+//?   cerr << s.name << " done\n"; //? 1
   if (not_already_inside_test && Trace_stream) {
     teardown();
     ofstream fout((Trace_dir+Trace_file).c_str());
diff --git a/chessboard.mu b/chessboard.mu
index c5f7ed4f..da0cd93f 100644
--- a/chessboard.mu
+++ b/chessboard.mu
@@ -29,10 +29,12 @@ scenario print-board-and-read-move [
   # we'll make the screen really wide because the program currently prints out a long line
   assume-screen 120:literal/width, 20:literal/height
   # initialize keyboard to type in a move
-  assume-keyboard [a2-a4
+  assume-console [
+    type [a2-a4
 ]
+  ]
   run [
-    screen:address, keyboard:address <- chessboard screen:address, keyboard:address
+    screen:address, console:address <- chessboard screen:address, console:address
 #?     $browse-trace #? 1
 #?     $close-trace #? 1
     # icon for the cursor
@@ -64,6 +66,17 @@ scenario print-board-and-read-move [
   ]
 ]
 
+#? scenario foo [ #? 1
+#?   $print [aaa] #? 1
+#?   run [ #? 1
+#?     1:number <- copy 34:literal #? 1
+#?   ] #? 1
+#?   memory-should-contain [ #? 1
+#?     1 <- 34 #? 1
+#?   ] #? 1
+#?   $print [zzz] #? 1
+#? ] #? 1
+
 ## Here's how 'chessboard' is implemented.
 
 recipe chessboard [
@@ -71,13 +84,13 @@ recipe chessboard [
 #?   $start-tracing #? 1
   default-space:address:array:location <- new location:type, 30:literal
   screen:address <- next-ingredient
-  keyboard:address <- next-ingredient
-#?   $print [screen: ], screen:address, [, keyboard: ], keyboard:address, [ 
+  console:address <- next-ingredient
+#?   $print [screen: ], screen:address, [, console: ], console:address, [ 
 #? ] #? 1
   board:address:array:address:array:character <- initial-position
   # hook up stdin
   stdin:address:channel <- new-channel 10:literal/capacity
-  start-running send-keys-to-channel:recipe, keyboard:address, stdin:address:channel, screen:address
+  start-running send-keys-to-channel:recipe, console:address, stdin:address:channel, screen:address
   # buffer lines in stdin
   buffered-stdin:address:channel <- new-channel 10:literal/capacity
   start-running buffer-lines:recipe, stdin:address:channel, buffered-stdin:address:channel