Adopt use of gnulib for portability.
[pspp-builds.git] / src / sort.h
index 4f8659e68d5de7100a431ee940c2e595a24506d7..af443edc34b8b4f5b5003b2d73d8f805b29003ce 100644 (file)
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA. */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
 
 #if !sort_h
 #define sort_h 1
 
-#include "vfm.h"
+#include <stddef.h>
+#include <stdbool.h>
+
+struct casereader;
+struct dictionary;
+struct variable;
+
 
 /* Sort direction. */
 enum sort_direction
@@ -29,28 +35,29 @@ enum sort_direction
     SRT_DESCEND                        /* Z, Y, X, ..., C, B, A. */
   };
 
-/* SORT CASES input program. */
-struct sort_cases_pgm 
+/* A sort criterion. */
+struct sort_criterion
   {
-    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. */
+    int fv;                     /* Variable data index. */
+    int width;                  /* 0=numeric, otherwise string width. */
+    enum sort_direction dir;    /* Sort direction. */
   };
 
-/* SORT CASES programmatic interface. */
+/* A set of sort criteria. */
+struct sort_criteria 
+  {
+    struct sort_criterion *crits;
+    size_t crit_cnt;
+  };
+
+
+void sort_destroy_criteria (struct sort_criteria *);
+
+struct casefile *sort_execute (struct casereader *,
+                               const struct sort_criteria *);
 
-typedef int read_sort_output_func (const struct ccase *, void *aux);
+int sort_active_file_in_place (const struct sort_criteria *);
 
-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 *);
+struct casefile *sort_active_file_to_casefile (const struct sort_criteria *);
 
 #endif /* !sort_h */