11523
|
1 ## Copyright (C) 1994-2011 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 -*- |
|
20 ## @deftypefn {Function File} {} dump_prefs (@var{file}) |
|
21 ## Have Octave dump all the current user preference variables to |
|
22 ## @var{file} in a format that can be parsed by Octave later. If |
|
23 ## @var{file} is omitted, the listing is printed to stdout. |
|
24 ## @end deftypefn |
799
|
25 |
2314
|
26 ## Author: jwe |
|
27 |
2311
|
28 function dump_prefs (file) |
799
|
29 |
|
30 if (nargin == 0) |
|
31 file = stdout; |
|
32 endif |
|
33 |
5775
|
34 ## FIXME -- it would be nice to be able to get the list of |
3163
|
35 ## built-in variables directly from Octave so that we wouldn't have to |
|
36 ## remember to update it each time the list of preference variables |
|
37 ## changes |
799
|
38 |
5868
|
39 ## Note that these are no longer variables. |
|
40 |
|
41 sym_list = ["EDITOR"; |
3426
|
42 "EXEC_PATH"; |
5868
|
43 "IMAGE_PATH"; |
3426
|
44 "PAGER"; |
|
45 "PS1"; |
|
46 "PS2"; |
|
47 "PS4"; |
|
48 "beep_on_error"; |
|
49 "completion_append_char"; |
4451
|
50 "crash_dumps_octave_core"; |
3426
|
51 "echo_executing_commands"; |
|
52 "fixed_point_format"; |
|
53 "gnuplot_binary"; |
|
54 "gnuplot_command_end"; |
|
55 "gnuplot_command_plot"; |
|
56 "gnuplot_command_replot"; |
|
57 "gnuplot_command_splot"; |
|
58 "gnuplot_command_title"; |
|
59 "gnuplot_command_using"; |
|
60 "gnuplot_command_with"; |
|
61 "history_file"; |
|
62 "history_size"; |
|
63 "ignore_function_time_stamp"; |
5794
|
64 "info_file"; |
|
65 "info_program"; |
|
66 "makeinfo_program"; |
3426
|
67 "max_recursion_depth"; |
|
68 "output_max_field_width"; |
|
69 "output_precision"; |
|
70 "page_output_immediately"; |
|
71 "page_screen_output"; |
|
72 "print_answer_id_name"; |
|
73 "print_empty_dimensions"; |
|
74 "save_precision"; |
|
75 "saving_history"; |
4451
|
76 "sighup_dumps_octave_core"; |
|
77 "sigterm_dumps_octave_core"; |
3426
|
78 "silent_functions"; |
|
79 "split_long_rows"; |
|
80 "string_fill_char"; |
|
81 "struct_levels_to_print"; |
5868
|
82 "suppress_verbose_help_message"]; |
3163
|
83 |
5868
|
84 for i = 1:rows(sym_list) |
|
85 sym = deblank (sym_list(i,:)); |
3163
|
86 try |
5868
|
87 val = feval (sym); |
|
88 if (isnumeric (val)) |
10549
|
89 val = sprintf ("%g", val); |
5868
|
90 endif |
|
91 fprintf (file, " %s = %s\n", sym, val); |
3163
|
92 catch |
5868
|
93 fprintf (file, "# %s = <no value or error in displaying it>\n", sym); |
3163
|
94 end_try_catch |
|
95 endfor |
799
|
96 |
|
97 endfunction |