changeset 9454:c58b8960c7d0

variables.cc (symbol_exist): ignore errors when parsing functions
author John W. Eaton <jwe@octave.org>
date Thu, 23 Jul 2009 14:57:53 -0400
parents 5fcf008c7c41
children ee8a035f3997
files src/ChangeLog src/variables.cc
diffstat 2 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jul 23 20:37:56 2009 +0200
+++ b/src/ChangeLog	Thu Jul 23 14:57:53 2009 -0400
@@ -1,3 +1,8 @@
+2009-07-23  John W. Eaton  <jwe@octave.org>
+
+	* variables.cc (safe_symbol_lookup): New function.
+	(symbol_exist): Use it.
+
 2009-07-23  Jaroslav Hajek  <highegg@gmail.com>
 
 	* DLD-FUNCTIONS/chol.cc (Fcholupdate,
--- a/src/variables.cc	Thu Jul 23 20:37:56 2009 +0200
+++ b/src/variables.cc	Thu Jul 23 14:57:53 2009 -0400
@@ -375,6 +375,30 @@
   return do_isglobal (args);
 }
 
+static octave_value
+safe_symbol_lookup (const std::string& symbol_name)
+{
+  octave_value retval;
+
+  unwind_protect::frame_id_t uwp_frame = unwind_protect::begin_frame ();
+  
+  unwind_protect::protect_var (buffer_error_messages);
+  unwind_protect::protect_var (Vdebug_on_error);
+  unwind_protect::protect_var (Vdebug_on_warning);
+
+  buffer_error_messages++;
+  Vdebug_on_error = false;
+  Vdebug_on_warning = false;
+
+  retval = symbol_table::find (symbol_name);
+
+  error_state = 0;
+
+  unwind_protect::run_frame (uwp_frame);
+
+  return retval;
+}
+
 int
 symbol_exist (const std::string& name, const std::string& type)
 {
@@ -395,7 +419,7 @@
   // name that is visible in the current scope will be in the local
   // symbol table.
 
-  octave_value val = symbol_table::find (symbol_name);
+  octave_value val = safe_symbol_lookup (symbol_name);
 
   if (val.is_defined ())
     {