2847
|
1 ## Copyright (C) 1996, 1997 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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
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 |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, USA. |
799
|
19 |
3449
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} dump_prefs (@var{file}) |
|
22 ## Have Octave dump all the current user preference variables to |
|
23 ## @var{file} in a format that can be parsed by Octave later. If |
|
24 ## @var{file} is omitted, the listing is printed to stdout. |
|
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 |
3163
|
35 ## XXX FIXME XXX -- it would be nice to be able to get the list of |
|
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 |
3163
|
40 var_list = ["EDITOR"; |
3426
|
41 "EXEC_PATH"; |
|
42 "IMAGEPATH"; |
|
43 "INFO_FILE"; |
|
44 "INFO_PROGRAM"; |
|
45 "LOADPATH"; |
|
46 "PAGER"; |
|
47 "PS1"; |
|
48 "PS2"; |
|
49 "PS4"; |
|
50 "automatic_replot"; |
|
51 "beep_on_error"; |
|
52 "completion_append_char"; |
|
53 "default_eval_print_flag"; |
|
54 "default_global_variable_value"; |
|
55 "default_return_value"; |
|
56 "default_save_format"; |
|
57 "define_all_return_values"; |
|
58 "do_fortran_indexing"; |
|
59 "echo_executing_commands"; |
|
60 "empty_list_elements_ok"; |
|
61 "fixed_point_format"; |
|
62 "gnuplot_binary"; |
|
63 "gnuplot_command_end"; |
|
64 "gnuplot_command_plot"; |
|
65 "gnuplot_command_replot"; |
|
66 "gnuplot_command_splot"; |
|
67 "gnuplot_command_title"; |
|
68 "gnuplot_command_using"; |
|
69 "gnuplot_command_with"; |
|
70 "gnuplot_has_frames"; |
|
71 "gnuplot_has_multiplot"; |
|
72 "history_file"; |
|
73 "history_size"; |
|
74 "ignore_function_time_stamp"; |
|
75 "implicit_num_to_str_ok"; |
|
76 "implicit_str_to_num_ok"; |
|
77 "initialize_global_variables"; |
|
78 "max_recursion_depth"; |
|
79 "ok_to_lose_imaginary_part"; |
|
80 "output_max_field_width"; |
|
81 "output_precision"; |
|
82 "page_output_immediately"; |
|
83 "page_screen_output"; |
|
84 "prefer_column_vectors"; |
|
85 "print_answer_id_name"; |
|
86 "print_empty_dimensions"; |
|
87 "print_rhs_assign_val"; |
|
88 "propagate_empty_matrices"; |
|
89 "resize_on_range_error"; |
|
90 "return_last_computed_value"; |
|
91 "save_precision"; |
|
92 "saving_history"; |
|
93 "silent_functions"; |
|
94 "split_long_rows"; |
|
95 "string_fill_char"; |
|
96 "struct_levels_to_print"; |
|
97 "suppress_verbose_help_message"; |
|
98 "treat_neg_dim_as_zero"; |
|
99 "warn_assign_as_truth_value"; |
|
100 "warn_divide_by_zero"; |
|
101 "warn_function_name_clash"; |
|
102 "warn_future_time_stamp"; |
|
103 "warn_missing_semicolon"; |
|
104 "warn_variable_switch_label"; |
|
105 "whitespace_in_literal_matrix"]; |
3163
|
106 |
|
107 for i = 1:rows(var_list) |
|
108 var = deblank (var_list(i,:)); |
|
109 try |
|
110 fprintf (file, " %s = %s\n", var, type ("-q", var)); |
|
111 catch |
|
112 fprintf (file, "# %s = <no value or error in displaying it>\n", var); |
|
113 end_try_catch |
|
114 endfor |
799
|
115 |
|
116 endfunction |