c499293ebb54a49648297af98ce35119295c7b0d
[pspp] / src / data / settings.h
1 /* PSPP - a program for statistical analysis.
2    Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2015 Free Software Foundation, Inc.
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17 #if !settings_h
18 #define settings_h 1
19
20 #include <stdbool.h>
21 #include <stddef.h>
22
23 #include "data/format.h"
24 #include "libpspp/float-format.h"
25 #include "libpspp/integer-format.h"
26 #include "libpspp/message.h"
27
28 struct caseproto;
29 struct settings;
30
31 void settings_init (void);
32 void settings_done (void);
33
34 struct settings *settings_get (void);
35 void settings_set (const struct settings *);
36 void settings_destroy (struct settings *);
37
38 enum float_format settings_get_input_float_format (void);
39 void settings_set_input_float_format ( enum float_format);
40
41 /* Returns the integer format used for IB and PIB input. */
42 enum integer_format settings_get_input_integer_format (void);
43
44 /* Sets the integer format used for IB and PIB input to
45    FORMAT. */
46 void settings_set_input_integer_format ( enum integer_format);
47
48
49 /* Returns the current output integer format. */
50 enum integer_format settings_get_output_integer_format (void);
51
52 /* Sets the output integer format to INTEGER_FORMAT. */
53 void settings_set_output_integer_format (enum integer_format integer_format);
54
55 /* Returns the current output float format. */
56 enum float_format settings_get_output_float_format (void);
57
58 /* Sets the output float format to FLOAT_FORMAT. */
59 void settings_set_output_float_format (enum float_format float_format);
60
61
62
63 int settings_get_viewlength (void);
64 void settings_set_viewlength ( int);
65
66 int settings_get_viewwidth (void);
67 void settings_set_viewwidth ( int);
68
69 bool settings_get_safer_mode (void);
70 void settings_set_safer_mode (void);
71
72 bool settings_get_include (void);
73 void settings_set_include ( bool);
74
75 int settings_get_epoch (void);
76 void settings_set_epoch ( int);
77
78 bool settings_get_scompression (void);
79 void settings_set_scompression (bool);
80
81 bool settings_get_undefined (void);
82 void settings_set_undefined (bool);
83 double settings_get_blanks (void);
84 void settings_set_blanks (double);
85
86 int settings_get_max_messages (enum msg_severity);
87 void settings_set_max_messages (enum msg_severity, int max);
88
89 bool settings_get_mprint (void);
90 void settings_set_mprint (bool);
91
92 int settings_get_mxloops (void);
93 void settings_set_mxloops ( int);
94
95 size_t settings_get_workspace (void);
96 size_t settings_get_workspace_cases (const struct caseproto *);
97 void settings_set_workspace (size_t);
98
99 const struct fmt_spec *settings_get_format (void);
100 void settings_set_format ( const struct fmt_spec *);
101
102 bool settings_get_testing_mode (void);
103 void settings_set_testing_mode (bool);
104
105 int settings_get_fuzzbits (void);
106 void settings_set_fuzzbits (int);
107
108 enum settings_var_style
109   {
110     SETTINGS_VAR_STYLE_NAMES,
111     SETTINGS_VAR_STYLE_LABELS,
112     SETTINGS_VAR_STYLE_BOTH
113   };
114
115 enum settings_value_style
116   {
117     SETTINGS_VAL_STYLE_VALUES,
118     SETTINGS_VAL_STYLE_LABELS,
119     SETTINGS_VAL_STYLE_BOTH
120   };
121
122
123 enum settings_value_style settings_get_value_style (void);
124 enum settings_var_style settings_get_var_style (void);
125
126 void settings_set_value_style (enum settings_value_style s);
127 void settings_set_var_style (enum settings_var_style s);
128
129
130 enum behavior_mode {
131   ENHANCED,             /* Use improved PSPP behavior. */
132   COMPATIBLE            /* Be as compatible as possible. */
133 };
134
135 enum behavior_mode settings_get_algorithm (void);
136 void settings_set_algorithm (enum behavior_mode);
137 enum behavior_mode settings_get_syntax (void);
138 void settings_set_syntax (enum behavior_mode);
139
140 void settings_set_cmd_algorithm (enum behavior_mode);
141 void unset_cmd_algorithm (void);
142
143 enum fmt_type;
144 bool settings_set_cc (const char *cc_string, enum fmt_type type);
145
146 int settings_get_decimal_char (enum fmt_type type);
147 void settings_set_decimal_char (char decimal);
148
149
150 const struct fmt_number_style * settings_get_style (enum fmt_type type);
151
152 char * settings_dollar_template (const struct fmt_spec *fmt);
153
154 /* Routing of different kinds of output. */
155 enum settings_output_devices
156   {
157     SETTINGS_DEVICE_LISTING = 1 << 0,  /* File or device. */
158     SETTINGS_DEVICE_TERMINAL = 1 << 1, /* Screen. */
159     SETTINGS_DEVICE_UNFILTERED = 1 << 2 /* Gets all output, no filtering. */
160   };
161
162 enum settings_output_type
163   {
164     SETTINGS_OUTPUT_ERROR,      /* Errors and warnings. */
165     SETTINGS_OUTPUT_NOTE,       /* Notes. */
166     SETTINGS_OUTPUT_SYNTAX,     /* Syntax. */
167     SETTINGS_OUTPUT_RESULT,     /* Everything else. */
168     SETTINGS_N_OUTPUT_TYPES
169   };
170
171
172
173 void settings_set_output_routing (enum settings_output_type,
174                                   enum settings_output_devices);
175 enum settings_output_devices settings_get_output_routing (
176   enum settings_output_type);
177
178 #endif /* !settings_h */