+ assert (fmt_check_output (format));
+ if (format.type == FMT_A)
+ {
+ char *in = CHAR_CAST (char *, input->s);
+ return recode_string_pool (UTF8, input_encoding, in, format.w, pool);
+ }
+ else if (fmt_get_category (format.type) == FMT_CAT_BINARY)
+ {
+ char tmp[16];
+
+ assert (format.w + 1 <= sizeof tmp);
+ converters[format.type] (input, format, settings, tmp);
+ return binary_to_utf8 (tmp, pool);
+ }
+ else
+ {
+ const struct fmt_number_style *style = fmt_settings_get_style (
+ settings, format.type);
+ size_t size = format.w + style->extra_bytes + 1;
+ char *output;
+
+ output = pool_alloc_unaligned (pool, size);
+ converters[format.type] (input, format, settings, output);
+ return output;
+ }
+}
+
+/* Like data_out_pool(), except that for basic numeric formats (F, COMMA, DOT,
+ COLLAR, PCT, E) and custom currency formats are formatted as wide as
+ necessary to fully display the selected number of decimal places. */
+char *
+data_out_stretchy (const union value *input, const char *encoding,
+ struct fmt_spec format,
+ const struct fmt_settings *settings, struct pool *pool)
+{
+
+ if (fmt_get_category (format.type) & (FMT_CAT_BASIC | FMT_CAT_CUSTOM))
+ {
+ const struct fmt_number_style *style
+ = fmt_settings_get_style (settings, format.type);
+ char tmp[128];
+ if (format.w + style->extra_bytes + 1 <= sizeof tmp)
+ {
+ struct fmt_spec wide_format = {
+ .type = format.type,
+ .w = 40,
+ .d = format.d,
+ };
+ output_number (input, wide_format, settings, tmp);
+ return pool_strdup (pool, tmp + strspn (tmp, " "));
+ }
+ }
+
+ return data_out_pool (input, encoding, format, settings, pool);
+}
+
+char *
+data_out (const union value *input, const char *input_encoding,
+ struct fmt_spec format, const struct fmt_settings *settings)
+{
+ return data_out_pool (input, input_encoding, format, settings, NULL);