Get rid of our own int32 type in favor of the standard int32_t type.
[pspp-builds.git] / src / data / sfm-private.h
1 /* PSPP - computes sample statistics.
2    Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3    Written by Ben Pfaff <blp@gnu.org>.
4
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18    02110-1301, USA. */
19
20 /* PORTME: There might easily be alignment problems with some of these
21    structures. */
22
23 #include <libpspp/compiler.h>
24 #include <stdint.h>
25 #include "variable.h"
26
27 /* This attribute might avoid some problems.  On the other hand... */
28 #define P ATTRIBUTE ((packed))
29
30 #if __BORLANDC__
31 #pragma option -a-              /* Turn off alignment. */
32 #endif
33
34 /* Find 64-bit floating-point type. */
35 #if SIZEOF_FLOAT == 8
36   #define flt64 float
37   #define FLT64_MAX FLT_MAX
38 #elif SIZEOF_DOUBLE == 8
39   #define flt64 double
40   #define FLT64_MAX DBL_MAX
41 #elif SIZEOF_LONG_DOUBLE == 8
42   #define flt64 long double
43   #define FLT64_MAX LDBL_MAX
44 #else
45   #error Which one of your basic types is 64-bit floating point?
46   #define flt64 double
47   #define FLT64_MAX DBL_MAX
48 #endif
49
50 /* Figure out SYSMIS value for flt64. */
51 #include <libpspp/magic.h>
52 #if SIZEOF_DOUBLE == 8
53 #define second_lowest_flt64 second_lowest_value
54 #else
55 #error Must define second_lowest_flt64 for your architecture.
56 #endif
57
58 /* Record Type 1: General Information. */
59 struct sysfile_header
60   {
61     char rec_type[4] P;         /* 00: Record-type code, "$FL2". */
62     char prod_name[60] P;       /* 04: Product identification. */
63     int32_t layout_code P;      /* 40: 2. */
64     int32_t case_size P;        /* 44: Number of `value's per case. 
65                                    Note: some systems set this to -1 */
66     int32_t compress P;         /* 48: 1=compressed, 0=not compressed. */
67     int32_t weight_idx P;         /* 4c: 1-based index of weighting var, or 0. */
68     int32_t case_cnt P;         /* 50: Number of cases, -1 if unknown. */
69     flt64 bias P;               /* 54: Compression bias (100.0). */
70     char creation_date[9] P;    /* 5c: `dd mmm yy' creation date of file. */
71     char creation_time[8] P;    /* 65: `hh:mm:ss' 24-hour creation time. */
72     char file_label[64] P;      /* 6d: File label. */
73     char padding[3] P;          /* ad: Ignored padding. */
74   };
75
76 /* Record Type 2: Variable. */
77 struct sysfile_variable
78   {
79     int32_t rec_type P;         /* 2. */
80     int32_t type P;             /* 0=numeric, 1-255=string width,
81                                    -1=continued string. */
82     int32_t has_var_label P;    /* 1=has a variable label, 0=doesn't. */
83     int32_t n_missing_values P; /* Missing value code of -3,-2,0,1,2, or 3. */
84     int32_t print P;    /* Print format. */
85     int32_t write P;    /* Write format. */
86     char name[SHORT_NAME_LEN] P; /* Variable name. */
87     /* The rest of the structure varies. */
88   };
89
90 #if __BORLANDC__
91 #pragma -a4
92 #endif