projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Issue an error if no valid data are found
[pspp]
/
src
/
language
/
stats
/
sort-criteria.c
diff --git
a/src/language/stats/sort-criteria.c
b/src/language/stats/sort-criteria.c
index fd90af22ff85958b2a00ef0523606d70846fe48b..81b68eab6c41afd5cb79fa2205aa72cb5ba347ff 100644
(file)
--- a/
src/language/stats/sort-criteria.c
+++ b/
src/language/stats/sort-criteria.c
@@
-1,6
+1,5
@@
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@
-26,6
+25,7
@@
#include <language/command.h>
#include <libpspp/message.h>
#include <language/lexer/lexer.h>
#include <language/command.h>
#include <libpspp/message.h>
#include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
#include <data/settings.h>
#include <data/variable.h>
#include "sort-criteria.h"
#include <data/settings.h>
#include <data/variable.h>
#include "sort-criteria.h"
@@
-49,14
+49,14
@@
static bool is_terminator(int tok, const int *terminators);
*/
struct sort_criteria *
*/
struct sort_criteria *
-sort_parse_criteria (const struct dictionary *dict,
- struct variable ***vars, size_t *var_cnt,
+sort_parse_criteria (
struct lexer *lexer,
const struct dictionary *dict,
+
const
struct variable ***vars, size_t *var_cnt,
bool *saw_direction,
const int *terminators
)
{
struct sort_criteria *criteria;
bool *saw_direction,
const int *terminators
)
{
struct sort_criteria *criteria;
- struct variable **local_vars = NULL;
+
const
struct variable **local_vars = NULL;
size_t local_var_cnt;
assert ((vars == NULL) == (var_cnt == NULL));
size_t local_var_cnt;
assert ((vars == NULL) == (var_cnt == NULL));
@@
-81,23
+81,23
@@
sort_parse_criteria (const struct dictionary *dict,
enum sort_direction direction;
/* Variables. */
enum sort_direction direction;
/* Variables. */
- if (!parse_variables
(
dict, vars, var_cnt,
+ if (!parse_variables
_const (lexer,
dict, vars, var_cnt,
PV_NO_DUPLICATE | PV_APPEND | PV_NO_SCRATCH))
goto error;
/* Sort direction. */
PV_NO_DUPLICATE | PV_APPEND | PV_NO_SCRATCH))
goto error;
/* Sort direction. */
- if (lex_match ('('))
+ if (lex_match (
lexer,
'('))
{
{
- if (lex_match_id (
"D") || lex_match_id (
"DOWN"))
+ if (lex_match_id (
lexer, "D") || lex_match_id (lexer,
"DOWN"))
direction = SRT_DESCEND;
direction = SRT_DESCEND;
- else if (lex_match_id (
"A") || lex_match_id (
"UP"))
+ else if (lex_match_id (
lexer, "A") || lex_match_id (lexer,
"UP"))
direction = SRT_ASCEND;
else
{
msg (SE, _("`A' or `D' expected inside parentheses."));
goto error;
}
direction = SRT_ASCEND;
else
{
msg (SE, _("`A' or `D' expected inside parentheses."));
goto error;
}
- if (!lex_match (')'))
+ if (!lex_match (
lexer,
')'))
{
msg (SE, _("`)' expected."));
goto error;
{
msg (SE, _("`)' expected."));
goto error;
@@
-114,12
+114,12
@@
sort_parse_criteria (const struct dictionary *dict,
for (; prev_var_cnt < criteria->crit_cnt; prev_var_cnt++)
{
struct sort_criterion *c = &criteria->crits[prev_var_cnt];
for (; prev_var_cnt < criteria->crit_cnt; prev_var_cnt++)
{
struct sort_criterion *c = &criteria->crits[prev_var_cnt];
- c->fv =
(*vars)[prev_var_cnt]->fv
;
- c->width =
(*vars)[prev_var_cnt]->width
;
+ c->fv =
var_get_case_index ((*vars)[prev_var_cnt])
;
+ c->width =
var_get_width ((*vars)[prev_var_cnt])
;
c->dir = direction;
}
}
c->dir = direction;
}
}
- while (
token != '.' && token != '/' && !is_terminator(token
, terminators));
+ while (
lex_token (lexer) != '.' && lex_token (lexer) != '/' && !is_terminator(lex_token (lexer)
, terminators));
free (local_vars);
return criteria;
free (local_vars);
return criteria;