Mercurial > hg > octave-nkf
changeset 4447:252b9162c084
[project @ 2003-07-08 18:37:53 by jwe]
author | jwe |
---|---|
date | Tue, 08 Jul 2003 18:37:53 +0000 |
parents | 3cd9ddde2da2 |
children | 042cdbb7f317 |
files | src/ChangeLog src/defaults.cc |
diffstat | 2 files changed, 64 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2003-07-08 John W. Eaton <jwe@bevo.che.wisc.edu> + + * defaults.cc (Vdefault_exec_path): New static variable. + (set_default_default_exec_path): New function. + (install_defaults): Call it. + (exec_path): Use it. + (default_exec_path): New function. + (symbols_of_defaults): Add DEFVAR for DEFAULT_EXEC_PATH. + 2003-07-07 John W. Eaton <jwe@bevo.che.wisc.edu> * defaults.h.in (OCTAVE_LOCALSTARTUPFILEDIR, OCTAVE_STARTUPFILEDIR):
--- a/src/defaults.cc +++ b/src/defaults.cc @@ -66,6 +66,10 @@ std::string Vlocal_ver_arch_lib_dir; std::string Vfcn_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; + // The path that will be searched for programs that we execute. // (--exec-path path) std::string Vexec_path; @@ -245,6 +249,16 @@ } static void +set_default_default_exec_path (void) +{ + Vdefault_exec_path + = Vlocal_ver_arch_lib_dir + std::string (SEPCHAR_STR) + + Vlocal_arch_lib_dir + std::string (SEPCHAR_STR) + + Varch_lib_dir + std::string (SEPCHAR_STR) + + Vbin_dir; +} + +static void set_default_exec_path (void) { std::string octave_exec_path = octave_env::getenv ("OCTAVE_EXEC_PATH"); @@ -376,6 +390,8 @@ set_default_bin_dir (); + set_default_default_exec_path (); + set_default_exec_path (); set_default_path (); @@ -438,12 +454,6 @@ { Vexec_path = s; - std::string std_path - = Vlocal_ver_arch_lib_dir + std::string (SEPCHAR_STR) - + Vlocal_arch_lib_dir + std::string (SEPCHAR_STR) - + Varch_lib_dir + std::string (SEPCHAR_STR) - + Vbin_dir; - std::string path; int eplen = Vexec_path.length (); @@ -455,21 +465,18 @@ if (prepend) { - path = std_path + Vexec_path; - - if (append) - path.append (std_path); + path = Vdefault_exec_path + Vexec_path; } else { path = Vexec_path; if (append) - path.append (std_path); + path.append (Vdefault_exec_path); } } else - path = std_path; + path = Vdefault_exec_path; octave_env::putenv ("PATH", path); } @@ -478,6 +485,29 @@ } static int +default_exec_path (void) +{ + int status = 0; + + std::string s = builtin_string_variable ("DEFAULT_EXEC_PATH"); + + if (s.empty ()) + { + gripe_invalid_value_specified ("DEFAULT_EXEC_PATH"); + status = -1; + } + else + { + Vdefault_exec_path = s; + + // Now also update PATH in environment. + exec_path (); + } + + return status; +} + +static int imagepath (void) { int status = 0; @@ -561,7 +591,7 @@ "-*- texinfo -*-\n\ @defvr {Built-in Variable} EXEC_PATH\n\ The variable @code{EXEC_PATH} is a colon separated list of directories\n\ -to search when executing subprograms. Its initial value is taken from\n\ +to search when executing external programs. Its initial value is taken from\n\ the environment variable @code{OCTAVE_EXEC_PATH} (if it exists) or\n\ @code{PATH}, but that value can be overridden by the command line\n\ argument @code{--exec-path PATH}, or by setting the value of\n\ @@ -583,6 +613,15 @@ prepended to your shell path.\n\ @end defvr"); + DEFVAR (DEFAULT_EXEC_PATH, Vdefault_exec_path, default_exec_path, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} DEFAULT_EXEC_PATH\n\ +A colon separated 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\ +@end defvr"); + DEFVAR (LOADPATH, Vload_path, loadpath, "-*- texinfo -*-\n\ @defvr {Built-in Variable} LOADPATH\n\ @@ -616,9 +655,9 @@ "-*- texinfo -*-\n\ @defvr {Built-in Variable} DEFAULT_LOADPATH\n\ A colon separated list of directories in which to search for function\n\ -files by default. The value of this variable is also automatically\n\ -substituted for leading, trailing, or doubled colons that appear in the\n\ -built-in variable @code{LOADPATH}.\n\ +files. The value of this variable is automatically substituted for\n\ +leading, trailing, or doubled colons that appear in the built-in\n\ +variable @code{LOADPATH}.\n\ @end defvr"); DEFVAR (IMAGEPATH, OCTAVE_IMAGEPATH, imagepath,