X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Ft-test-parser.c;h=8810301c67f7d990e79444dbf5781790ee84c60f;hb=037d8f6e7932459b5d0fb479a2c5030a8088f3d1;hp=5d6b2ae21c0c437ca6fc912b07daa8aa10147a09;hpb=759791b6dee89c598eef75c482feed729067fa3b;p=pspp diff --git a/src/language/stats/t-test-parser.c b/src/language/stats/t-test-parser.c index 5d6b2ae21c..8810301c67 100644 --- a/src/language/stats/t-test-parser.c +++ b/src/language/stats/t-test-parser.c @@ -73,7 +73,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) lex_match (lexer, T_EQUALS); - for (; lex_token (lexer) != T_ENDCMD; ) + for (; lex_token (lexer) != T_ENDCMD;) { lex_match (lexer, T_SLASH); if (lex_match_id (lexer, "TESTVAL")) @@ -96,8 +96,9 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) if (NULL == (gvar = parse_variable (lexer, dict))) goto exit; - value_init (&gval0, var_get_width (gvar)); - value_init (&gval1, var_get_width (gvar)); + gval_width = var_get_width (gvar); + value_init (&gval0, gval_width); + value_init (&gval1, gval_width); int n; if (lex_match (lexer, T_LPAREN)) @@ -154,7 +155,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) PV_NO_DUPLICATE | PV_NUMERIC)) goto exit; - if ( lex_match (lexer, T_WITH)) + if (lex_match (lexer, T_WITH)) { with = true; if (!parse_variables_const (lexer, dict, @@ -180,16 +181,16 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) { int i; - if ( !with ) + if (!with) n_pairs = (n_v1 * (n_v1 - 1)) / 2.0; - else if ( paired ) + else if (paired) n_pairs = n_v1; else n_pairs = n_v1 * n_v2; pairs = xcalloc (n_pairs, sizeof *pairs); - if ( with) + if (with) { int x = 0; if (paired) @@ -235,7 +236,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) } else if (lex_match_id (lexer, "VARIABLES")) { - if ( tt.mode == MODE_PAIRED) + if (tt.mode == MODE_PAIRED) { msg (SE, _("%s subcommand may not be used with %s."), "VARIABLES", "PAIRS"); goto exit; @@ -249,7 +250,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) PV_NO_DUPLICATE | PV_NUMERIC)) goto exit; } - else if ( lex_match_id (lexer, "MISSING")) + else if (lex_match_id (lexer, "MISSING")) { lex_match (lexer, T_EQUALS); while (lex_token (lexer) != T_ENDCMD && lex_token (lexer) != T_SLASH) @@ -281,8 +282,8 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) else if (lex_match_id (lexer, "CRITERIA")) { lex_match (lexer, T_EQUALS); - if ( lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI")) - if ( lex_force_match (lexer, T_LPAREN)) + if (lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI")) + if (lex_force_match (lexer, T_LPAREN)) { if (!lex_force_num (lexer)) goto exit; @@ -299,7 +300,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) } } - if ( mode_count != 1) + if (mode_count != 1) { msg (SE, _("Exactly one of TESTVAL, GROUPS and PAIRS subcommands " "must be specified.")); @@ -321,18 +322,18 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) while (casegrouper_get_next_group (grouper, &group)) { - if ( tt.mode == MODE_SINGLE) + if (tt.mode == MODE_SINGLE) { - if ( tt.missing_type == MISS_LISTWISE ) + if (tt.missing_type == MISS_LISTWISE) group = casereader_create_filter_missing (group, tt.vars, tt.n_vars, tt.exclude, NULL, NULL); one_sample_run (&tt, testval, group); } - else if ( tt.mode == MODE_PAIRED) + else if (tt.mode == MODE_PAIRED) { - if ( tt.missing_type == MISS_LISTWISE ) + if (tt.missing_type == MISS_LISTWISE) { group = casereader_create_filter_missing (group, v1, n_v1, @@ -348,7 +349,7 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) } else /* tt.mode == MODE_INDEP */ { - if ( tt.missing_type == MISS_LISTWISE ) + if (tt.missing_type == MISS_LISTWISE) { group = casereader_create_filter_missing (group, tt.vars, tt.n_vars,