changeset 5027:da607e9daf12

[project @ 2004-09-23 01:37:57 by jwe]
author jwe
date Thu, 23 Sep 2004 01:37:58 +0000
parents 06f7ff1aee5a
children 4e4062bb9807
files src/ChangeLog src/pt-plot.cc src/variables.cc src/variables.h
diffstat 4 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 23 01:04:32 2004 +0000
+++ b/src/ChangeLog	Thu Sep 23 01:37:58 2004 +0000
@@ -3,6 +3,10 @@
 	* pt-plot.cc (send_to_plot_stream): Skip automatic replot if in
 	multiplot mode.
 
+	* variables.cc (get_global_value): New arg, silent.
+	* variables.h (get_global_value): Default value for silent arg is
+	false.
+
 2004-09-22  David Bateman  <dbateman@free.fr>
 
 	* ov-fcn-inline.cc (Finline): When called with a single arg, derive
--- a/src/pt-plot.cc	Thu Sep 23 01:04:32 2004 +0000
+++ b/src/pt-plot.cc	Thu Sep 23 01:37:58 2004 +0000
@@ -217,7 +217,7 @@
     {
       *plot_stream << cmd;
 
-      octave_value mm = get_global_value ("__multiplot_mode__");
+      octave_value mm = get_global_value ("__multiplot_mode__", true);
 
       bool is_multiplot_mode = mm.is_true ();
 
--- a/src/variables.cc	Thu Sep 23 01:04:32 2004 +0000
+++ b/src/variables.cc	Thu Sep 23 01:37:58 2004 +0000
@@ -919,7 +919,7 @@
 }
 
 octave_value
-get_global_value (const std::string& nm)
+get_global_value (const std::string& nm, bool silent)
 {
   octave_value retval;
 
@@ -929,12 +929,12 @@
     {
       octave_value sr_def = sr->def ();
 
-      if (sr_def.is_undefined ())
+      if (sr_def.is_defined ())
+	retval = sr_def;
+      else if (! silent)
 	error ("get_global_by_name: undefined symbol `%s'", nm.c_str ());
-      else
-	retval = sr_def;
     }
-  else
+  else if (! silent)
     error ("get_global_by_name: unknown symbol `%s'", nm.c_str ());
 
   return retval;
--- a/src/variables.h	Thu Sep 23 01:04:32 2004 +0000
+++ b/src/variables.h	Thu Sep 23 01:37:58 2004 +0000
@@ -91,7 +91,8 @@
 
 extern octave_value lookup_function_handle (const std::string& nm);
 
-extern octave_value get_global_value (const std::string& nm);
+extern octave_value
+get_global_value (const std::string& nm, bool silent = false);
 
 extern void set_global_value (const std::string& nm, const octave_value& val);