diff src/variables.cc @ 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 c5f03874ea2a
children bb413c0d0d6d
line wrap: on
line diff
--- 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 ())
     {