about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--034call.cc2
-rw-r--r--038scheduler.cc23
-rw-r--r--043new.cc2
-rw-r--r--072scenario_screen.cc24
-rw-r--r--081run_interactive.cc2
5 files changed, 4 insertions, 49 deletions
diff --git a/034call.cc b/034call.cc
index 16b6ca41..0a8a940b 100644
--- a/034call.cc
+++ b/034call.cc
@@ -109,7 +109,7 @@ inline const vector<instruction>& routine::steps() const {
 while (current_step_index() >= SIZE(Current_routine->steps())) {
   // Falling Through End Of Recipe
   --Callstack_depth;
-//?   cerr << "reply " << Current_routine->calls.size() << '\n'; //? 2
+//?   cerr << "reply " << SIZE(Current_routine->calls) << '\n'; //? 2
   Current_routine->calls.pop_front();
   if (Current_routine->calls.empty()) return;
   // Complete Call Fallthrough
diff --git a/038scheduler.cc b/038scheduler.cc
index a218799c..b0d489d5 100644
--- a/038scheduler.cc
+++ b/038scheduler.cc
@@ -47,21 +47,15 @@ Scheduling_interval = 500;
 Routines.clear();
 :(replace{} "void run(recipe_ordinal r)")
 void run(recipe_ordinal r) {
-//?   cerr << "AAA 4\n"; //? 1
   Routines.push_back(new routine(r));
-//?   cerr << "AAA " << Routines.size() << " routines\n"; //? 1
   Current_routine_index = 0, Current_routine = Routines.at(0);
   while (!all_routines_done()) {
     skip_to_next_routine();
-//?     cout << "scheduler: " << Current_routine_index << '\n'; //? 1
     assert(Current_routine);
     assert(Current_routine->state == RUNNING);
     trace("schedule") << current_routine_label() << end();
-//?     trace("schedule") << Current_routine_index << ": " << current_recipe_name() << end(); //? 1
-//?     trace("schedule") << Current_routine->id << " " << current_recipe_name() << end(); //? 1
     run_current_routine(Scheduling_interval);
     // Scheduler State Transitions
-//?     cerr << "AAA completed? " << Current_routine->completed() << '\n'; //? 1
     if (Current_routine->completed())
       Current_routine->state = COMPLETED;
     // End Scheduler State Transitions
@@ -69,13 +63,11 @@ void run(recipe_ordinal r) {
     // Scheduler Cleanup
     // End Scheduler Cleanup
   }
-//?   cout << "done with run\n"; //? 1
 }
 
 :(code)
 bool all_routines_done() {
   for (long long int i = 0; i < SIZE(Routines); ++i) {
-//?     cout << "routine " << i << ' ' << Routines.at(i)->state << '\n'; //? 1
     if (Routines.at(i)->state == RUNNING) {
       return false;
     }
@@ -89,13 +81,11 @@ void skip_to_next_routine() {
   assert(Current_routine_index < SIZE(Routines));
   for (long long int i = (Current_routine_index+1)%SIZE(Routines);  i != Current_routine_index;  i = (i+1)%SIZE(Routines)) {
     if (Routines.at(i)->state == RUNNING) {
-//?       cout << "switching to " << i << '\n'; //? 1
       Current_routine_index = i;
       Current_routine = Routines.at(i);
       return;
     }
   }
-//?   cout << "all done\n"; //? 1
 }
 
 string current_routine_label() {
@@ -141,7 +131,6 @@ Recipe_ordinal["start-running"] = START_RUNNING;
 :(before "End Primitive Recipe Implementations")
 case START_RUNNING: {
   routine* new_routine = new routine(ingredients.at(0).at(0));
-//?   cerr << new_routine->id << " -> " << Current_routine->id << '\n'; //? 1
   new_routine->parent_index = Current_routine_index;
   // populate ingredients
   for (long long int i = 1; i < SIZE(current_instruction().ingredients); ++i)
@@ -252,29 +241,17 @@ recipe f1 [
 -schedule: f1
 
 :(before "End Scheduler Cleanup")
-//? trace("schedule") << "Before cleanup" << end(); //? 1
-//? for (long long int i = 0; i < SIZE(Routines); ++i) { //? 1
-//?   trace("schedule") << i << ": " << Routines.at(i)->id << ' ' << Routines.at(i)->state << ' ' << Routines.at(i)->parent_index << ' ' << Routines.at(i)->state << end(); //? 1
-//? } //? 1
 for (long long int i = 0; i < SIZE(Routines); ++i) {
   if (Routines.at(i)->state == COMPLETED) continue;
   if (Routines.at(i)->parent_index < 0) continue;  // root thread
-//?   trace("schedule") << "AAA " << i << end(); //? 1
   if (has_completed_parent(i)) {
-//?     trace("schedule") << "BBB " << i << end(); //? 1
     Routines.at(i)->state = COMPLETED;
   }
 }
-//? trace("schedule") << "After cleanup" << end(); //? 1
-//? for (long long int i = 0; i < SIZE(Routines); ++i) { //? 1
-//?   trace("schedule") << i << ": " << Routines.at(i)->id << ' ' << Routines.at(i)->state << ' ' << Routines.at(i)->parent_index << ' ' << Routines.at(i)->state << end(); //? 1
-//? } //? 1
 
 :(code)
 bool has_completed_parent(long long int routine_index) {
-//?   trace("schedule") << "CCC " << routine_index << '\n' << end(); //? 2
   for (long long int j = routine_index; j >= 0; j = Routines.at(j)->parent_index) {
-//?     trace("schedule") << "DDD " << j << '\n' << end(); //? 2
     if (Routines.at(j)->state == COMPLETED)
       return true;
   }
diff --git a/043new.cc b/043new.cc
index 5fb62ed3..d72ca7ec 100644
--- a/043new.cc
+++ b/043new.cc
@@ -114,7 +114,7 @@ case NEW: {
 //? :(before "End Teardown") //? 1
 //? cerr << Total_alloc << "/" << Num_alloc //? 1
 //?      << " vs " << Total_free << "/" << Num_free << '\n'; //? 1
-//? cerr << Memory.size() << '\n'; //? 1
+//? cerr << SIZE(Memory) << '\n'; //? 1
 
 :(code)
 void ensure_space(long long int size) {
diff --git a/072scenario_screen.cc b/072scenario_screen.cc
index b3642f1a..d456a8d8 100644
--- a/072scenario_screen.cc
+++ b/072scenario_screen.cc
@@ -7,7 +7,6 @@
 :(scenarios run_mu_scenario)
 :(scenario screen_in_scenario)
 scenario screen-in-scenario [
-#?   $start-tracing #? 2
   assume-screen 5:literal/width, 3:literal/height
   run [
     screen:address <- print-character screen:address, 97:literal  # 'a'
@@ -18,7 +17,6 @@ scenario screen-in-scenario [
     .     .
     .     .
   ]
-#?   $exit #? 1
 ]
 
 :(scenario screen_in_scenario_unicode)
@@ -34,7 +32,6 @@ scenario screen-in-scenario-unicode-color [
     .     .
     .     .
   ]
-#?   $exit
 ]
 
 :(scenario screen_in_scenario_color)
@@ -67,7 +64,6 @@ scenario screen-in-scenario-color [
     .     .
     .     .
   ]
-#?   $exit
 ]
 
 :(scenario screen_in_scenario_error)
@@ -144,7 +140,6 @@ Name[r]["screen"] = SCREEN;
 :(before "End Rewrite Instruction(curr)")
 // rewrite `assume-screen width, height` to
 // `screen:address <- new-fake-screen width, height`
-//? cout << "before: " << curr.to_string() << '\n'; //? 1
 if (curr.name == "assume-screen") {
   curr.operation = Recipe_ordinal["new-fake-screen"];
   curr.name = "new-fake-screen";
@@ -152,8 +147,6 @@ if (curr.name == "assume-screen") {
   assert(curr.products.empty());
   curr.products.push_back(reagent("screen:address"));
   curr.products.at(0).set_value(SCREEN);
-//? cout << "after: " << curr.to_string() << '\n'; //? 1
-//? cout << "AAA " << Recipe_ordinal["new-fake-screen"] << '\n'; //? 1
 }
 
 //: screen-should-contain is a regular instruction
@@ -196,7 +189,6 @@ struct raw_string_stream {
 
 :(code)
 void check_screen(const string& expected_contents, const int color) {
-//?   cerr << "Checking screen for color " << color << "\n"; //? 2
   assert(!Current_routine->calls.front().default_space);  // not supported
   long long int screen_location = Memory[SCREEN];
   int data_offset = find_element_name(Type_ordinal["screen"], "data");
@@ -210,29 +202,20 @@ void check_screen(const string& expected_contents, const int color) {
   raw_string_stream cursor(expected_contents);
   // todo: too-long expected_contents should fail
   long long int addr = screen_data_start+1;  // skip length
-//?   cerr << "screen height " << screen_height << '\n'; //? 1
   for (long long int row = 0; row < screen_height; ++row) {
-//?     cerr << "row: " << row << '\n'; //? 3
-//?     cerr << "contents: " << cursor.buf+cursor.index << "$\n"; //? 1
     cursor.skip_whitespace_and_comments();
     if (cursor.at_end()) break;
-//?     cerr << "row2\n"; //? 2
     assert(cursor.get() == '.');
     for (long long int column = 0;  column < screen_width;  ++column, addr+= /*size of screen-cell*/2) {
       const int cell_color_offset = 1;
       uint32_t curr = cursor.get();
-//?       cerr << "col: " << column << '\n'; //? 1
       if (Memory[addr] == 0 && isspace(curr)) continue;
-//?       cerr << color << " vs " << Memory[addr+1] << '\n'; //? 1
       if (curr == ' ' && color != -1 && color != Memory[addr+cell_color_offset]) {
         // filter out other colors
         continue;
       }
-//?       cerr << "col3 " << column << ": " << Memory[addr] << " " << curr << '\n'; //? 1
       if (Memory[addr] != 0 && Memory[addr] == curr) {
-//?         cerr << "col4\n"; //? 1
         if (color == -1 || color == Memory[addr+cell_color_offset]) continue;
-//?         cerr << "col5: " << column << '\n'; //? 1
         // contents match but color is off
         if (Current_scenario && !Scenario_testing_scenario) {
           // genuine test in a mu file
@@ -249,7 +232,6 @@ void check_screen(const string& expected_contents, const int color) {
         return;
       }
 
-//?       cerr << "col6 " << column << ": " << Memory[addr] << " " << curr << '\n'; //? 1
       // really a mismatch
       // can't print multi-byte unicode characters in warnings just yet. not very useful for debugging anyway.
       char expected_pretty[10] = {0};
@@ -284,11 +266,9 @@ void check_screen(const string& expected_contents, const int color) {
   assert(cursor.at_end());
 }
 
-raw_string_stream::raw_string_stream(const string& backing) :index(0), max(backing.size()), buf(backing.c_str()) {}
+raw_string_stream::raw_string_stream(const string& backing) :index(0), max(SIZE(backing)), buf(backing.c_str()) {}
 
 bool raw_string_stream::at_end() const {
-//?   cerr << index << ' ' << max << '\n'; //? 1
-//?   cerr << buf << "$\n"; //? 1
   if (index >= max) return true;
   if (tb_utf8_char_length(buf[index]) > max-index) {
     raise << "unicode string seems corrupted at index "<< index << " character " << static_cast<int>(buf[index]) << '\n' << end();
@@ -348,11 +328,9 @@ void dump_screen() {
   assert(data_offset >= 0);
   long long int screen_data_location = screen_location+data_offset;  // type: address:array:character
   long long int screen_data_start = Memory[screen_data_location];  // type: array:character
-//?   cerr << "data start: " << screen_data_start << '\n'; //? 1
   assert(Memory[screen_data_start] == screen_width*screen_height);
   long long int curr = screen_data_start+1;  // skip length
   for (long long int row = 0; row < screen_height; ++row) {
-//?     cerr << curr << ":\n"; //? 2
     cerr << '.';
     for (long long int col = 0; col < screen_width; ++col) {
       if (Memory[curr])
diff --git a/081run_interactive.cc b/081run_interactive.cc
index 75e58012..7bc2ca5a 100644
--- a/081run_interactive.cc
+++ b/081run_interactive.cc
@@ -242,7 +242,7 @@ long long int stringified_value_of_location(long long int address) {
 }
 
 bool is_string(const reagent& x) {
-  return x.types.size() == 3
+  return SIZE(x.types) == 3
       && x.types.at(0) == Type_ordinal["address"]
       && x.types.at(1) == Type_ordinal["array"]
       && x.types.at(2) == Type_ordinal["character"];