# HG changeset patch # User John W. Eaton # Date 1215805390 14400 # Node ID c3d21b9b94b679db93ba863f721171f36b74f248 # Parent 935be827eaf8fbbb44f7eb34a5951a893e436724 eliminate octave_call_stack member functions caller_user_script and caller_user_function, and unused difference_type args diff -r 935be827eaf8 -r c3d21b9b94b6 src/ChangeLog --- a/src/ChangeLog Fri Jul 11 14:56:30 2008 -0400 +++ b/src/ChangeLog Fri Jul 11 15:43:10 2008 -0400 @@ -1,5 +1,28 @@ 2008-07-11 John W. Eaton + * 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. diff -r 935be827eaf8 -r c3d21b9b94b6 src/debug.cc --- a/src/debug.cc Fri Jul 11 14:56:30 2008 -0400 +++ b/src/debug.cc Fri Jul 11 15:43:10 2008 -0400 @@ -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 (); diff -r 935be827eaf8 -r c3d21b9b94b6 src/defun.cc --- a/src/defun.cc Fri Jul 11 14:56:30 2008 -0400 +++ b/src/defun.cc Fri Jul 11 15:43:10 2008 -0400 @@ -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 (); diff -r 935be827eaf8 -r c3d21b9b94b6 src/toplev.cc --- a/src/toplev.cc Fri Jul 11 14:56:30 2008 -0400 +++ b/src/toplev.cc Fri Jul 11 15:43:10 2008 -0400 @@ -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 (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 (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 (f); - break; + if (nskip > 0) + nskip--; + else + { + retval = dynamic_cast (f); + break; + } } } diff -r 935be827eaf8 -r c3d21b9b94b6 src/toplev.h --- a/src/toplev.h Fri Jul 11 14:56:30 2008 -0400 +++ b/src/toplev.h Fri Jul 11 15:43:10 2008 -0400 @@ -103,8 +103,6 @@ typedef std::deque::reverse_iterator reverse_iterator; typedef std::deque::const_reverse_iterator const_reverse_iterator; - typedef std::deque::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)