changeset 4719:9759e52e19bc

[project @ 2004-01-23 04:08:27 by jwe]
author jwe
date Fri, 23 Jan 2004 04:08:27 +0000
parents ab71705f294f
children e759d01692db
files src/ChangeLog src/error.cc
diffstat 2 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Jan 23 03:21:05 2004 +0000
+++ b/src/ChangeLog	Fri Jan 23 04:08:27 2004 +0000
@@ -1,5 +1,8 @@
 2004-01-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* error.cc (pr_where): New arg, print_code with default value true.
+	(warning): Call pr_where with second arg false.
+
 	* file-io.cc (Ffrewind): Only return value if nargout > 0.
 	(Ffprintf): Likewise.
 	(Fprintf): Likewise.
--- a/src/error.cc	Fri Jan 23 03:21:05 2004 +0000
+++ b/src/error.cc	Fri Jan 23 04:08:27 2004 +0000
@@ -313,7 +313,7 @@
 }
 
 static void
-pr_where (const char *name)
+pr_where (const char *name, bool print_code = true)
 {
   if (curr_statement)
     {
@@ -335,25 +335,28 @@
       else
 	pr_where_1 ("%s: near line %d, column %d:", name, l, c);
 
-      // XXX FIXME XXX -- Note that the column number is probably not
-      // going to mean much here since the code is being reproduced
-      // from the parse tree, and we are only showing one statement
-      // even if there were multiple statements on the original source
-      // line.
+      if (print_code)
+	{
+	  // XXX FIXME XXX -- Note that the column number is probably
+	  // not going to mean much here since the code is being
+	  // reproduced from the parse tree, and we are only showing
+	  // one statement even if there were multiple statements on
+	  // the original source line.
 
-      OSSTREAM output_buf;
-
-      output_buf << std::endl;
+	  OSSTREAM output_buf;
 
-      tree_print_code tpc (output_buf, ">>> ");
+	  output_buf << std::endl;
 
-      curr_statement->accept (tpc);
+	  tree_print_code tpc (output_buf, ">>> ");
+
+	  curr_statement->accept (tpc);
 
-      output_buf << std::endl << OSSTREAM_ENDS;
+	  output_buf << std::endl << OSSTREAM_ENDS;
 
-      pr_where_1 ("%s", OSSTREAM_C_STR (output_buf));
+	  pr_where_1 ("%s", OSSTREAM_C_STR (output_buf));
 
-      OSSTREAM_FREEZE (output_buf);
+	  OSSTREAM_FREEZE (output_buf);
+	}
     }
 }
 
@@ -366,7 +369,7 @@
 	  && Vwarning_option == "backtrace"
 	  && ! warning_state
 	  && ! discard_warning_messages)
-	pr_where ("warning");
+	pr_where ("warning", false);
 
       va_list args;
       va_start (args, fmt);