/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2010, 2011 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include <config.h>
-#include <assert.h>
-#include <stdlib.h>
#include <limits.h>
-
-#include "sort-criteria.h"
-#include <data/procedure.h>
-#include <data/settings.h>
-#include <data/variable.h>
-#include <language/command.h>
-#include <language/lexer/lexer.h>
-#include <libpspp/message.h>
-#include <data/subcase.h>
-#include <math/sort.h>
+#include <stdlib.h>
#include <sys/types.h>
-#include "xalloc.h"
+#include "data/dataset.h"
+#include "data/settings.h"
+#include "data/subcase.h"
+#include "data/variable.h"
+#include "language/command.h"
+#include "language/lexer/lexer.h"
+#include "language/stats/sort-criteria.h"
+#include "libpspp/message.h"
+#include "math/sort.h"
+
+#include "gl/xalloc.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
if (!parse_sort_criteria (lexer, dataset_dict (ds), &ordering, NULL, NULL))
return CMD_CASCADING_FAILURE;
- if (settings_get_testing_mode () && lex_match (lexer, '/'))
+ if (settings_get_testing_mode () && lex_match (lexer, T_SLASH))
{
- if (!lex_force_match_id (lexer, "BUFFERS") || !lex_match (lexer, '=')
- || !lex_force_int (lexer))
+ if (!lex_force_match_id (lexer, "BUFFERS") || !lex_match (lexer, T_EQUALS)
+ || !lex_force_int_range (lexer, "BUFFERS", 2, INT_MAX))
goto done;
min_buffers = max_buffers = lex_integer (lexer);
- if (max_buffers < 2)
- {
- msg (SE, _("Buffer limit must be at least 2."));
- goto done;
- }
lex_get (lexer);
}
proc_discard_output (ds);
- output = sort_execute (proc_open (ds), &ordering);
+ output = sort_execute (proc_open_filtering (ds, false), &ordering);
ok = proc_commit (ds);
- ok = proc_set_active_file_data (ds, output) && ok;
+ ok = dataset_set_source (ds, output) && ok;
done:
min_buffers = 64;
max_buffers = INT_MAX;
subcase_destroy (&ordering);
- return ok ? lex_end_of_command (lexer) : CMD_CASCADING_FAILURE;
+ return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
}