Mercurial > octave
diff libinterp/corefcn/call-stack.cc @ 32589:05b4479c29d8 stable
maint: C++ style check for libinterp/ before 9.1 release.
* libinterp/corefcn/__ichol__.cc, libinterp/corefcn/__ilu__.cc,
libinterp/corefcn/bsxfun.cc, libinterp/corefcn/call-stack.cc,
libinterp/corefcn/defaults.cc, libinterp/corefcn/environment.cc,
libinterp/corefcn/error.cc, libinterp/corefcn/event-manager.cc,
libinterp/corefcn/ft-text-renderer.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/graphics-utils.cc, libinterp/corefcn/graphics.cc,
libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc,
libinterp/corefcn/hook-fcn.cc, libinterp/corefcn/input.cc,
libinterp/corefcn/interpreter-private.cc, libinterp/corefcn/interpreter.cc,
libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc,
libinterp/corefcn/ls-hdf5.cc, libinterp/corefcn/lu.cc,
libinterp/corefcn/mex.cc, libinterp/corefcn/oct-hist.cc,
libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-stream.cc,
libinterp/corefcn/pager.cc, libinterp/corefcn/perms.cc,
libinterp/corefcn/pr-output.cc, libinterp/corefcn/qr.cc,
libinterp/corefcn/settings.cc, libinterp/corefcn/sparse-xdiv.cc,
libinterp/corefcn/stack-frame.cc, libinterp/corefcn/syminfo.cc,
libinterp/corefcn/symrcm.cc, libinterp/corefcn/symscope.cc,
libinterp/corefcn/symtab.cc, libinterp/corefcn/sysdep.cc,
libinterp/corefcn/tsearch.cc, libinterp/corefcn/url-handle-manager.cc,
libinterp/corefcn/utils.cc, libinterp/corefcn/xnorm.cc,
libinterp/dldfcn/__init_fltk__.cc, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov-bool-mat.cc, libinterp/octave-value/ov-cell.cc,
libinterp/octave-value/ov-ch-mat.cc, libinterp/octave-value/ov-class.cc,
libinterp/octave-value/ov-classdef.cc, libinterp/octave-value/ov-fcn-handle.cc,
libinterp/octave-value/ov-fcn-handle.h, libinterp/octave-value/ov-fcn.h,
libinterp/octave-value/ov-inline.h, libinterp/octave-value/ov-lazy-idx.cc,
libinterp/octave-value/ov-range.cc, libinterp/octave-value/ov-range.h,
libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov-usr-fcn.cc,
libinterp/octave-value/ov.cc, libinterp/octave.cc,
libinterp/parse-tree/anon-fcn-validator.cc, libinterp/parse-tree/bp-table.cc,
libinterp/parse-tree/oct-lvalue.cc, libinterp/parse-tree/pt-classdef.cc,
libinterp/parse-tree/pt-colon.cc, libinterp/parse-tree/pt-eval.cc,
libinterp/parse-tree/pt-eval.h, libinterp/parse-tree/pt-tm-const.cc,
libinterp/parse-tree/pt-walk.cc:
C++ style check for libinterp/ before 9.1 release.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 12 Dec 2023 18:24:05 -0800 |
parents | e424a55bc9fb |
children | 60515d0cd023 2e484f9f1f18 |
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc Mon Dec 11 18:28:46 2023 -0500 +++ b/libinterp/corefcn/call-stack.cc Tue Dec 12 18:24:05 2023 -0800 @@ -63,7 +63,8 @@ push (symbol_scope ("top scope")); } -octave_function *call_stack::current_function (bool skip_first) const +octave_function * +call_stack::current_function (bool skip_first) const { if (m_cs.empty ()) error ("current_function: call stack is empty"); @@ -88,7 +89,8 @@ return fcn; } -int call_stack::current_line () const +int +call_stack::current_line () const { int retval = -1; @@ -101,7 +103,8 @@ return retval; } -int call_stack::current_column () const +int +call_stack::current_column () const { int retval = -1; @@ -114,7 +117,8 @@ return retval; } -octave_user_code *call_stack::current_user_code () const +octave_user_code * +call_stack::current_user_code () const { // Start at current frame. @@ -133,7 +137,8 @@ return nullptr; } -int call_stack::current_user_code_line () const +int +call_stack::current_user_code_line () const { // Start at current frame. @@ -157,7 +162,8 @@ return -1; } -int call_stack::current_user_code_column () const +int +call_stack::current_user_code_column () const { // Start at current frame. @@ -181,7 +187,8 @@ return -1; } -unwind_protect *call_stack::curr_fcn_unwind_protect_frame () +unwind_protect * +call_stack::curr_fcn_unwind_protect_frame () { // Start at current frame. @@ -200,7 +207,8 @@ return nullptr; } -octave_user_code *call_stack::debug_user_code () const +octave_user_code * +call_stack::debug_user_code () const { octave_user_code *retval = nullptr; @@ -226,7 +234,8 @@ return retval; } -int call_stack::debug_user_code_line () const +int +call_stack::debug_user_code_line () const { int retval = -1; @@ -255,7 +264,8 @@ return retval; } -int call_stack::debug_user_code_column () const +int +call_stack::debug_user_code_column () const { int retval = -1; @@ -285,17 +295,20 @@ return retval; } -std::string call_stack::get_dispatch_class () const +std::string +call_stack::get_dispatch_class () const { return m_cs[m_curr_frame]->get_dispatch_class (); } -void call_stack::set_dispatch_class (const std::string& class_name) +void +call_stack::set_dispatch_class (const std::string& class_name) { m_cs[m_curr_frame]->set_dispatch_class (class_name); } -bool call_stack::is_class_method_executing (std::string& dispatch_class) const +bool +call_stack::is_class_method_executing (std::string& dispatch_class) const { dispatch_class = ""; @@ -309,7 +322,8 @@ return retval; } -bool call_stack::is_class_constructor_executing (std::string& dispatch_class) const +bool +call_stack::is_class_constructor_executing (std::string& dispatch_class) const { dispatch_class = ""; @@ -323,7 +337,8 @@ return retval; } -bool call_stack::all_scripts () const +bool +call_stack::all_scripts () const { bool retval = true; @@ -375,7 +390,8 @@ : parent_link); } -void call_stack::push (const symbol_scope& scope) +void +call_stack::push (const symbol_scope& scope) { std::size_t new_frame_idx; std::shared_ptr<stack_frame> parent_link; @@ -392,8 +408,9 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_function *fcn, - const std::shared_ptr<stack_frame>& closure_frames) +void +call_stack::push (octave_user_function *fcn, + const std::shared_ptr<stack_frame>& closure_frames) { std::size_t new_frame_idx; std::shared_ptr<stack_frame> parent_link; @@ -411,9 +428,10 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_function *fcn, - const stack_frame::local_vars_map& local_vars, - const std::shared_ptr<stack_frame>& closure_frames) +void +call_stack::push (octave_user_function *fcn, + const stack_frame::local_vars_map& local_vars, + const std::shared_ptr<stack_frame>& closure_frames) { std::size_t new_frame_idx; std::shared_ptr<stack_frame> parent_link; @@ -431,7 +449,8 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_user_script *script) +void +call_stack::push (octave_user_script *script) { std::size_t new_frame_idx; std::shared_ptr<stack_frame> parent_link; @@ -448,7 +467,8 @@ m_curr_frame = new_frame_idx; } -void call_stack::push (octave_function *fcn) +void +call_stack::push (octave_function *fcn) { std::size_t new_frame_idx; std::shared_ptr<stack_frame> parent_link; @@ -465,7 +485,8 @@ m_curr_frame = new_frame_idx; } -bool call_stack::goto_frame (std::size_t n, bool verbose) +bool +call_stack::goto_frame (std::size_t n, bool verbose) { bool retval = false; @@ -486,7 +507,8 @@ return retval; } -std::size_t call_stack::find_current_user_frame () const +std::size_t +call_stack::find_current_user_frame () const { std::size_t user_frame = m_curr_frame; @@ -503,7 +525,8 @@ return user_frame; } -std::shared_ptr<stack_frame> call_stack::current_user_frame () const +std::shared_ptr<stack_frame> +call_stack::current_user_frame () const { std::size_t frame = find_current_user_frame (); @@ -514,7 +537,8 @@ // the call stack that corresponds to a script, function, or scope // beginning with the frame indexed by START. -std::size_t call_stack::dbupdown (std::size_t start, int n, bool verbose) +std::size_t +call_stack::dbupdown (std::size_t start, int n, bool verbose) { if (start >= m_cs.size ()) error ("invalid stack frame"); @@ -604,7 +628,8 @@ // function, script or scope frame then there is an error in the // implementation. -std::size_t call_stack::dbupdown (int n, bool verbose) +std::size_t +call_stack::dbupdown (int n, bool verbose) { std::size_t start = find_current_user_frame (); @@ -616,7 +641,8 @@ // value of m_curr_frame would be wiped out when dbup returns and the // stack frame for dbup is popped. -void call_stack::goto_caller_frame () +void +call_stack::goto_caller_frame () { std::size_t start = find_current_user_frame (); @@ -628,7 +654,8 @@ m_curr_frame = caller_frame ? caller_frame->index () : 0; } -void call_stack::goto_base_frame () +void +call_stack::goto_base_frame () { if (m_curr_frame > 0) m_curr_frame = 0; @@ -699,15 +726,17 @@ return retval; } -std::list<frame_info> call_stack::backtrace_info () const +std::list<frame_info> +call_stack::backtrace_info () const { octave_idx_type curr_user_frame = -1; return backtrace_info (curr_user_frame, true); } -octave_map call_stack::backtrace (octave_idx_type& curr_user_frame, - bool print_subfn) const +octave_map +call_stack::backtrace (octave_idx_type& curr_user_frame, + bool print_subfn) const { std::list<std::shared_ptr<stack_frame>> frames = backtrace_frames (curr_user_frame); @@ -740,19 +769,22 @@ return retval; } -octave_map call_stack::backtrace () const +octave_map +call_stack::backtrace () const { octave_idx_type curr_user_frame = -1; return backtrace (curr_user_frame, true); } -octave_map call_stack::empty_backtrace () const +octave_map +call_stack::empty_backtrace () const { return octave_map (dim_vector (0, 1), bt_fields); } -void call_stack::pop () +void +call_stack::pop () { // Never pop top scope. // FIXME: is it possible for this case to happen? @@ -774,7 +806,8 @@ } } -std::shared_ptr<stack_frame> call_stack::pop_return () +std::shared_ptr<stack_frame> +call_stack::pop_return () { if (!m_cs.empty ()) { @@ -794,18 +827,21 @@ return nullptr; } -void call_stack::clear () +void +call_stack::clear () { while (! m_cs.empty ()) pop (); } -symbol_info_list call_stack::all_variables () +symbol_info_list +call_stack::all_variables () { return m_cs[m_curr_frame]->all_variables (); } -std::list<std::string> call_stack::global_variable_names () const +std::list<std::string> +call_stack::global_variable_names () const { std::list<std::string> retval; @@ -820,17 +856,20 @@ return retval; } -std::list<std::string> call_stack::top_level_variable_names () const +std::list<std::string> +call_stack::top_level_variable_names () const { return m_cs[0]->variable_names (); } -std::list<std::string> call_stack::variable_names () const +std::list<std::string> +call_stack::variable_names () const { return m_cs[m_curr_frame]->variable_names (); } -void call_stack::clear_global_variable (const std::string& name) +void +call_stack::clear_global_variable (const std::string& name) { auto p = m_global_values.find (name); @@ -838,7 +877,8 @@ p->second = octave_value (); } -void call_stack::clear_global_variable_pattern (const std::string& pattern) +void +call_stack::clear_global_variable_pattern (const std::string& pattern) { symbol_match pat (pattern); @@ -849,7 +889,8 @@ } } -void call_stack::clear_global_variable_regexp (const std::string& pattern) +void +call_stack::clear_global_variable_regexp (const std::string& pattern) { regexp pat (pattern); @@ -860,7 +901,8 @@ } } -void call_stack::clear_global_variables () +void +call_stack::clear_global_variables () { for (auto& nm_ov : m_global_values) nm_ov.second = octave_value (); @@ -878,58 +920,68 @@ return m_cs[m_curr_frame]->regexp_symbol_info (pattern); } -symbol_info_list call_stack::get_symbol_info () +symbol_info_list +call_stack::get_symbol_info () { return m_cs[m_curr_frame]->get_symbol_info (); } -symbol_info_list call_stack::top_scope_symbol_info () const +symbol_info_list +call_stack::top_scope_symbol_info () const { return m_cs[0]->get_symbol_info (); } -octave_value call_stack::max_stack_depth (const octave_value_list& args, - int nargout) +octave_value +call_stack::max_stack_depth (const octave_value_list& args, + int nargout) { return set_internal_variable (m_max_stack_depth, args, nargout, "max_stack_depth", 0); } -void call_stack::make_persistent (const symbol_record& sym) +void +call_stack::make_persistent (const symbol_record& sym) { m_cs[m_curr_frame]->make_persistent (sym); } -void call_stack::make_global (const symbol_record& sym) +void +call_stack::make_global (const symbol_record& sym) { m_cs[m_curr_frame]->make_global (sym); } -octave_value call_stack::global_varval (const std::string& name) const +octave_value +call_stack::global_varval (const std::string& name) const { auto p = m_global_values.find (name); return p == m_global_values.end () ? octave_value () : p->second; } -octave_value& call_stack::global_varref (const std::string& name) +octave_value& +call_stack::global_varref (const std::string& name) { return m_global_values[name]; } -octave_value call_stack::get_top_level_value (const std::string& name) const +octave_value +call_stack::get_top_level_value (const std::string& name) const { return m_cs[0]->varval (name); } -void call_stack::set_top_level_value (const std::string& name, - const octave_value& value) +void +call_stack::set_top_level_value (const std::string& name, + const octave_value& value) { m_cs[0]->assign (name, value); } -octave_value call_stack::do_who (int argc, const string_vector& argv, - bool return_list, bool verbose) +octave_value +call_stack::do_who (int argc, const string_vector& argv, + bool return_list, bool verbose) { octave_value retval; @@ -1027,19 +1079,21 @@ } } -octave_value call_stack::do_who_two (const string_vector& patterns, - bool have_regexp, bool return_list, - bool verbose, const std::string& msg) +octave_value +call_stack::do_who_two (const string_vector& patterns, + bool have_regexp, bool return_list, + bool verbose, const std::string& msg) { return m_cs[m_curr_frame]->who (patterns, have_regexp, return_list, verbose, m_evaluator.whos_line_format (), msg); } -octave_value call_stack::do_global_who_two (const string_vector& patterns, - bool have_regexp, - bool return_list, bool verbose, - const std::string& msg) +octave_value +call_stack::do_global_who_two (const string_vector& patterns, + bool have_regexp, + bool return_list, bool verbose, + const std::string& msg) { symbol_info_list symbol_stats; std::list<std::string> symbol_names; @@ -1133,7 +1187,8 @@ return octave_value (); } -void call_stack::display () const +void +call_stack::display () const { std::ostream& os = octave_stdout; @@ -1147,8 +1202,9 @@ } } -void call_stack::set_auto_fcn_var (stack_frame::auto_var_type avt, - const octave_value& val) +void +call_stack::set_auto_fcn_var (stack_frame::auto_var_type avt, + const octave_value& val) { m_cs[m_curr_frame]->set_auto_fcn_var (avt, val); } @@ -1165,7 +1221,8 @@ m_cs[m_curr_frame]->set_nargout (nargout); } -octave_value call_stack::get_auto_fcn_var (stack_frame::auto_var_type avt) const +octave_value +call_stack::get_auto_fcn_var (stack_frame::auto_var_type avt) const { return m_cs[m_curr_frame]->get_auto_fcn_var (avt); }