X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2FsfmP.h;h=8fb79e3f70f06b521ef0ae25501aec1726b19978;hb=a1887dd91b27990bba31adb888a4273379a4bf8c;hp=d03ba042b73732084398ebe4de9c8dce85250b21;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp-builds.git diff --git a/src/sfmP.h b/src/sfmP.h index d03ba042..8fb79e3f 100644 --- a/src/sfmP.h +++ b/src/sfmP.h @@ -21,27 +21,61 @@ structures. */ /* This attribute might avoid some problems. On the other hand... */ -#define P __attribute__((packed)) +#define P ATTRIBUTE ((packed)) #if __BORLANDC__ #pragma option -a- /* Turn off alignment. */ #endif +/* Find 32-bit signed integer type. */ +#if SIZEOF_SHORT == 4 + #define int32 short +#elif SIZEOF_INT == 4 + #define int32 int +#elif SIZEOF_LONG == 4 + #define int32 long +#else + #error Which one of your basic types is 32-bit signed integer? +#endif + +/* Find 64-bit floating-point type. */ +#if SIZEOF_FLOAT == 8 + #define flt64 float + #define FLT64_MAX FLT_MAX +#elif SIZEOF_DOUBLE == 8 + #define flt64 double + #define FLT64_MAX DBL_MAX +#elif SIZEOF_LONG_DOUBLE == 8 + #define flt64 long double + #define FLT64_MAX LDBL_MAX +#else + #error Which one of your basic types is 64-bit floating point? + #define flt64 double + #define FLT64_MAX DBL_MAX +#endif + +/* Figure out SYSMIS value for flt64. */ +#if SIZEOF_DOUBLE == 8 +#define second_lowest_flt64 second_lowest_value +#else +#error Must define second_lowest_flt64 for your architecture. +#endif + /* Record Type 1: General Information. */ struct sysfile_header { - char rec_type[4] P; /* Record-type code, "$FL2". */ - char prod_name[60] P; /* Product identification. */ - int32 layout_code P; /* 2. */ - int32 case_size P; /* Number of `value's per case. */ - int32 compressed P; /* 1=compressed, 0=not compressed. */ - int32 weight_index P; /* 1-based index of weighting var, or zero. */ - int32 ncases P; /* Number of cases, -1 if unknown. */ - flt64 bias P; /* Compression bias (100.0). */ - char creation_date[9] P; /* `dd mmm yy' creation date of file. */ - char creation_time[8] P; /* `hh:mm:ss' 24-hour creation time. */ - char file_label[64] P; /* File label. */ - char padding[3] P; /* Ignored padding. */ + char rec_type[4] P; /* 00: Record-type code, "$FL2". */ + char prod_name[60] P; /* 04: Product identification. */ + int32 layout_code P; /* 40: 2. */ + int32 case_size P; /* 44: Number of `value's per case. */ + int32 compress P; /* 48: 1=compressed, 0=not compressed. */ + int32 weight_idx P; /* 4c: 1-based index of weighting var, or 0. */ + int32 case_cnt P; /* 50: Number of cases, -1 if unknown. */ + flt64 bias P; /* 54: Compression bias (100.0). */ + char creation_date[9] P; /* 5c: `dd mmm yy' creation date of file. */ + char creation_time[8] P; /* 65: `hh:mm:ss' 24-hour creation time. */ + char file_label[64] P; /* 6d: File label. */ + char padding[3] P; /* ad: Ignored padding. */ }; /* Record Type 2: Variable. */