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