about summary refs log tree commit diff stats
path: root/073wait.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-18 10:44:40 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-18 10:44:40 -0700
commit5813bcfc7d5c368514554d712da45584b5114f0b (patch)
tree09a68f2b2be114d962c8db1ff500c34ee982303d /073wait.cc
parentc83f3bca47b1538ce469fc4463d6165156735675 (diff)
downloadmu-5813bcfc7d5c368514554d712da45584b5114f0b.tar.gz
3520
Drop a few debug prints. Hopefully now we need never duplicate trace
statements and can instead just dump them to screen.

I'll soon need the ability to selectively dump traces for a specific
label.
Diffstat (limited to '073wait.cc')
-rw-r--r--073wait.cc2
1 files changed, 0 insertions, 2 deletions
diff --git a/073wait.cc b/073wait.cc
index 0f6266eb..122f4731 100644
--- a/073wait.cc
+++ b/073wait.cc
@@ -346,7 +346,6 @@ case WAIT_FOR_ROUTINE: {
   Current_routine->state = WAITING;
   Current_routine->waiting_on_routine = ingredients.at(0).at(0);
   trace(9998, "run") << "waiting for routine " << ingredients.at(0).at(0) << end();
-//?   cerr << Current_routine->id << ": waiting for routine " << ingredients.at(0).at(0) << '\n';
   break;
 }
 
@@ -365,7 +364,6 @@ for (int i = 0; i < SIZE(Routines); ++i) {
     if (waitee->id == id && waitee->state != RUNNING && waitee->state != WAITING) {
       // routine is COMPLETED or DISCONTINUED
       trace(9999, "schedule") << "waking up routine " << waiter->id << end();
-//?       cerr << id << " is now done (" << waitee->state << "); waking up waiting routine " << waiter->id << '\n';
       waiter->state = RUNNING;
       waiter->waiting_on_routine = 0;
     }
ackground-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
//: Phase 2: Filter loaded recipes through an extensible list of 'transforms'.
//:
//: The hope is that this framework of transform tools will provide a
//: deconstructed alternative to conventional compilers.

:(before "End recipe Fields")
long long int transformed_until;
  recipe() :transformed_until(-1) {}

:(before "End Types")
typedef void (*transform_fn)(recipe_ordinal);

:(before "End Globals")
vector<transform_fn> Transform;

:(code)
void transform_all() {
  for (long long int t = 0; t < SIZE(Transform); ++t) {
    for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
      recipe& r = p->second;
      if (r.steps.empty()) continue;
      if (r.transformed_until != t-1) continue;
      (*Transform.at(t))(/*recipe_ordinal*/p->first);
      r.transformed_until = t;
    }
  }
  parse_int_reagents();  // do this after all other transforms have run
}

void parse_int_reagents() {
  for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) {
    recipe& r = p->second;
    if (r.steps.empty()) continue;
    for (long long int index = 0; index < SIZE(r.steps); ++index) {
      instruction& inst = r.steps.at(index);
      for (long long int i = 0; i < SIZE(inst.ingredients); ++i) {
        populate_value(inst.ingredients.at(i));
      }
      for (long long int i = 0; i < SIZE(inst.products); ++i) {
        populate_value(inst.products.at(i));
      }
    }
  }
}

void populate_value(reagent& r) {
  if (r.initialized) return;
  // End Reagent-parsing Exceptions
  if (!is_integer(r.name)) return;
  r.set_value(to_integer(r.name));
}