Mercurial > hg > octave-nkf
changeset 2419:015cbef2b75f
[project @ 1996-10-16 17:46:12 by jwe]
author | jwe |
---|---|
date | Wed, 16 Oct 1996 17:46:12 +0000 |
parents | 25a26fe3f1d4 |
children | 449f35baba49 |
files | src/ChangeLog src/pt-mat.cc |
diffstat | 2 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ Wed Oct 16 12:00:11 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + * pt-mat.cc (tm_row_const::tm_row_const_rep::eval_error, + tm_row_const::tm_row_const_rep::eval_warning): New functions. + (tm_row_const::tm_row_const (const tree_matrix_row&): Use them to + give better error messages. + * pt-fvc.cc (tree_identifier::eval): Avoid dereferencing null object_to_eval.
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -98,6 +98,11 @@ tm_row_const_rep& operator = (const tm_row_const_rep&); + + + void eval_error (const char *msg, int l, int c) const; + + void eval_warning (const char *msg, int l, int c) const; }; public: @@ -182,10 +187,12 @@ if (this_elt_nr == 0 || this_elt_nc == 0) { if (Vempty_list_elements_ok < 0) - warning ("empty matrix found in matrix list"); + eval_warning ("empty matrix found in matrix list", + elt->line (), elt->column ()); else if (Vempty_list_elements_ok == 0) { - ::error ("empty matrix found in matrix list"); + eval_error ("empty matrix found in matrix list", + elt->line (), elt->column ()); break; } } @@ -199,7 +206,8 @@ } else if (this_elt_nr != nr) { - ::error ("number of rows must match"); + eval_error ("number of rows must match", + elt->line (), elt->column ()); break; } @@ -219,6 +227,26 @@ ok = ! error_state; } +void +tm_row_const::tm_row_const_rep::eval_error (const char *msg, int l, + int c) const +{ + if (l == -1 && c == -1) + ::error ("%s", msg); + else + ::error ("%s near line %d, column %d", msg, l, c); +} + +void +tm_row_const::tm_row_const_rep::eval_warning (const char *msg, int l, + int c) const +{ + if (l == -1 && c == -1) + ::warning ("%s", msg); + else + ::warning ("%s near line %d, column %d", msg, l, c); +} + template class SLNode<tm_row_const>; template class SLList<tm_row_const>;