Mercurial > octave-nkf
annotate scripts/deprecated/dump_prefs.m @ 20614:10ec79b47808
use new string_value method to handle value extraction errors
* __voronoi__.cc, chol.cc, colamd.cc, fftw.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Oct 2015 18:15:56 -0400 |
parents | 4197fc428c7d |
children |
rev | line source |
---|---|
19731
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19679
diff
changeset
|
1 ## Copyright (C) 1994-2015 John W. Eaton |
2313 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
2313 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
799 | 18 |
3449 | 19 ## -*- texinfo -*- |
12528
2ac5028e5cb7
dump_prefs.m: Close @deftypefn macro left open.
Rik <octave@nomad.inbox5.com>
parents:
12527
diff
changeset
|
20 ## @deftypefn {Function File} {} dump_prefs () |
2ac5028e5cb7
dump_prefs.m: Close @deftypefn macro left open.
Rik <octave@nomad.inbox5.com>
parents:
12527
diff
changeset
|
21 ## @deftypefnx {Function File} {} dump_prefs (@var{fid}) |
19230 | 22 ## |
19679
ebd27d8c63fd
update default branch to release as 4.0
John W. Eaton <jwe@octave.org>
parents:
19230
diff
changeset
|
23 ## @code{dump_prefs} is deprecated and will be removed in Octave version 4.4. |
19230 | 24 ## Please use individual preference get/set routines in all new code. |
25 ## | |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
26 ## Dump the current settings of all user preferences to stdout in a format that |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
27 ## can be parsed by Octave later. |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
28 ## |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
29 ## If the optional argument @var{fid} is given then the results are written to |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
30 ## the file specified by file descriptor @var{fid}. |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
31 ## @seealso{octave_config_info} |
3449 | 32 ## @end deftypefn |
799 | 33 |
2314 | 34 ## Author: jwe |
35 | |
19679
ebd27d8c63fd
update default branch to release as 4.0
John W. Eaton <jwe@octave.org>
parents:
19230
diff
changeset
|
36 ## Deprecated in 4.0 |
ebd27d8c63fd
update default branch to release as 4.0
John W. Eaton <jwe@octave.org>
parents:
19230
diff
changeset
|
37 |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
38 function dump_prefs (fid) |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
39 |
19230 | 40 persistent warned = false; |
41 if (! warned) | |
42 warned = true; | |
43 warning ("Octave:deprecated-function", | |
44 "dump_prefs is obsolete and will be removed from a future version of Octave, recode using individual preference get/set routines"); | |
45 endif | |
46 | |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
47 if (nargin > 1) |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
48 print_usage (); |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
49 endif |
799 | 50 |
51 if (nargin == 0) | |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
52 fid = stdout; |
799 | 53 endif |
54 | |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
55 ## FIXME: It would be nice to be able to get the list of built-in variables |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
56 ## directly from Octave so that we wouldn't have to remember to update it |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
57 ## each time the list of preference variables changes |
799 | 58 |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
59 ## FIXME: Update this list for 4.2.0 release |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
60 ## Example, 'gnuplot_command_end' is no longer valid. |
5868 | 61 |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
62 pref_list = {"EDITOR" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
63 "EXEC_PATH" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
64 "IMAGE_PATH" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
65 "PAGER" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
66 "PS1" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
67 "PS2" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
68 "PS4" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
69 "beep_on_error" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
70 "completion_append_char" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
71 "crash_dumps_octave_core" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
72 "echo_executing_commands" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
73 "fixed_point_format" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
74 "gnuplot_binary" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
75 "gnuplot_command_end" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
76 "gnuplot_command_plot" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
77 "gnuplot_command_replot" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
78 "gnuplot_command_splot" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
79 "gnuplot_command_title" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
80 "gnuplot_command_using" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
81 "gnuplot_command_with" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
82 "history_file" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
83 "history_size" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
84 "ignore_function_time_stamp" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
85 "info_file" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
86 "info_program" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
87 "makeinfo_program" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
88 "max_recursion_depth" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
89 "output_max_field_width" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
90 "output_precision" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
91 "page_output_immediately" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
92 "page_screen_output" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
93 "print_answer_id_name" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
94 "print_empty_dimensions" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
95 "save_precision" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
96 "saving_history" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
97 "sighup_dumps_octave_core" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
98 "sigterm_dumps_octave_core" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
99 "silent_functions" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
100 "split_long_rows" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
101 "string_fill_char" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
102 "struct_levels_to_print" |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
103 "suppress_verbose_help_message"}; |
3163 | 104 |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
105 for i = 1:rows (pref_list) |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
106 pref = pref_list{i}; |
3163 | 107 try |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
108 val = feval (pref); |
5868 | 109 if (isnumeric (val)) |
10549 | 110 val = sprintf ("%g", val); |
5868 | 111 endif |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
112 fprintf (fid, " %s = %s\n", pref, val); |
3163 | 113 catch |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
114 fprintf (fid, "# %s = <no value or error in displaying it>\n", pref); |
3163 | 115 end_try_catch |
116 endfor | |
799 | 117 |
118 endfunction | |
17338
1c89599167a6
maint: End m-files with 1 blank line.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
119 |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
120 |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
121 %!error dump_prefs (1,2) |
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
18891
diff
changeset
|
122 |