Mercurial > hg > octave-nkf
annotate libinterp/interpfcn/defaults.cc @ 15971:e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
* build-aux/common.mk: define octlocaledir
* configure.ac: default for octlocaledir is '$(datadir)/octave/$(version)/locale
* libgui/Makefile.am: octlocale_DATA is the list of translation files
* libinterp/interpfcn/defaults.cc: define Voct_locale_dir
* libinterp/interpfcn/defaults.cc(set_default_oct_locale_dir): new function;
* libinterp/interpfcn/defaults.cc(install_defaults):
call set_default_oct_locale_dir ()
* libinterp/interpfcn/defaults.in.h: define OCTAVE_OCTLOCALEDIR,
declare Voct_locale_dir
* run-octave.in: set OCTAVE_LOCALE_DIR to $top_srcdir/libgui/languages
* libgui/languages/generic.*: renamed into en_US.*
* libgui/languages/translators: updated comment related to generic file
author | Torsten <ttl@justmail.de> |
---|---|
date | Sat, 19 Jan 2013 16:21:46 +0100 |
parents | b1ff8c83e232 |
children | 9bc1f8278966 |
rev | line source |
---|---|
2203 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13951
diff
changeset
|
3 Copyright (C) 1996-2012 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 () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
255 + Vlocal_api_arch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
256 + Vlocal_arch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
257 + Varch_lib_dir + dir_path::path_sep_str () |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
258 + Vbin_dir; |
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 |
e2a4f3478b7c
datetick.m: add missing semicolon
John W. Eaton <jwe@octave.org>
parents:
10840
diff
changeset
|
262 // FIXME -- should we really be modifying PATH in the environment? |
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 { | |
374 Vlocal_site_defaults_file = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); | |
375 Vlocal_site_defaults_file.append ("/octaverc"); | |
376 } | |
377 else | |
378 Vlocal_site_defaults_file = lsf; | |
2203 | 379 } |
380 | |
381 static void | |
382 set_site_defaults_file (void) | |
383 { | |
9132
eb1747dbd360
Update help strings for command line options
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
384 std::string sf = octave_env::getenv ("OCTAVE_VERSION_INITFILE"); |
5781 | 385 |
386 if (sf.empty ()) | |
387 { | |
388 Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); | |
389 Vsite_defaults_file.append ("/octaverc"); | |
390 } | |
391 else | |
392 Vsite_defaults_file = sf; | |
2203 | 393 } |
394 | |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
395 static void |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
396 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
|
397 { |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
398 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
|
399 { |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
400 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
|
401 |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
402 if (df.empty ()) |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
403 Vbuilt_in_docstrings_file |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
404 = 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
|
405 else |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
406 Vbuilt_in_docstrings_file = df; |
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 } |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
409 |
2203 | 410 void |
411 install_defaults (void) | |
412 { | |
413 // OCTAVE_HOME must be set first! | |
414 | |
415 set_octave_home (); | |
416 | |
417 set_default_info_dir (); | |
418 | |
3141 | 419 set_default_data_dir (); |
420 | |
421 set_default_libexec_dir (); | |
422 | |
2203 | 423 set_default_arch_lib_dir (); |
424 | |
5909 | 425 set_default_local_ver_arch_lib_dir (); |
426 set_default_local_api_arch_lib_dir (); | |
2439 | 427 set_default_local_arch_lib_dir (); |
428 | |
5814 | 429 set_default_local_ver_oct_file_dir (); |
430 set_default_local_api_oct_file_dir (); | |
431 set_default_local_oct_file_dir (); | |
2203 | 432 |
5814 | 433 set_default_local_ver_fcn_file_dir (); |
434 set_default_local_api_fcn_file_dir (); | |
435 set_default_local_fcn_file_dir (); | |
436 | |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
437 set_default_oct_etc_dir (); |
15971
e27d9b9b71f4
gui: install translation files into $(datadir)/octave/$(version)/locale
Torsten <ttl@justmail.de>
parents:
15478
diff
changeset
|
438 set_default_oct_locale_dir (); |
15157
a87fa9132b72
provide Voct_etc_dir variable
John W. Eaton <jwe@octave.org>
parents:
15088
diff
changeset
|
439 |
5814 | 440 set_default_fcn_file_dir (); |
5397 | 441 set_default_oct_file_dir (); |
442 | |
5814 | 443 set_default_image_dir (); |
444 | |
2203 | 445 set_default_bin_dir (); |
446 | |
5814 | 447 set_exec_path (); |
4447 | 448 |
5814 | 449 set_image_path (); |
2203 | 450 |
8865
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
451 set_default_doc_cache_file (); |
eace5649a8b5
set default value for doc_cache_file variable
John W. Eaton <jwe@octave.org>
parents:
8008
diff
changeset
|
452 |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14429
diff
changeset
|
453 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
|
454 |
2203 | 455 set_default_info_file (); |
456 | |
457 set_default_info_prog (); | |
458 | |
459 set_default_editor (); | |
460 | |
461 set_local_site_defaults_file (); | |
462 | |
463 set_site_defaults_file (); | |
15470
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
464 |
bf0857c789f4
initialize docstrings for built-in functions from file
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
465 set_built_in_docstrings_file (); |
2203 | 466 } |
467 | |
5794 | 468 DEFUN (EDITOR, args, nargout, |
469 "-*- texinfo -*-\n\ | |
10840 | 470 @deftypefn {Built-in Function} {@var{val} =} EDITOR ()\n\ |
5794 | 471 @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
|
472 @deftypefnx {Built-in Function} {} EDITOR (@var{new_val}, \"local\")\n\ |
5794 | 473 Query or set the internal variable that specifies the editor to\n\ |
9134
a3739e27b017
Update section 2.4 of basics.txi
Rik <rdrider0-list@yahoo.com>
parents:
9132
diff
changeset
|
474 use with the @code{edit_history} command. The default value is taken from\n\ |
10840 | 475 the environment variable @w{@env{EDITOR}} when Octave starts. If the\n\ |
476 environment variable is not initialized, @w{@env{EDITOR}} will be set to\n\ | |
5794 | 477 @code{\"emacs\"}.\n\ |
13951
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
478 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
479 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
480 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
481 variable value is restored when exiting the function.\n\ |
5794 | 482 @seealso{edit_history}\n\ |
483 @end deftypefn") | |
2203 | 484 { |
5794 | 485 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EDITOR); |
2203 | 486 } |
487 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
488 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
489 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
490 %! orig_val = EDITOR (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
491 %! old_val = EDITOR ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
492 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
493 %! assert (EDITOR (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
494 %! EDITOR (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
495 %! assert (EDITOR (), orig_val); |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
496 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
497 %!error (EDITOR (1, 2)) |
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 |
5794 | 500 DEFUN (EXEC_PATH, args, nargout, |
501 "-*- texinfo -*-\n\ | |
10840 | 502 @deftypefn {Built-in Function} {@var{val} =} EXEC_PATH ()\n\ |
5794 | 503 @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
|
504 @deftypefnx {Built-in Function} {} EXEC_PATH (@var{new_val}, \"local\")\n\ |
5794 | 505 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
|
506 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
|
507 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
|
508 @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
|
509 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
|
510 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
511 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
512 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
513 variable value is restored when exiting the function.\n\ |
5794 | 514 @end deftypefn") |
4217 | 515 { |
5794 | 516 octave_value retval = SET_NONEMPTY_INTERNAL_STRING_VARIABLE (EXEC_PATH); |
4217 | 517 |
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
|
518 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
|
519 set_exec_path (VEXEC_PATH); |
2203 | 520 |
5794 | 521 return retval; |
2203 | 522 } |
523 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
524 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
525 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
526 %! orig_val = EXEC_PATH (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
527 %! old_val = EXEC_PATH ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
528 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
529 %! assert (EXEC_PATH (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
530 %! EXEC_PATH (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
531 %! 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
|
532 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
533 %!error (EXEC_PATH (1, 2)) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
534 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
535 |
5814 | 536 DEFUN (IMAGE_PATH, args, nargout, |
5794 | 537 "-*- texinfo -*-\n\ |
10840 | 538 @deftypefn {Built-in Function} {@var{val} =} IMAGE_PATH ()\n\ |
5814 | 539 @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
|
540 @deftypefnx {Built-in Function} {} IMAGE_PATH (@var{new_val}, \"local\")\n\ |
5794 | 541 Query or set the internal variable that specifies a colon separated\n\ |
542 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
|
543 \n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
544 When called from inside a function with the \"local\" option, the variable is\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
545 changed locally for the function and any subroutines it calls. The original\n\ |
79aa00a94e9e
doc: Document "local" option for configuration variables.
Rik <octave@nomad.inbox5.com>
parents:
12855
diff
changeset
|
546 variable value is restored when exiting the function.\n\ |
5794 | 547 @end deftypefn") |
548 { | |
5814 | 549 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (IMAGE_PATH); |
5794 | 550 } |
551 | |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
552 /* |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
553 %!test |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
554 %! orig_val = IMAGE_PATH (); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
555 %! old_val = IMAGE_PATH ("X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
556 %! assert (orig_val, old_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
557 %! assert (IMAGE_PATH (), "X"); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
558 %! IMAGE_PATH (orig_val); |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
559 %! 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
|
560 |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
561 %!error (IMAGE_PATH (1, 2)) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
562 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
563 |
5780 | 564 DEFUN (OCTAVE_HOME, args, , |
565 "-*- texinfo -*-\n\ | |
566 @deftypefn {Built-in Function} {} OCTAVE_HOME ()\n\ | |
567 Return the name of the top-level Octave installation directory.\n\ | |
568 @end deftypefn") | |
569 { | |
570 octave_value retval; | |
2831 | 571 |
5780 | 572 if (args.length () == 0) |
573 retval = Voctave_home; | |
574 else | |
5823 | 575 print_usage (); |
5780 | 576 |
577 return retval; | |
5749 | 578 } |
3446 | 579 |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
580 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
581 %!assert (ischar (OCTAVE_HOME ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
582 %!error OCTAVE_HOME (1) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
583 */ |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
584 |
5749 | 585 DEFUNX ("OCTAVE_VERSION", FOCTAVE_VERSION, args, , |
586 "-*- texinfo -*-\n\ | |
587 @deftypefn {Built-in Function} {} OCTAVE_VERSION ()\n\ | |
588 Return the version number of Octave, as a string.\n\ | |
589 @end deftypefn") | |
590 { | |
591 octave_value retval; | |
592 | |
593 int nargin = args.length (); | |
594 | |
595 if (nargin == 0) | |
596 retval = OCTAVE_VERSION; | |
597 else | |
5823 | 598 print_usage (); |
5749 | 599 |
600 return retval; | |
2203 | 601 } |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
602 |
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
603 /* |
14429
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
604 %!assert (ischar (OCTAVE_VERSION ())) |
eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
605 %!error OCTAVE_VERSION (1) |
12851
7fce673b934a
codesprint: new tests for defaults.cc
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
606 */ |