-static int viewlength = 24;
-static int viewwidth = 79;
-static bool long_view = false;
-
-static bool safer_mode = false;
-
-static bool do_echo = false;
-static bool include = true;
-
-static int epoch = -1;
-
-static bool errorbreak = false;
-
-static bool route_errors_to_terminal = true;
-static bool route_errors_to_listing = true;
-
-static bool scompress = true;
-
-static bool undefined = true;
-static double blanks = SYSMIS;
-
-static int mxwarns = 100;
-static int mxerrs = 100;
-
-static bool printback = true;
-static bool mprint = true;
-
-static int mxloops = 1;
-
-static bool nulline = true;
-
-static char endcmd = '.';
-
-static size_t workspace = 4L * 1024 * 1024;
-
-static struct fmt_spec default_format = {FMT_F, 8, 2};
-
-static bool testing_mode = false;
-
-static int global_algorithm = ENHANCED;
-static int cmd_algorithm = ENHANCED;
-static int *algorithm = &global_algorithm;
-
-static int syntax = ENHANCED;
-
-static void init_viewport (void);
-static void get_termcap_viewport (void);
-
+struct settings
+{
+ /* Integer format used for IB and PIB input. */
+ enum integer_format input_integer_format;
+
+ /* Floating-point format used for RB and RBHEX input. */
+ enum float_format input_float_format;
+
+ /* Format of integers in output (SET WIB). */
+ enum integer_format output_integer_format;
+
+ /* Format of reals in output (SET WRB). */
+ enum float_format output_float_format;
+
+ int viewlength;
+ int viewwidth;
+ bool safer_mode;
+ bool include;
+ bool route_errors_to_terminal;
+ bool route_errors_to_listing;
+ bool scompress;
+ bool undefined;
+ double blanks;
+ int max_messages[MSG_N_SEVERITIES];
+ bool printback;
+
+ /* Macro settings. */
+ bool mexpand; /* Expand macros? */
+ bool mprint; /* Print macro expansions? */
+ int miterate; /* Maximum iterations of !FOR. */
+ int mnest; /* Maximum nested macro expansion levels. */
+
+ int mxloops;
+ size_t workspace;
+ struct fmt_spec default_format;
+ bool testing_mode;
+ int fuzzbits;
+
+ int cmd_algorithm;
+ int global_algorithm;
+ int syntax;
+
+ struct fmt_settings styles;
+ double small;
+
+ enum settings_output_devices output_routing[SETTINGS_N_OUTPUT_TYPES];
+
+ enum settings_value_show show_values;
+ enum settings_value_show show_variables;
+};
+
+static struct settings the_settings = {
+ .input_integer_format = INTEGER_NATIVE,
+ .input_float_format = FLOAT_NATIVE_DOUBLE,
+ .output_integer_format = INTEGER_NATIVE,
+ .output_float_format = FLOAT_NATIVE_DOUBLE,
+ .viewlength = 24,
+ .viewwidth = 79,
+ .safer_mode = false,
+ .include = true,
+ .route_errors_to_terminal = true,
+ .route_errors_to_listing = true,
+ .scompress = true,
+ .undefined = true,
+ .blanks = SYSMIS,
+
+ .max_messages = {
+ [MSG_S_ERROR] = 100,
+ [MSG_S_WARNING] = 100,
+ [MSG_S_NOTE] = 100
+ },
+
+ .printback = true,
+
+ .mexpand = true,
+ .mprint = false,
+ .miterate = 1000,
+ .mnest = 50,
+
+ .mxloops = 40,
+ .workspace = 64L * 1024 * 1024,
+ .default_format = { .type = FMT_F, .w = 8, .d = 2 },
+ .testing_mode = false,
+ .fuzzbits = 6,
+ .cmd_algorithm = ENHANCED,
+ .global_algorithm = ENHANCED,
+ .syntax = ENHANCED,
+ .styles = FMT_SETTINGS_INIT,
+ .small = .0001,
+
+ /* output_routing */
+ .output_routing = {
+#define LT (SETTINGS_DEVICE_LISTING | SETTINGS_DEVICE_TERMINAL)
+ [SETTINGS_OUTPUT_ERROR] = LT,
+ [SETTINGS_OUTPUT_NOTE] = LT,
+ [SETTINGS_OUTPUT_SYNTAX] = 0,
+ [SETTINGS_OUTPUT_RESULT] = LT
+#undef LT
+ },
+
+ .show_values = SETTINGS_VALUE_SHOW_LABEL,
+ .show_variables = SETTINGS_VALUE_SHOW_LABEL,
+};
+
+/* Initializes the settings module. */