projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NPAR TESTS: Fix "NPAR TESTS BINOMIAL, P = 0.5; N1/N2 < 1" test failure.
[pspp]
/
src
/
language
/
stats
/
sort-cases.c
diff --git
a/src/language/stats/sort-cases.c
b/src/language/stats/sort-cases.c
index 4cf1f9fd977b0b0241eff961c6717e9f4ab7a644..8998120addee90db4de6b6fcb2a038c2f262b30f 100644
(file)
--- a/
src/language/stats/sort-cases.c
+++ b/
src/language/stats/sort-cases.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000
, 2010
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
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
@@
-26,12
+26,13
@@
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
#include <data/variable.h>
#include <language/command.h>
#include <language/lexer/lexer.h>
-#include <libpspp/alloc.h>
#include <libpspp/message.h>
#include <libpspp/message.h>
-#include <data/
case-ordering
.h>
+#include <data/
subcase
.h>
#include <math/sort.h>
#include <sys/types.h>
#include <math/sort.h>
#include <sys/types.h>
+#include "xalloc.h"
+
#include "gettext.h"
#define _(msgid) gettext (msgid)
#include "gettext.h"
#define _(msgid) gettext (msgid)
@@
-40,20
+41,20
@@
int
cmd_sort_cases (struct lexer *lexer, struct dataset *ds)
{
int
cmd_sort_cases (struct lexer *lexer, struct dataset *ds)
{
- struct
case_ordering *
ordering;
+ struct
subcase
ordering;
struct casereader *output;
bool ok = false;
lex_match (lexer, T_BY);
proc_cancel_temporary_transformations (ds);
struct casereader *output;
bool ok = false;
lex_match (lexer, T_BY);
proc_cancel_temporary_transformations (ds);
-
ordering = parse_case_ordering (lexer, dataset_dict (ds), NULL
);
- if (
ordering == NULL
)
+
subcase_init_empty (&ordering
);
+ if (
!parse_sort_criteria (lexer, dataset_dict (ds), &ordering, NULL, NULL)
)
return CMD_CASCADING_FAILURE;
return CMD_CASCADING_FAILURE;
- if (
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,
'='
)
+ if (!lex_force_match_id (lexer, "BUFFERS") || !lex_match (lexer,
T_EQUALS
)
|| !lex_force_int (lexer))
goto done;
|| !lex_force_int (lexer))
goto done;
@@
-68,8
+69,7
@@
cmd_sort_cases (struct lexer *lexer, struct dataset *ds)
}
proc_discard_output (ds);
}
proc_discard_output (ds);
- output = sort_execute (proc_open (ds), ordering);
- ordering = NULL;
+ output = sort_execute (proc_open (ds), &ordering);
ok = proc_commit (ds);
ok = proc_set_active_file_data (ds, output) && ok;
ok = proc_commit (ds);
ok = proc_set_active_file_data (ds, output) && ok;
@@
-77,7
+77,7
@@
cmd_sort_cases (struct lexer *lexer, struct dataset *ds)
min_buffers = 64;
max_buffers = INT_MAX;
min_buffers = 64;
max_buffers = INT_MAX;
-
case_ordering_destroy (
ordering);
+
subcase_destroy (&
ordering);
return ok ? lex_end_of_command (lexer) : CMD_CASCADING_FAILURE;
}
return ok ? lex_end_of_command (lexer) : CMD_CASCADING_FAILURE;
}