diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-09 17:57:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-09 17:57:19 -0700 |
commit | 6251c2c5a1a3be7f1958dc44da605be5f7d43c64 (patch) | |
tree | 6ba342ac75415fa828a9cce34bdd567eeee5f565 /cpp/032trace | |
parent | 442a33019c03480612290b4741b07a0caa310d3d (diff) | |
download | mu-6251c2c5a1a3be7f1958dc44da605be5f7d43c64.tar.gz |
1046 - mu programs can now add to the trace
Still just raw strings, but interpolation is coming.
Diffstat (limited to 'cpp/032trace')
-rw-r--r-- | cpp/032trace | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cpp/032trace b/cpp/032trace new file mode 100644 index 00000000..3a7b0b0e --- /dev/null +++ b/cpp/032trace @@ -0,0 +1,21 @@ +:(scenario "trace") +recipe main [ + trace [foo], [this is a trace in mu] +] ++foo: this is a trace in mu + +:(before "End Globals") +const int TRACE = 32; +:(before "End Primitive Recipe Numbers") +Recipe_number["trace"] = TRACE; +assert(Next_recipe_number == TRACE); +Next_recipe_number++; +:(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; +} |