about summary refs log tree commit diff stats
path: root/cpp/025trace
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-17 11:00:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-17 11:00:56 -0700
commitc495d2ac7ca0d7f1c1a9bbb7d1ad5072a7eface5 (patch)
tree95db0f8d742a87eba6c15833d0ac9b982e98174d /cpp/025trace
parent353a452e691a8b55e28d7b3b1d09cf294265eba0 (diff)
downloadmu-c495d2ac7ca0d7f1c1a9bbb7d1ad5072a7eface5.tar.gz
1075
Diffstat (limited to 'cpp/025trace')
-rw-r--r--cpp/025trace19
1 files changed, 19 insertions, 0 deletions
diff --git a/cpp/025trace b/cpp/025trace
new file mode 100644
index 00000000..bd05d848
--- /dev/null
+++ b/cpp/025trace
@@ -0,0 +1,19 @@
+:(scenario "trace")
+recipe main [
+  trace [foo], [this is a trace in mu]
+]
++foo: this is a trace in mu
+
+:(before "End Primitive Recipe Declarations")
+TRACE,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["trace"] = TRACE;
+:(before "End Primitive Recipe Implementations")
+case TRACE: {
+  assert(isa_literal(instructions[pc].ingredients[0]));
+  string label = instructions[pc].ingredients[0].name;
+  assert(isa_literal(instructions[pc].ingredients[1]));
+  string message = instructions[pc].ingredients[1].name;
+  trace(label) << message;
+  break;
+}