changeset 6626:af16354ea09c

[project @ 2007-05-16 14:58:26 by jwe]
author jwe
date Wed, 16 May 2007 14:58:26 +0000
parents 5d02dfacfc9e
children 37dcb57b80f6
files src/ChangeLog src/load-path.cc src/load-path.h src/ls-mat5.cc src/ov-fcn-handle.cc
diffstat 5 files changed, 34 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed May 16 08:49:48 2007 +0000
+++ b/src/ChangeLog	Wed May 16 14:58:26 2007 +0000
@@ -1,3 +1,14 @@
+2007-05-16  John W. Eaton  <jwe@octave.org>
+
+	* load-path.h (load_path::sys_path): New static data member.
+	(load_path::system_path): New static function.
+	(load_path::do_system_path): New function.
+	* load-path.cc (Vsystem_path): Delete.
+	(load_path::do_initialize): Use sys_path, not Vsystem_path.
+	(Fpathdef): Call load_path::system_path instead of using Vsystem_path.
+	* ls-mat5.cc (read_mat5_binary_element): Likewise.
+	* ov-fcn-handle.cc (octave_fcn_handle::set_fcn): Likewise.
+
 2007-05-16  David Bateman  <dbateman@free.fr>
 
 	* load_pathc.cc (std::string octave_system_path (void)): New
--- a/src/load-path.cc	Wed May 16 08:49:48 2007 +0000
+++ b/src/load-path.cc	Wed May 16 14:58:26 2007 +0000
@@ -48,14 +48,6 @@
 load_path::hook_function_ptr load_path::remove_hook = execute_pkg_del;
 std::string load_path::command_line_path;
 
-static std::string Vsystem_path;
-
-std::string
-octave_system_path (void)
-{
-  return Vsystem_path;
-}
-
 void
 load_path::dir_info::update (void)
 {
@@ -360,18 +352,18 @@
 void
 load_path::do_initialize (bool set_initial_path)
 {
-  Vsystem_path = dir_path::path_sep_str;
+  sys_path = dir_path::path_sep_str;
 
   if (set_initial_path)
     {
-      maybe_add_path_elts (Vsystem_path, Vlocal_ver_oct_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vlocal_api_oct_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vlocal_oct_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vlocal_ver_fcn_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vlocal_api_fcn_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vlocal_fcn_file_dir);
-      maybe_add_path_elts (Vsystem_path, Voct_file_dir);
-      maybe_add_path_elts (Vsystem_path, Vfcn_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_ver_oct_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_api_oct_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_oct_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_ver_fcn_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_api_fcn_file_dir);
+      maybe_add_path_elts (sys_path, Vlocal_fcn_file_dir);
+      maybe_add_path_elts (sys_path, Voct_file_dir);
+      maybe_add_path_elts (sys_path, Vfcn_file_dir);
     }
 
   std::string tpath = load_path::command_line_path;
@@ -384,8 +376,8 @@
   if (! tpath.empty ())
     xpath += dir_path::path_sep_str + tpath;
 
-  if (Vsystem_path != dir_path::path_sep_str)
-    xpath += Vsystem_path;
+  if (sys_path != dir_path::path_sep_str)
+    xpath += sys_path;
 
   do_set (xpath, false);
 }
@@ -1295,7 +1287,7 @@
 @seealso{path, addpath, rmpath, genpath, savepath, pathsep}\n\
 @end deftypefn")
 {
-  return octave_value (Vsystem_path);
+  return load_path::system_path ();
 }
 
 DEFUN (path, args, nargout,
--- a/src/load-path.h	Wed May 16 08:49:48 2007 +0000
+++ b/src/load-path.h	Wed May 16 14:58:26 2007 +0000
@@ -173,6 +173,11 @@
       command_line_path += dir_path::path_sep_str + p;
   }
 
+  static std::string system_path (void)
+  {
+    return instance_ok () ? do_system_path () : std::string ();
+  }
+
 private:
 
   static const int M_FILE = 1;
@@ -277,6 +282,8 @@
 
   static std::string command_line_path;
 
+  static std::string sys_path;
+
   static bool instance_ok (void);
 
   typedef std::list<dir_info>::const_iterator const_dir_info_list_iterator;
@@ -332,6 +339,8 @@
 
   void do_display (std::ostream& os) const;
 
+  std::string system_path (void) const { return sys_path; }
+
   void add_to_fcn_map (const dir_info& di, bool at_end) const;
 };
 
@@ -341,8 +350,6 @@
 extern void execute_pkg_add (const std::string& dir);
 extern void execute_pkg_del (const std::string& dir);
 
-extern std::string octave_system_path (void);
-
 #endif
 
 /*
--- a/src/ls-mat5.cc	Wed May 16 08:49:48 2007 +0000
+++ b/src/ls-mat5.cc	Wed May 16 14:58:26 2007 +0000
@@ -800,7 +800,7 @@
 			names(1) = fname + ".mex";
 			names(2) = fname + ".m";
 
-			dir_path p (octave_system_path ());
+			dir_path p (load_path::system_path ());
 
 			str = octave_env::make_absolute 
 			  (p.find_first_of (names), octave_env::getcwd ());
--- a/src/ov-fcn-handle.cc	Wed May 16 08:49:48 2007 +0000
+++ b/src/ov-fcn-handle.cc	Wed May 16 14:58:26 2007 +0000
@@ -197,7 +197,7 @@
 	  names(1) = nm + ".mex";
 	  names(2) = nm + ".m";
 
-	  dir_path p (octave_system_path ());
+	  dir_path p (load_path::system_path ());
 
 	  str = octave_env::make_absolute 
 	    (p.find_first_of (names), octave_env::getcwd ());