changeset 4486:6ceba1f351fb

[project @ 2003-08-22 16:49:46 by jwe]
author jwe
date Fri, 22 Aug 2003 16:49:46 +0000
parents bd3cfa59eb61
children f36a75f8deca
files src/ChangeLog src/defaults.cc src/parse.h src/parse.y
diffstat 4 files changed, 35 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Aug 21 20:29:34 2003 +0000
+++ b/src/ChangeLog	Fri Aug 22 16:49:46 2003 +0000
@@ -1,3 +1,11 @@
+2003-08-22  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* defaults.cc (maybe_add_or_del_packages): Use source_file instead
+	of parse_and_execute.
+	* parse.y (source_file): New function.
+	(Fsource): Use it.
+	* parse.h (source_file): Provide decl.
+
 2003-08-21  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* utils.cc (octave_vsnprintf): Copy va_list to avoid using more
--- a/src/defaults.cc	Thu Aug 21 20:29:34 2003 +0000
+++ b/src/defaults.cc	Fri Aug 22 16:49:46 2003 +0000
@@ -135,7 +135,7 @@
 	  file_stat fs = file_stat (file);
 
 	  if (fs.exists ())
-	    parse_and_execute (file);
+	    source_file (file);
 
 	  if (error_state)
 	    return;
--- a/src/parse.h	Thu Aug 21 20:29:34 2003 +0000
+++ b/src/parse.h	Fri Aug 22 16:49:46 2003 +0000
@@ -100,6 +100,9 @@
 extern bool
 load_fcn_from_file (symbol_record *sym_rec, bool exec_script);
 
+extern void
+source_file (const std::string file_name);
+
 extern octave_value_list
 feval (const std::string& name,
        const octave_value_list& args = octave_value_list (),
--- a/src/parse.y	Thu Aug 21 20:29:34 2003 +0000
+++ b/src/parse.y	Fri Aug 22 16:49:46 2003 +0000
@@ -3459,6 +3459,28 @@
   return script_file_executed;
 }
 
+void
+source_file (const std::string file_name)
+{
+  std::string file_full_name = file_ops::tilde_expand (file_name);
+
+  unwind_protect::begin_frame ("source_file");
+
+  unwind_protect_str (curr_fcn_file_name);
+  unwind_protect_str (curr_fcn_file_full_name);
+
+  curr_fcn_file_name = file_name;
+  curr_fcn_file_full_name = file_full_name;
+
+  parse_fcn_file (file_full_name, true, true);
+
+  if (error_state)
+    error ("source: error sourcing file `%s'",
+	   file_full_name.c_str ());
+
+  unwind_protect::run_frame ("source_file");
+}
+
 DEFUN (source, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} source (@var{file})\n\
@@ -3476,25 +3498,7 @@
       std::string file_name = args(0).string_value ();
 
       if (! error_state)
-	{
-	  std::string file_full_name = file_ops::tilde_expand (file_name);
-
-	  unwind_protect::begin_frame ("Fsource");
-
-	  unwind_protect_str (curr_fcn_file_name);
-	  unwind_protect_str (curr_fcn_file_full_name);
-
-	  curr_fcn_file_name = file_name;
-	  curr_fcn_file_full_name = file_full_name;
-
-	  parse_fcn_file (file_full_name, true, true);
-
-	  if (error_state)
-	    error ("source: error sourcing file `%s'",
-		   file_full_name.c_str ());
-
-	  unwind_protect::run_frame ("Fsource");
-	}
+        source_file (file_name);
       else
 	error ("source: expecting file name as argument");
     }