Mercurial > hg > octave-nkf
annotate libinterp/corefcn/defaults.cc @ 20830:b65888ec820e draft default tip gccjit
dmalcom gcc jit import
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Fri, 27 Feb 2015 16:59:36 +0100 |
parents | 4f45eaf83908 |
children |
rev | line source |
---|---|
2203 | 1 /* |
2 | |
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19384
diff
changeset
|
3 Copyright (C) 1996-2015 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2203 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2203 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include <cstdlib> | |
28 | |
6114 | 29 #include <algorithm> |
3503 | 30 #include <iostream> |
2203 | 31 #include <string> |
32 | |
33 #include <sys/types.h> | |
34 #include <unistd.h> | |
35 | |
5814 | 36 #include "dir-ops.h" |
2926 | 37 #include "oct-env.h" |
4217 | 38 #include "file-stat.h" |
3174 | 39 #include "pathsearch.h" |
4217 | 40 #include "str-vec.h" |
2926 | 41 |
2492 | 42 #include <defaults.h> |
2203 | 43 #include "defun.h" |
44 #include "error.h" | |
3040 | 45 #include "file-ops.h" |
2203 | 46 #include "gripes.h" |
47 #include "help.h" | |
5395 | 48 #include "input.h" |
5832 | 49 #include "load-path.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; | |
5909 | 66 std::string Vlocal_api_arch_lib_dir; |
3597 | 67 std::string Vlocal_ver_arch_lib_dir; |
5814 | 68 |
69 std::string Vlocal_ver_oct_file_dir; | |
70 std::string Vlocal_api_oct_file_dir; | |
71 std::string Vlocal_oct_file_dir; | |
2203 | 72 |
5814 | 73 std::string Vlocal_ver_fcn_file_dir; |
74 std::string Vlocal_api_fcn_file_dir; | |
75 std::string Vlocal_fcn_file_dir; | |
76 | |
19224
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
77 std::string Voct_data_dir; |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
78 std::string Voct_etc_dir; |
15971
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
79 std::string Voct_locale_dir; |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
80 |
5814 | 81 std::string Voct_file_dir; |
82 std::string Vfcn_file_dir; | |
83 | |
84 std::string Vimage_dir; | |
4447 | 85 |
2203 | 86 // The path that will be searched for programs that we execute. |
87 // (--exec-path path) | |
5794 | 88 static std::string VEXEC_PATH; |
2203 | 89 |
90 // Name of the editor to be invoked by the edit_history command. | |
5794 | 91 std::string VEDITOR; |
2203 | 92 |
5814 | 93 static std::string VIMAGE_PATH; |
2203 | 94 |
3523 | 95 std::string Vlocal_site_defaults_file; |
96 std::string Vsite_defaults_file; | |
2203 | 97 |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
98 std::string Vbuilt_in_docstrings_file; |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
99 |
6274 | 100 std::string |
3523 | 101 subst_octave_home (const std::string& s) |
2203 | 102 { |
3523 | 103 std::string retval; |
2203 | 104 |
3523 | 105 std::string prefix = OCTAVE_PREFIX; |
2203 | 106 |
107 retval = s; | |
108 | |
109 if (Voctave_home != prefix) | |
110 { | |
5275 | 111 octave_idx_type len = prefix.length (); |
6276 | 112 |
113 if (s.substr (0, len) == prefix) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
114 retval.replace (0, len, Voctave_home); |
2203 | 115 } |
116 | |
8007
a2ab20ba78f7
make file_ops a proper singleton class
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
117 if (file_ops::dir_sep_char () != '/') |
a2ab20ba78f7
make file_ops a proper singleton class
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
118 std::replace (retval.begin (), retval.end (), '/', |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10182
diff
changeset
|
119 file_ops::dir_sep_char ()); |
6114 | 120 |
2203 | 121 return retval; |
122 } | |
123 | |
124 static void | |
125 set_octave_home (void) | |
126 { | |
3523 | 127 std::string oh = octave_env::getenv ("OCTAVE_HOME"); |
2203 | 128 |
3523 | 129 Voctave_home = oh.empty () ? std::string (OCTAVE_PREFIX) : oh; |
2203 | 130 } |
131 | |
132 static void | |
133 set_default_info_dir (void) | |
134 { | |
135 Vinfo_dir = subst_octave_home (OCTAVE_INFODIR); | |
136 } | |
137 | |
138 static void | |
3141 | 139 set_default_data_dir (void) |
140 { | |
141 Vdata_dir = subst_octave_home (OCTAVE_DATADIR); | |
142 } | |
143 | |
144 static void | |
145 set_default_libexec_dir (void) | |
146 { | |
147 Vlibexec_dir = subst_octave_home (OCTAVE_LIBEXECDIR); | |
148 } | |
149 | |
150 static void | |
2203 | 151 set_default_arch_lib_dir (void) |
152 { | |
153 Varch_lib_dir = subst_octave_home (OCTAVE_ARCHLIBDIR); | |
154 } | |
155 | |
156 static void | |
2439 | 157 set_default_local_arch_lib_dir (void) |
158 { | |
159 Vlocal_arch_lib_dir = subst_octave_home (OCTAVE_LOCALARCHLIBDIR); | |
160 } | |
161 | |
162 static void | |
5909 | 163 set_default_local_api_arch_lib_dir (void) |
164 { | |
165 Vlocal_api_arch_lib_dir = subst_octave_home (OCTAVE_LOCALAPIARCHLIBDIR); | |
166 } | |
167 | |
168 static void | |
3597 | 169 set_default_local_ver_arch_lib_dir (void) |
170 { | |
171 Vlocal_ver_arch_lib_dir = subst_octave_home (OCTAVE_LOCALVERARCHLIBDIR); | |
172 } | |
173 | |
174 static void | |
5814 | 175 set_default_local_ver_oct_file_dir (void) |
176 { | |
177 Vlocal_ver_oct_file_dir = subst_octave_home (OCTAVE_LOCALVEROCTFILEDIR); | |
178 } | |
179 | |
180 static void | |
181 set_default_local_api_oct_file_dir (void) | |
182 { | |
183 Vlocal_api_oct_file_dir = subst_octave_home (OCTAVE_LOCALAPIOCTFILEDIR); | |
184 } | |
185 | |
186 static void | |
187 set_default_local_oct_file_dir (void) | |
188 { | |
189 Vlocal_oct_file_dir = subst_octave_home (OCTAVE_LOCALOCTFILEDIR); | |
190 } | |
191 | |
192 static void | |
193 set_default_local_ver_fcn_file_dir (void) | |
194 { | |
195 Vlocal_ver_fcn_file_dir = subst_octave_home (OCTAVE_LOCALVERFCNFILEDIR); | |
196 } | |
197 | |
198 static void | |
199 set_default_local_api_fcn_file_dir (void) | |
200 { | |
201 Vlocal_api_fcn_file_dir = subst_octave_home (OCTAVE_LOCALAPIFCNFILEDIR); | |
202 } | |
203 | |
204 static void | |
205 set_default_local_fcn_file_dir (void) | |
206 { | |
207 Vlocal_fcn_file_dir = subst_octave_home (OCTAVE_LOCALFCNFILEDIR); | |
208 } | |
209 | |
210 static void | |
2203 | 211 set_default_fcn_file_dir (void) |
212 { | |
213 Vfcn_file_dir = subst_octave_home (OCTAVE_FCNFILEDIR); | |
214 } | |
215 | |
216 static void | |
5814 | 217 set_default_image_dir (void) |
218 { | |
219 Vimage_dir = subst_octave_home (OCTAVE_IMAGEDIR); | |
220 } | |
221 | |
222 static void | |
19224
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
223 set_default_oct_data_dir (void) |
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
224 { |
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
225 Voct_data_dir = subst_octave_home (OCTAVE_OCTDATADIR); |
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
226 } |
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
227 |
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
228 static void |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
229 set_default_oct_etc_dir (void) |
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
230 { |
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
231 Voct_etc_dir = subst_octave_home (OCTAVE_OCTETCDIR); |
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
232 } |
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
233 |
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
234 static void |
15971
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
235 set_default_oct_locale_dir (void) |
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
236 { |
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
237 Voct_locale_dir = subst_octave_home (OCTAVE_OCTLOCALEDIR); |
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
238 } |
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
239 |
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
240 static void |
5397 | 241 set_default_oct_file_dir (void) |
242 { | |
243 Voct_file_dir = subst_octave_home (OCTAVE_OCTFILEDIR); | |
244 } | |
245 | |
246 static void | |
2203 | 247 set_default_bin_dir (void) |
248 { | |
249 Vbin_dir = subst_octave_home (OCTAVE_BINDIR); | |
250 } | |
251 | |
5814 | 252 void |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
253 set_exec_path (const std::string& path_arg) |
4447 | 254 { |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
255 std::string tpath = path_arg; |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
256 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
257 if (tpath.empty ()) |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
258 tpath = octave_env::getenv ("OCTAVE_EXEC_PATH"); |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
259 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
260 if (tpath.empty ()) |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
261 tpath = Vlocal_ver_arch_lib_dir + dir_path::path_sep_str () |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
262 + Vlocal_api_arch_lib_dir + dir_path::path_sep_str () |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
263 + Vlocal_arch_lib_dir + dir_path::path_sep_str () |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
264 + Varch_lib_dir + dir_path::path_sep_str () |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
265 + Vbin_dir; |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
266 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
267 VEXEC_PATH = tpath; |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
268 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
269 // FIXME: should we really be modifying PATH in the environment? |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
270 // The way things are now, Octave will ignore directories set in the |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
271 // PATH with calls like |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
272 // |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
273 // setenv ("PATH", "/my/path"); |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
274 // |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
275 // To fix this, I think Octave should be searching the combination of |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
276 // PATH and EXEC_PATH for programs that it executes instead of setting |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
277 // the PATH in the environment and relying on the shell to do the |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
278 // searching. |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
279 |
5814 | 280 // This is static so that even if set_exec_path is called more than |
281 // once, shell_path is the original PATH from the environment, | |
282 // before we start modifying it. | |
283 static std::string shell_path = octave_env::getenv ("PATH"); | |
284 | |
285 if (! shell_path.empty ()) | |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
286 tpath = shell_path + dir_path::path_sep_str () + tpath; |
5814 | 287 |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
288 octave_env::putenv ("PATH", tpath); |
5814 | 289 } |
290 | |
291 void | |
292 set_image_path (const std::string& path) | |
293 { | |
294 VIMAGE_PATH = "."; | |
295 | |
296 std::string tpath = path; | |
297 | |
298 if (tpath.empty ()) | |
299 tpath = octave_env::getenv ("OCTAVE_IMAGE_PATH"); | |
300 | |
301 if (! tpath.empty ()) | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
8007
diff
changeset
|
302 VIMAGE_PATH += dir_path::path_sep_str () + tpath; |
5814 | 303 |
5832 | 304 tpath = genpath (Vimage_dir, ""); |
305 | |
306 if (! tpath.empty ()) | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
8007
diff
changeset
|
307 VIMAGE_PATH += dir_path::path_sep_str () + tpath; |
5814 | 308 } |
309 | |
2203 | 310 static void |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
311 set_default_doc_cache_file (void) |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
312 { |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
313 if (Vdoc_cache_file.empty ()) |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
314 { |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
315 std::string def_file = subst_octave_home (OCTAVE_DOC_CACHE_FILE); |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
316 |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
317 std::string env_file = octave_env::getenv ("OCTAVE_DOC_CACHE_FILE"); |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
318 |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
319 Vdoc_cache_file = env_file.empty () ? def_file : env_file; |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
320 } |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
321 } |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
322 |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
323 static void |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
324 set_default_texi_macros_file (void) |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
325 { |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
326 if (Vtexi_macros_file.empty ()) |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
327 { |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
328 std::string def_file = subst_octave_home (OCTAVE_TEXI_MACROS_FILE); |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
329 |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
330 std::string env_file = octave_env::getenv ("OCTAVE_TEXI_MACROS_FILE"); |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
331 |
15478
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
332 Vtexi_macros_file = env_file.empty () ? def_file : env_file; |
b1ff8c83e232
set Vdoc_cache_file and Vtexi_macros_file variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15473
diff
changeset
|
333 } |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
334 } |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
335 |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
336 static void |
2203 | 337 set_default_info_file (void) |
338 { | |
15473
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
339 if (Vinfo_file.empty ()) |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
340 { |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
341 std::string std_info_file = subst_octave_home (OCTAVE_INFOFILE); |
2512 | 342 |
15473
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
343 std::string oct_info_file = octave_env::getenv ("OCTAVE_INFO_FILE"); |
2203 | 344 |
15473
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
345 Vinfo_file = oct_info_file.empty () ? std_info_file : oct_info_file; |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
346 } |
2203 | 347 } |
348 | |
349 static void | |
350 set_default_info_prog (void) | |
351 { | |
15473
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
352 if (Vinfo_program.empty ()) |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
353 { |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
354 std::string oct_info_prog = octave_env::getenv ("OCTAVE_INFO_PROGRAM"); |
2203 | 355 |
15473
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
356 if (oct_info_prog.empty ()) |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
357 Vinfo_program = "info"; |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
358 else |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
359 Vinfo_program = std::string (oct_info_prog); |
457a2ff2a71b
set Vinfo_file and Vinfo_program variables directly from command line options
John W. Eaton <jwe@octave.org>
parents:
15470
diff
changeset
|
360 } |
2203 | 361 } |
362 | |
4773 | 363 static void |
2203 | 364 set_default_editor (void) |
365 { | |
5794 | 366 VEDITOR = "emacs"; |
2203 | 367 |
3523 | 368 std::string env_editor = octave_env::getenv ("EDITOR"); |
2203 | 369 |
2926 | 370 if (! env_editor.empty ()) |
5794 | 371 VEDITOR = env_editor; |
2203 | 372 } |
373 | |
374 static void | |
375 set_local_site_defaults_file (void) | |
376 { | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
377 std::string lsf = octave_env::getenv ("OCTAVE_SITE_INITFILE"); |
5781 | 378 |
379 if (lsf.empty ()) | |
380 { | |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
381 Vlocal_site_defaults_file |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
382 = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); |
5781 | 383 Vlocal_site_defaults_file.append ("/octaverc"); |
384 } | |
385 else | |
386 Vlocal_site_defaults_file = lsf; | |
2203 | 387 } |
388 | |
389 static void | |
390 set_site_defaults_file (void) | |
391 { | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
392 std::string sf = octave_env::getenv ("OCTAVE_VERSION_INITFILE"); |
5781 | 393 |
394 if (sf.empty ()) | |
395 { | |
396 Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); | |
397 Vsite_defaults_file.append ("/octaverc"); | |
398 } | |
399 else | |
400 Vsite_defaults_file = sf; | |
2203 | 401 } |
402 | |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
403 static void |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
404 set_built_in_docstrings_file (void) |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
405 { |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
406 if (Vbuilt_in_docstrings_file.empty ()) |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
407 { |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
408 std::string df = octave_env::getenv ("OCTAVE_BUILT_IN_DOCSTRINGS_FILE"); |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
409 |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
410 if (df.empty ()) |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
411 Vbuilt_in_docstrings_file |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
412 = Voct_etc_dir + file_ops::dir_sep_str () + "built-in-docstrings"; |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
413 else |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
414 Vbuilt_in_docstrings_file = df; |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
415 } |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
416 } |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
417 |
2203 | 418 void |
419 install_defaults (void) | |
420 { | |
421 // OCTAVE_HOME must be set first! | |
422 | |
423 set_octave_home (); | |
424 | |
425 set_default_info_dir (); | |
426 | |
3141 | 427 set_default_data_dir (); |
428 | |
429 set_default_libexec_dir (); | |
430 | |
2203 | 431 set_default_arch_lib_dir (); |
432 | |
5909 | 433 set_default_local_ver_arch_lib_dir (); |
434 set_default_local_api_arch_lib_dir (); | |
2439 | 435 set_default_local_arch_lib_dir (); |
436 | |
5814 | 437 set_default_local_ver_oct_file_dir (); |
438 set_default_local_api_oct_file_dir (); | |
439 set_default_local_oct_file_dir (); | |
2203 | 440 |
5814 | 441 set_default_local_ver_fcn_file_dir (); |
442 set_default_local_api_fcn_file_dir (); | |
443 set_default_local_fcn_file_dir (); | |
444 | |
19224
d902542221c8
new data directory for storing data files we distribute
John W. Eaton <jwe@octave.org>
parents:
17991
diff
changeset
|
445 set_default_oct_data_dir (); |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
446 set_default_oct_etc_dir (); |
15971
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
447 set_default_oct_locale_dir (); |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
448 |
5814 | 449 set_default_fcn_file_dir (); |
5397 | 450 set_default_oct_file_dir (); |
451 | |
5814 | 452 set_default_image_dir (); |
453 | |
2203 | 454 set_default_bin_dir (); |
455 | |
5814 | 456 set_exec_path (); |
4447 | 457 |
5814 | 458 set_image_path (); |
2203 | 459 |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
460 set_default_doc_cache_file (); |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
461 |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
462 set_default_texi_macros_file (); |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
463 |
2203 | 464 set_default_info_file (); |
465 | |
466 set_default_info_prog (); | |
467 | |
468 set_default_editor (); | |
469 | |
470 set_local_site_defaults_file (); | |
471 | |
472 set_site_defaults_file (); | |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
473 |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
474 set_built_in_docstrings_file (); |
2203 | 475 } |
476 | |
5794 | 477 DEFUN (EDITOR, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
478 "-*- texinfo -*-\n\ |
10840 | 479 @deftypefn {Built-in Function} {@var{val} =} EDITOR ()\n\ |
5794 | 480 @deftypefnx {Built-in Function} {@var{old_val} =} EDITOR (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
481 @deftypefnx {Built-in Function} {} EDITOR (@var{new_val}, \"local\")\n\ |
17991
22187db555cf
Remove editor option from edit() and use only EDITOR() (bug #40600)
Carnë Draug <carandraug@octave.org>
parents:
17787
diff
changeset
|
482 Query or set the internal variable that specifies the default text editor.\n\ |
22187db555cf
Remove editor option from edit() and use only EDITOR() (bug #40600)
Carnë Draug <carandraug@octave.org>
parents:
17787
diff
changeset
|
483 \n\ |
22187db555cf
Remove editor option from edit() and use only EDITOR() (bug #40600)
Carnë Draug <carandraug@octave.org>
parents:
17787
diff
changeset
|
484 The default value is taken from the environment variable @w{@env{EDITOR}}\n\ |
20382
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
485 when Octave starts. If the environment variable is not initialized,\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
486 @w{@env{EDITOR}} will be set to @qcode{\"emacs\"}.\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
487 \n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
488 When called from inside a function with the @qcode{\"local\"} option, the\n\ |
20382
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
489 variable is changed locally for the function and any subroutines it calls.\n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
490 The original variable value is restored when exiting the function.\n\ |
16926
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
491 \n\ |
17991
22187db555cf
Remove editor option from edit() and use only EDITOR() (bug #40600)
Carnë Draug <carandraug@octave.org>
parents:
17787
diff
changeset
|
492 @seealso{edit, edit_history}\n\ |
5794 | 493 @end deftypefn") |
2203 | 494 { |
5794 | 495 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EDITOR); |
2203 | 496 } |
497 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
498 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
499 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
500 %! orig_val = EDITOR (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
501 %! old_val = EDITOR ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
502 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
503 %! assert (EDITOR (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
504 %! EDITOR (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
505 %! assert (EDITOR (), orig_val); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
506 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
507 %!error (EDITOR (1, 2)) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
508 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
509 |
5794 | 510 DEFUN (EXEC_PATH, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
511 "-*- texinfo -*-\n\ |
10840 | 512 @deftypefn {Built-in Function} {@var{val} =} EXEC_PATH ()\n\ |
5794 | 513 @deftypefnx {Built-in Function} {@var{old_val} =} EXEC_PATH (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
514 @deftypefnx {Built-in Function} {} EXEC_PATH (@var{new_val}, \"local\")\n\ |
5794 | 515 Query or set the internal variable that specifies a colon separated\n\ |
11294
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
516 list of directories to append to the shell PATH when executing external\n\ |
20382
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
517 programs.\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
518 \n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
519 The initial value of is taken from the environment variable\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
520 @w{@env{OCTAVE_EXEC_PATH}}, but that value can be overridden by the command\n\ |
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
521 line argument @option{--exec-path PATH}.\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
522 \n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
523 When called from inside a function with the @qcode{\"local\"} option, the\n\ |
20382
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
524 variable is changed locally for the function and any subroutines it calls.\n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
525 The original variable value is restored when exiting the function.\n\ |
16926
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
526 \n\ |
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
527 @seealso{IMAGE_PATH, OCTAVE_HOME}\n\ |
5794 | 528 @end deftypefn") |
4217 | 529 { |
5794 | 530 octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH); |
4217 | 531 |
11298
cb94bdc74670
defaults.cc (FEXEC_PATH): only call set_exec_path if nargin is greater than zero
John W. Eaton <jwe@octave.org>
parents:
11294
diff
changeset
|
532 if (args.length () > 0) |
cb94bdc74670
defaults.cc (FEXEC_PATH): only call set_exec_path if nargin is greater than zero
John W. Eaton <jwe@octave.org>
parents:
11294
diff
changeset
|
533 set_exec_path (VEXEC_PATH); |
2203 | 534 |
5794 | 535 return retval; |
2203 | 536 } |
537 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
538 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
539 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
540 %! orig_val = EXEC_PATH (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
541 %! old_val = EXEC_PATH ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
542 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
543 %! assert (EXEC_PATH (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
544 %! EXEC_PATH (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
545 %! assert (EXEC_PATH (), orig_val); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
546 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
547 %!error (EXEC_PATH (1, 2)) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
548 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
549 |
5814 | 550 DEFUN (IMAGE_PATH, args, nargout, |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
551 "-*- texinfo -*-\n\ |
10840 | 552 @deftypefn {Built-in Function} {@var{val} =} IMAGE_PATH ()\n\ |
5814 | 553 @deftypefnx {Built-in Function} {@var{old_val} =} IMAGE_PATH (@var{new_val})\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
554 @deftypefnx {Built-in Function} {} IMAGE_PATH (@var{new_val}, \"local\")\n\ |
5794 | 555 Query or set the internal variable that specifies a colon separated\n\ |
556 list of directories in which to search for image files.\n\ | |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
557 \n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
558 When called from inside a function with the @qcode{\"local\"} option, the\n\ |
20382
4f45eaf83908
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
559 variable is changed locally for the function and any subroutines it calls.\n\ |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
16926
diff
changeset
|
560 The original variable value is restored when exiting the function.\n\ |
16926
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
561 \n\ |
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
562 @seealso{EXEC_PATH, OCTAVE_HOME}\n\ |
5794 | 563 @end deftypefn") |
564 { | |
5814 | 565 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGE_PATH); |
5794 | 566 } |
567 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
568 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
569 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
570 %! orig_val = IMAGE_PATH (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
571 %! old_val = IMAGE_PATH ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
572 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
573 %! assert (IMAGE_PATH (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
574 %! IMAGE_PATH (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
575 %! assert (IMAGE_PATH (), orig_val); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
576 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
577 %!error (IMAGE_PATH (1, 2)) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
578 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
579 |
5780 | 580 DEFUN (OCTAVE_HOME, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
581 "-*- texinfo -*-\n\ |
5780 | 582 @deftypefn {Built-in Function} {} OCTAVE_HOME ()\n\ |
583 Return the name of the top-level Octave installation directory.\n\ | |
16926
23f6852052bb
defaults.cc: refer to more functions in the seealso section of help text.
Carnë Draug <carandraug@octave.org>
parents:
16892
diff
changeset
|
584 @seealso{EXEC_PATH, IMAGE_PATH}\n\ |
5780 | 585 @end deftypefn") |
586 { | |
587 octave_value retval; | |
2831 | 588 |
5780 | 589 if (args.length () == 0) |
590 retval = Voctave_home; | |
591 else | |
5823 | 592 print_usage (); |
5780 | 593 |
594 return retval; | |
5749 | 595 } |
3446 | 596 |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
597 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
598 %!assert (ischar (OCTAVE_HOME ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
599 %!error OCTAVE_HOME (1) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
600 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
601 |
5749 | 602 DEFUNX ("OCTAVE_VERSION", FOCTAVE_VERSION, args, , |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
603 "-*- texinfo -*-\n\ |
5749 | 604 @deftypefn {Built-in Function} {} OCTAVE_VERSION ()\n\ |
19384
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
19224
diff
changeset
|
605 Return the version number of Octave as a string.\n\ |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
19224
diff
changeset
|
606 @seealso{ver, version}\n\ |
5749 | 607 @end deftypefn") |
608 { | |
609 octave_value retval; | |
610 | |
611 int nargin = args.length (); | |
612 | |
613 if (nargin == 0) | |
614 retval = OCTAVE_VERSION; | |
615 else | |
5823 | 616 print_usage (); |
5749 | 617 |
618 return retval; | |
2203 | 619 } |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
620 |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
621 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
622 %!assert (ischar (OCTAVE_VERSION ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
623 %!error OCTAVE_VERSION (1) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
624 */ |