# HG changeset patch # User jwe # Date 845487972 0 # Node ID 015cbef2b75f29499bb5f3bad4b38bed7dbe1106 # Parent 25a26fe3f1d491353021267889b5e465c270686c [project @ 1996-10-16 17:46:12 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ Wed Oct 16 12:00:11 1996 John W. Eaton + * 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. diff --git a/src/pt-mat.cc b/src/pt-mat.cc --- 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; template class SLList;