X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fvar.h;h=11add5b0daa99ecc7600c0e1bcb1207b3ee80469;hb=bc963dae9be291ea0a7cccf189d13e00d3797cfd;hp=fc9827d93b94785661a27a2c08a57884ac2e873e;hpb=6f972e0ef93c3a7e00fd5335ea22af2c878f4589;p=pspp diff --git a/src/var.h b/src/var.h index fc9827d93b..11add5b0da 100644 --- a/src/var.h +++ b/src/var.h @@ -23,54 +23,8 @@ #include #include "format.h" #include "t-test.h" +#include "val.h" -/* Values. */ - -/* Max length of a short string value, generally 8 chars. */ -#define MAX_SHORT_STRING ((SIZEOF_DOUBLE)>=8 ? ((SIZEOF_DOUBLE)+1)/2*2 : 8) -#define MIN_LONG_STRING (MAX_SHORT_STRING+1) - -/* Max string length. */ -#define MAX_STRING 255 - -/* FYI: It is a bad situation if sizeof(flt64) < MAX_SHORT_STRING: - then short string missing values can be truncated in system files - because there's only room for as many characters as can fit in a - flt64. */ -#if MAX_SHORT_STRING > 8 -#error MAX_SHORT_STRING must be less than 8. -#endif - -/* Special values. */ -#define SYSMIS (-DBL_MAX) -#define LOWEST second_lowest_value -#define HIGHEST DBL_MAX - -/* Describes one value, which is either a floating-point number or a - short string. */ -union value - { - /* A numeric value. */ - double f; - - /* A short-string value. */ - unsigned char s[MAX_SHORT_STRING]; - - /* Used by evaluate_expression() to return a string result. - As currently implemented, it's a pointer to a dynamic - buffer in the appropriate expression. - - Also used by the AGGREGATE procedure in handling string - values. */ - unsigned char *c; - }; - -/* Maximum number of `union value's in a single number or string - value. */ -#define MAX_ELEMS_PER_VALUE (MAX_STRING / sizeof (union value) + 1) - -int compare_values (union value *a, union value *b, int width); - /* Frequency tables. */ /* Frequency table entry. */ @@ -197,19 +151,6 @@ struct get_proc int fv, nv; /* First, # of values. */ }; -/* Sort order. */ -enum - { - SRT_ASCEND, /* A, B, C, ..., X, Y, Z. */ - SRT_DESCEND /* Z, Y, X, ..., C, B, A. */ - }; - -/* SORT CASES private data. */ -struct sort_cases_proc - { - int order; /* SRT_ASCEND or SRT_DESCEND. */ - }; - /* MEANS private data. */ struct means_proc { @@ -309,7 +250,6 @@ struct variable struct frequencies_proc frq; struct list_proc lst; struct means_proc mns; - struct sort_cases_proc srt; struct matrix_data_proc mxd; struct match_files_proc mtf; struct t_test_proc t_t; @@ -348,6 +288,13 @@ struct ccase { union value data[1]; }; + +/* Linked list of cases. */ +struct case_list + { + struct case_list *next; + struct ccase c; + }; /* Dictionary. */ @@ -468,17 +415,16 @@ void copy_missing_values (struct variable *dest, const struct variable *src); /* Transformations. */ +struct trns_header; +typedef int trns_proc_func (struct trns_header *, struct ccase *, int); +typedef void trns_free_func (struct trns_header *); + /* Header for all transformations. */ struct trns_header { - /* Index into t_trns[]. */ - int index; - - /* Transformation proc. */ - int (*proc) (struct trns_header *, struct ccase *); - - /* Garbage collector proc. */ - void (*free) (struct trns_header *); + int index; /* Index into t_trns[]. */ + trns_proc_func *proc; /* Transformation proc. */ + trns_free_func *free; /* Garbage collector proc. */ }; /* Array of transformations */