about summary refs log tree commit diff stats
path: root/029tools.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-12-14 01:30:56 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-12-15 10:20:41 -0800
commit601ff75bc76b5cdc76d54a399dd764cf399822e3 (patch)
treec92fd13ea83e0d666f1986f52ffc032b3955ec91 /029tools.cc
parente167fdf43cedea8b96690246734d652643fe1bd1 (diff)
downloadmu-601ff75bc76b5cdc76d54a399dd764cf399822e3.tar.gz
three bugs fixed
- notes
bug in edit/ triggers in immutable but not master branch
bug triggered by changes to layer 059: we're finding an unspecialized call to 'length' in 'append_6'

hard to debug because trace isn't complete
just bring out the big hammer: use a new log file

length_2 from recipes.mu is not being deleted (bug #1)
so reload doesn't switch length to length_2 when variant_already_exists (bug #2)
so we end up saving in Recipe for a primitive ordinal
so no valid specialization is found for 'length' (bug #3)

why doesn't it trigger in a non-interactive scenario?
argh, wasn't checking for an empty line at end. ok, confidence restored.
Diffstat (limited to '029tools.cc')
-rw-r--r--029tools.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/029tools.cc b/029tools.cc
index 29b40836..fb52c7b4 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -301,3 +301,29 @@ case _DUMP_MEMORY: {
   dump_memory();
   break;
 }
+
+//: In times of real extremis we need to create a whole new modality for debug
+//: logs, independent of other changes to the screen or Trace_stream.
+
+:(before "End Globals")
+ofstream LOG;
+:(before "End One-time Setup")
+//? LOG.open("log");
+
+:(before "End Primitive Recipe Declarations")
+_LOG,
+:(before "End Primitive Recipe Numbers")
+put(Recipe_ordinal, "$log", _LOG);
+:(before "End Primitive Recipe Checks")
+case _LOG: {
+  break;
+}
+:(before "End Primitive Recipe Implementations")
+case _LOG: {
+  ostringstream out;
+  for (long long int i = 0; i < SIZE(current_instruction().ingredients); ++i) {
+    out << print_mu(current_instruction().ingredients.at(i), ingredients.at(i));
+  }
+  LOG << out.str() << "(length: " << get(Recipe_ordinal, "length") << '/' << contains_key(Recipe, get(Recipe_ordinal, "length")) << ")\n";
+  break;
+}