+
+/* Returns the decimal point character for TYPE. */
+int
+settings_get_decimal_char (enum fmt_type type)
+{
+ return fmt_get_style (the_settings.styles, type)->decimal;
+}
+
+void
+settings_set_decimal_char (char decimal)
+{
+ fmt_set_decimal (the_settings.styles, decimal);
+}
+
+
+
+/* Returns the number formatting style associated with the given
+ format TYPE. */
+const struct fmt_number_style *
+settings_get_style (enum fmt_type type)
+{
+ assert (is_fmt_type (type));
+ return &the_settings.styles[type];
+}
+
+
+/* Returns a string of the form "$#,###.##" according to FMT,
+ which must be of type FMT_DOLLAR. The caller must free the
+ string. */
+char *
+settings_dollar_template (const struct fmt_spec *fmt)
+{
+ const struct fmt_number_style *styles = the_settings.styles;
+ struct string str = DS_EMPTY_INITIALIZER;
+ int c;
+ const struct fmt_number_style *fns ;
+
+ assert (fmt->type == FMT_DOLLAR);
+
+ fns = fmt_get_style (styles, fmt->type);
+
+ ds_put_char (&str, '$');
+ for (c = MAX (fmt->w - fmt->d - 1, 0); c > 0; )
+ {
+ ds_put_char (&str, '#');
+ if (--c % 4 == 0 && c > 0)
+ {
+ ds_put_char (&str, fns->grouping);
+ --c;
+ }
+ }
+ if (fmt->d > 0)
+ {
+ ds_put_char (&str, fns->decimal);
+ ds_put_char_multiple (&str, '#', fmt->d);
+ }
+
+ return ds_cstr (&str);
+}
+
+void
+settings_set_output_routing (enum settings_output_type type,
+ enum settings_output_devices devices)
+{
+ assert (type < SETTINGS_N_OUTPUT_TYPES);
+ the_settings.output_routing[type] = devices;
+}
+
+enum settings_output_devices
+settings_get_output_routing (enum settings_output_type type)