Mercurial > hg > octave-nkf
changeset 4976:bfcd251499b2
[project @ 2004-09-08 19:31:31 by jwe]
author | jwe |
---|---|
date | Wed, 08 Sep 2004 19:31:31 +0000 |
parents | 80842ad3f85c |
children | 3736fb91aa2d |
files | src/ChangeLog src/error.cc |
diffstat | 2 files changed, 41 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2004-09-08 John W. Eaton <jwe@octave.org> + * error.cc (pr_where): Do a better job of printing location info. + + * input.cc (get_user_input): Print location info before the debug + prompt. From Keith Goodman <kwgoodman@gmail.com>. + * 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. @@ -11,9 +16,6 @@ * 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/error.cc +++ b/src/error.cc @@ -318,23 +318,48 @@ { if (curr_statement) { - const char *f_nm = 0; + std::string nm; - if (curr_function) + int l = -1; + int c = -1; + + octave_function *fcn = curr_function; + + if (fcn) { - std::string fcn_name = curr_function->name (); - std::string file_name = curr_function->fcn_file_name (); + nm = fcn->name (); + + if (nm == "error" || nm == "warning") + fcn = curr_caller_function; + + if (fcn) + { + nm = fcn->fcn_file_name (); - f_nm = file_name.empty () ? fcn_name.c_str () : file_name.c_str (); + if (nm.empty ()) + nm = fcn->name (); + + if (curr_statement) + { + l = curr_statement->line (); + c = curr_statement->column (); + } + } } - int l = curr_statement->line (); - int c = curr_statement->column (); - - if (f_nm) - pr_where_1 ("%s: in %s near line %d, column %d:", name, f_nm, l, c); + if (nm.empty ()) + { + if (l > 0 && c > 0) + pr_where_1 ("%s: near line %d, column %d:", name, l, c); + } else - pr_where_1 ("%s: near line %d, column %d:", name, l, c); + { + if (l > 0 && c > 0) + pr_where_1 ("%s: in %s near line %d, column %d:", + name, nm.c_str (), l, c); + else + pr_where_1 ("%s: in %s", name, nm.c_str ()); + } if (print_code) {