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