The string value @code{s}, intended to be presented to the user
formatted according to @code{format}. The format for a string is not
too interesting, and the corpus contains many clearly invalid formats
-like A16.39 or A255.127 or A134.1, so readers should probably ignore
-the format entirely.
+like A16.39 or A255.127 or A134.1, so readers should probably entirely
+disregard the format. PSPP only checks @code{format} to distinguish
+AHEX format.
@code{s} is a value of variable @code{var-name} and has value label
@code{value-label}. @code{var-name} is never empty but
if (error)
return NULL;
out->string.s = xstrdup (in->type_04.s);
+ out->string.hex = (in->type_04.format >> 16) == fmt_to_io (FMT_AHEX);
out->string.var_name = xstrdup (in->type_04.var_name);
out->string.value_label = xstrdup_if_nonempty (in->type_04.value_label);
break;
case PIVOT_VALUE_STRING:
put_byte (buf, 4);
put_value_mod (buf, value, NULL);
- put_format (buf,
- &(struct fmt_spec) { FMT_A, strlen (value->string.s), 0 },
- false);
+ size_t len = strlen (value->string.s);
+ if (value->string.hex)
+ put_format (buf, &(struct fmt_spec) { FMT_AHEX, len * 2, 0 }, false);
+ else
+ put_format (buf, &(struct fmt_spec) { FMT_A, len, 0 }, false);
put_string (buf, value->string.value_label);
put_string (buf, value->string.var_name);
put_show_values (buf, value->string.show);