X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fnpar.q;h=8c6f98f82cf669275376313a03650b9ba5de0ff8;hb=41009f9ff6541a025357fd8e06fcdaf5220e48fa;hp=4caa112aefe8895555add598c773518078f5415d;hpb=3c52a21736b3777ced3e47148fa2fc8f9eff59c8;p=pspp-builds.git diff --git a/src/language/stats/npar.q b/src/language/stats/npar.q index 4caa112a..8c6f98f8 100644 --- a/src/language/stats/npar.q +++ b/src/language/stats/npar.q @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. -*-c-*- - Copyright (C) 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2006, 2008, 2009 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 @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -159,7 +161,7 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) test->insert_variables (test, var_hash); } - npar_specs.vv = (const struct variable **) const_hsh_data (var_hash); + npar_specs.vv = (const struct variable **) const_hsh_sort (var_hash); npar_specs.n_vars = const_hsh_count (var_hash); if ( cmd.sbc_statistics ) @@ -222,10 +224,11 @@ npar_custom_chisquare (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs = aux; struct chisquare_test *cstp = pool_alloc(specs->pool, sizeof(*cstp)); - struct one_sample_test *tp = (struct one_sample_test *) cstp; + struct one_sample_test *tp = &cstp->parent; + struct npar_test *nt = &tp->parent; - ((struct npar_test *)tp)->execute = chisquare_execute; - ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables; + nt->execute = chisquare_execute; + nt->insert_variables = one_sample_insert_variables; if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds), &tp->vars, &tp->n_vars, @@ -315,7 +318,7 @@ npar_custom_chisquare (struct lexer *lexer, struct dataset *ds, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -327,10 +330,11 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds, { struct npar_specs *specs = aux; struct binomial_test *btp = pool_alloc(specs->pool, sizeof(*btp)); - struct one_sample_test *tp = (struct one_sample_test *) btp; + struct one_sample_test *tp = &btp->parent; + struct npar_test *nt = &tp->parent; - ((struct npar_test *)tp)->execute = binomial_execute; - ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables; + nt->execute = binomial_execute; + nt->insert_variables = one_sample_insert_variables; btp->category1 = btp->category2 = btp->cutpoint = SYSMIS; @@ -380,7 +384,7 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -411,7 +415,7 @@ parse_two_sample_related_test (struct lexer *lexer, const struct variable **vlist2; size_t n_vlist2; - ((struct npar_test *)test_parameters)->insert_variables = two_sample_insert_variables; + test_parameters->parent.insert_variables = two_sample_insert_variables; if (!parse_variables_const_pool (lexer, pool, dict, @@ -511,7 +515,8 @@ npar_custom_wilcoxon (struct lexer *lexer, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc (specs->pool, sizeof(*tp)); - ((struct npar_test *)tp)->execute = wilcoxon_execute; + struct npar_test *nt = &tp->parent; + nt->execute = wilcoxon_execute; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, tp, specs->pool) ) @@ -521,7 +526,7 @@ npar_custom_wilcoxon (struct lexer *lexer, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -534,7 +539,8 @@ npar_custom_mcnemar (struct lexer *lexer, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp)); - ((struct npar_test *)tp)->execute = NULL; + struct npar_test *nt = &tp->parent; + nt->execute = NULL; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), @@ -545,7 +551,7 @@ npar_custom_mcnemar (struct lexer *lexer, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -557,8 +563,9 @@ npar_custom_sign (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp)); - ((struct npar_test *)tp)->execute = NULL; + struct npar_test *nt = &tp->parent; + nt->execute = sign_execute; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, tp, specs->pool) ) @@ -568,7 +575,7 @@ npar_custom_sign (struct lexer *lexer, struct dataset *ds, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -579,7 +586,7 @@ one_sample_insert_variables (const struct npar_test *test, struct const_hsh_table *var_hash) { int i; - struct one_sample_test *ost = (struct one_sample_test *) test; + struct one_sample_test *ost = UP_CAST (test, struct one_sample_test, parent); for ( i = 0 ; i < ost->n_vars ; ++i ) const_hsh_insert (var_hash, ost->vars[i]);