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