/* pdstv.h This file contains structure and constant declarations for the PDS Table Verifier utility 'pdstv'. 08 Mar 2001, A.C.Raugh 26 Feb 2002, acr: Increased precision of max/min found in file 08 Mar 2002. acr: Removed TABLE_TYPE macro (replaced with function) 01 Feb 2003, acr: Expanded structures to accommodate NOT_APPLICABLE and UNKNOWN_CONSTANT values. 03 May 2007, acr: Increased MAXTIMEWIDTH */ /*=========================================================================== Macro Definitions ===========================================================================*/ #define MAXERRORS 10 /* Maximum times to report a single error */ #define MINDATEWIDTH 7 /* YYYY-DDD */ #define MAXDATEWIDTH 10 /* YYYY-MM-DD */ #define MINTIMEWIDTH 11 /* YYYY-DDDThh */ #define MAXTIMEWIDTH 30 /* YYYY-MM-DDThh:mm:ss.ssssssssss */ #define MAXRECORDLENGTH 1000 /* Max input line length for label */ /* Flag Values: */ #define TRUE 1 #define FALSE 0 #define MAX_FOUND 1 #define MIN_FOUND 2 #define BOTH_FOUND 3 #define MSB 1 #define LSB 0 #define NOT_SET -1 #define TRIM_BLANKS 1 #define NO_TRIM_BLANKS 0 /* Return status from "skip_object": */ #define UNEXPECTED_KEYWORD 4 #define ENDOFOBJECT 3 #define ENDOFLABEL 2 #define ENDOFFILE 1 /* Data types: */ #define UNRECOGNIZED 0 #define UNSIGNED_INTEGER 1 #define SIGNED_INTEGER 2 #define REAL 3 #define CHARACTER 4 #define DATE 5 #define TIME 6 #define SPARE 7 #ifndef FLDTYPES #define FLDTYPES static char *field_type[] = /* Column data type translation */ { "Unrecognized", /* 0 */ "Unsigned Integer", /* 1 */ "Signed Integer", /* 2 */ "Real", /* 3 */ "Character", /* 4 */ "Date", /* 5 */ "Time", /* 6 */ "Spare" /* 7 */ }; #endif /* Field types: */ #define COLUMN 100 #define CONTAINER 200 #define NUMERIC_FIELD(A) (A == SIGNED_INTEGER || A == UNSIGNED_INTEGER || \ A == REAL) /*=========================================================================== Structure Definitions ===========================================================================*/ /* Column structure: */ struct colstruct { int bytes; /* Number of bytes in field */ int start_byte; /* First byte, 1-based */ int type; /* Code for field type (defined globally above)*/ int items; /* The number of sub-columns in the column */ int item_bytes; /* Number of bytes per sub-column */ int item_offset; /* Offset between items (may differ from bytes)*/ int msbflag; /* 1 = MSB data; 0 = LDB data; -1 = unset */ union { double dbl; char *str; } max; /* Max field value in file */ union { double dbl; char *str; } min; /* Min field value in file */ int mmflag; /* 1 = max present, 2= min present, 3=both */ union { double dbl; char *str; } vmax; /* Valid max field value */ union { double dbl; char *str; } vmin; /* Valid min field value */ int vmflag; /* 1 = vmax present, 2= vmin present, 3=both */ double dmax,dmin; /* Derived max/min present */ int dmflag; /* same as mmflag for derived values */ double offset; /* zero offset (to apply to values in file) */ double scaling_factor; /* scaling factor (to apply to values in file) */ /* Flags and values for *_CONSTANT keywords */ int invflag; /* true if INVALID_CONSTANT is present */ union { double dbl; char *str; } invalid; /* Null data value */ int missflag; /* true if MISSING_CONSTANT is present */ union { double dbl; char *str; } missing; /* missing data value */ int naflag; /* true if NOT_APPLICABLE_CONSTANT is present */ union { double dbl; char *str; } not_applicable; int unkflag; /* true if UNKNOWN_CONSTANT is present */ union { double dbl; char *str; } unknown; int nullflag; /* true if NULL_CONSTANT is present */ union { double dbl; char *str; } null; int fwidth,fprecision;/* "format" field width and precision values */ char name[62]; /* Name of the field (required) */ char format[51]; /* FORTRAN format descriptor */ char colnum[50]; /* Column index string */ /* Statistics accumulators: */ union { double dbl; /* maximum actual value encountered, double */ int bytes; /* maximum string length encountered */ } maxfound; char *maxstr; /* maximum value string */ union { double dbl; /* minimum actual value encountered, double */ int bytes; /* minimum string length encountered */ } minfound; char *minstr; /* minimum value string */ long int invalidcount; /* number of 'invalid' data values found */ long int missingcount; /* number of data values flagged as 'missing' */ long int nacount; /* number of 'not_applicable' values */ long int nullcount; /* number of 'null' values */ long int unknowncount; /* number of 'unknown' values */ long int badcount; /* number of bad values (i.e., not flagged) */ }; typedef struct colstruct column; /* CONTAINER structure: */ struct cntstruct { long int start_byte; /* relative to start of enclosing structure */ char *name; char colnum[50]; /* Column index string */ long int bytes; /* total bytes */ long int repetitions; /* repetition count */ struct fieldstruct *fldlist; }; typedef struct cntstruct container; /* FIELD list structure: */ struct fieldstruct { int type; union { column *col; container *cnt; } ptr; struct fieldstruct *next; }; typedef struct fieldstruct field; /* TABLE structure: */ struct tablestruct { char *label; /* Label from "OBJECT = " line */ char *datafile; char *name; int tblnum; /* Sequential number (order in label) */ long int offset; /* Byte offset from start of data file */ char offset_read[100]; /* Complete offset string from label */ int record_offset; /* 1 = offset is in records, 0 = */ int ascii; /* TRUE if ASCII; FALSE if binary */ int checked; /* TRUE if data have been checked */ long int rows; int row_bytes; int columns; int row_prefix_bytes; int row_suffix_bytes; field *fldlist; struct tablestruct *next; }; typedef struct tablestruct table; /* Type conversion structure: */ union typeconv { double r8; float r4; unsigned long int uli; long int sli; unsigned short int usi; short int ssi; unsigned char uc; char sc; char byte[4]; };