Fix memory leaks.
[pspp-builds.git] / src / sort.h
index 4f8659e68d5de7100a431ee940c2e595a24506d7..63054413f539a0238f1efd7594faeb648a195869 100644 (file)
 #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. */
-
-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 *);
+#include <stddef.h>
+
+struct casereader;
+struct dictionary;
+struct variable;
+
+struct sort_criteria *sort_parse_criteria (const struct dictionary *,
+                                           struct variable ***, int *);
+void sort_destroy_criteria (struct sort_criteria *);
+
+struct casefile *sort_execute (struct casereader *,
+                               const struct sort_criteria *);
+int sort_active_file_in_place (const struct sort_criteria *);
+struct casefile *sort_active_file_to_casefile (const struct sort_criteria *);
 
 #endif /* !sort_h */