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