Mercurial > octave
changeset 27201:bd49997051ef
eliminate direct access to call stack in defun functions
* pt-eval.h, pt-eval.cc (tree_evaluator::current_function): New function.
* defun.cc (print_usage, get_current_shlib): Eliminate direct access
to call stack.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Apr 2019 17:39:42 +0000 |
parents | dc1edf932248 |
children | 23962b243bad |
files | libinterp/corefcn/defun.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h |
diffstat | 3 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/defun.cc Mon Apr 01 17:32:02 2019 +0000 +++ b/libinterp/corefcn/defun.cc Mon Apr 01 17:39:42 2019 +0000 @@ -26,7 +26,6 @@ #include <string> -#include "call-stack.h" #include "defun.h" #include "dynamic-ld.h" #include "error.h" @@ -50,9 +49,9 @@ void print_usage (void) { - octave::call_stack& cs = octave::__get_call_stack__ ("print_usage"); + octave::tree_evaluator& tw = octave::__get_evaluator__ ("print_usage"); - const octave_function *cur = cs.current (); + const octave_function *cur = tw.current_function (); if (cur) print_usage (cur->name ()); @@ -139,9 +138,9 @@ { octave::dynamic_library retval; - octave::call_stack& cs = octave::__get_call_stack__ ("get_current_shlib"); + octave::tree_evaluator& tw = octave::__get_evaluator__ ("get_current_shlib"); - octave_function *curr_fcn = cs.current (); + octave_function *curr_fcn = tw.current_function (); if (curr_fcn) {
--- a/libinterp/parse-tree/pt-eval.cc Mon Apr 01 17:32:02 2019 +0000 +++ b/libinterp/parse-tree/pt-eval.cc Mon Apr 01 17:39:42 2019 +0000 @@ -1881,6 +1881,11 @@ return m_call_stack.current_user_code (); } + octave_function * tree_evaluator::current_function (void) const + { + return m_call_stack.current (); + } + bool tree_evaluator::goto_frame (size_t n, bool verbose) { return m_call_stack.goto_frame (n, verbose);
--- a/libinterp/parse-tree/pt-eval.h Mon Apr 01 17:32:02 2019 +0000 +++ b/libinterp/parse-tree/pt-eval.h Mon Apr 01 17:39:42 2019 +0000 @@ -495,6 +495,8 @@ octave_user_code * caller_user_code (size_t nskip = 0) const; + octave_function * current_function (void) const; + bool goto_frame (size_t n = 0, bool verbose = false); void restore_frame (size_t n);