From 2e8c5d39157d1178ad453c86d94d4e1830d8dfe6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 8 Jul 2015 13:26:02 -0700 Subject: 1723 Some reorg before we start plumbing 'reply' from 'run-interactive' to return a string containing the results. --- 034call.cc | 5 +---- 036call_reply.cc | 5 +---- 081run_interactive.cc | 15 +++++++++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/034call.cc b/034call.cc index 6d820809..45251b52 100644 --- a/034call.cc +++ b/034call.cc @@ -107,10 +107,7 @@ inline const vector& routine::steps() const { // when we reach the end of one call, we may reach the end of the one below // it, and the one below that, and so on while (current_step_index() >= SIZE(Current_routine->steps())) { - if (current_recipe_name() == "interactive") { -//? trace("foo") << "showing warnings again"; //? 1 - Hide_warnings = false; - } + // Falling Through End Of Recipe --Callstack_depth; //? cerr << "reply " << Current_routine->calls.size() << '\n'; //? 2 Current_routine->calls.pop_front(); diff --git a/036call_reply.cc b/036call_reply.cc index d09763fe..71aa4991 100644 --- a/036call_reply.cc +++ b/036call_reply.cc @@ -18,12 +18,9 @@ REPLY, Recipe_ordinal["reply"] = REPLY; :(before "End Primitive Recipe Implementations") case REPLY: { + // Starting Reply const instruction& reply_inst = current_instruction(); // save pointer into recipe before pop const string& callee = current_recipe_name(); - if (callee == "interactive") { - trace("foo") << "showing warnings again"; - Hide_warnings = true; - } --Callstack_depth; //? if (tb_is_active()) { //? 1 //? tb_clear(); //? 1 diff --git a/081run_interactive.cc b/081run_interactive.cc index fd076c06..bf995c39 100644 --- a/081run_interactive.cc +++ b/081run_interactive.cc @@ -36,13 +36,11 @@ case RUN_INTERACTIVE: { } :(code) -// reads a string, tries to call it as code. +// reads a string, tries to call it as code, saving all warnings. // returns true if successfully called (no errors found during load and transform) bool run_interactive(long long int address) { long long int size = Memory[address]; - if (size == 0) { - return false; - } + if (size == 0) return false; ostringstream tmp; for (long long int curr = address+1; curr <= address+size; ++curr) { // todo: unicode @@ -65,6 +63,15 @@ bool run_interactive(long long int address) { return true; } +:(after "Starting Reply") +if (current_recipe_name() == "interactive") clean_up_interactive(); +:(after "Falling Through End Of Recipe") +if (current_recipe_name() == "interactive") clean_up_interactive(); +:(code) +void clean_up_interactive() { + Hide_warnings = false; +} + string strip_comments(string in) { ostringstream result; for (long long int i = 0; i < SIZE(in); ++i) { -- cgit 1.4.1-2-gfad0