diff src/toplev.cc @ 2985:aa9d0c0e0458

[project @ 1997-05-16 06:54:18 by jwe]
author jwe
date Fri, 16 May 1997 06:55:52 +0000
parents 20f5cec4f11c
children 8afe3bf4c449
line wrap: on
line diff
--- a/src/toplev.cc	Fri May 16 05:14:34 1997 +0000
+++ b/src/toplev.cc	Fri May 16 06:55:52 1997 +0000
@@ -67,6 +67,7 @@
 #include "pathsearch.h"
 #include "procstream.h"
 #include "ov.h"
+#include "pt-jump.h"
 #include "pt-plot.h"
 #include "pt-stmt.h"
 #include "sighandlers.h"
@@ -81,12 +82,6 @@
 // Nonzero means we print 
 static bool Vdefault_eval_print_flag = true;
 
-// Nonzero means we're breaking out of a loop or function body.
-extern int breaking;
-
-// Nonzero means we're returning from a function.
-extern int returning;
-
 // Nonzero means we are using readline.
 // (--no-line-editing)
 int line_editing = 1;
@@ -116,13 +111,13 @@
 void
 parse_and_execute (FILE *f)
 {
-  begin_unwind_frame ("parse_and_execute");
+  unwind_protect::begin_frame ("parse_and_execute");
   
   YY_BUFFER_STATE old_buf = current_buffer ();
   YY_BUFFER_STATE new_buf = create_buffer (f);
 
-  add_unwind_protect (restore_input_buffer, old_buf);
-  add_unwind_protect (delete_input_buffer, new_buf);
+  unwind_protect::add (restore_input_buffer, old_buf);
+  unwind_protect::add (delete_input_buffer, new_buf);
 
   switch_to_buffer (new_buf);
 
@@ -149,13 +144,14 @@
 
 	  global_command = 0;
 
-	  bool quit = (returning || breaking);
+	  bool quit = (tree_return_command::returning
+		       || tree_break_command::breaking);
 
-	  if (returning)
-	    returning = 0;
+	  if (tree_return_command::returning)
+	    tree_return_command::returning = 0;
 
-	  if (breaking)
-	    breaking--;
+	  if (tree_break_command::breaking)
+	    tree_break_command::breaking--;
 
 	  if (error_state)
 	    {
@@ -171,7 +167,7 @@
     }
   while (retval == 0);
 
-  run_unwind_frame ("parse_and_execute");
+  unwind_protect::run_frame ("parse_and_execute");
 }
 
 static void
@@ -184,7 +180,7 @@
 void
 parse_and_execute (const string& s, bool verbose, const char *warn_for)
 {
-  begin_unwind_frame ("parse_and_execute_2");
+  unwind_protect::begin_frame ("parse_and_execute_2");
 
   unwind_protect_int (reading_script_file);
   unwind_protect_str (curr_fcn_file_full_name);
@@ -196,7 +192,7 @@
 
   if (f)
     {
-      add_unwind_protect (safe_fclose, f);
+      unwind_protect::add (safe_fclose, f);
 
       unwind_protect_int (input_line_number);
       unwind_protect_int (current_input_column);
@@ -219,7 +215,7 @@
   else if (warn_for)
     error ("%s: unable to open file `%s'", warn_for, s.c_str ());
 
-  run_unwind_frame ("parse_and_execute_2");
+  unwind_protect::run_frame ("parse_and_execute_2");
 }
 
 int
@@ -263,13 +259,14 @@
 
 	  if (! (interactive || forced_interactive))
 	    {
-	      bool quit = (returning || breaking);
+	      bool quit = (tree_return_command::returning
+			   || tree_break_command::breaking);
 
-	      if (returning)
-		returning = 0;
+	      if (tree_return_command::returning)
+		tree_return_command::returning = 0;
 
-	      if (breaking)
-		breaking--;
+	      if (tree_break_command::breaking)
+		tree_break_command::breaking--;
 
 	      if (quit)
 		break;
@@ -514,7 +511,7 @@
 static octave_value_list
 eval_string (const string& s, bool silent, int& parse_status, int nargout)
 {
-  begin_unwind_frame ("eval_string");
+  unwind_protect::begin_frame ("eval_string");
 
   unwind_protect_int (get_input_from_eval_string);
   unwind_protect_int (input_from_command_line_file);
@@ -528,8 +525,8 @@
   YY_BUFFER_STATE old_buf = current_buffer ();
   YY_BUFFER_STATE new_buf = create_buffer (0);
 
-  add_unwind_protect (restore_input_buffer, old_buf);
-  add_unwind_protect (delete_input_buffer, new_buf);
+  unwind_protect::add (restore_input_buffer, old_buf);
+  unwind_protect::add (delete_input_buffer, new_buf);
 
   switch_to_buffer (new_buf);
 
@@ -545,7 +542,7 @@
 
   tree_statement_list *command = global_command;
 
-  run_unwind_frame ("eval_string");
+  unwind_protect::run_frame ("eval_string");
 
   octave_value_list retval;
 
@@ -597,7 +594,7 @@
 
   if (nargin > 0)
     {
-      begin_unwind_frame ("Feval");
+      unwind_protect::begin_frame ("Feval");
 
       if (nargin > 1)
 	{
@@ -619,14 +616,14 @@
 
 	  buffer_error_messages = 0;
 	  bind_global_error_variable ();
-	  add_unwind_protect (clear_global_error_variable, 0);
+	  unwind_protect::add (clear_global_error_variable, 0);
 
 	  eval_string (args(1), 0, parse_status, nargout);
 
 	  retval = octave_value_list ();
 	}
 
-      run_unwind_frame ("Feval");
+      unwind_protect::run_frame ("Feval");
     }
   else
     print_usage ("eval");
@@ -649,7 +646,7 @@
 
   iprocstream *cmd = new iprocstream (cmd_str.c_str ());
 
-  add_unwind_protect (cleanup_iprocstream, cmd);
+  unwind_protect::add (cleanup_iprocstream, cmd);
 
   int status = 127;
 
@@ -682,7 +679,7 @@
   else
     error ("unable to start subprocess for `%s'", cmd_str.c_str ());
 
-  run_unwind_protect ();
+  unwind_protect::run ();
 
   return retval;
 }