diff libinterp/parse-tree/pt-eval.cc @ 18267:bc139ccccef9 gui-release

Don't echo scripts not executed from the cmd line when using 'echo on'(bug #41202) * toplev.h (octave_call_stack::all_scripts): New function returns TRUE if all elements an the call stack are scripts. Add prototype for do_all_scripts(). toplev.cc (octave_call_stack::do_all_scripts): New function to search call stack scripts only. * pt-eval.cc (tree_evaluator::visit_statement): Check octave_call_stack::all_scripts() and don't echo scripts if script is called from a function.
author Rik <rik@octave.org>
date Sun, 12 Jan 2014 18:18:47 -0800
parents 6ef8b920a7d6
children 75d7cde2dda4 3978a5509f40
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Fri Jan 10 19:25:07 2014 -0500
+++ b/libinterp/parse-tree/pt-eval.cc	Sun Jan 12 18:18:47 2014 -0800
@@ -705,13 +705,12 @@
           if (! Vdebugging)
             octave_call_stack::set_location (stmt.line (), stmt.column ());
 
-          // FIXME: we need to distinguish functions from scripts
-          //        to get this right.
           if ((statement_context == script
-               && ((Vecho_executing_commands & ECHO_SCRIPTS)
-                   || (Vecho_executing_commands & ECHO_FUNCTIONS)))
+               && ((Vecho_executing_commands & ECHO_SCRIPTS
+                   && octave_call_stack::all_scripts ())
+                   || Vecho_executing_commands & ECHO_FUNCTIONS))
               || (statement_context == function
-                  && (Vecho_executing_commands & ECHO_FUNCTIONS)))
+                  && Vecho_executing_commands & ECHO_FUNCTIONS))
             stmt.echo_code ();
         }