Next: , Previous: Values, Up: Basic Concepts


2.2 Input and Output Formats

Input and output formats specify how to convert data fields to and from data values (see Input and Output Formats). PSPP uses struct fmt_spec to represent input and output formats.

Function prototypes and other declarations related to formats are in the <data/format.h> header.

— Structure: struct fmt_spec

An input or output format, with the following members:

enum fmt_type type
The format type (see below).
int w
Field width, in bytes. The width of numeric fields is always between 1 and 40 bytes, and the width of string fields is always between 1 and 65534 bytes. However, many individual types of formats place stricter limits on field width (see fmt_max_input_width, fmt_max_output_width).
int d
Number of decimal places, in character positions. For format types that do not allow decimal places to be specified, this value must be 0. Format types that do allow decimal places have type-specific and often width-specific restrictions on d (see fmt_max_input_decimals, fmt_max_output_decimals).

— Enumeration: enum fmt_type

An enumerated type representing an input or output format type. Each PSPP input and output format has a corresponding enumeration constant prefixed by `FMT': FMT_F, FMT_COMMA, FMT_DOT, and so on.

The following sections describe functions for manipulating formats and the data in fields represented by formats.