+
+static void
+fmt_number_style_init (struct fmt_number_style *style)
+{
+ fmt_affix_set (&style->neg_prefix, "");
+ fmt_affix_set (&style->prefix, "");
+ fmt_affix_set (&style->suffix, "");
+ fmt_affix_set (&style->neg_suffix, "");
+ style->decimal = '.';
+ style->grouping = 0;
+}
+
+static void
+fmt_number_style_clone (struct fmt_number_style *new,
+ const struct fmt_number_style *old)
+{
+ fmt_affix_set (&new->neg_prefix, old->neg_prefix.s);
+ fmt_affix_set (&new->prefix, old->prefix.s);
+ fmt_affix_set (&new->suffix, old->suffix.s);
+ fmt_affix_set (&new->neg_suffix, old->neg_suffix.s);
+ new->decimal = old->decimal;
+ new->grouping = old->grouping;
+}
+
+/* Destroys a struct fmt_number_style. */
+static void
+fmt_number_style_destroy (struct fmt_number_style *style)
+{
+ if (style != NULL)
+ {
+ fmt_affix_free (&style->neg_prefix);
+ fmt_affix_free (&style->prefix);
+ fmt_affix_free (&style->suffix);
+ fmt_affix_free (&style->neg_suffix);
+ }
+}
+
+/* Returns the total width of the standard prefix and suffix for
+ STYLE. */
+int
+fmt_affix_width (const struct fmt_number_style *style)
+{
+ return strlen (style->prefix.s) + strlen (style->suffix.s);
+}
+
+/* Returns the total width of the negative prefix and suffix for
+ STYLE. */
+int
+fmt_neg_affix_width (const struct fmt_number_style *style)
+{
+ return strlen (style->neg_prefix.s) + strlen (style->neg_suffix.s);
+}
+
+/* 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];
+}
+
+const struct fmt_spec F_8_0 = {FMT_F, 8, 0};