--- /dev/null
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 2010 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef PSPP_SAV_H
+#define PSPP_SAV_H 1
+
+struct pspp_sav_header
+ {
+ char *product;
+ int compressed;
+ int weight_index;
+ int n_cases;
+ double bias;
+ time_t created;
+ char *file_label;
+ };
+
+/* Values for 'type' member of struct pspp_sav_format. */
+#define PSPP_SAV_FMT_A 1
+#define PSPP_SAV_FMT_AHEX 2
+#define PSPP_SAV_FMT_COMMA 3
+#define PSPP_SAV_FMT_DOLLAR 4
+#define PSPP_SAV_FMT_F 5
+#define PSPP_SAV_FMT_IB 6
+#define PSPP_SAV_FMT_PIBHEX 7
+#define PSPP_SAV_FMT_P 8
+#define PSPP_SAV_FMT_PIB 9
+#define PSPP_SAV_FMT_PK 10
+#define PSPP_SAV_FMT_RB 11
+#define PSPP_SAV_FMT_RBHEX 12
+/* 13 and 14 are not used. */
+#define PSPP_SAV_FMT_Z 15
+#define PSPP_SAV_FMT_N 16
+#define PSPP_SAV_FMT_E 17
+/* 18 and 19 are not used. */
+#define PSPP_SAV_FMT_DATE 20
+#define PSPP_SAV_FMT_TIME 21
+#define PSPP_SAV_FMT_DATETIME 22
+#define PSPP_SAV_FMT_ADATE 23
+#define PSPP_SAV_FMT_JDATE 24
+#define PSPP_SAV_FMT_DTIME 25
+#define PSPP_SAV_FMT_WKDAY 26
+#define PSPP_SAV_FMT_MONTH 27
+#define PSPP_SAV_FMT_MOYR 28
+#define PSPP_SAV_FMT_QYR 29
+#define PSPP_SAV_FMT_WKYR 30
+#define PSPP_SAV_FMT_PCT 31
+#define PSPP_SAV_FMT_DOT 32
+#define PSPP_SAV_FMT_CCA 33
+#define PSPP_SAV_FMT_CCB 34
+#define PSPP_SAV_FMT_CCC 35
+#define PSPP_SAV_FMT_CCD 36
+#define PSPP_SAV_FMT_CCE 37
+#define PSPP_SAV_FMT_EDATE 38
+#define PSPP_SAV_FMT_SDATE 39
+
+struct pspp_sav_format
+ {
+ int type; /* One of PSPP_SAV_FMT_*. */
+ int w; /* Width. */
+ int d; /* Number of decimal places, 0 for strings. */
+ };
+
+union pspp_sav_value
+ {
+ double number;
+ char *string;
+ };
+
+struct pspp_sav_missing_values
+ {
+ size_t n_values;
+ union pspp_sav_value *values;
+
+ int has_range;
+ int range_lowest;
+ int range_highest;
+ union pspp_sav_value lo, hi;
+ };
+
+struct pspp_sav_variable
+ {
+ char *short_name;
+ int width;
+ char *var_label;
+ struct pspp_sav_format print;
+ struct pspp_sav_format write;
+ struct pspp_sav_missing_values missing;
+ };
+
+struct pspp_sav_value_label
+ {
+ union pspp_sav_value value;
+ char *label;
+ };
+
+struct pspp_sav_value_labels
+ {
+ /* The variables that are labeled. */
+ int *var_indexes;
+ size_t n_vars;
+
+ /* The labels. */
+ struct pspp_sav_value_label *labels;
+ size_t n_labels;
+ };
+
+struct pspp_sav_document
+ {
+ char **lines;
+ size_t n_lines;
+ };
+
+#define PSPP_SAV_FP_IEEE754 1
+#define PSPP_SAV_FP_IBM370 2
+#define PSPP_SAV_FP_DECVAXE 3
+
+#define PSPP_SAV_ENDIAN_BIG 1
+#define PSPP_SAV_ENDIAN_LITTLE 2
+
+#define PSPP_SAV_CC_EBCDIC 1
+#define PSPP_SAV_CC_ASCII7 2
+#define PSPP_SAV_CC_ASCII8 3
+#define PSPP_SAV_CC_DECKANJI 4
+
+struct pspp_sav_integer_info
+ {
+ int version_major;
+ int version_minor;
+ int version_revision;
+ int machine_code;
+ int float_rep;
+ int compression_code;
+ int endianness;
+ int character_code;
+ };
+
+struct pspp_sav_float_info
+ {
+ double sysmis;
+ double highest;
+ double lowest;
+ };
+
+/* Type of a multiple response set. */
+#define PSPP_SAV_MRSET_MDGROUP 0 /* Multiple dichotomy group. */
+#define PSPP_SAV_MRSET_MCGROUP 1 /* Multiple category group. */
+
+/* Source of category labels for a multiple dichotomy group. */
+#define PSPP_SAV_MDGROUP_VARLABELS 0 /* Variable labels. */
+#define PSPP_SAV_MDGROUP_COUNTEDVALUES 1 /* Value labels for counted value. */
+
+struct pspp_sav_mrset
+ {
+ char *name;
+ char *label;
+ char **var_short_names;
+ size_t n_vars;
+ int type; /* One of PSPP_SAV_MRSET_*. */
+
+ /* PSPP_SAV_MRSET_MDGROUP only */
+ int cat_source; /* Source of category labels. */
+ bool label_from_var_label; /* 'label' taken from variable label? */
+ union pspp_sav_value counted; /* Counted value. */
+ int width; /* Width of 'counted'. */
+ };
+
+/* Measurement level. */
+#define PSPP_SAV_MEASURE_UNKNOWN 0
+#define PSPP_SAV_MEASURE_NOMINAL 1
+#define PSPP_SAV_MEASURE_ORDINAL 2
+#define PSPP_SAV_MEASURE_CONTINUOUS 3
+
+/* Alignment. */
+#define PSPP_SAV_ALIGN_LEFT 0
+#define PSPP_SAV_ALIGN_RIGHT 1
+#define PSPP_SAV_ALIGN_CENTER 2
+
+struct pspp_sav_display
+ {
+ int measure; /* One of PSPP_SAV_MEASURE_*. */
+ int width; /* Display width in ems, 0 if not present. */
+ int alignment; /* One of PSPP_SAV_ALIGN_*. */
+ };
+
+struct pspp_sav_display_params
+ {
+ struct pspp_sav_display *params;
+ size_t n_params;
+ };
+
+struct pspp_sav_long_name
+ {
+ char *short_name;
+ char *long_name;
+ };
+
+struct pspp_sav_very_long_string
+ {
+ char *short_name;
+ short int full_width;
+ };
+
+struct pspp_sav_encoding
+ {
+ char *encoding;
+ };
+
+struct pspp_sav_long_string_value_labels
+ {
+ /* Labeled variable. */
+ char *var_name; /* Name of labeled variable. */
+ int width; /* Width of labeled variable, in [9,32767]. */
+
+ /* Labels. */
+ struct pspp_sav_value_label *labels;
+ size_t n_labels;
+ };
+
+struct pspp_sav_attribute
+ {
+ char *long_var_name; /* Variable name (NULL for file attribute). */
+ char *attr_name; /* Attribute name. */
+ char **values; /* All the values. */
+ size_t n_values; /* Number of values. */
+ };
+
+struct pspp_sav_ncases64
+ {
+ long long int n_cases;
+ };
+
+/* Compression opcodes. */
+#define PSPP_SAV_OP_IGNORE 0 /* No-op */
+#define PSPP_SAV_OP_INT_MIN 1 /* Minimum compressed integer opcode. */
+#define PSPP_SAV_OP_INT_MIN 251 /* Maximum compressed integer opcode. */
+#define PSPP_SAV_OP_EOF 252 /* End of data. */
+#define PSPP_SAV_OP_LITERAL 253 /* 8-byte uncompressible data follows. */
+#define PSPP_SAV_OP_SPACES 254 /* Represents 8 bytes of spaces. */
+#define PSPP_SAV_OP_SYSMIS 255 /* Represents system missing value. */
+
+#endif /* pspp-sav.h */