diff src/octave.cc @ 9009:da58ec8f62e8

tag bug don't define forced variables
author John W. Eaton <jwe@octave.org>
date Mon, 23 Mar 2009 19:29:01 -0400
parents d47290508a55
children eb1747dbd360
line wrap: on
line diff
--- a/src/octave.cc	Mon Mar 23 18:21:25 2009 -0400
+++ b/src/octave.cc	Mon Mar 23 19:29:01 2009 -0400
@@ -367,6 +367,18 @@
   unwind_protect::run_frame ("execute_startup_files");
 }
 
+static void
+unmark_forced_vars (void *arg)
+{
+  // Unmark any symbols that may have been tagged as local variables
+  // while parsing (for example, by force_local_variable in lex.l).
+
+  symbol_table::scope_id *pscope = static_cast <symbol_table::scope_id *> (arg);
+
+  if (pscope)
+    symbol_table::unmark_forced_variables (*pscope);
+}
+
 static int
 execute_eval_option_code (const std::string& code)
 {
@@ -386,6 +398,11 @@
 
   unwind_protect_bool (interactive);
 
+  // Do this with an unwind-protect cleanup function so that the
+  // forced variables will be unmarked in the event of an interrupt.
+  symbol_table::scope_id scope = symbol_table::top_scope ();
+  unwind_protect::add (unmark_forced_vars, &scope);
+
   interactive = false;
 
   int parse_status = 0;