From 0ce24b26894eceb38e6b71337db34a542bfc6dd2 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 20 Apr 2016 20:07:50 -0700 Subject: 2850 --- 029tools.cc | 18 ++++++++++++++++++ 030address.cc | 12 ++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/029tools.cc b/029tools.cc index 2a52cb2e..cb24fd85 100644 --- a/029tools.cc +++ b/029tools.cc @@ -325,3 +325,21 @@ case _LOG: { LOG << out.str() << '\n'; break; } + +//: set a variable from within mu code +//: useful for selectively tracing or printing after some point +:(before "End Globals") +bool Foo = false; +:(before "End Primitive Recipe Declarations") +_FOO, +:(before "End Primitive Recipe Numbers") +put(Recipe_ordinal, "$foo", _FOO); +:(before "End Primitive Recipe Checks") +case _FOO: { + break; +} +:(before "End Primitive Recipe Implementations") +case _FOO: { + Foo = true; + break; +} diff --git a/030address.cc b/030address.cc index dde4d79a..47431b63 100644 --- a/030address.cc +++ b/030address.cc @@ -152,21 +152,21 @@ case _DUMP: { //: grab an address, and then dump its value at intervals //: useful for tracking down memory corruption (writing to an out-of-bounds address) :(before "End Globals") -int foo = -1; +int Bar = -1; :(before "End Primitive Recipe Declarations") -_FOO, +_BAR, :(before "End Primitive Recipe Numbers") -put(Recipe_ordinal, "$foo", _FOO); +put(Recipe_ordinal, "$bar", _BAR); :(before "End Primitive Recipe Implementations") -case _FOO: { +case _BAR: { if (current_instruction().ingredients.empty()) { - if (foo != -1) cerr << foo << ": " << no_scientific(get_or_insert(Memory, foo)) << '\n'; + if (Bar != -1) cerr << Bar << ": " << no_scientific(get_or_insert(Memory, Bar)) << '\n'; else cerr << '\n'; } else { reagent tmp = current_instruction().ingredients.at(0); canonize(tmp); - foo = tmp.value; + Bar = tmp.value; } break; } -- cgit 1.4.1-2-gfad0