X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fsort.h;h=4f8659e68d5de7100a431ee940c2e595a24506d7;hb=cf89e411db41c05c39753b05cf144c8b26a44d96;hp=e6c9fed9df4c2046d4a9a51c25fd38b66e72e0b1;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/sort.h b/src/sort.h index e6c9fed9df..4f8659e68d 100644 --- a/src/sort.h +++ b/src/sort.h @@ -20,12 +20,37 @@ #if !sort_h #define sort_h 1 +#include "vfm.h" + +/* Sort direction. */ +enum sort_direction + { + SRT_ASCEND, /* A, B, C, ..., X, Y, Z. */ + SRT_DESCEND /* Z, Y, X, ..., C, B, A. */ + }; + +/* SORT CASES input program. */ +struct sort_cases_pgm + { + int ref_cnt; /* Reference count. */ + + struct variable **vars; /* Variables to sort. */ + enum sort_direction *dirs; /* Sort directions. */ + int var_cnt; /* Number of variables to sort. */ + + struct internal_sort *isrt; /* Internal sort output. */ + struct external_sort *xsrt; /* External sort output. */ + size_t case_size; /* Number of bytes in case. */ + }; + /* SORT CASES programmatic interface. */ -int sort_cases (int separate); -void read_sort_output (int (*write_case)(void)); -/* Variables to sort. */ -extern struct variable **v_sort; -extern int nv_sort; +typedef int read_sort_output_func (const struct ccase *, void *aux); + +struct sort_cases_pgm *parse_sort (void); +int sort_cases (struct sort_cases_pgm *, int separate); +void read_sort_output (struct sort_cases_pgm *, + read_sort_output_func, void *aux); +void destroy_sort_cases_pgm (struct sort_cases_pgm *); #endif /* !sort_h */