about summary refs log tree commit diff stats
path: root/029tools.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-02-25 00:17:46 -0800
committerKartik Agaram <vc@akkartik.com>2019-02-25 01:50:53 -0800
commitc442a5ad806b6cccbb3ec4c5744b14b0c1f31a01 (patch)
tree318fb1d56e7ee3c750635d3326ad0739dfdacefe /029tools.cc
parente5998f74ac29bb4bf2aedfdd6fbea801ffdb08f6 (diff)
downloadmu-c442a5ad806b6cccbb3ec4c5744b14b0c1f31a01.tar.gz
4987 - support `browse_trace` tool in SubX
I've extracted it into a separate binary, independent of my Mu prototype.

I also cleaned up my tracing layer to be a little nicer. Major improvements:

- Realized that incremental tracing really ought to be the default.
  And to minimize printing traces to screen.

- Finally figured out how to combine layers and call stack frames in a
  single dimension of depth. The answer: optimize for the experience of
  `browse_trace`. Instructions occupy a range of depths based on their call
  stack frame, and minor details of an instruction lie one level deeper
  in each case.

Other than that, I spent some time adjusting levels everywhere to make
`browse_trace` useful.
Diffstat (limited to '029tools.cc')
-rw-r--r--029tools.cc18
1 files changed, 2 insertions, 16 deletions
diff --git a/029tools.cc b/029tools.cc
index be3c04e2..56ac861c 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -169,20 +169,6 @@ case _CLEAR_TRACE: {
   break;
 }
 
-:(before "End Primitive Recipe Declarations")
-_SAVE_TRACE,
-:(before "End Primitive Recipe Numbers")
-put(Recipe_ordinal, "$save-trace", _SAVE_TRACE);
-:(before "End Primitive Recipe Checks")
-case _SAVE_TRACE: {
-  break;
-}
-:(before "End Primitive Recipe Implementations")
-case _SAVE_TRACE: {
-  if (Save_trace) Trace_stream->save();
-  break;
-}
-
 //:: 'cheating' by using the host system
 
 :(before "End Primitive Recipe Declarations")
@@ -197,7 +183,7 @@ case _PRINT: {
 case _PRINT: {
   for (int i = 0;  i < SIZE(ingredients);  ++i) {
     if (is_literal(current_instruction().ingredients.at(i))) {
-      trace(9998, "run") << "$print: " << current_instruction().ingredients.at(i).name << end();
+      trace(Callstack_depth+1, "run") << "$print: " << current_instruction().ingredients.at(i).name << end();
       if (!has_property(current_instruction().ingredients.at(i), "newline")) {
         cout << current_instruction().ingredients.at(i).name;
       }
@@ -210,7 +196,7 @@ case _PRINT: {
     // End $print Special-cases
     else {
       for (int j = 0;  j < SIZE(ingredients.at(i));  ++j) {
-        trace(9998, "run") << "$print: " << ingredients.at(i).at(j) << end();
+        trace(Callstack_depth+1, "run") << "$print: " << ingredients.at(i).at(j) << end();
         if (j > 0) cout << " ";
         cout << no_scientific(ingredients.at(i).at(j));
       }