diff libinterp/parse-tree/pt-eval.h @ 23729:06b3d1d54054

allow echo state to be modified from inside functions * ov-usr-fcn.h, ov-usr-fcn.cc (octave_user_code::curr_unwind_protect_frame, octave_user_code::unwind_protect_frame): Move variable and accessor function here from octave_user_function. (octave_user_script::call): Also unwind-protect and set current unwind_protect frame variable here. * pt-eval.h, pt-eval.cc (tree_evaluator::set_echo_state, tree_evaluator::maybe_set_echo_state, tree_evaluator::push_echo_state_cleanup, maybe_push_echo_state_cleanup): New functions. (tree_evaluator::push_echo_state): Call push_ech_state_cleanup and set_echo_state. (tree_evaluator::echo): Call maybe_push_echo_state_cleanup and set_echo_state.
author John W. Eaton <jwe@octave.org>
date Wed, 05 Jul 2017 08:37:45 -0400
parents b40b7243a782
children ea879bc55272
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.h	Wed Jul 05 09:44:01 2017 -0400
+++ b/libinterp/parse-tree/pt-eval.h	Wed Jul 05 08:37:45 2017 -0400
@@ -365,14 +365,22 @@
       return old_val;
     }
 
-    void push_echo_state (unwind_protect& frame, int type,
-                          const std::string& file_name);
-
     octave_value
     string_fill_char (const octave_value_list& args, int nargout);
 
+    void push_echo_state (unwind_protect& frame, int type,
+                          const std::string& file_name, size_t pos = 1);
+
   private:
 
+    void set_echo_state (int type, const std::string& file_name, size_t pos);
+
+    void maybe_set_echo_state (void);
+
+    void push_echo_state_cleanup (unwind_protect& frame);
+
+    bool maybe_push_echo_state_cleanup (void);
+
     void do_breakpoint (tree_statement& stmt) const;
 
     void do_breakpoint (bool is_breakpoint,