Mercurial > hg > octave-avbm
changeset 7923:c3d21b9b94b6
eliminate octave_call_stack member functions caller_user_script and caller_user_function, and unused difference_type args
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 11 Jul 2008 15:43:10 -0400 |
parents | 935be827eaf8 |
children | 4976f66d469b |
files | src/ChangeLog src/debug.cc src/defun.cc src/toplev.cc src/toplev.h |
diffstat | 5 files changed, 46 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,28 @@ 2008-07-11 John W. Eaton <jwe@octave.org> + * toplev.cc, toplev.h (octave_call_stack::caller_user_function, + octave_call_stack::caller_user_script, + octave_call_stack::do_caller_user_function, + octave_call_stack::do_caller_user_script): + Delete functions and decls. + + * defun.cc (print_usage): Call octave_call_stack::caller_user_code, + not octave_call_stack::caller_user_function. + * debug.cc (get_user_code): Likewise. + + * toplev.h (octave_call_stack::difference_type): Delete typedef. + * toplev.cc, toplev.h (octave_call_stack::caller_user_code_line, + octave_call_stack::do_caller_user_code_line, + octave_call_stack::caller_user_code_column, + octave_call_stack::do_caller_user_code_column, + octave_call_stack::caller_script, + octave_call_stack::do_caller_script, + octave_call_stack::caller_user_function, + octave_call_stack::do_caller_user_function, + octave_call_stack::caller_user_code, + octave_call_stack::do_caller_user_code): + Delete unused difference_type arg. + * ov-float.h, ov-flt-re-mat.cc, ov-range.h, ov-re-mat.h, ov-re-sparse.cc, ov-scalar.h: Check for NaN in bool_value and bool_array_value member functions to bool.
--- a/src/debug.cc +++ b/src/debug.cc @@ -67,7 +67,7 @@ octave_user_code *dbg_fcn = 0; if (fname.empty ()) - dbg_fcn = octave_call_stack::caller_user_function (); + dbg_fcn = octave_call_stack::caller_user_code (); else { octave_value fcn = symbol_table::find_function (fname); @@ -881,10 +881,8 @@ tree::last_line = -1; - // Next to skip 2 here. One for the oct-file dbstep and - // another for the function we actually want to step out of. tree::break_function = - octave_call_stack::caller_user_code (2); + octave_call_stack::caller_user_code (1); tree::last_break_function = octave_call_stack::caller_user_code ();
--- a/src/defun.cc +++ b/src/defun.cc @@ -105,7 +105,7 @@ octave_value retval; if (args.length () == 0) - print_usage (octave_call_stack::caller_user_function ()); + print_usage (octave_call_stack::caller_user_code ()); else print_usage ();
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -112,7 +112,7 @@ } int -octave_call_stack::do_caller_user_code_line (difference_type q) const +octave_call_stack::do_caller_user_code_line (void) const { int retval = -1; @@ -140,7 +140,7 @@ } int -octave_call_stack::do_caller_user_code_column (difference_type q) const +octave_call_stack::do_caller_user_code_column (void) const { int retval = -1; @@ -204,54 +204,8 @@ return retval; } -octave_user_script * -octave_call_stack::do_caller_user_script (difference_type q) const -{ - octave_user_script *retval = 0; - - const_iterator p = cs.end (); - - while (p != cs.begin ()) - { - const call_stack_elt& elt = *(--p); - - octave_function *f = elt.fcn; - - if (f && f->is_user_script ()) - { - retval = dynamic_cast<octave_user_script *> (f); - break; - } - } - - return retval; -} - -octave_user_function * -octave_call_stack::do_caller_user_function (difference_type q) const -{ - octave_user_function *retval = 0; - - const_iterator p = cs.end (); - - while (p != cs.begin ()) - { - const call_stack_elt& elt = *(--p); - - octave_function *f = elt.fcn; - - if (f && f->is_user_function ()) - { - retval = dynamic_cast<octave_user_function *> (f); - break; - } - } - - return retval; -} - octave_user_code * -octave_call_stack::do_caller_user_code (difference_type q) const +octave_call_stack::do_caller_user_code (size_t nskip) const { octave_user_code *retval = 0; @@ -265,8 +219,13 @@ if (f && f->is_user_code ()) { - retval = dynamic_cast<octave_user_code *> (f); - break; + if (nskip > 0) + nskip--; + else + { + retval = dynamic_cast<octave_user_code *> (f); + break; + } } }
--- a/src/toplev.h +++ b/src/toplev.h @@ -103,8 +103,6 @@ typedef std::deque<call_stack_elt>::reverse_iterator reverse_iterator; typedef std::deque<call_stack_elt>::const_reverse_iterator const_reverse_iterator; - typedef std::deque<call_stack_elt>::difference_type difference_type; - static bool instance_ok (void) { bool retval = true; @@ -145,15 +143,15 @@ } // Line in user code caller. - static int caller_user_code_line (difference_type q = 0) + static int caller_user_code_line (void) { - return instance_ok () ? instance->do_caller_user_code_line (q) : -1; + return instance_ok () ? instance->do_caller_user_code_line () : -1; } // Column in user code caller. - static int caller_user_code_column (difference_type q = 0) + static int caller_user_code_column (void) { - return instance_ok () ? instance->do_caller_user_code_column (q) : -1; + return instance_ok () ? instance->do_caller_user_code_column () : -1; } // Caller function, may be built-in. @@ -195,22 +193,10 @@ return instance_ok () ? instance->do_element (n) : 0; } - // First script on the stack. - static octave_user_script *caller_script (difference_type q = 0) + // First user-defined function on the stack. + static octave_user_code *caller_user_code (size_t nskip = 0) { - return instance_ok () ? instance->do_caller_user_script (q) : 0; - } - - // First user-defined function on the stack. - static octave_user_function *caller_user_function (difference_type q = 0) - { - return instance_ok () ? instance->do_caller_user_function (q) : 0; - } - - // First user-defined function on the stack. - static octave_user_code *caller_user_code (difference_type q = 0) - { - return instance_ok () ? instance->do_caller_user_code (q) : 0; + return instance_ok () ? instance->do_caller_user_code (nskip) : 0; } static void @@ -296,9 +282,9 @@ int do_current_column (void) const; - int do_caller_user_code_line (difference_type q = 0) const; + int do_caller_user_code_line (void) const; - int do_caller_user_code_column (difference_type q = 0) const; + int do_caller_user_code_column (void) const; size_t do_current_frame (void) { return curr_frame; } @@ -331,11 +317,7 @@ return retval; } - octave_user_script *do_caller_user_script (difference_type q = 0) const; - - octave_user_function *do_caller_user_function (difference_type q = 0) const; - - octave_user_code *do_caller_user_code (difference_type q = 0) const; + octave_user_code *do_caller_user_code (size_t nskip) const; void do_push (octave_function *f, symbol_table::scope_id scope, symbol_table::context_id context)