Mercurial > hg > octave-lyh
annotate scripts/miscellaneous/dump_prefs.m @ 14459:a22a41ab6824
doc: Add Colin Macdonald and Mike Miller to contributors.in
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Tue, 13 Mar 2012 01:30:26 -0400 |
parents | 72c96de7a403 |
children | 5d3a684236b0 |
rev | line source |
---|---|
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
12528
diff
changeset
|
1 ## Copyright (C) 1994-2012 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}) |
12527
30ee8f0cc7c2
Add dump_prefs to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
22 ## Dump all of the current user preference variables in a format that can be |
30ee8f0cc7c2
Add dump_prefs to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
23 ## parsed by Octave later. @var{fid} is a file descriptor as returned by |
30ee8f0cc7c2
Add dump_prefs to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
24 ## @code{fopen}. If @var{file} is omitted, the listing is printed to stdout. |
3449 | 25 ## @end deftypefn |
799 | 26 |
2314 | 27 ## Author: jwe |
28 | |
2311 | 29 function dump_prefs (file) |
799 | 30 |
31 if (nargin == 0) | |
32 file = stdout; | |
33 endif | |
34 | |
5775 | 35 ## FIXME -- it would be nice to be able to get the list of |
3163 | 36 ## built-in variables directly from Octave so that we wouldn't have to |
37 ## remember to update it each time the list of preference variables | |
38 ## changes | |
799 | 39 |
5868 | 40 ## Note that these are no longer variables. |
41 | |
42 sym_list = ["EDITOR"; | |
3426 | 43 "EXEC_PATH"; |
5868 | 44 "IMAGE_PATH"; |
3426 | 45 "PAGER"; |
46 "PS1"; | |
47 "PS2"; | |
48 "PS4"; | |
49 "beep_on_error"; | |
50 "completion_append_char"; | |
4451 | 51 "crash_dumps_octave_core"; |
3426 | 52 "echo_executing_commands"; |
53 "fixed_point_format"; | |
54 "gnuplot_binary"; | |
55 "gnuplot_command_end"; | |
56 "gnuplot_command_plot"; | |
57 "gnuplot_command_replot"; | |
58 "gnuplot_command_splot"; | |
59 "gnuplot_command_title"; | |
60 "gnuplot_command_using"; | |
61 "gnuplot_command_with"; | |
62 "history_file"; | |
63 "history_size"; | |
64 "ignore_function_time_stamp"; | |
5794 | 65 "info_file"; |
66 "info_program"; | |
67 "makeinfo_program"; | |
3426 | 68 "max_recursion_depth"; |
69 "output_max_field_width"; | |
70 "output_precision"; | |
71 "page_output_immediately"; | |
72 "page_screen_output"; | |
73 "print_answer_id_name"; | |
74 "print_empty_dimensions"; | |
75 "save_precision"; | |
76 "saving_history"; | |
4451 | 77 "sighup_dumps_octave_core"; |
78 "sigterm_dumps_octave_core"; | |
3426 | 79 "silent_functions"; |
80 "split_long_rows"; | |
81 "string_fill_char"; | |
82 "struct_levels_to_print"; | |
5868 | 83 "suppress_verbose_help_message"]; |
3163 | 84 |
5868 | 85 for i = 1:rows(sym_list) |
86 sym = deblank (sym_list(i,:)); | |
3163 | 87 try |
5868 | 88 val = feval (sym); |
89 if (isnumeric (val)) | |
10549 | 90 val = sprintf ("%g", val); |
5868 | 91 endif |
92 fprintf (file, " %s = %s\n", sym, val); | |
3163 | 93 catch |
5868 | 94 fprintf (file, "# %s = <no value or error in displaying it>\n", sym); |
3163 | 95 end_try_catch |
96 endfor | |
799 | 97 |
98 endfunction |