about summary refs log tree commit diff stats
path: root/011load.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-29 11:15:13 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-29 11:15:13 -0700
commitb2ec0969e9f7ef7c3267545efbed907c15084695 (patch)
treea7104a5daf769414a90aec52da93e57507c5fba5 /011load.cc
parente330f8545533d03bfe1a29506f243d4846dbd7c2 (diff)
downloadmu-b2ec0969e9f7ef7c3267545efbed907c15084695.tar.gz
2310 - add some more tracing
I've been growing lax on white-box testing when it's one of the three
big thrusts of this whole effort. Perhaps it was because I got too
obsessed with keeping traces stable and didn't notice that stable
doesn't mean "not changing". Or perhaps it's because I still don't have
a zoomable trace browser that can parse traces from disk. Or perhaps
$trace-browser is too clunky and discourages me from using it.
Regardless, I need to make the trace useable again before I work much
more on the next few rewriting transforms.
Diffstat (limited to '011load.cc')
-rw-r--r--011load.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/011load.cc b/011load.cc
index 3e1766f9..db97f3b0 100644
--- a/011load.cc
+++ b/011load.cc
@@ -47,7 +47,9 @@ long long int slurp_recipe(istream& in) {
   if (Recipe_ordinal.find(recipe_name) == Recipe_ordinal.end()) {
     Recipe_ordinal[recipe_name] = Next_recipe_ordinal++;
   }
+  trace(9991, "load") << "--- defining " << recipe_name << end();
   if (Recipe.find(Recipe_ordinal[recipe_name]) != Recipe.end()) {
+    trace(9991, "parse") << "already exists" << end();
     if (warn_on_redefine(recipe_name))
       raise << "redefining recipe " << Recipe[Recipe_ordinal[recipe_name]].name << "\n" << end();
     Recipe.erase(Recipe_ordinal[recipe_name]);
@@ -69,6 +71,7 @@ void slurp_body(istream& in, recipe& result) {
   instruction curr;
   while (next_instruction(in, &curr)) {
     // End Rewrite Instruction(curr, recipe result)
+    trace(9992, "load") << "after rewriting: " << curr.to_string() << end();
     if (!curr.is_clear())
       result.steps.push_back(curr);
   }
@@ -110,7 +113,7 @@ bool next_instruction(istream& in, instruction* curr) {
   if (SIZE(words) == 1 && !isalnum(words.at(0).at(0)) && words.at(0).at(0) != '$') {
     curr->is_label = true;
     curr->label = words.at(0);
-    trace("parse") << "label: " << curr->label << end();
+    trace(9993, "parse") << "label: " << curr->label << end();
     if (in.eof()) {
       raise_error << "7: unbalanced '[' for recipe\n" << end();
       return false;
@@ -144,12 +147,12 @@ bool next_instruction(istream& in, instruction* curr) {
     curr->ingredients.push_back(reagent(*p));
   }
 
-  trace("parse") << "instruction: " << curr->name << end();
+  trace(9993, "parse") << "instruction: " << curr->name << end();
   for (vector<reagent>::iterator p = curr->ingredients.begin(); p != curr->ingredients.end(); ++p) {
-    trace("parse") << "  ingredient: " << p->to_string() << end();
+    trace(9993, "parse") << "  ingredient: " << p->to_string() << end();
   }
   for (vector<reagent>::iterator p = curr->products.begin(); p != curr->products.end(); ++p) {
-    trace("parse") << "  product: " << p->to_string() << end();
+    trace(9993, "parse") << "  product: " << p->to_string() << end();
   }
   if (in.eof()) {
     raise_error << "9: unbalanced '[' for recipe\n" << end();