projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
T-TEST: Allow both CIN and CI on CRITERIA.
[pspp]
/
src
/
language
/
stats
/
t-test-parser.c
diff --git
a/src/language/stats/t-test-parser.c
b/src/language/stats/t-test-parser.c
index 51f30b9cfcd16a383af8725b8dfd94f685216ea3..138969f8bf4f3d3437733fc53e9d2a34393b2c97 100644
(file)
--- a/
src/language/stats/t-test-parser.c
+++ b/
src/language/stats/t-test-parser.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2011 Free Software Foundation, Inc.
+ Copyright (C) 2011
, 2015
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
@@
-48,18
+48,18
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
const struct variable **v2 = NULL;
size_t n_v2;
const struct variable **v2 = NULL;
size_t n_v2;
- size_t n_pairs;
+ size_t n_pairs
= 0
;
vp *pairs = NULL;
/* One sample mode */
vp *pairs = NULL;
/* One sample mode */
- double testval;
+ double testval
= SYSMIS
;
/* Independent samples mode */
const struct variable *gvar;
union value gval0;
union value gval1;
/* Independent samples mode */
const struct variable *gvar;
union value gval0;
union value gval1;
- bool cut;
+ bool cut
= false
;
tt.wv = dict_get_weight (dict);
tt.dict = dict;
tt.wv = dict_get_weight (dict);
tt.dict = dict;
@@
-68,6
+68,7
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
tt.missing_type = MISS_ANALYSIS;
tt.n_vars = 0;
tt.vars = NULL;
tt.missing_type = MISS_ANALYSIS;
tt.n_vars = 0;
tt.vars = NULL;
+ tt.mode = MODE_undef;
lex_match (lexer, T_EQUALS);
lex_match (lexer, T_EQUALS);
@@
-119,8
+120,8
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
if ( cut == true && var_is_alpha (gvar))
{
if ( cut == true && var_is_alpha (gvar))
{
- msg (SE, _("When applying
GROUPS
to a string variable, two "
- "values must be specified."));
+ msg (SE, _("When applying
%s
to a string variable, two "
+ "values must be specified.")
, "GROUPS"
);
goto parse_failed;
}
}
goto parse_failed;
}
}
@@
-128,6
+129,13
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
{
bool with = false;
bool paired = false;
{
bool with = false;
bool paired = false;
+
+ if (tt.n_vars > 0)
+ {
+ msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS");
+ goto parse_failed;
+ }
+
mode_count++;
tt.mode = MODE_PAIRED;
lex_match (lexer, T_EQUALS);
mode_count++;
tt.mode = MODE_PAIRED;
lex_match (lexer, T_EQUALS);
@@
-170,8
+178,7
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
else
n_pairs = n_v1 * n_v2;
else
n_pairs = n_v1 * n_v2;
- pairs = xcalloc (sizeof *pairs, n_pairs);
-
+ pairs = xcalloc (n_pairs, sizeof *pairs);
if ( with)
{
if ( with)
{
@@
-221,7
+228,7
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
{
if ( tt.mode == MODE_PAIRED)
{
{
if ( tt.mode == MODE_PAIRED)
{
- msg (SE, _("
VARIABLES subcommand may not be used with PAIRS.")
);
+ msg (SE, _("
%s subcommand may not be used with %s."), "VARIABLES", "PAIRS"
);
goto parse_failed;
}
goto parse_failed;
}
@@
-265,7
+272,7
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
else if (lex_match_id (lexer, "CRITERIA"))
{
lex_match (lexer, T_EQUALS);
else if (lex_match_id (lexer, "CRITERIA"))
{
lex_match (lexer, T_EQUALS);
- if ( lex_
force_match_id (lexer, "CIN
"))
+ if ( lex_
match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI
"))
if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
if ( lex_force_match (lexer, T_LPAREN))
{
lex_force_num (lexer);
@@
-290,7
+297,7
@@
cmd_t_test (struct lexer *lexer, struct dataset *ds)
if (tt.n_vars == 0 && tt.mode != MODE_PAIRED)
{
if (tt.n_vars == 0 && tt.mode != MODE_PAIRED)
{
-
msg (SE, _("One or more VARIABLES must be specified.")
);
+
lex_sbc_missing ("VARIABLES"
);
goto parse_failed;
}
goto parse_failed;
}