diff src/error.cc @ 5582:6bf56668b01a

[project @ 2005-12-15 01:08:20 by jwe]
author jwe
date Thu, 15 Dec 2005 01:10:05 +0000
parents 80e629357483
children a527e0f77aa5
line wrap: on
line diff
--- a/src/error.cc
+++ b/src/error.cc
@@ -67,6 +67,10 @@
 // TRUE means that Octave will print a verbose warning.  Currently unused.
 static bool Vverbose_warning;
 
+// TRUE means that Octave will print no warnings, but lastwarn will be 
+//updated
+static bool Vquiet_warning = false;
+
 // A structure containing (most of) the current state of warnings.
 static Octave_map warning_options;
 
@@ -169,9 +173,12 @@
       Vlast_warning_message = msg_string;
     }
 
-  octave_diary << msg_string;
+  if (! Vquiet_warning)
+    {
+      octave_diary << msg_string;
 
-  std::cerr << msg_string;
+      std::cerr << msg_string;
+    }
 }
 
 static void
@@ -857,6 +864,14 @@
 		      done = true;
 		    }
 		}
+	      else if (arg2 == "quiet")
+		{
+		  if (arg1 != "error")
+		    {
+		      Vquiet_warning = (arg1 == "on");
+		      done = true;
+		    }
+		}
 	      else
 		{
 		  if (arg2 == "last")
@@ -917,7 +932,7 @@
 	      if (arg2 == "all")
 		retval = warning_options;
 	      else if (arg2 == "backtrace" || arg2 == "debug"
-		       || arg2 == "verbose")
+		       || arg2 == "verbose" || arg2 == "quiet")
 		{
 		  Octave_map tmp;
 		  tmp.assign ("identifier", arg2);
@@ -925,8 +940,12 @@
 		    tmp.assign ("state", Vbacktrace_on_warning ? "on" : "off");
 		  else if (arg2 == "debug")
 		    tmp.assign ("state", Vdebug_on_warning ? "on" : "off");
+		  else if (arg2 == "verbose")
+		    tmp.assign ("state", Vverbose_warning ? "on" : "off");
 		  else
-		    tmp.assign ("state", Vverbose_warning ? "on" : "off");
+		    tmp.assign ("state", Vquiet_warning ? "on" : "off");
+
+		  retval = tmp;
 		}
 	      else
 		{
@@ -1071,7 +1090,7 @@
 	    }
 	}
       else
-	error ("lastwarn: expecting arguments to be character strings");
+	error ("lasterr: expecting arguments to be character strings");
     }
   else
     print_usage ("lasterr");
@@ -1112,6 +1131,7 @@
 
 	  if (argc == 1 || nargout > 0)
 	    {
+	      warning_state = 0;
 	      retval(1) = prev_warning_id;
 	      retval(0) = prev_warning_message;
 	    }