about summary refs log tree commit diff stats
path: root/027debug.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-05 21:17:24 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-05 21:17:24 -0700
commitb96af395b9af2ff9df94b3e82213171f30827c8d (patch)
tree17c8c12648ccc25625e2534ec8d74fbe8f1542cc /027debug.cc
parent2e3b597fe85b654e82b891c22d50754fa5a26156 (diff)
downloadmu-b96af395b9af2ff9df94b3e82213171f30827c8d.tar.gz
1276 - make C++ version the default
I've tried to update the Readme, but there are at least a couple of issues.
Diffstat (limited to '027debug.cc')
-rw-r--r--027debug.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/027debug.cc b/027debug.cc
new file mode 100644
index 00000000..27ac8ce6
--- /dev/null
+++ b/027debug.cc
@@ -0,0 +1,52 @@
+//: Recipe to look at elements of containers.
+
+:(before "End Primitive Recipe Declarations")
+_PRINT,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["$print"] = _PRINT;
+:(before "End Primitive Recipe Implementations")
+case _PRINT: {
+  if (isa_literal(current_instruction().ingredients[0])) {
+    trace("run") << "$print: " << current_instruction().ingredients[0].name;
+    cout << current_instruction().ingredients[0].name;
+    break;
+  }
+  vector<long long int> result(read_memory(current_instruction().ingredients[0]));
+  for (index_t i = 0; i < result.size(); ++i) {
+    trace("run") << "$print: " << result[i];
+    if (i > 0) cout << " ";
+    cout << result[i];
+  }
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_START_TRACING,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["$start-tracing"] = _START_TRACING;
+:(before "End Primitive Recipe Implementations")
+case _START_TRACING: {
+  Trace_stream->dump_layer = "all";
+//?   cout << Trace_stream << ": " << Trace_stream->dump_layer << '\n'; //? 1
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_STOP_TRACING,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["$stop-tracing"] = _STOP_TRACING;
+:(before "End Primitive Recipe Implementations")
+case _STOP_TRACING: {
+  Trace_stream->dump_layer = "";
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+_EXIT,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["$exit"] = _EXIT;
+:(before "End Primitive Recipe Implementations")
+case _EXIT: {
+  exit(0);
+  break;
+}