2203
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2203
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2203
|
21 |
|
22 */ |
|
23 |
|
24 #ifdef HAVE_CONFIG_H |
|
25 #include <config.h> |
|
26 #endif |
|
27 |
|
28 #include <cstdlib> |
|
29 |
3503
|
30 #include <iostream> |
2203
|
31 #include <string> |
|
32 |
|
33 #ifdef HAVE_UNISTD_H |
2442
|
34 #ifdef HAVE_SYS_TYPES_H |
2203
|
35 #include <sys/types.h> |
2442
|
36 #endif |
2203
|
37 #include <unistd.h> |
|
38 #endif |
|
39 |
2926
|
40 #include "oct-env.h" |
4217
|
41 #include "file-stat.h" |
3174
|
42 #include "pathsearch.h" |
4217
|
43 #include "str-vec.h" |
2926
|
44 |
2492
|
45 #include <defaults.h> |
2203
|
46 #include "defun.h" |
|
47 #include "error.h" |
3040
|
48 #include "file-ops.h" |
2203
|
49 #include "gripes.h" |
|
50 #include "help.h" |
5395
|
51 #include "input.h" |
3185
|
52 #include "oct-obj.h" |
2390
|
53 #include "ov.h" |
4217
|
54 #include "parse.h" |
2203
|
55 #include "toplev.h" |
4217
|
56 #include "unwind-prot.h" |
2203
|
57 #include "variables.h" |
2492
|
58 #include <version.h> |
2203
|
59 |
3523
|
60 std::string Voctave_home; |
2203
|
61 |
3523
|
62 std::string Vbin_dir; |
|
63 std::string Vinfo_dir; |
|
64 std::string Vdata_dir; |
|
65 std::string Vlibexec_dir; |
|
66 std::string Varch_lib_dir; |
|
67 std::string Vlocal_arch_lib_dir; |
3597
|
68 std::string Vlocal_ver_arch_lib_dir; |
3523
|
69 std::string Vfcn_file_dir; |
5397
|
70 std::string Voct_file_dir; |
2203
|
71 |
4447
|
72 // The default path that will be searched for programs that we |
|
73 // execute (in addition to the user-specified --exec-path). |
|
74 static std::string Vdefault_exec_path; |
|
75 |
2203
|
76 // The path that will be searched for programs that we execute. |
|
77 // (--exec-path path) |
3523
|
78 std::string Vexec_path; |
2203
|
79 |
|
80 // Load path specified on command line. |
|
81 // (--path path; -p path) |
3523
|
82 static std::string Vload_path; |
2203
|
83 |
3192
|
84 // The default load path with OCTAVE_HOME appropriately substituted. |
3523
|
85 static std::string Vdefault_load_path; |
3192
|
86 |
3174
|
87 // And the cached directory path corresponding to Vload_path. |
|
88 dir_path Vload_path_dir_path; |
|
89 |
2203
|
90 // Name of the editor to be invoked by the edit_history command. |
3523
|
91 std::string Veditor; |
2203
|
92 |
3523
|
93 std::string Vimagepath; |
2203
|
94 |
3523
|
95 std::string Vlocal_site_defaults_file; |
|
96 std::string Vsite_defaults_file; |
2203
|
97 |
4776
|
98 // Name of the FFTW wisdom program. |
|
99 std::string Vfftw_wisdom_prog; |
4773
|
100 |
4217
|
101 // Each element of A and B should be directory names. For each |
|
102 // element of A not in the list B, execute SCRIPT_FILE in that |
|
103 // directory if it exists. |
|
104 |
|
105 static void |
|
106 maybe_add_or_del_packages (const string_vector& a, |
|
107 const string_vector& b, |
4247
|
108 const std::string& script_file) |
4217
|
109 { |
|
110 if (! octave_interpreter_ready) |
|
111 return; |
|
112 |
|
113 unwind_protect::begin_frame ("maybe_add_or_del_packages"); |
|
114 |
|
115 unwind_protect_bool (input_from_startup_file); |
|
116 |
|
117 input_from_startup_file = true; |
|
118 |
5275
|
119 octave_idx_type a_len = a.length (); |
|
120 octave_idx_type b_len = b.length (); |
4217
|
121 |
5275
|
122 for (octave_idx_type i = 0; i < a_len; i++) |
4217
|
123 { |
|
124 std::string a_dir = a[i]; |
|
125 |
|
126 bool found = false; |
|
127 |
5275
|
128 for (octave_idx_type j = 0; j < b_len; j++) |
4217
|
129 { |
|
130 if (b[j] == a_dir) |
|
131 { |
|
132 found = true; |
|
133 break; |
|
134 } |
|
135 } |
|
136 |
|
137 if (! found) |
|
138 { |
|
139 std::string file = a_dir + file_ops::dir_sep_str + script_file; |
|
140 |
|
141 file_stat fs = file_stat (file); |
|
142 |
|
143 if (fs.exists ()) |
4486
|
144 source_file (file); |
4217
|
145 |
|
146 if (error_state) |
|
147 return; |
|
148 } |
|
149 } |
|
150 |
|
151 unwind_protect::run_frame ("maybe_add_or_del_packages"); |
|
152 } |
|
153 |
|
154 static void |
|
155 update_load_path_dir_path (void) |
|
156 { |
|
157 string_vector old_dirs = Vload_path_dir_path.all_directories (); |
|
158 |
|
159 Vload_path_dir_path = dir_path (Vload_path, Vdefault_load_path); |
|
160 |
|
161 string_vector new_dirs = Vload_path_dir_path.all_directories (); |
|
162 |
|
163 maybe_add_or_del_packages (old_dirs, new_dirs, "PKG_DEL"); |
|
164 |
|
165 if (! error_state) |
|
166 maybe_add_or_del_packages (new_dirs, old_dirs, "PKG_ADD"); |
|
167 } |
|
168 |
|
169 void |
|
170 execute_default_pkg_add_files (void) |
|
171 { |
|
172 string_vector old_dirs; |
|
173 string_vector new_dirs = Vload_path_dir_path.all_directories (); |
|
174 |
|
175 maybe_add_or_del_packages (new_dirs, old_dirs, "PKG_ADD"); |
|
176 } |
|
177 |
3535
|
178 static std::string |
3523
|
179 subst_octave_home (const std::string& s) |
2203
|
180 { |
3523
|
181 std::string retval; |
2203
|
182 |
3523
|
183 std::string prefix = OCTAVE_PREFIX; |
2203
|
184 |
|
185 retval = s; |
|
186 |
|
187 if (Voctave_home != prefix) |
|
188 { |
5275
|
189 octave_idx_type len = prefix.length (); |
2203
|
190 size_t start = 0; |
2522
|
191 while ((start = retval.find (prefix, start)) != NPOS) |
2203
|
192 { |
|
193 retval.replace (start, len, Voctave_home); |
2522
|
194 start += len; |
2203
|
195 } |
|
196 } |
|
197 |
|
198 return retval; |
|
199 } |
|
200 |
|
201 static void |
|
202 set_octave_home (void) |
|
203 { |
3523
|
204 std::string oh = octave_env::getenv ("OCTAVE_HOME"); |
2203
|
205 |
3523
|
206 Voctave_home = oh.empty () ? std::string (OCTAVE_PREFIX) : oh; |
2203
|
207 } |
|
208 |
|
209 static void |
|
210 set_default_info_dir (void) |
|
211 { |
|
212 Vinfo_dir = subst_octave_home (OCTAVE_INFODIR); |
|
213 } |
|
214 |
|
215 static void |
3141
|
216 set_default_data_dir (void) |
|
217 { |
|
218 Vdata_dir = subst_octave_home (OCTAVE_DATADIR); |
|
219 } |
|
220 |
|
221 static void |
|
222 set_default_libexec_dir (void) |
|
223 { |
|
224 Vlibexec_dir = subst_octave_home (OCTAVE_LIBEXECDIR); |
|
225 } |
|
226 |
|
227 static void |
2203
|
228 set_default_arch_lib_dir (void) |
|
229 { |
|
230 Varch_lib_dir = subst_octave_home (OCTAVE_ARCHLIBDIR); |
|
231 } |
|
232 |
|
233 static void |
2439
|
234 set_default_local_arch_lib_dir (void) |
|
235 { |
|
236 Vlocal_arch_lib_dir = subst_octave_home (OCTAVE_LOCALARCHLIBDIR); |
|
237 } |
|
238 |
|
239 static void |
3597
|
240 set_default_local_ver_arch_lib_dir (void) |
|
241 { |
|
242 Vlocal_ver_arch_lib_dir = subst_octave_home (OCTAVE_LOCALVERARCHLIBDIR); |
|
243 } |
|
244 |
|
245 static void |
2203
|
246 set_default_fcn_file_dir (void) |
|
247 { |
|
248 Vfcn_file_dir = subst_octave_home (OCTAVE_FCNFILEDIR); |
|
249 } |
|
250 |
|
251 static void |
5397
|
252 set_default_oct_file_dir (void) |
|
253 { |
|
254 Voct_file_dir = subst_octave_home (OCTAVE_OCTFILEDIR); |
|
255 } |
|
256 |
|
257 static void |
2203
|
258 set_default_bin_dir (void) |
|
259 { |
|
260 Vbin_dir = subst_octave_home (OCTAVE_BINDIR); |
|
261 } |
|
262 |
|
263 static void |
4447
|
264 set_default_default_exec_path (void) |
|
265 { |
|
266 Vdefault_exec_path |
|
267 = Vlocal_ver_arch_lib_dir + std::string (SEPCHAR_STR) |
|
268 + Vlocal_arch_lib_dir + std::string (SEPCHAR_STR) |
|
269 + Varch_lib_dir + std::string (SEPCHAR_STR) |
|
270 + Vbin_dir; |
|
271 } |
|
272 |
|
273 static void |
2203
|
274 set_default_exec_path (void) |
|
275 { |
3523
|
276 std::string octave_exec_path = octave_env::getenv ("OCTAVE_EXEC_PATH"); |
2203
|
277 |
2926
|
278 if (octave_exec_path.empty ()) |
2203
|
279 { |
3523
|
280 std::string shell_path = octave_env::getenv ("PATH"); |
2203
|
281 |
2926
|
282 if (! shell_path.empty ()) |
2203
|
283 { |
5451
|
284 Vexec_path = std::string (SEPCHAR_STR); |
2203
|
285 Vexec_path.append (shell_path); |
|
286 } |
|
287 } |
2926
|
288 else |
3523
|
289 Vexec_path = std::string (octave_exec_path); |
2203
|
290 } |
|
291 |
|
292 static void |
|
293 set_default_path (void) |
|
294 { |
3192
|
295 Vdefault_load_path = subst_octave_home (OCTAVE_FCNFILEPATH); |
2203
|
296 |
3523
|
297 std::string oct_path = octave_env::getenv ("OCTAVE_PATH"); |
2203
|
298 |
5451
|
299 Vload_path = oct_path.empty () ? std::string (SEPCHAR_STR) : oct_path; |
3174
|
300 |
4217
|
301 update_load_path_dir_path (); |
2203
|
302 } |
|
303 |
|
304 static void |
|
305 set_default_info_file (void) |
|
306 { |
3523
|
307 std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE); |
2512
|
308 |
3523
|
309 std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE"); |
2203
|
310 |
2926
|
311 Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file; |
2203
|
312 } |
|
313 |
|
314 static void |
|
315 set_default_info_prog (void) |
|
316 { |
3523
|
317 std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM"); |
2203
|
318 |
2926
|
319 if (oct_info_prog.empty ()) |
3141
|
320 Vinfo_prog = "info"; |
2926
|
321 else |
3523
|
322 Vinfo_prog = std::string (oct_info_prog); |
2203
|
323 } |
|
324 |
4773
|
325 static void |
4776
|
326 set_default_fftw_wisdom_prog (void) |
4773
|
327 { |
4776
|
328 std::string oct_wisdom_prog = octave_env::getenv ("OCTAVE_FFTW_WISDOM_PROGRAM"); |
4773
|
329 |
|
330 if (oct_wisdom_prog.empty ()) |
4776
|
331 Vfftw_wisdom_prog = "fftw-wisdom"; |
4773
|
332 else |
4776
|
333 Vfftw_wisdom_prog = std::string (oct_wisdom_prog); |
4773
|
334 } |
|
335 |
2203
|
336 static void |
|
337 set_default_editor (void) |
|
338 { |
2993
|
339 Veditor = "emacs"; |
2203
|
340 |
3523
|
341 std::string env_editor = octave_env::getenv ("EDITOR"); |
2203
|
342 |
2926
|
343 if (! env_editor.empty ()) |
|
344 Veditor = env_editor; |
2203
|
345 } |
|
346 |
|
347 static void |
|
348 set_local_site_defaults_file (void) |
|
349 { |
|
350 Vlocal_site_defaults_file = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); |
|
351 Vlocal_site_defaults_file.append ("/octaverc"); |
|
352 } |
|
353 |
|
354 static void |
|
355 set_site_defaults_file (void) |
|
356 { |
|
357 Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); |
|
358 Vsite_defaults_file.append ("/octaverc"); |
|
359 } |
|
360 |
3534
|
361 std::string |
3523
|
362 maybe_add_default_load_path (const std::string& pathstring) |
2203
|
363 { |
3523
|
364 std::string retval; |
2203
|
365 |
|
366 if (! pathstring.empty ()) |
|
367 { |
|
368 if (pathstring[0] == SEPCHAR) |
|
369 { |
3192
|
370 retval = Vdefault_load_path; |
2203
|
371 retval.append (pathstring); |
|
372 } |
|
373 else |
|
374 retval = pathstring; |
|
375 |
|
376 if (pathstring[pathstring.length () - 1] == SEPCHAR) |
3192
|
377 retval.append (Vdefault_load_path); |
|
378 |
|
379 size_t pos = 0; |
|
380 do |
|
381 { |
5451
|
382 pos = retval.find (std::string (SEPCHAR_STR) + |
|
383 std::string (SEPCHAR_STR)); |
3192
|
384 |
|
385 if (pos != NPOS) |
|
386 retval.insert (pos+1, Vdefault_load_path); |
|
387 } |
|
388 while (pos != NPOS); |
2203
|
389 } |
|
390 |
|
391 return retval; |
|
392 } |
|
393 |
|
394 void |
|
395 install_defaults (void) |
|
396 { |
|
397 // OCTAVE_HOME must be set first! |
|
398 |
|
399 set_octave_home (); |
|
400 |
|
401 set_default_info_dir (); |
|
402 |
3141
|
403 set_default_data_dir (); |
|
404 |
|
405 set_default_libexec_dir (); |
|
406 |
2203
|
407 set_default_arch_lib_dir (); |
|
408 |
2439
|
409 set_default_local_arch_lib_dir (); |
|
410 |
3597
|
411 set_default_local_ver_arch_lib_dir (); |
|
412 |
2203
|
413 set_default_fcn_file_dir (); |
|
414 |
5397
|
415 set_default_oct_file_dir (); |
|
416 |
2203
|
417 set_default_bin_dir (); |
|
418 |
4447
|
419 set_default_default_exec_path (); |
|
420 |
2203
|
421 set_default_exec_path (); |
|
422 |
|
423 set_default_path (); |
|
424 |
|
425 set_default_info_file (); |
|
426 |
|
427 set_default_info_prog (); |
|
428 |
4776
|
429 set_default_fftw_wisdom_prog (); |
4773
|
430 |
2203
|
431 set_default_editor (); |
|
432 |
|
433 set_local_site_defaults_file (); |
|
434 |
|
435 set_site_defaults_file (); |
|
436 } |
|
437 |
4264
|
438 DEFUN (rehash, , , |
|
439 "-*- texinfo -*-\n\ |
|
440 @deftypefn {Built-in Function} {} rehash ()\n\ |
|
441 Reinitialize Octave's @code{LOADPATH} directory cache.\n\ |
|
442 @end deftypefn") |
|
443 { |
|
444 octave_value_list retval; |
|
445 |
|
446 Vload_path_dir_path.rehash (); |
|
447 |
|
448 return retval; |
|
449 } |
|
450 |
2203
|
451 static int |
|
452 editor (void) |
|
453 { |
|
454 int status = 0; |
|
455 |
3523
|
456 std::string s = builtin_string_variable ("EDITOR"); |
2203
|
457 |
|
458 if (s.empty ()) |
|
459 { |
|
460 gripe_invalid_value_specified ("EDITOR"); |
|
461 status = -1; |
|
462 } |
|
463 else |
|
464 Veditor = s; |
|
465 |
|
466 return status; |
|
467 } |
|
468 |
|
469 static int |
|
470 exec_path (void) |
|
471 { |
|
472 int status = 0; |
|
473 |
3523
|
474 std::string s = builtin_string_variable ("EXEC_PATH"); |
2439
|
475 |
|
476 if (s.empty ()) |
2203
|
477 { |
|
478 gripe_invalid_value_specified ("EXEC_PATH"); |
|
479 status = -1; |
|
480 } |
|
481 else |
|
482 { |
2439
|
483 Vexec_path = s; |
|
484 |
3523
|
485 std::string path; |
2203
|
486 |
|
487 int eplen = Vexec_path.length (); |
|
488 |
|
489 if (eplen > 0) |
|
490 { |
2926
|
491 bool prepend = (Vexec_path[0] == ':'); |
|
492 bool append = (eplen > 1 && Vexec_path[eplen-1] == ':'); |
2203
|
493 |
|
494 if (prepend) |
|
495 { |
4447
|
496 path = Vdefault_exec_path + Vexec_path; |
2203
|
497 } |
|
498 else |
|
499 { |
2926
|
500 path = Vexec_path; |
|
501 |
2203
|
502 if (append) |
4447
|
503 path.append (Vdefault_exec_path); |
2203
|
504 } |
|
505 } |
|
506 else |
4447
|
507 path = Vdefault_exec_path; |
2203
|
508 |
2926
|
509 octave_env::putenv ("PATH", path); |
2203
|
510 } |
|
511 |
|
512 return status; |
|
513 } |
|
514 |
4773
|
515 static int |
4776
|
516 fftw_wisdom_prog (void) |
4773
|
517 { |
|
518 int status = 0; |
|
519 |
4776
|
520 std::string s = builtin_string_variable ("FFTW_WISDOM_PROGRAM"); |
4773
|
521 |
|
522 if (s.empty ()) |
|
523 { |
4776
|
524 gripe_invalid_value_specified ("FFTW_WISDOM_PROGRAM"); |
4773
|
525 status = -1; |
|
526 } |
|
527 else |
4776
|
528 Vfftw_wisdom_prog = s; |
4773
|
529 |
|
530 return status; |
|
531 } |
|
532 |
2203
|
533 static int |
4447
|
534 default_exec_path (void) |
|
535 { |
|
536 int status = 0; |
|
537 |
|
538 std::string s = builtin_string_variable ("DEFAULT_EXEC_PATH"); |
|
539 |
|
540 if (s.empty ()) |
|
541 { |
|
542 gripe_invalid_value_specified ("DEFAULT_EXEC_PATH"); |
|
543 status = -1; |
|
544 } |
|
545 else |
|
546 { |
|
547 Vdefault_exec_path = s; |
|
548 |
|
549 // Now also update PATH in environment. |
|
550 exec_path (); |
|
551 } |
|
552 |
|
553 return status; |
|
554 } |
|
555 |
|
556 static int |
2203
|
557 imagepath (void) |
|
558 { |
|
559 int status = 0; |
|
560 |
3523
|
561 std::string s = builtin_string_variable ("IMAGEPATH"); |
2203
|
562 |
|
563 if (s.empty ()) |
|
564 { |
|
565 gripe_invalid_value_specified ("IMAGEPATH"); |
|
566 status = -1; |
|
567 } |
|
568 else |
|
569 Vimagepath = s; |
|
570 |
|
571 return status; |
|
572 } |
|
573 |
|
574 static int |
|
575 loadpath (void) |
|
576 { |
|
577 int status = 0; |
|
578 |
3523
|
579 std::string s = builtin_string_variable ("LOADPATH"); |
2203
|
580 |
|
581 if (s.empty ()) |
|
582 { |
|
583 gripe_invalid_value_specified ("LOADPATH"); |
|
584 status = -1; |
|
585 } |
5395
|
586 else if (Vload_path != s) |
3174
|
587 { |
3971
|
588 // I'm not sure whether this causes more problems that it |
|
589 // solves... |
|
590 // if (! (s[0] == ':' || s[s.length () - 1] == ':' |
5451
|
591 // || s.find (std::string (SEPCHAR_STR) + |
|
592 // std::string (SEPCHAR_STR)) != NPOS)) |
3971
|
593 // warning ("LOADPATH will ignore default load path"); |
3967
|
594 |
3195
|
595 Vload_path = s; |
3174
|
596 |
5395
|
597 // By resetting the last prompt time variable, we will force |
|
598 // checks for out of date symbols even if the change to LOADPATH |
|
599 // and subsequent function calls happen between prompts. |
|
600 |
|
601 // XXX FIXME XXX -- maybe we should rename |
|
602 // Vlast_prompt_time_stamp since the new usage doesn't really |
|
603 // fit with the current name? |
|
604 |
|
605 Vlast_prompt_time.stamp (); |
|
606 |
4217
|
607 update_load_path_dir_path (); |
|
608 } |
|
609 |
|
610 return status; |
|
611 } |
|
612 |
|
613 static int |
|
614 default_load_path (void) |
|
615 { |
|
616 int status = 0; |
|
617 |
|
618 std::string s = builtin_string_variable ("DEFAULT_LOADPATH"); |
|
619 |
|
620 if (s.empty ()) |
|
621 { |
|
622 gripe_invalid_value_specified ("DEFAULT_LOADPATH"); |
|
623 status = -1; |
|
624 } |
|
625 else |
|
626 { |
|
627 Vdefault_load_path = s; |
|
628 |
|
629 update_load_path_dir_path (); |
3174
|
630 } |
2203
|
631 |
|
632 return status; |
|
633 } |
|
634 |
|
635 void |
|
636 symbols_of_defaults (void) |
|
637 { |
3258
|
638 DEFVAR (EDITOR, Veditor, editor, |
3368
|
639 "-*- texinfo -*-\n\ |
|
640 @defvr {Built-in Variable} EDITOR\n\ |
|
641 A string naming the editor to use with the @code{edit_history} command.\n\ |
|
642 If the environment variable @code{EDITOR} is set when Octave starts, its\n\ |
|
643 value is used as the default. Otherwise, @code{EDITOR} is set to\n\ |
|
644 @code{\"emacs\"}.\n\ |
|
645 @end defvr"); |
2203
|
646 |
4776
|
647 DEFVAR (FFTW_WISDOM_PROGRAM, Vfftw_wisdom_prog, fftw_wisdom_prog, |
4773
|
648 "-*- texinfo -*-\n\ |
4776
|
649 @defvr {Built-in Variable} FFTW_WISDOM_PROGRAM\n\ |
4773
|
650 A string naming the FFTW wisdom program to use to create wisdom data\n\ |
|
651 to accelerate Fourier transforms. If the environment variable\n\ |
|
652 @code{OCTAVE_WISDOM_PROGRAM} is set when Octave starts, its value is used\n\ |
|
653 as the default. Otherwise, @code{WISDOM_PROGRAM} is set to\n\ |
|
654 @code{\"fftw-wisdom\"}.\n\ |
|
655 @end defvr"); |
|
656 |
3258
|
657 DEFVAR (EXEC_PATH, Vexec_path, exec_path, |
3301
|
658 "-*- texinfo -*-\n\ |
|
659 @defvr {Built-in Variable} EXEC_PATH\n\ |
|
660 The variable @code{EXEC_PATH} is a colon separated list of directories\n\ |
4447
|
661 to search when executing external programs. Its initial value is taken from\n\ |
3301
|
662 the environment variable @code{OCTAVE_EXEC_PATH} (if it exists) or\n\ |
|
663 @code{PATH}, but that value can be overridden by the command line\n\ |
|
664 argument @code{--exec-path PATH}, or by setting the value of\n\ |
|
665 @code{EXEC_PATH} in a startup script. If the value of @code{EXEC_PATH}\n\ |
|
666 begins (ends) with a colon, the directories\n\ |
|
667 \n\ |
|
668 @example\n\ |
|
669 @group\n\ |
|
670 @var{octave-home}/libexec/octave/site/exec/@var{arch}\n\ |
|
671 @var{octave-home}/libexec/octave/@var{version}/exec/@var{arch}\n\ |
|
672 @end group\n\ |
|
673 @end example\n\ |
|
674 \n\ |
|
675 @noindent\n\ |
|
676 are prepended (appended) to @code{EXEC_PATH}, where @var{octave-home}\n\ |
|
677 is the top-level directory where all of Octave is installed\n\ |
|
678 (the default value is @file{@value{OCTAVEHOME}}). If you don't specify\n\ |
|
679 a value for @code{EXEC_PATH} explicitly, these special directories are\n\ |
|
680 prepended to your shell path.\n\ |
|
681 @end defvr"); |
2203
|
682 |
4447
|
683 DEFVAR (DEFAULT_EXEC_PATH, Vdefault_exec_path, default_exec_path, |
|
684 "-*- texinfo -*-\n\ |
|
685 @defvr {Built-in Variable} DEFAULT_EXEC_PATH\n\ |
|
686 A colon separated list of directories in which to search when executing\n\ |
|
687 external programs. The value of this variable is automatically\n\ |
|
688 substituted for leading, trailing, or doubled colons that appear in the\n\ |
|
689 built-in variable @code{EXEC_PATH}.\n\ |
|
690 @end defvr"); |
4773
|
691 |
3258
|
692 DEFVAR (LOADPATH, Vload_path, loadpath, |
3371
|
693 "-*- texinfo -*-\n\ |
|
694 @defvr {Built-in Variable} LOADPATH\n\ |
|
695 A colon separated list of directories in which to search for function\n\ |
|
696 files. @xref{Functions and Scripts}. The value of @code{LOADPATH}\n\ |
|
697 overrides the environment variable @code{OCTAVE_PATH}. @xref{Installation}.\n\ |
|
698 \n\ |
|
699 @code{LOADPATH} is now handled in the same way as @TeX{} handles\n\ |
|
700 @code{TEXINPUTS}. Leading, trailing, or doubled colons that appear in\n\ |
|
701 @code{LOADPATH} are replaced by the value of @code{DEFAULT_LOADPATH}.\n\ |
5451
|
702 The default value of @code{LOADPATH} is @code{\"\n" |
|
703 SEPCHAR_STR |
|
704 "\"}, which tells Octave to search in the directories specified by\n\ |
|
705 @code{DEFAULT_LOADPATH}.\n\ |
3371
|
706 \n\ |
|
707 In addition, if any path element ends in @samp{//}, that directory and\n\ |
|
708 all subdirectories it contains are searched recursively for function\n\ |
|
709 files. This can result in a slight delay as Octave caches the lists of\n\ |
|
710 files found in the @code{LOADPATH} the first time Octave searches for a\n\ |
|
711 function. After that, searching is usually much faster because Octave\n\ |
|
712 normally only needs to search its internal cache for files.\n\ |
|
713 \n\ |
|
714 To improve performance of recursive directory searching, it is best for\n\ |
|
715 each directory that is to be searched recursively to contain\n\ |
|
716 @emph{either} additional subdirectories @emph{or} function files, but\n\ |
|
717 not a mixture of both.\n\ |
|
718 \n\ |
3402
|
719 @xref{Organization of Functions}, for a description of the function file\n\ |
3371
|
720 directories that are distributed with Octave.\n\ |
|
721 @end defvr"); |
2203
|
722 |
4217
|
723 DEFVAR (DEFAULT_LOADPATH, Vdefault_load_path, default_load_path, |
3371
|
724 "-*- texinfo -*-\n\ |
|
725 @defvr {Built-in Variable} DEFAULT_LOADPATH\n\ |
|
726 A colon separated list of directories in which to search for function\n\ |
4447
|
727 files. The value of this variable is automatically substituted for\n\ |
|
728 leading, trailing, or doubled colons that appear in the built-in\n\ |
|
729 variable @code{LOADPATH}.\n\ |
3371
|
730 @end defvr"); |
3192
|
731 |
3258
|
732 DEFVAR (IMAGEPATH, OCTAVE_IMAGEPATH, imagepath, |
3373
|
733 "-*- texinfo -*-\n\ |
3532
|
734 @defvr {Built-in Variable} IMAGEPATH\n\ |
3373
|
735 A colon separated list of directories in which to search for image\n\ |
|
736 files.\n\ |
|
737 @end defvr"); |
2203
|
738 |
3141
|
739 DEFCONST (OCTAVE_HOME, Voctave_home, |
3446
|
740 "-*- texinfo -*-\n\ |
5333
|
741 @defvr {Built-in Constant} OCTAVE_HOME\n\ |
3446
|
742 The name of the top-level Octave installation directory.\n\ |
|
743 @end defvr"); |
2831
|
744 |
3141
|
745 DEFCONSTX ("OCTAVE_VERSION", SBV_OCTAVE_VERSION, OCTAVE_VERSION, |
3301
|
746 "-*- texinfo -*-\n\ |
5333
|
747 @defvr {Built-in Constant} OCTAVE_VERSION\n\ |
3301
|
748 The version number of Octave, as a string.\n\ |
|
749 @end defvr"); |
3446
|
750 |
2203
|
751 } |
|
752 |
|
753 /* |
|
754 ;;; Local Variables: *** |
|
755 ;;; mode: C++ *** |
|
756 ;;; End: *** |
|
757 */ |