changeset 168:a500c60e8f23

[project @ 1993-10-19 05:24:44 by jwe]
author jwe
date Tue, 19 Oct 1993 05:27:59 +0000
parents 43074bfdc8c5
children 49ab724d0a32
files src/oct-hist.cc src/oct-hist.h src/parse.y
diffstat 3 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/oct-hist.cc	Tue Oct 19 05:14:27 1993 +0000
+++ b/src/oct-hist.cc	Tue Oct 19 05:27:59 1993 +0000
@@ -58,6 +58,9 @@
 #include <readline/history.h>
 }
 
+// Nonzero means input is coming from temporary history file.
+int input_from_tmp_history_file = 0;
+
 // Nonzero means we are saving history lines.
 int saving_history = 1;
 
@@ -512,7 +515,7 @@
 
   file.close ();
 
-  return name;
+  return strsave (name);
 }
 
 void
@@ -569,7 +572,9 @@
 
   begin_unwind_frame ("do_edit_history");
   unwind_protect_int (echo_input);
+  unwind_protect_int (input_from_tmp_history_file);
   echo_input = 1;
+  input_from_tmp_history_file = 1;
 
   parse_and_execute (name, 1);
 
@@ -579,6 +584,8 @@
 // unwind_protect.
 
   unlink (name);
+
+  delete [] name;
 }
 
 void
@@ -593,7 +600,9 @@
 
   begin_unwind_frame ("do_run_history");
   unwind_protect_int (echo_input);
+  unwind_protect_int (input_from_tmp_history_file);
   echo_input = 1;
+  input_from_tmp_history_file = 1;
 
   parse_and_execute (name, 1);
 
@@ -603,6 +612,8 @@
 // unwind_protect.
 
   unlink (name);
+
+  delete [] name;
 }
 
 int
--- a/src/oct-hist.h	Tue Oct 19 05:14:27 1993 +0000
+++ b/src/oct-hist.h	Tue Oct 19 05:27:59 1993 +0000
@@ -36,6 +36,9 @@
 extern void do_run_history (int, char**);
 extern int current_history_number (void);
 
+// Nonzero means input is coming from temporary history file.
+extern int input_from_tmp_history_file;
+
 // Nonzero means we are saving history lines.
 extern int saving_history;
 
--- a/src/parse.y	Tue Oct 19 05:14:27 1993 +0000
+++ b/src/parse.y	Tue Oct 19 05:27:59 1993 +0000
@@ -34,6 +34,7 @@
 
 #include "error.h"
 #include "variables.h"
+#include "octave-hist.h"
 #include "user-prefs.h"
 #include "input.h"
 #include "utils.h"
@@ -486,7 +487,7 @@
 		      (sr, $1->line (), $1->column ());
 		    tree_simple_assignment_expression *expr =
 		      new tree_simple_assignment_expression
-			(id, $3, $2->line () , $2->column ());
+			(id, $3, $2->line (), $2->column ());
 		    expr->eval (0);
 		  }
 		| global_decl1 optcomma NAME
@@ -908,7 +909,8 @@
 		      }
 		    else
 		      {
-			if (reading_script_file
+			if (! input_from_tmp_history_file
+			    && reading_script_file
 			    && strcmp (curr_m_file_name, id_name) == 0)
 			  warning ("function `%s' defined within\
  script file `%s.m'", id_name, curr_m_file_name);