From a654e4ecace2d506d1b10f1dde2c287ebe84ef37 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 26 Mar 2016 23:59:59 -0700 Subject: 2812 --- html/063wait.cc.html | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'html/063wait.cc.html') diff --git a/html/063wait.cc.html b/html/063wait.cc.html index 4dcffd9b..da1acf6a 100644 --- a/html/063wait.cc.html +++ b/html/063wait.cc.html @@ -3,27 +3,35 @@ Mu - 063wait.cc - - + + - + + + + -
+
 //: Routines can be put in a 'waiting' state, from which it will be ready to
 //: run again when a specific memory location changes its value. This is mu's
 //: basic technique for orchestrating the order in which different routines
@@ -49,7 +57,7 @@ def f2 [
 WAITING,
 :(before "End routine Fields")
 // only if state == WAITING
-long long int waiting_on_location;
+int waiting_on_location;
 int old_value_of_waiting_location;
 :(before "End routine Constructor")
 waiting_on_location = old_value_of_waiting_location = 0;
@@ -78,7 +86,7 @@ put(Recipe_ordinal,//: scheduler tweak to get routines out of that state
 
 :(before "End Scheduler State Transitions")
-for (long long int i = 0; i < SIZE(Routines); ++i) {
+for (int i = 0; i < SIZE(Routines); ++i) {
   if (Routines.at(i)->state != WAITING) continue;
   if (Routines.at(i)->waiting_on_location &&
       get_or_insert(Memory, Routines.at(i)->waiting_on_location) != Routines.at(i)->old_value_of_waiting_location) {
@@ -111,7 +119,7 @@ def f2 [
 
 :(before "End routine Fields")
 // only if state == WAITING
-long long int waiting_on_routine;
+int waiting_on_routine;
 :(before "End routine Constructor")
 waiting_on_routine = 0;
 
@@ -122,7 +130,7 @@ put(Recipe_ordinal,:(before "End Primitive Recipe Checks")
 case WAIT_FOR_ROUTINE: {
   if (SIZE(inst.ingredients) != 1) {
-    raise << maybe(get(Recipe, r).name) << "'wait-for-routine' requires exactly one ingredient, but got " << to_string(inst) << '\n' << end();
+    raise << maybe(get(Recipe, r).name) << "'wait-for-routine' requires exactly one ingredient, but got " << to_original_string(inst) << '\n' << end();
     break;
   }
   if (!is_mu_number(inst.ingredients.at(0))) {
@@ -134,7 +142,7 @@ put(Recipe_ordinal,:(before "End Primitive Recipe Implementations")
 case WAIT_FOR_ROUTINE: {
   if (ingredients.at(0).at(0) == Current_routine->id) {
-    raise << maybe(current_recipe_name()) << "routine can't wait for itself! " << to_string(current_instruction()) << '\n' << end();
+    raise << maybe(current_recipe_name()) << "routine can't wait for itself! " << to_original_string(current_instruction()) << '\n' << end();
     break;
   }
   Current_routine->state = WAITING;
@@ -147,12 +155,12 @@ put(Recipe_ordinal,// Wake up any routines waiting for other routines to go to sleep.
 // Important: this must come after the scheduler loop above giving routines
 // waiting for locations to change a chance to wake up.
-for (long long int i = 0; i < SIZE(Routines); ++i) {
+for (int i = 0; i < SIZE(Routines); ++i) {
   if (Routines.at(i)->state != WAITING) continue;
   if (!Routines.at(i)->waiting_on_routine) continue;
-  long long int id = Routines.at(i)->waiting_on_routine;
+  int id = Routines.at(i)->waiting_on_routine;
   assert(id != Routines.at(i)->id);  // routine can't wait on itself
-  for (long long int j = 0; j < SIZE(Routines); ++j) {
+  for (int j = 0; j < SIZE(Routines); ++j) {
     if (Routines.at(j)->id == id && Routines.at(j)->state != RUNNING) {
       trace(9999, "schedule") << "waking up routine " << Routines.at(i)->id << end();
       Routines.at(i)->state = RUNNING;
@@ -171,7 +179,7 @@ put(Recipe_ordinal,}
 :(before "End Primitive Recipe Implementations")
 case SWITCH: {
-  long long int id = some_other_running_routine();
+  int id = some_other_running_routine();
   if (id) {
     assert(id != Current_routine->id);
     Current_routine->state = WAITING;
@@ -181,8 +189,8 @@ put(Recipe_ordinal,}
 
 :(code)
-long long int some_other_running_routine() {
-  for (long long int i = 0; i < SIZE(Routines); ++i) {
+int some_other_running_routine() {
+  for (int i = 0; i < SIZE(Routines); ++i) {
     if (i == Current_routine_index) continue;
     assert(Routines.at(i) != Current_routine);
     assert(Routines.at(i)->id != Current_routine->id);
@@ -194,3 +202,4 @@ put(Recipe_ordinal,
 
 
+
-- 
cgit 1.4.1-2-gfad0