# HG changeset patch # User jwe # Date 1094671891 0 # Node ID bfcd251499b27a23943d7e69e32603c2ebf70271 # Parent 80842ad3f85c473bf8cca7d1409f111b7b500734 [project @ 2004-09-08 19:31:31 by jwe] diff -r 80842ad3f85c -r bfcd251499b2 src/ChangeLog --- a/src/ChangeLog Wed Sep 08 18:37:59 2004 +0000 +++ b/src/ChangeLog Wed Sep 08 19:31:31 2004 +0000 @@ -1,5 +1,10 @@ 2004-09-08 John W. Eaton + * 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 . + * 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 . - * 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. diff -r 80842ad3f85c -r bfcd251499b2 src/error.cc --- a/src/error.cc Wed Sep 08 18:37:59 2004 +0000 +++ b/src/error.cc Wed Sep 08 19:31:31 2004 +0000 @@ -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) {