Beginning of VFM cleanup.
[pspp-builds.git] / src / sort.h
index 15a5b2db25d71f6f3a7d554e63426021ca52504d..928a5170b1340caeeb105687020e2ad11db61136 100644 (file)
 
 #include "vfm.h"
 
-/* SORT CASES programmatic interface. */
-int sort_cases (int separate);
-void read_sort_output (write_case_func *, write_case_data);
+/* 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. */
+  };
 
-/* Variables to sort. */
-extern struct variable **v_sort;
-extern int nv_sort;
+/* SORT CASES programmatic interface. */
+struct sort_cases_pgm *parse_sort (void);
+int sort_cases (struct sort_cases_pgm *, int separate);
+void read_sort_output (struct sort_cases_pgm *,
+                       write_case_func *, write_case_data);
+void destroy_sort_cases_pgm (struct sort_cases_pgm *);
 
 #endif /* !sort_h */