Next: Formatted Data Input and Output, Previous: Obtaining Properties of Format Types, Up: Input and Output Formats [Contents][Index]
Each of the basic numeric formats (F, E, COMMA, DOT, DOLLAR, PCT) and
custom currency formats (CCA, CCB, CCC, CCD, CCE) has an associated
numeric formatting style, represented by struct fmt_number_style
.
Input and output conversion of formats that have numeric styles is
determined mainly by the style, although the formatting rules have
special cases that are not represented within the style.
A structure type with the following members:
struct substring neg_prefix
struct substring prefix
struct substring suffix
struct substring neg_suffix
A set of strings used a prefix to negative numbers, a prefix to every
number, a suffix to every number, and a suffix to negative numbers,
respectively. Each of these strings is no more than
FMT_STYLE_AFFIX_MAX
bytes (currently 16) bytes in length.
These strings must be freed with ss_dealloc
when no longer
needed.
decimal
The character used as a decimal point. It must be either ‘.’ or ‘,’.
grouping
The character used for grouping digits to the left of the decimal
point. It may be ‘.’ or ‘,’, in which case it must not be
equal to decimal
, or it may be set to 0 to disable grouping.
The following functions are provided for working with numeric formatting styles.
Initialises a struct fmt_number_style
with all of the
prefixes and suffixes set to the empty string, ‘.’ as the decimal
point character, and grouping disables.
Destroys style, freeing its storage.
A function which creates an array of all the styles used by pspp, and calls fmt_number_style_init on each of them.
A wrapper function which takes an array of struct fmt_number_style
, calls
fmt_number_style_destroy on each of them, and then frees the array.
Returns the total length of style’s prefix
and suffix
.
Returns the total length of style’s neg_prefix
and
neg_suffix
.
PSPP maintains a global set of number styles for each of the basic numeric formats and custom currency formats. The following functions work with these global styles:
Returns the numeric style for the given format type.
Returns the name of the given format type.
Next: Formatted Data Input and Output, Previous: Obtaining Properties of Format Types, Up: Input and Output Formats [Contents][Index]