changeset 315:260863721a51

[project @ 1994-01-28 04:22:45 by jwe]
author jwe
date Fri, 28 Jan 1994 04:22:45 +0000
parents 1738f4390384
children 4bc4f8015280
files src/octave.cc src/parse.y src/toplev.h
diffstat 3 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/octave.cc	Tue Jan 25 23:19:17 1994 +0000
+++ b/src/octave.cc	Fri Jan 28 04:22:45 1994 +0000
@@ -110,6 +110,9 @@
 // Pointer to function that is currently being evaluated.
 tree_function *curr_function = (tree_function *) NULL;
 
+// Nonzero means input is coming from startup file.
+int input_from_startup_file = 0;
+
 // Top level context (?)
 jmp_buf toplevel;
 
@@ -265,6 +268,11 @@
 static void
 execute_startup_files (void)
 {
+  begin_unwind_frame ("execute_startup_files");
+
+  unwind_protect_int (input_from_startup_file);
+  input_from_startup_file = 1;
+
 // Execute commands from the site-wide configuration file.
 
   char *sd = get_site_defaults ();
@@ -291,6 +299,8 @@
 
   if (home_rc_statbuf.st_ino != dot_rc_statbuf.st_ino)
     parse_and_execute ("./.octaverc", 0);
+
+  run_unwind_frame ("execute_startup_files");
 }
 
 /*
@@ -437,6 +447,12 @@
 
   install_builtins ();
 
+  initialize_readline ();
+
+  initialize_pager ();
+
+  install_signal_handlers ();
+
   if (read_init_files)
     {
       saving_history = 0;
@@ -444,10 +460,6 @@
       saving_history = 1;
     }
 
-  initialize_readline ();
-
-  initialize_pager ();
-
 // Avoid counting commands executed from startup files.
   current_command_number = 1;
 
@@ -491,8 +503,6 @@
   if (! (interactive || forced_interactive))
     using_readline = 0;
 
-  install_signal_handlers ();
-
   if (! inhibit_startup_message)
     {
       cout << "Octave, version " << version_string
--- a/src/parse.y	Tue Jan 25 23:19:17 1994 +0000
+++ b/src/parse.y	Fri Jan 28 04:22:45 1994 +0000
@@ -1,6 +1,6 @@
 /* parse.y						-*- text -*-
 
-Copyright (C) 1992, 1993 John W. Eaton
+Copyright (C) 1992, 1993, 1994 John W. Eaton
 
 This file is part of Octave.
 
@@ -909,7 +909,8 @@
 			$4->stash_m_file_time (time ((time_t *) NULL));
 			$4->mark_as_system_m_file ();
 		      }
-		    else if (! input_from_tmp_history_file
+		    else if (! (input_from_tmp_history_file
+				|| input_from_startup_file)
 			     && reading_script_file
 			     && strcmp (curr_m_file_name, id_name) == 0)
 		      {
--- a/src/toplev.h	Tue Jan 25 23:19:17 1994 +0000
+++ b/src/toplev.h	Fri Jan 28 04:22:45 1994 +0000
@@ -1,7 +1,7 @@
 // octave.h                                              -*- C++ -*-
 /*
 
-Copyright (C) 1992, 1993 John W. Eaton
+Copyright (C) 1992, 1993, 1994 John W. Eaton
 
 This file is part of Octave.
 
@@ -82,6 +82,9 @@
 // Pointer to function that is currently being evaluated.
 extern tree_function *curr_function;
 
+// Nonzero means input is coming from startup file.
+extern int input_from_startup_file;
+
 #endif
 
 /*