+ return fmt_get_style (type)->grouping;
+}
+
+/* Sets the number style for TYPE to have the given standard
+ PREFIX and SUFFIX, "-" as prefix suffix, an empty negative
+ suffix, DECIMAL as the decimal point character, and GROUPING
+ as the grouping character. */
+static void
+set_style (enum fmt_type type,
+ const char *prefix, const char *suffix,
+ char decimal, char grouping)
+{
+ struct fmt_number_style *style;
+
+ assert (is_fmt_type (type));
+
+ fmt_number_style_destroy (styles[type]);
+
+ style = styles[type] = fmt_number_style_create ();
+ ss_alloc_substring (&style->neg_prefix, ss_cstr ("-"));
+ ss_alloc_substring (&style->prefix, ss_cstr (prefix));
+ ss_alloc_substring (&style->suffix, ss_cstr (suffix));
+ style->decimal = decimal;
+ style->grouping = grouping;
+}
+
+/* Sets the number style for TYPE as with set_style, but only if
+ TYPE has not already been initialized. */
+static void
+init_style (enum fmt_type type,
+ const char *prefix, const char *suffix,
+ char decimal, char grouping)
+{
+ assert (is_fmt_type (type));
+ if (styles[type] == NULL)
+ set_style (type, prefix, suffix, decimal, grouping);
+}
+
+/* Sets the decimal point character to DECIMAL. */
+void
+fmt_set_decimal (char decimal)
+{
+ int grouping = decimal == '.' ? ',' : '.';
+ assert (decimal == '.' || decimal == ',');
+
+ set_style (FMT_F, "", "", decimal, 0);
+ set_style (FMT_E, "", "", decimal, 0);
+ set_style (FMT_COMMA, "", "", decimal, grouping);
+ set_style (FMT_DOT, "", "", grouping, decimal);
+ set_style (FMT_DOLLAR, "$", "", decimal, grouping);
+ set_style (FMT_PCT, "", "%", decimal, 0);
+
+ init_style (FMT_CCA, "", "", decimal, grouping);
+ init_style (FMT_CCB, "", "", decimal, grouping);
+ init_style (FMT_CCC, "", "", decimal, grouping);
+ init_style (FMT_CCD, "", "", decimal, grouping);
+ init_style (FMT_CCE, "", "", decimal, grouping);
+}
+\f
+/* Returns the struct fmt_desc for the given format TYPE. */
+static const struct fmt_desc *
+get_fmt_desc (enum fmt_type type)
+{
+ static const struct fmt_desc formats[FMT_NUMBER_OF_FORMATS] =
+ {
+#define FMT(NAME, METHOD, IMIN, OMIN, IO, CATEGORY) \
+ {#NAME, IMIN, OMIN, IO, CATEGORY},
+#include "format.def"
+ };
+
+ assert (is_fmt_type (type));
+ return &formats[type];