+union value;
+
+/* Initialization. */
+void fmt_init (void);
+void fmt_done (void);
+
+/* Constructing formats. */
+struct fmt_spec fmt_for_input (enum fmt_type, int w, int d) PURE_FUNCTION;
+struct fmt_spec fmt_for_output (enum fmt_type, int w, int d) PURE_FUNCTION;
+struct fmt_spec fmt_for_output_from_input (const struct fmt_spec *);
+
+/* Verifying formats. */
+bool fmt_check (const struct fmt_spec *, bool for_input);
+bool fmt_check_input (const struct fmt_spec *);
+bool fmt_check_output (const struct fmt_spec *);
+bool fmt_check_type_compat (const struct fmt_spec *, int var_type);
+bool fmt_check_width_compat (const struct fmt_spec *, int width);
+
+/* Working with formats. */
+int fmt_var_width (const struct fmt_spec *);
+char *fmt_to_string (const struct fmt_spec *, char s[FMT_STRING_LEN_MAX + 1]);
+
+/* Format types. */
+const char *fmt_name (enum fmt_type) PURE_FUNCTION;
+bool fmt_from_name (const char *name, enum fmt_type *);
+
+bool fmt_takes_decimals (enum fmt_type) PURE_FUNCTION;
+
+int fmt_min_input_width (enum fmt_type) PURE_FUNCTION;
+int fmt_max_input_width (enum fmt_type) PURE_FUNCTION;
+int fmt_max_input_decimals (enum fmt_type, int width) PURE_FUNCTION;
+int fmt_min_output_width (enum fmt_type) PURE_FUNCTION;
+int fmt_max_output_width (enum fmt_type) PURE_FUNCTION;
+int fmt_max_output_decimals (enum fmt_type, int width) PURE_FUNCTION;
+int fmt_step_width (enum fmt_type) PURE_FUNCTION;
+
+bool fmt_is_string (enum fmt_type) PURE_FUNCTION;
+bool fmt_is_numeric (enum fmt_type) PURE_FUNCTION;
+enum fmt_category fmt_get_category (enum fmt_type) PURE_FUNCTION;
+
+enum fmt_type fmt_input_to_output (enum fmt_type) PURE_FUNCTION;
+
+int fmt_to_io (enum fmt_type) PURE_FUNCTION;
+bool fmt_from_io (int io, enum fmt_type *);
+
+bool fmt_usable_for_input (enum fmt_type) PURE_FUNCTION;
+const char *fmt_date_template (enum fmt_type) PURE_FUNCTION;
+\f
+/* Maximum length of prefix or suffix string in
+ struct fmt_number_style. */
+#define FMT_STYLE_AFFIX_MAX 16
+
+/* A numeric output style. */
+struct fmt_number_style
+ {
+ struct substring neg_prefix; /* Negative prefix. */
+ struct substring prefix; /* Prefix. */
+ struct substring suffix; /* Suffix. */
+ struct substring neg_suffix; /* Negative suffix. */
+ char decimal; /* Decimal point: '.' or ','. */
+ char grouping; /* Grouping character: ',', '.', or 0. */
+ };
+
+struct fmt_number_style *fmt_number_style_create (void);
+void fmt_number_style_destroy (struct fmt_number_style *);
+
+const struct fmt_number_style *fmt_get_style (enum fmt_type);
+void fmt_set_style (enum fmt_type, struct fmt_number_style *);
+
+int fmt_affix_width (const struct fmt_number_style *);
+int fmt_neg_affix_width (const struct fmt_number_style *);
+
+int fmt_decimal_char (enum fmt_type);
+int fmt_grouping_char (enum fmt_type);