about summary refs log tree commit diff stats
path: root/029tools.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-08-02 15:26:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-08-02 16:18:16 -0700
commit7f402c85eb34a739055dc3e5bb4be337169ec68c (patch)
treecbb0365029213b87f8da70b00268bf8981b9a892 /029tools.cc
parentd082b17675f40037b0e6c26384d99362acd0749e (diff)
downloadmu-7f402c85eb34a739055dc3e5bb4be337169ec68c.tar.gz
1921 - show trace by clicking on code
Region to click on to edit is now reduced to just the menu bar for the
sandbox (excluding the 'x' for deleting the sandbox). The symmetry there
might be useful, but we'll see if the relative click area is
in line with how commonly the actions are performed.
Diffstat (limited to '029tools.cc')
-rw-r--r--029tools.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/029tools.cc b/029tools.cc
index cd4123fa..587818ea 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -12,15 +12,22 @@ TRACE,
 Recipe_ordinal["trace"] = TRACE;
 :(before "End Primitive Recipe Implementations")
 case TRACE: {
-  if (SIZE(ingredients) != 2) {
-    raise << current_recipe_name() << ": 'trace' takes exactly two ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
-    break;
+  if (SIZE(ingredients) == 2) {
+    assert(is_literal(current_instruction().ingredients.at(0)));
+    string label = current_instruction().ingredients.at(0).name;
+    assert(is_literal(current_instruction().ingredients.at(1)));
+    string message = current_instruction().ingredients.at(1).name;
+    trace(1, label) << message << end();
+  }
+  else if (SIZE(ingredients) == 1) {
+    assert(is_literal(current_instruction().ingredients.at(0)));
+    string message = current_instruction().ingredients.at(0).name;
+    cerr << "tracing " << message << '\n';
+    trace(1, "app") << message << end();
+  }
+  else {
+    raise << current_recipe_name() << ": 'trace' takes one or two ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
   }
-  assert(is_literal(current_instruction().ingredients.at(0)));
-  string label = current_instruction().ingredients.at(0).name;
-  assert(is_literal(current_instruction().ingredients.at(1)));
-  string message = current_instruction().ingredients.at(1).name;
-  trace(1, label) << message << end();
   break;
 }