# HG changeset patch # User jwe # Date 1147384714 0 # Node ID 67bf9b4f2ae27f14d9a1dd403b2ab5e29ed10cdf # Parent dfef2f909f341827acf399e3934ea39310247619 [project @ 2006-05-11 21:58:34 by jwe] diff -r dfef2f909f34 -r 67bf9b4f2ae2 ChangeLog --- a/ChangeLog Thu May 11 19:46:15 2006 +0000 +++ b/ChangeLog Thu May 11 21:58:34 2006 +0000 @@ -1,3 +1,15 @@ +2006-05-11 John W. Eaton + + * configure.in (localfcnfilepath, localoctfilepath, fcnfilepath, + imagepath): Delete variables. + * Makeconf.in (localfcnfilepath, localoctfilepath, fcnfilepath, + imagepath): Likewise. + (do-subst-default-vals): Don't substitute them. + + * run-octave.in: Pass --image-path to octave. + Use find to recursively add directories to loadpath. + Fixup set args command in .gdbinit here. + 2006-05-09 John W. Eaton * octMakefile.in (abs_top_srcdir): Substitute value here. diff -r dfef2f909f34 -r 67bf9b4f2ae2 Makeconf.in --- a/Makeconf.in Thu May 11 19:46:15 2006 +0000 +++ b/Makeconf.in Thu May 11 21:58:34 2006 +0000 @@ -287,7 +287,6 @@ localfcnfiledir = @localfcnfiledir@ localapifcnfiledir = @localapifcnfiledir@ localverfcnfiledir = @localverfcnfiledir@ -localfcnfilepath = @localfcnfilepath@ # Where to put executables to be run by Octave rather than # the user. This path usually includes the Octave version @@ -313,17 +312,9 @@ localoctfiledir = @localoctfiledir@ localapioctfiledir = @localapioctfiledir@ localveroctfiledir = @localveroctfiledir@ -localoctfilepath = @localoctfilepath@ -# Where Octave will search to find its function files. Before -# changing this, check to see if your purpose wouldn't -# better be served by changing localfcnfilepath. This -# should be a colon-separated list of directories. -fcnfilepath = @fcnfilepath@ - -# Where Octave will search to find image files.es. +# Where Octave will search to find image files. imagedir = @imagedir@ -imagepath = @imagepath@ # The type of computer we are running on. canonical_host_type = @canonical_host_type@ @@ -511,9 +502,7 @@ -e "s|%OCTAVE_DEFAULT_PAGER%|\"${DEFAULT_PAGER}\"|" \ -e "s|%OCTAVE_EXEC_PREFIX%|\"${exec_prefix}\"|" \ -e "s|%OCTAVE_FCNFILEDIR%|\"${fcnfiledir}\"|" \ - -e "s|%OCTAVE_FCNFILEPATH%|\"${fcnfilepath}\"|" \ -e "s|%OCTAVE_IMAGEDIR%|\"${imagedir}\"|" \ - -e "s|%OCTAVE_IMAGEPATH%|\"${imagepath}\"|" \ -e "s|%OCTAVE_INCLUDEDIR%|\"${includedir}\"|" \ -e "s|%OCTAVE_INFODIR%|\"${infodir}\"|" \ -e "s|%OCTAVE_INFOFILE%|\"${infofile}\"|" \ @@ -523,9 +512,7 @@ -e "s|%OCTAVE_LOCALAPIOCTFILEDIR%|\"${localapioctfiledir}\"|" \ -e "s|%OCTAVE_LOCALARCHLIBDIR%|\"${localarchlibdir}\"|" \ -e "s|%OCTAVE_LOCALFCNFILEDIR%|\"${localfcnfiledir}\"|" \ - -e "s|%OCTAVE_LOCALFCNFILEPATH%|\"${localfcnfilepath}\"|" \ -e "s|%OCTAVE_LOCALOCTFILEDIR%|\"${localoctfiledir}\"|" \ - -e "s|%OCTAVE_LOCALOCTFILEPATH%|\"${localoctfilepath}\"|" \ -e "s|%OCTAVE_LOCALSTARTUPFILEDIR%|\"${localstartupfiledir}\"|" \ -e "s|%OCTAVE_LOCALVERARCHLIBDIR%|\"${localverarchlibdir}\"|" \ -e "s|%OCTAVE_LOCALVERFCNFILEDIR%|\"${localverfcnfiledir}\"|" \ diff -r dfef2f909f34 -r 67bf9b4f2ae2 NEWS --- a/NEWS Thu May 11 19:46:15 2006 +0000 +++ b/NEWS Thu May 11 21:58:34 2006 +0000 @@ -1,7 +1,28 @@ Summary of changes for version 3.0: ---------------------------------- - * Previous versions of Octave had a number of built-in variables to + ** The way Octave handles search paths has changed. Instead of + setting the built-in variable LOADPATH, you must use addpath, + rmpath, or path to manipulate the function search path. These + functions will maintain "." at the head of the path, for + compatibility with Matlab. + + Leading, trailing or doubled colons are no longer special. + Now, all elements of the search path are explicitly included in + the path when Octave starts. To display the path, use the path + function. + + Path elements that end in // are no longer searched recursively. + Instead, you may use addpath and the genpath function to add an + entire directory tree to the path. For example, + + addpath (genpath ("~/octave")); + + will add ~/octave and all directories below it to the head of the + path. + + + ** Previous versions of Octave had a number of built-in variables to control warnings (for example, warn_divide_by_zero). These variables have been replaced by warning identifiers that are used with the warning function to control the state of warnings. @@ -45,7 +66,7 @@ help warning_ids - * All built-in variables have been converted to functions. This + ** All built-in variables have been converted to functions. This change simplifies the interpreter and allows a consistent interface to internal variables for user-defined packages and the core functions distributed with Octave. In most cases, code that diff -r dfef2f909f34 -r 67bf9b4f2ae2 configure.in --- a/configure.in Thu May 11 19:46:15 2006 +0000 +++ b/configure.in Thu May 11 21:58:34 2006 +0000 @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.509 $) +AC_REVISION($Revision: 1.510 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -79,8 +79,6 @@ OCTAVE_SET_DEFAULT(localapifcnfiledir, '$(datadir)/octave/site/$(api_version)/m') OCTAVE_SET_DEFAULT(localverfcnfiledir, '$(datadir)/octave/$(version)/site/m') -OCTAVE_SET_DEFAULT(localfcnfilepath, - '$(localverfcnfiledir)//$(sepchar)$(localapifcnfiledir)//$(sepchar)$(localfcnfiledir)//') OCTAVE_SET_DEFAULT(octlibdir, '$(libdir)/octave-$(version)') OCTAVE_SET_DEFAULT(archlibdir, '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)') @@ -96,12 +94,7 @@ '$(libexecdir)/octave/site/oct/$(api_version)/$(canonical_host_type)') OCTAVE_SET_DEFAULT(localveroctfiledir, '$(libexecdir)/octave/$(version)/site/oct/$(canonical_host_type)') -OCTAVE_SET_DEFAULT(localoctfilepath, - '$(localveroctfiledir)//$(sepchar)$(localapioctfiledir)//$(sepchar)$(localoctfiledir)//') -OCTAVE_SET_DEFAULT(fcnfilepath, - '.$(sepchar)$(localoctfilepath)$(sepchar)$(localfcnfilepath)$(sepchar)$(octfiledir)//$(sepchar)$(fcnfiledir)//') OCTAVE_SET_DEFAULT(imagedir, '$(datadir)/octave/$(version)/imagelib') -OCTAVE_SET_DEFAULT(imagepath, '.$(sepchar)$(imagedir)//') ### Make configure args available for other uses. diff -r dfef2f909f34 -r 67bf9b4f2ae2 run-octave.in --- a/run-octave.in Thu May 11 19:46:15 2006 +0000 +++ b/run-octave.in Thu May 11 21:58:34 2006 +0000 @@ -1,8 +1,19 @@ #! /bin/sh top_srcdir=%abs_top_srcdir% builddir=%builddir% -LOADPATH="$top_srcdir/test//:$top_srcdir/scripts//:$builddir/scripts//:$builddir/src//:"; -args="--path=$LOADPATH" +## FIXME -- this will fail for filenames with embedded spaces... +dirs="$top_srcdir/test $top_srcdir/scripts $builddir/scripts $builddir/src" +dirs=$(find $dirs -type d -a ! \( \( -name CVS -o -name private \) -a -prune \)) +for d in $dirs; do + LOADPATH=$LOADPATH:$d +done +LOADPATH=$(echo $LOADPATH | sed 's|^:||') +IMAGEPATH="$top_srcdir/scripts/image" +args="--path=$LOADPATH --image-path=$IMAGEPATH" +if [ $(pwd) = "$builddir" ]; then + sed "s|^set args.*$|set args $args|" .gdbinit > .gdbinit-tmp + mv .gdbinit-tmp .gdbinit +fi if [ $# -gt 0 ]; then if [ "x$1" = "x-g" ]; then driver="gdb" diff -r dfef2f909f34 -r 67bf9b4f2ae2 scripts/path/addpath.m --- a/scripts/path/addpath.m Thu May 11 19:46:15 2006 +0000 +++ b/scripts/path/addpath.m Thu May 11 21:58:34 2006 +0000 @@ -19,12 +19,12 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} addpath (@var{dir1}, @dots{}) ## @deftypefnx {Function File} {} addpath (@var{dir1}, @dots{}, @var{option}) -## Add @var{dir1}, @dots{} to the current @code{LOADPATH}. If +## Add @var{dir1}, @dots{} to the current function search path. If ## @var{option} is @samp{"-begin"} or 0 (the default), prepend the ## directory name to the current path. If @var{option} is @samp{"-end"} ## or 1, append the directory name to the current path. ## Directories added to the path must exist. -## @seealso{path, rmpath, savepath, pathsep} +## @seealso{path, rmpath, genpath, pathdef, savepath, pathsep} ## @end deftypefn ## Author: Etienne Grossmann @@ -59,12 +59,13 @@ xpath = cellstr (split (path (), psep)); n_path_elts = length (xpath); - for i = 1:n_path_elts - tmp = xpath{i}; - tmp = regexprep (tmp, "//+", "/"); - tmp = regexprep (tmp, "/$", ""); - xpath{i,1} = xpath{i}; - xpath{i,2} = tmp; + + ## Strip "." for now. Calling path to set the path will restore it. + for k = n_path_elts:-1:1 + if (strcmp (".", xpath{k})) + xpath(k) = []; + n_path_elts--; + endif endfor for i = 1:nargs @@ -73,6 +74,9 @@ for j = 1:n_dir_elts dir = regexprep (dir_elts{j}, "//+", "/"); dir = regexprep (dir, "/$", ""); + if (strcmp (dir, ".") && append) + warning ("addpath: \".\" is always first in the path"); + endif [s, status, msg] = stat (dir); if (status != 0) warning ("addpath: %s: %s", dir, msg); @@ -81,30 +85,28 @@ warning ("addpath: %s: not a directory", dir); continue; endif - elt_found = false; for k = n_path_elts:-1:1 - if (strcmp (dir, xpath{k,2})) - xpath(k,:) = []; + if (strcmp (dir, xpath{k})) + xpath(k) = []; n_path_elts--; - elt_found = true; endif endfor if (append) - xpath = [xpath; {dir_elts{j}, dir}]; + xpath = [xpath; {dir}]; else - xpath = [{dir_elts{j}, dir}; xpath]; + xpath = [{dir}; xpath]; endif endfor endfor - xpath{:,2} = psep; - xpath{end,2} = ""; - xpath = xpath'; + ## Ensure a 1xN cell array. + xpath = xpath(:)'; + + xpath{2,:} = psep; + xpath{2,end} = ""; tmp = strcat (xpath{:}); - tmp = strrep (tmp, DEFAULT_LOADPATH (), ""); - path (tmp); endif diff -r dfef2f909f34 -r 67bf9b4f2ae2 scripts/path/path.m --- a/scripts/path/path.m Thu May 11 19:46:15 2006 +0000 +++ b/scripts/path/path.m Thu May 11 21:58:34 2006 +0000 @@ -1,78 +0,0 @@ -## Copyright (C) 1997 John W. Eaton -## -## This file is part of Octave. -## -## Octave is free software; you can redistribute it and/or modify it -## under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2, or (at your option) -## any later version. -## -## Octave is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with Octave; see the file COPYING. If not, write to the Free -## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -## 02110-1301, USA. - -## -*- texinfo -*- -## @deftypefn {Function File} {} path (@dots{}) -## Modify or display Octave's @code{LOADPATH}. -## -## If @var{nargin} and @var{nargout} are zero, display the elements of -## Octave's @code{LOADPATH} in an easy to read format. -## -## If @var{nargin} is zero and nargout is greater than zero, return the -## current value of @code{LOADPATH}. -## -## If @var{nargin} is greater than zero, concatenate the arguments, -## separating them with @code{pathsep()}. Set @code{LOADPATH} to the result -## and also return it. -## -## No checks are made for duplicate elements. -## @seealso{addpath, rmpath, savepath, pathsep} -## @end deftypefn - -## Author: jwe - -function retval = path (varargin) - - psep = pathsep (); - - if (nargin > 0) - p = varargin{1}; - for i = 2:nargin - p = sprintf ("%s%s%s", p, psep, varargin{i}); - endfor - LOADPATH (p); - endif - - lp = LOADPATH (); - dlp = DEFAULT_LOADPATH (); - - if (lp(1) == psep) - p = strcat (dlp, lp); - else - t = findstr (lp, [psep,psep]); - if (any (t)) - loc = t(1); - lp = lp; - p = strcat (lp(1:loc), dlp, lp(loc+1:end)); - elseif (lp(end) == psep) - p = strcat (lp, dlp); - else - p = lp; - endif - endif - - if (nargin == 0 && nargout == 0) - puts ("\nOctave's search path contains the following directories:\n\n "); - puts (strrep (p, psep, "\n ")); - puts ("\n\n"); - else - retval = p; - endif - -endfunction diff -r dfef2f909f34 -r 67bf9b4f2ae2 scripts/path/rmpath.m --- a/scripts/path/rmpath.m Thu May 11 19:46:15 2006 +0000 +++ b/scripts/path/rmpath.m Thu May 11 21:58:34 2006 +0000 @@ -16,9 +16,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} rmpath (@var{dir1}, @dots{}) -## Remove @var{dir1}, @dots{} from the current @code{LOADPATH}. +## Remove @var{dir1}, @dots{} from the current function search path. ## -## @seealso{path, addpath, savepath, pathsep} +## @seealso{path, addpath, genpath, pathdef, savepath, pathsep} ## @end deftypefn ## Author: Etienne Grossmann @@ -35,13 +35,6 @@ xpath = cellstr (split (path (), psep)); n_path_elts = length (xpath); - for i = 1:n_path_elts - tmp = xpath{i}; - tmp = regexprep (tmp, "//+", "/"); - tmp = regexprep (tmp, "/$", ""); - xpath{i,1} = xpath{i}; - xpath{i,2} = tmp; - endfor for i = 1:nargin dir_elts = cellstr (split (varargin{i}, psep)); @@ -51,8 +44,10 @@ dir = regexprep (dir, "/$", ""); elt_found = false; for k = n_path_elts:-1:1 - if (strcmp (dir, xpath{k,2})) - xpath(k,:) = []; + if (strcmp (dir, ".")) + warning ("rmpath: can't remove \".\" from path"); + elseif (strcmp (dir, xpath{k})) + xpath(k) = []; n_path_elts--; elt_found = true; endif @@ -63,14 +58,14 @@ endfor endfor - xpath{:,2} = psep; - xpath{end,2} = ""; - xpath = xpath'; + ## Ensure a 1xN cell array. + xpath = xpath(:)'; + + xpath{2,:} = psep; + xpath{2,end} = ""; tmp = strcat (xpath{:}); - tmp = strrep (tmp, DEFAULT_LOADPATH (), ""); - path (tmp); endfunction diff -r dfef2f909f34 -r 67bf9b4f2ae2 scripts/path/savepath.m --- a/scripts/path/savepath.m Thu May 11 19:46:15 2006 +0000 +++ b/scripts/path/savepath.m Thu May 11 21:58:34 2006 +0000 @@ -22,7 +22,7 @@ ## Save the current function search path to @var{file}. If @var{file} ## is omitted, @file{~/.octaverc} is used. If successful, ## @code{savepath} returns 0. -## @seealso{path, addpath, rmpath, pathsep} +## @seealso{path, addpath, rmpath, genpath, pathdef, pathsep} ## @end deftypefn ## Author: Bill Denney diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/Cell.cc --- a/src/Cell.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/Cell.cc Thu May 11 21:58:34 2006 +0000 @@ -46,9 +46,9 @@ if (trim) { - size_t n = s.find_last_not_of (' '); + size_t pos = s.find_last_not_of (' '); - s = (n == NPOS) ? "" : s.substr (0, n+1); + s = (pos == NPOS) ? "" : s.substr (0, pos+1); } elem(i,0) = s; diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/ChangeLog --- a/src/ChangeLog Thu May 11 19:46:15 2006 +0000 +++ b/src/ChangeLog Thu May 11 21:58:34 2006 +0000 @@ -1,3 +1,52 @@ +2006-05-11 John W. Eaton + + * octave.cc (IMAGE_PATH_OPTION): New macro. + (usage_string, verbose_usage): Include --image-path option. + (long_opts): Include --image-path. + (octave_main): Handle IMAGE_PATH_OPTION. + + * toplev.cc (Foctave_config_info): Delete fcnfilepath, imagepath, + localfcnfilepath, and localoctfilepath from the struct. + * defaults.h.in (OCTAVE_FCNFILEPATH, OCTAVE_IMAGEPATH, + OCTAVE_LOCALFCNFILEPATH, OCTAVE_LOCALOCTFILEPATH): Delete variables. + + * octave.cc (octave_main): Call set_exec_path and set_load_path + instead of bind_internal_variable. + + * defaults.cc (Fpathsep): Rename from FDEFAULT_LOADPATH. + Don't allow path to be set. + (Fpath): Rename from FLOADPATH. Make Matlab-compatible. + (update_load_path_dir_path): No need to pass VDEFAULT_LOADPATH to + dir_path constructor now. + (update_exec_path, FDEFAULT_EXEC_PATH, + set_default_default_exec_path, set_default_exec_path, + maybe_add_default_load_path): Delete functions. + (VDEFAULT_EXEC_PATH): Delete variable. + (FEXEC_PATH): Leading and trailing colons no longer special. + (set_exec_path, set_load_path, set_image_path, + maybe_add_path_elts): New functions. + (install_defaults): Call set_exec_path and set_load_path instead + of set_default_exec_path and set_default_path. Don't call + set_default_default_exec_path. Do call set_image_path. + * defaults.cc (genpath, Fgenpath): New functions. + (Vlocal_ver_oct_file_dir, Vlocal_api_oct_file_dir, + Vlocal_oct_file_dir, Vlocal_ver_fcn_file_dir, + Vlocal_api_fcn_file_dir, Vlocal_fcn_file_dir, Vimage_dir): + New variables. + (set_default_local_ver_oct_file_dir, + set_default_local_api_oct_file_dir, + set_default_local_oct_file_dir, + set_default_local_ver_fcn_file_dir, + set_default_local_api_fcn_file_dir, + set_default_local_fcn_file_dir, set_default_image_dir): + New functions. + (install_defaults): Call them. + * defaults.h.in (set_exec_path, set_load_path, set_image_path, + Vlocal_ver_oct_file_dir, Vlocal_api_oct_file_dir, + Vlocal_oct_file_dir, Vlocal_ver_fcn_file_dir, + Vlocal_api_fcn_file_dir, Vlocal_fcn_file_dir, + Vlocal_fcn_file_dir, Vimage_dir): Provide decls. + 2006-05-10 John W. Eaton * ov-cell.cc (Fcellstr): Trim trailing blanks. diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/defaults.cc --- a/src/defaults.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/defaults.cc Thu May 11 21:58:34 2006 +0000 @@ -37,6 +37,7 @@ #include #endif +#include "dir-ops.h" #include "oct-env.h" #include "file-stat.h" #include "pathsearch.h" @@ -66,12 +67,19 @@ std::string Varch_lib_dir; std::string Vlocal_arch_lib_dir; std::string Vlocal_ver_arch_lib_dir; -std::string Vfcn_file_dir; -std::string Voct_file_dir; + +std::string Vlocal_ver_oct_file_dir; +std::string Vlocal_api_oct_file_dir; +std::string Vlocal_oct_file_dir; -// The default path that will be searched for programs that we -// execute (in addition to the user-specified --exec-path). -static std::string VDEFAULT_EXEC_PATH; +std::string Vlocal_ver_fcn_file_dir; +std::string Vlocal_api_fcn_file_dir; +std::string Vlocal_fcn_file_dir; + +std::string Voct_file_dir; +std::string Vfcn_file_dir; + +std::string Vimage_dir; // The path that will be searched for programs that we execute. // (--exec-path path) @@ -90,7 +98,7 @@ // Name of the editor to be invoked by the edit_history command. std::string VEDITOR; -static std::string VIMAGEPATH; +static std::string VIMAGE_PATH; std::string Vlocal_site_defaults_file; std::string Vsite_defaults_file; @@ -156,7 +164,7 @@ { string_vector old_dirs = Vload_path_dir_path.all_directories (); - Vload_path_dir_path = dir_path (VLOADPATH, VDEFAULT_LOADPATH); + Vload_path_dir_path = dir_path (VLOADPATH, ""); string_vector new_dirs = Vload_path_dir_path.all_directories (); @@ -243,12 +251,54 @@ } static void +set_default_local_ver_oct_file_dir (void) +{ + Vlocal_ver_oct_file_dir = subst_octave_home (OCTAVE_LOCALVEROCTFILEDIR); +} + +static void +set_default_local_api_oct_file_dir (void) +{ + Vlocal_api_oct_file_dir = subst_octave_home (OCTAVE_LOCALAPIOCTFILEDIR); +} + +static void +set_default_local_oct_file_dir (void) +{ + Vlocal_oct_file_dir = subst_octave_home (OCTAVE_LOCALOCTFILEDIR); +} + +static void +set_default_local_ver_fcn_file_dir (void) +{ + Vlocal_ver_fcn_file_dir = subst_octave_home (OCTAVE_LOCALVERFCNFILEDIR); +} + +static void +set_default_local_api_fcn_file_dir (void) +{ + Vlocal_api_fcn_file_dir = subst_octave_home (OCTAVE_LOCALAPIFCNFILEDIR); +} + +static void +set_default_local_fcn_file_dir (void) +{ + Vlocal_fcn_file_dir = subst_octave_home (OCTAVE_LOCALFCNFILEDIR); +} + +static void set_default_fcn_file_dir (void) { Vfcn_file_dir = subst_octave_home (OCTAVE_FCNFILEDIR); } static void +set_default_image_dir (void) +{ + Vimage_dir = subst_octave_home (OCTAVE_IMAGEDIR); +} + +static void set_default_oct_file_dir (void) { Voct_file_dir = subst_octave_home (OCTAVE_OCTFILEDIR); @@ -260,47 +310,124 @@ Vbin_dir = subst_octave_home (OCTAVE_BINDIR); } -static void -set_default_default_exec_path (void) +void +set_exec_path (const std::string& path) { - VDEFAULT_EXEC_PATH - = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str + VEXEC_PATH = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str + Vlocal_arch_lib_dir + dir_path::path_sep_str + Varch_lib_dir + dir_path::path_sep_str + Vbin_dir; + + // This is static so that even if set_exec_path is called more than + // once, shell_path is the original PATH from the environment, + // before we start modifying it. + static std::string shell_path = octave_env::getenv ("PATH"); + + if (! shell_path.empty ()) + VEXEC_PATH += dir_path::path_sep_str + shell_path; + + std::string tpath = path; + + if (tpath.empty ()) + tpath = octave_env::getenv ("OCTAVE_EXEC_PATH"); + + if (! tpath.empty ()) + VEXEC_PATH = tpath + dir_path::path_sep_str + VEXEC_PATH; + + octave_env::putenv ("PATH", VEXEC_PATH); +} + +static std::string +genpath (const std::string& dirname) +{ + std::string retval; + + std::string full_dirname = file_ops::tilde_expand (dirname); + + dir_entry dir (full_dirname); + + if (dir) + { + retval = dirname; + + string_vector dirlist = dir.read (); + + octave_idx_type len = dirlist.length (); + + for (octave_idx_type i = 0; i < len; i++) + { + std::string elt = dirlist[i]; + + if (elt != "." && elt != ".." && elt != "private") + { + std::string nm = full_dirname + file_ops::dir_sep_str + elt; + + file_stat fs (nm); + + if (fs && fs.is_dir ()) + retval += dir_path::path_sep_str + genpath (nm); + } + } + } + + return retval; } static void -set_default_exec_path (void) +maybe_add_path_elts (std::string& pathvar, const std::string& dir) { - std::string octave_exec_path = octave_env::getenv ("OCTAVE_EXEC_PATH"); - - if (octave_exec_path.empty ()) - { - std::string shell_path = octave_env::getenv ("PATH"); + std::string tpath = genpath (dir); - if (! shell_path.empty ()) - { - VEXEC_PATH = dir_path::path_sep_str; - VEXEC_PATH.append (shell_path); - } - } - else - VEXEC_PATH = std::string (octave_exec_path); + if (! tpath.empty ()) + pathvar += dir_path::path_sep_str + tpath; } -static void -set_default_path (void) +void +set_load_path (const std::string& path) { - VDEFAULT_LOADPATH = subst_octave_home (OCTAVE_FCNFILEPATH); + VDEFAULT_LOADPATH = ":"; + + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_ver_oct_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_api_oct_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_oct_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_ver_fcn_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_api_fcn_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vlocal_fcn_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Voct_file_dir); + maybe_add_path_elts (VDEFAULT_LOADPATH, Vfcn_file_dir); - std::string oct_path = octave_env::getenv ("OCTAVE_PATH"); + std::string tpath = path; + + if (tpath.empty ()) + tpath = octave_env::getenv ("OCTAVE_LOADPATH"); - VLOADPATH = oct_path.empty () ? dir_path::path_sep_str : oct_path; + VLOADPATH = "."; + + if (! tpath.empty ()) + VLOADPATH += dir_path::path_sep_str + tpath; + + if (VDEFAULT_LOADPATH != ":") + VLOADPATH += VDEFAULT_LOADPATH; update_load_path_dir_path (); } +void +set_image_path (const std::string& path) +{ + VIMAGE_PATH = "."; + + std::string tpath = path; + + if (tpath.empty ()) + tpath = octave_env::getenv ("OCTAVE_IMAGE_PATH"); + + if (! tpath.empty ()) + VIMAGE_PATH += dir_path::path_sep_str + tpath; + + maybe_add_path_elts (VIMAGE_PATH, Vimage_dir); +} + static void set_default_info_file (void) { @@ -372,38 +499,6 @@ Vsite_defaults_file = sf; } -std::string -maybe_add_default_load_path (const std::string& pathstring) -{ - std::string retval; - - if (! pathstring.empty ()) - { - if (dir_path::is_path_sep (pathstring[0])) - { - retval = VDEFAULT_LOADPATH; - retval.append (pathstring); - } - else - retval = pathstring; - - if (dir_path::is_path_sep (pathstring[pathstring.length () - 1])) - retval.append (VDEFAULT_LOADPATH); - - size_t pos = 0; - do - { - pos = retval.find (dir_path::path_sep_str + dir_path::path_sep_str); - - if (pos != NPOS) - retval.insert (pos+1, VDEFAULT_LOADPATH); - } - while (pos != NPOS); - } - - return retval; -} - void install_defaults (void) { @@ -423,17 +518,26 @@ set_default_local_ver_arch_lib_dir (); - set_default_fcn_file_dir (); + set_default_local_ver_oct_file_dir (); + set_default_local_api_oct_file_dir (); + set_default_local_oct_file_dir (); + set_default_local_ver_fcn_file_dir (); + set_default_local_api_fcn_file_dir (); + set_default_local_fcn_file_dir (); + + set_default_fcn_file_dir (); set_default_oct_file_dir (); + set_default_image_dir (); + set_default_bin_dir (); - set_default_default_exec_path (); + set_exec_path (); - set_default_exec_path (); + set_load_path (); - set_default_path (); + set_image_path (); set_default_info_file (); @@ -448,6 +552,29 @@ set_site_defaults_file (); } +DEFUN (genpath, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} genpath (@var{dir})\n\ +Return a path constructed from @var{dir} and all its subdiretories.\n\ +@end deftypefn") +{ + octave_value retval; + + if (args.length () == 1) + { + std::string dirname = args(0).string_value (); + + if (! error_state) + retval = genpath (dirname); + else + error ("genpath: expecting argument to be a character string"); + } + else + print_usage ("genpath"); + + return retval; +} + DEFUN (rehash, , , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} rehash ()\n\ @@ -476,36 +603,6 @@ return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EDITOR); } -static void -update_exec_path (void) -{ - std::string path; - - int eplen = VEXEC_PATH.length (); - - if (eplen > 0) - { - bool prepend = (VEXEC_PATH[0] == ':'); - bool append = (eplen > 1 && VEXEC_PATH[eplen-1] == ':'); - - if (prepend) - { - path = VDEFAULT_EXEC_PATH + VEXEC_PATH; - } - else - { - path = VEXEC_PATH; - - if (append) - path.append (VDEFAULT_EXEC_PATH); - } - } - else - path = VDEFAULT_EXEC_PATH; - - octave_env::putenv ("PATH", path); -} - DEFUN (EXEC_PATH, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} EXEC_PATH ()\n\ @@ -515,10 +612,11 @@ Its initial value is taken from the environment variable\n\ @code{OCTAVE_EXEC_PATH} (if it exists) or @code{PATH}, but that\n\ value can be overridden by the command line argument\n\ -@code{--exec-path PATH}. Any leading, trailing, or doubled colon in\n\ -the value of @code{EXEC_PATH} are replaced by by the value of\n\ -@code{DEFAULT_EXEC_PATH}.\n\ -@seealso{DEFAULT_EXEC_PATH}\n\ +@code{--exec-path PATH}. At startup, an additional set of\n\ +directories (including the shell PATH) is appended to the path\n\ +specified in the environment or on the command line. If you use\n\ +the @code{EXEC_PATH} function to modify the path, you should take\n\ +care to preserve these additional directories.\n\ @end deftypefn") { std::string saved_exec_path = VEXEC_PATH; @@ -526,7 +624,7 @@ octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH); if (VEXEC_PATH != saved_exec_path) - update_exec_path (); + octave_env::putenv ("PATH", VEXEC_PATH); return retval; } @@ -545,115 +643,100 @@ return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (fftw_wisdom_program); } -DEFUN (DEFAULT_EXEC_PATH, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} DEFAULT_EXEC_PATH ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} DEFAULT_EXEC_PATH (@var{new_val})\n\ -Query or set the internal variable that specifies a colon separated\n\ -list of directories in which to search when executing\n\ -external programs. The value of this variable is automatically\n\ -substituted for leading, trailing, or doubled colons that appear in the\n\ -built-in variable @code{EXEC_PATH}.\n\ -@seealso{EXEC_PATH}\n\ -@end deftypefn") -{ - std::string saved_default_exec_path = VDEFAULT_EXEC_PATH; - - octave_value retval - = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (DEFAULT_EXEC_PATH); - - if (VDEFAULT_EXEC_PATH != saved_default_exec_path) - update_exec_path (); - - return retval; -} - -DEFUN (IMAGEPATH, args, nargout, +DEFUN (IMAGE_PATH, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} IMAGEPATH ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} IMAGEPATH (@var{new_val})\n\ +@deftypefn {Built-in Function} {@var{val} =} IMAGE_PATH ()\n\ +@deftypefnx {Built-in Function} {@var{old_val} =} IMAGE_PATH (@var{new_val})\n\ Query or set the internal variable that specifies a colon separated\n\ list of directories in which to search for image files.\n\ @end deftypefn") { - return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGEPATH); + return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGE_PATH); } -DEFUN (LOADPATH, args, nargout, +DEFUN (path, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} LOADPATH ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} LOADPATH (@var{new_val})\n\ -Query or set the internal variable that specifies a colon separated\n\ -list of directories in which to search for function\n\ -files. @xref{Functions and Scripts}. The value of @code{LOADPATH}\n\ -overrides the environment variable @code{OCTAVE_PATH}. @xref{Installation}.\n\ +@deftypefn {Function File} {} path (@dots{})\n\ +Modify or display Octave's @code{LOADPATH}.\n\ \n\ -Leading, trailing, or doubled colons that appear in\n\ -@code{LOADPATH} are replaced by the value of @code{DEFAULT_LOADPATH}.\n\ -The default value of @code{LOADPATH} is @code{\"\n" -SEPCHAR_STR -"\"}, which tells Octave to search in the directories specified by\n\ -@code{DEFAULT_LOADPATH}.\n\ +If @var{nargin} and @var{nargout} are zero, display the elements of\n\ +Octave's @code{LOADPATH} in an easy to read format.\n\ \n\ -In addition, if any path element ends in @samp{//}, that directory and\n\ -all subdirectories it contains are searched recursively for function\n\ -files. This can result in a slight delay as Octave caches the lists of\n\ -files found in the @code{LOADPATH} the first time Octave searches for a\n\ -function. After that, searching is usually much faster because Octave\n\ -normally only needs to search its internal cache for files.\n\ +If @var{nargin} is zero and nargout is greater than zero, return the\n\ +current value of @code{LOADPATH}.\n\ \n\ -To improve performance of recursive directory searching, it is best for\n\ -each directory that is to be searched recursively to contain\n\ -@emph{either} additional subdirectories @emph{or} function files, but\n\ -not a mixture of both.\n\ +If @var{nargin} is greater than zero, concatenate the arguments,\n\ +separating them with @code{pathsep()}. Set the internal search path\n\ +to the result and return it.\n\ \n\ -@xref{Organization of Functions}, for a description of the function file\n\ -directories that are distributed with Octave.\n\ -@seealso{DEFAULT_LOADPATH}\n\ +No checks are made for duplicate elements.\n\ +@seealso{addpath, rmpath, genpath, pathdef, savepath, pathsep}\n\ @end deftypefn") { - std::string saved_loadpath = VLOADPATH; + octave_value retval; + + int argc = args.length () + 1; - octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (LOADPATH); + string_vector argv = args.make_argv ("path"); - if (VLOADPATH != saved_loadpath) + if (! error_state) { - // By resetting the last prompt time variable, we will force - // checks for out of date symbols even if the change to LOADPATH - // and subsequent function calls happen between prompts. + if (argc > 1) + { + std::string path = argv[1]; + + for (int i = 2; i < argc; i++) + path += dir_path::path_sep_str; + + size_t plen = path.length (); + + if (! ((plen == 1 && path[0] == ':') + || (plen > 1 + && path.substr (0, 2) == ("." + dir_path::path_sep_str)))) + path = "." + dir_path::path_sep_str + path; + + VLOADPATH = path; + + // By resetting the last prompt time variable, we will force + // checks for out of date symbols even if the change to + // LOADPATH and subsequent function calls happen between + // prompts. - // FIXME -- maybe we should rename - // Vlast_prompt_time_stamp since the new usage doesn't really - // fit with the current name? + // FIXME -- maybe we should rename + // Vlast_prompt_time_stamp since the new usage doesn't really + // fit with the current name? + + Vlast_prompt_time.stamp (); + + update_load_path_dir_path (); + } - Vlast_prompt_time.stamp (); + if (nargout > 0) + retval = VLOADPATH; + else if (argc == 1 && nargout == 0) + { + octave_stdout << "\nOctave's search path contains the following directories:\n\n"; - update_load_path_dir_path (); + string_vector sv = Vload_path_dir_path.all_directories (); + + sv.list_in_columns (octave_stdout); + + octave_stdout << "\n"; + } } return retval; } -DEFUN (DEFAULT_LOADPATH, args, nargout, +DEFUN (pathdef, , , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {@var{val} =} DEFAULT_LOADPATH ()\n\ -@deftypefnx {Built-in Function} {@var{old_val} =} DEFAULT_LOADPATH (@var{new_val})\n\ -Query or set the internal variable that specifies the colon separated\n\ -list of directories in which to search for function files. The value\n\ -of this variable is automatically substituted for leading, trailing,\n\ -or doubled colons that appear in the internal @code{loadpath} variable.\n\ +Return the default list of directories in which to search for function\n\ +files.\n\ @seealso{LOADPATH}\n\ @end deftypefn") { - std::string saved_default_loadpath = VDEFAULT_LOADPATH; - - octave_value retval - = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (DEFAULT_LOADPATH); - - if (VDEFAULT_LOADPATH != saved_default_loadpath) - update_load_path_dir_path (); - - return retval; + return octave_value (VDEFAULT_LOADPATH); } DEFUN (OCTAVE_HOME, args, , diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/defaults.h.in --- a/src/defaults.h.in Thu May 11 19:46:15 2006 +0000 +++ b/src/defaults.h.in Thu May 11 21:58:34 2006 +0000 @@ -57,18 +57,10 @@ #define OCTAVE_FCNFILEDIR %OCTAVE_FCNFILEDIR% #endif -#ifndef OCTAVE_FCNFILEPATH -#define OCTAVE_FCNFILEPATH %OCTAVE_FCNFILEPATH% -#endif - #ifndef OCTAVE_IMAGEDIR #define OCTAVE_IMAGEDIR %OCTAVE_IMAGEDIR% #endif -#ifndef OCTAVE_IMAGEPATH -#define OCTAVE_IMAGEPATH %OCTAVE_IMAGEPATH% -#endif - #ifndef OCTAVE_INCLUDEDIR #define OCTAVE_INCLUDEDIR %OCTAVE_INCLUDEDIR% #endif @@ -109,18 +101,10 @@ #define OCTAVE_LOCALFCNFILEDIR %OCTAVE_LOCALFCNFILEDIR% #endif -#ifndef OCTAVE_LOCALFCNFILEPATH -#define OCTAVE_LOCALFCNFILEPATH %OCTAVE_LOCALFCNFILEPATH% -#endif - #ifndef OCTAVE_LOCALOCTFILEDIR #define OCTAVE_LOCALOCTFILEDIR %OCTAVE_LOCALOCTFILEDIR% #endif -#ifndef OCTAVE_LOCALOCTFILEPATH -#define OCTAVE_LOCALOCTFILEPATH %OCTAVE_LOCALOCTFILEPATH% -#endif - #ifndef OCTAVE_LOCALSTARTUPFILEDIR #define OCTAVE_LOCALSTARTUPFILEDIR %OCTAVE_LOCALSTARTUPFILEDIR% #endif @@ -182,8 +166,19 @@ extern std::string Varch_lib_dir; extern std::string Vlocal_arch_lib_dir; extern std::string Vlocal_ver_arch_lib_dir; + +extern std::string Vlocal_ver_oct_file_dir; +extern std::string Vlocal_api_oct_file_dir; +extern std::string Vlocal_oct_file_dir; + +extern std::string Vlocal_ver_fcn_file_dir; +extern std::string Vlocal_api_fcn_file_dir; +extern std::string Vlocal_fcn_file_dir; + +extern std::string Voct_file_dir; extern std::string Vfcn_file_dir; -extern std::string Voct_file_dir; + +extern std::string Vimage_dir; // And the cached directory path corresponding to Vload_path. extern dir_path Vload_path_dir_path; @@ -203,6 +198,10 @@ extern void install_defaults (void); +extern void set_exec_path (const std::string& path = std::string ()); +extern void set_load_path (const std::string& path = std::string ()); +extern void set_image_path (const std::string& path = std::string ()); + #endif /* diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/defun.cc --- a/src/defun.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/defun.cc Thu May 11 21:58:34 2006 +0000 @@ -169,7 +169,7 @@ sym_rec->document (doc); // Also insert the full name in the symbol table. This way, we can - // properly cope with changes to LOADPATH. + // properly cope with changes to LOAD_PATH. symbol_record *full_sr = fbi_sym_tab->lookup (shl.file_name (), true); diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/help.cc --- a/src/help.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/help.cc Thu May 11 21:58:34 2006 +0000 @@ -1521,10 +1521,10 @@ @deffnx {Command} lookfor -all @var{str}\n\ @deffnx {Function} {[@var{fun}, @var{helpstring}] = } lookfor (@var{str})\n\ @deffnx {Function} {[@var{fun}, @var{helpstring}] = } lookfor ('-all', @var{str})\n\ -Search for the string @var{str} in all of the functions found in\n\ -@var{LOADPATH}. By default @code{lookfor} searchs for @var{str} in the\n\ -first sentence of the help string of each function found. The entire\n\ -help string of each function found of @var{LOADPATH} can be search if\n\ +Search for the string @var{str} in all of the functions found in the\n\ +function search path. By default @code{lookfor} searchs for @var{str}\n\ +in the first sentence of the help string of each function found. The entire\n\ +help string of each function found in the path can be search if\n\ the '-all' argument is supplied. All searches are case insensitive.\n\ \n\ Called with no output arguments, @code{lookfor} prints the list of matching\n\ diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/octave.cc --- a/src/octave.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/octave.cc Thu May 11 21:58:34 2006 +0000 @@ -118,10 +118,10 @@ // Usage message static const char *usage_string = "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\ - [--exec-path path] [--help] [--info-file file] [--info-program prog]\n\ - [--interactive] [--no-history] [--no-init-file] [--no-line-editing]\n\ - [--no-site-file] [-p path] [--path path] [--silent] [--traditional]\n\ - [--verbose] [--version] [file]"; + [--exec-path path] [--help] [--image-path path] [--info-file file]\n\ + [--info-program prog] [--interactive] [--no-history] [--no-init-file]\n\ + [--no-line-editing] [--no-site-file] [-p path] [--path path]\n\ + [--silent] [--traditional] [--verbose] [--version] [file]"; // This is here so that it's more likely that the usage message and // the real set of options will agree. Note: the `+' must come first @@ -138,13 +138,14 @@ // fields in this structure. #define EVAL_OPTION 1 #define EXEC_PATH_OPTION 2 -#define INFO_FILE_OPTION 3 -#define INFO_PROG_OPTION 4 -#define NO_INIT_FILE_OPTION 5 -#define NO_LINE_EDITING_OPTION 6 -#define NO_SITE_FILE_OPTION 7 -#define PERSIST_OPTION 8 -#define TRADITIONAL_OPTION 9 +#define IMAGE_PATH_OPTION 3 +#define INFO_FILE_OPTION 4 +#define INFO_PROG_OPTION 5 +#define NO_INIT_FILE_OPTION 6 +#define NO_LINE_EDITING_OPTION 7 +#define NO_SITE_FILE_OPTION 8 +#define PERSIST_OPTION 9 +#define TRADITIONAL_OPTION 10 long_options long_opts[] = { { "debug", prog_args::no_arg, 0, 'd' }, @@ -153,6 +154,7 @@ { "eval", prog_args::required_arg, 0, EVAL_OPTION }, { "exec-path", prog_args::required_arg, 0, EXEC_PATH_OPTION }, { "help", prog_args::no_arg, 0, 'h' }, + { "image-path", prog_args::required_arg, 0, IMAGE_PATH_OPTION }, { "info-file", prog_args::required_arg, 0, INFO_FILE_OPTION }, { "info-program", prog_args::required_arg, 0, INFO_PROG_OPTION }, { "interactive", prog_args::no_arg, 0, 'i' }, @@ -420,6 +422,7 @@ --eval CODE Evaluate CODE. Exit when done unless --persist.\n\ --exec-path PATH Set path for executing subprograms.\n\ --help, -h, -? Print short help message and exit.\n\ + --image-path PATH Set initial IMAGEPATH to PATH.\n\ --info-file FILE Use top-level info file FILE.\n\ --info-program PROGRAM Use PROGRAM for reading info files.\n\ --interactive, -i Force interactive behavior.\n\ @@ -428,7 +431,7 @@ --no-line-editing Don't use readline for command-line editing.\n\ --no-site-file Don't read the site-wide octaverc file.\n\ --norc, -f Don't read any initialization files.\n\ - --path PATH, -p PATH Set initial LOADPATH to PATH.\n\ + --path PATH, -p PATH Set initial function search path to PATH.\n\ --persist Go interactive after --eval or reading from FILE.\n\ --silent, -q Don't print message at startup.\n\ --traditional Set compatibility variables.\n\ @@ -575,7 +578,7 @@ case 'p': if (args.optarg ()) - bind_internal_variable ("LOADPATH", args.optarg ()); + set_load_path (args.optarg ()); break; case 'q': @@ -605,7 +608,12 @@ case EXEC_PATH_OPTION: if (args.optarg ()) - bind_internal_variable ("exec_path", args.optarg ()); + set_exec_path (args.optarg ()); + break; + + case IMAGE_PATH_OPTION: + if (args.optarg ()) + set_image_path (args.optarg ()); break; case INFO_FILE_OPTION: diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/toplev.cc --- a/src/toplev.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/toplev.cc Thu May 11 21:58:34 2006 +0000 @@ -790,9 +790,7 @@ "datadir", OCTAVE_DATADIR, "exec_prefix", OCTAVE_EXEC_PREFIX, "fcnfiledir", OCTAVE_FCNFILEDIR, - "fcnfilepath", OCTAVE_FCNFILEPATH, "imagedir", OCTAVE_IMAGEDIR, - "imagepath", OCTAVE_IMAGEPATH, "includedir", OCTAVE_INCLUDEDIR, "infodir", OCTAVE_INFODIR, "infofile", OCTAVE_INFOFILE, @@ -802,9 +800,7 @@ "localapioctfiledir", OCTAVE_LOCALAPIOCTFILEDIR, "localarchlibdir", OCTAVE_LOCALARCHLIBDIR, "localfcnfiledir", OCTAVE_LOCALFCNFILEDIR, - "localfcnfilepath", OCTAVE_LOCALFCNFILEPATH, "localoctfiledir", OCTAVE_LOCALOCTFILEDIR, - "localoctfilepath", OCTAVE_LOCALOCTFILEPATH, "localstartupfiledir", OCTAVE_LOCALSTARTUPFILEDIR, "localverarchlibdir", OCTAVE_LOCALVERARCHLIBDIR, "localverfcnfiledir", OCTAVE_LOCALVERFCNFILEDIR, diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/utils.cc --- a/src/utils.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/utils.cc Thu May 11 21:58:34 2006 +0000 @@ -269,7 +269,7 @@ @deftypefnx {Built-in Function} {} file_in_loadpath (@var{file}, \"all\")\n\ \n\ Return the absolute name of @var{file} if it can be found in\n\ -the list of directories specified by @code{LOADPATH}.\n\ +the list of directories specified by @code{path}.\n\ If no file is found, return an empty matrix.\n\ \n\ If the first argument is a cell array of strings, search each\n\ @@ -279,7 +279,7 @@ If the second optional argument @code{\"all\"} is supplied, return\n\ a cell array containing the list of all files that have the same\n\ name in the path. If no files are found, return an empty cell array.\n\ -@seealso{file_in_path, LOADPATH}\n\ +@seealso{file_in_path, path}\n\ @end deftypefn") { octave_value retval; @@ -328,7 +328,7 @@ @deftypefnx {Built-in Function} {} file_in_path (@var{path}, @var{file}, \"all\")\n\ Return the absolute name of @var{file} if it can be found in\n\ @var{path}. The value of @var{path} should be a colon-separated list of\n\ -directories in the format described for @code{LOADPATH}. If no file\n\ +directories in the format described for @code{path}. If no file\n\ is found, return an empty matrix. For example,\n\ \n\ @example\n\ @@ -343,11 +343,6 @@ If the third optional argument @code{\"all\"} is supplied, return\n\ a cell array containing the list of all files that have the same\n\ name in the path. If no files are found, return an empty cell array.\n\ -\n\ -Note that @code{file_in_path} does not expand leading, trailing,\n\ -or doubled colons the way that @code{file_in_loadpath} does. See\n\ -also @xref{Function Files}, for an explanation of\n\ -how colon expansion is applied to @code{LOADPATH}.\n\ @seealso{file_in_loadpath}\n\ @end deftypefn") { diff -r dfef2f909f34 -r 67bf9b4f2ae2 src/variables.cc --- a/src/variables.cc Thu May 11 19:46:15 2006 +0000 +++ b/src/variables.cc Thu May 11 21:58:34 2006 +0000 @@ -891,8 +891,8 @@ "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} exist (@var{name}, @var{type})\n\ Return 1 if the name exists as a variable, 2 if the name (after\n\ -appending @samp{.m}) is a function file in Octave's LOADPATH, 3 if the\n\ -name is a @samp{.oct} file in Octave's LOADPATH, 5 if the name is a\n\ +appending @samp{.m}) is a function file in Octave's @code{path}, 3 if the\n\ +name is a @samp{.oct} file in Octave's @code{path}, 5 if the name is a\n\ built-in function, 7 if the name is a directory, or 103\n\ if the name is a function not associated with a file (entered on\n\ the command line).\n\ @@ -900,7 +900,7 @@ Otherwise, return 0.\n\ \n\ This function also returns 2 if a regular file called @var{name}\n\ -exists in Octave's @code{LOADPATH}. If you want information about\n\ +exists in Octave's search path. If you want information about\n\ other types of files, you should use some combination of the functions\n\ @code{file_in_path} and @code{stat} instead.\n\ \n\ @@ -1786,7 +1786,7 @@ @item -builtins\n\ List built-in functions. This includes all currently\n\ compiled function files, but does not include all function files that\n\ -are in the @code{LOADPATH}.\n\ +are in the search path.\n\ \n\ @item -functions\n\ List user-defined functions.\n\ @@ -2607,7 +2607,7 @@ Octave will not automatically recompile function files in subdirectories of\n\ @file{@var{octave-home}/lib/@var{version}} if they have changed since\n\ they were last compiled, but will recompile other function files in the\n\ -@code{LOADPATH} if they change. If set to @code{\"all\"}, Octave will not\n\ +search path if they change. If set to @code{\"all\"}, Octave will not\n\ recompile any function files unless their definitions are removed with\n\ @code{clear}. If set to \"none\", Octave will always check time stamps\n\ on files to determine whether functions defined in function files\n\ diff -r dfef2f909f34 -r 67bf9b4f2ae2 test/test_system.m --- a/test/test_system.m Thu May 11 19:46:15 2006 +0000 +++ b/test/test_system.m Thu May 11 21:58:34 2006 +0000 @@ -347,7 +347,7 @@ %!error fnmatch ("foo", "bar", 3); %% test/octave.test/system/file_in_path-1.m -%!assert(isstr (file_in_path (LOADPATH, "date.m"))); +%!assert(isstr (file_in_path (path (), "date.m"))); %% test/octave.test/system/file_in_path-2.m %!error file_in_path ("foo", "bar", 1);