Mercurial > hg > octave-nkf
changeset 4975:80842ad3f85c
[project @ 2004-09-08 18:37:58 by jwe]
author | jwe |
---|---|
date | Wed, 08 Sep 2004 18:37:59 +0000 |
parents | ff29117ce225 |
children | bfcd251499b2 |
files | src/ChangeLog src/input.cc src/ov-builtin.cc src/ov-mapper.cc src/ov-usr-fcn.cc src/pt-stmt.cc src/pt-stmt.h src/toplev.cc src/toplev.h |
diffstat | 9 files changed, 74 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,19 @@ 2004-09-08 John W. Eaton <jwe@octave.org> + * ov-usr-fcn.cc (octave_user_function::do_multi_index_op): + Save and set curr_caller_function and curr_caller_statement here. + * ov-mapper.cc (octave_mapper::do_multi_index_op): Likewise. + * ov-builtin.cc (octave_builtin::do_multi_index_op): Likewise. + + * pt-stmt.cc (curr_caller_statement): New variable. + * pt-stmt.h: Provide decl. + + * toplev.cc (curr_caller_function): New variable. + * toplev.h: Provide decl. + + * input.cc (get_user_input): Print location info before the debug + prompt. From Keith Goodman <kwgoodman@gmail.com>. + * pt-arg-list.cc (convert_to_const_vector): Unwind-protect index_position before modifying it. Don't protect and set index_position unless stash_object is true.
--- a/src/input.cc +++ b/src/input.cc @@ -535,7 +535,43 @@ if (nargin == 2) read_as_string++; - std::string prompt ("debug> "); + std::string nm; + int line = -1; + + // We look at curr_caller_function because curr_function is always + // "keyboard". + + if (curr_caller_function) + { + nm = curr_caller_function->fcn_file_name (); + + if (nm.empty ()) + nm = curr_caller_function->name (); + + if (curr_statement) + line = curr_statement->line (); + } + + OSSTREAM buf; + + if (! nm.empty ()) + { + buf << "stopped in " << nm; + + if (line > 0) + buf << " at line " << line; + } + + buf << OSSTREAM_ENDS; + + std::string msg = OSSTREAM_STR (buf); + + OSSTREAM_FREEZE (buf); + + if (! msg.empty ()) + message ("keyboard", msg.c_str ()); + + std::string prompt = "debug> "; if (nargin > 0) {
--- a/src/ov-builtin.cc +++ b/src/ov-builtin.cc @@ -109,6 +109,9 @@ else { unwind_protect_ptr (curr_function); + unwind_protect_ptr (curr_caller_function); + + curr_caller_function = curr_function; curr_function = this; retval = (*f) (args, nargout);
--- a/src/ov-mapper.cc +++ b/src/ov-mapper.cc @@ -288,6 +288,9 @@ if (args(0).is_defined ()) { unwind_protect_ptr (curr_function); + unwind_protect_ptr (curr_caller_function); + + curr_caller_function = curr_function; curr_function = this; retval = apply (args(0));
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -393,6 +393,11 @@ curr_sym_tab = sym_tab; unwind_protect_ptr (curr_function); + unwind_protect_ptr (curr_caller_function); + unwind_protect_ptr (curr_caller_statement); + + curr_caller_statement = curr_statement; + curr_caller_function = curr_function; curr_function = this; if (! is_nested_function ())
--- a/src/pt-stmt.cc +++ b/src/pt-stmt.cc @@ -51,6 +51,9 @@ // Pointer to the current statement being executed. tree_statement *curr_statement = 0; +// Pointer to the current statement being executed in the calling function. +tree_statement *curr_caller_statement = 0; + // A list of commands to be executed. tree_statement::~tree_statement (void)
--- a/src/pt-stmt.h +++ b/src/pt-stmt.h @@ -159,6 +159,9 @@ // Pointer to the current statement being executed. extern tree_statement *curr_statement; +// Pointer to the current statement being executed in the calling function. +extern tree_statement *curr_caller_statement; + #endif /*
--- a/src/toplev.cc +++ b/src/toplev.cc @@ -93,6 +93,9 @@ // Pointer to function that is currently being evaluated. octave_function *curr_function = 0; +// Pointer to caller of curr_function. +octave_function *curr_caller_function = 0; + // Pointer to parent function that is currently being evaluated. octave_function *curr_parent_function = 0;
--- a/src/toplev.h +++ b/src/toplev.h @@ -48,6 +48,9 @@ // Pointer to function that is currently being evaluated. extern octave_function *curr_function; +// Pointer to caller of curr_function. +extern octave_function *curr_caller_function; + // Pointer to parent function that is currently being evaluated. extern octave_function *curr_parent_function;