X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fchisquare.c;fp=src%2Flanguage%2Fstats%2Fchisquare.c;h=6cb7fc0b192ee2bfce5e50a620a26bd466a3ee6e;hb=7fbfc32fc3c636959b0a25b3e76609f86519e84a;hp=6287977b5abc1fb21272823e6ec5c0f4bd2fa101;hpb=da299bd9871b178336a440c6ac53aebc3cea672e;p=pspp-builds.git diff --git a/src/language/stats/chisquare.c b/src/language/stats/chisquare.c index 6287977b..6cb7fc0b 100644 --- a/src/language/stats/chisquare.c +++ b/src/language/stats/chisquare.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 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 @@ -58,7 +58,7 @@ create_freq_hash_with_range (const struct dictionary *dict, { bool warn = true; float i_d; - struct ccase c; + struct ccase *c; struct hsh_table *freq_hash = hsh_create (4, compare_freq, hash_freq, @@ -79,21 +79,21 @@ create_freq_hash_with_range (const struct dictionary *dict, hsh_insert (freq_hash, fr); } - while (casereader_read (input, &c)) + while ((c = casereader_read (input)) != NULL) { union value obs_value; struct freq **existing_fr; struct freq *fr = xmalloc(sizeof (*fr)); - fr->value = case_data (&c, var); + fr->value = case_data (c, var); - fr->count = dict_get_case_weight (dict, &c, &warn); + fr->count = dict_get_case_weight (dict, c, &warn); obs_value.f = trunc (fr->value->f); if ( obs_value.f < lo || obs_value.f > hi) { free (fr); - case_destroy (&c); + case_unref (c); continue; } @@ -108,7 +108,7 @@ create_freq_hash_with_range (const struct dictionary *dict, (*existing_fr)->count += fr->count; free (fr); - case_destroy (&c); + case_unref (c); } if (casereader_destroy (input)) return freq_hash; @@ -131,20 +131,20 @@ create_freq_hash (const struct dictionary *dict, const struct variable *var) { bool warn = true; - struct ccase c; + struct ccase *c; struct hsh_table *freq_hash = hsh_create (4, compare_freq, hash_freq, free_freq_mutable_hash, (void *) var); - for (; casereader_read (input, &c); case_destroy (&c)) + for (; (c = casereader_read (input)) != NULL; case_unref (c)) { struct freq **existing_fr; struct freq *fr = xmalloc(sizeof (*fr)); - fr->value = case_data (&c, var); + fr->value = case_data (c, var); - fr->count = dict_get_case_weight (dict, &c, &warn); + fr->count = dict_get_case_weight (dict, c, &warn); existing_fr = (struct freq **) hsh_probe (freq_hash, fr); if ( *existing_fr) @@ -321,7 +321,9 @@ void chisquare_execute (const struct dataset *ds, struct casereader *input, enum mv_class exclude, - const struct npar_test *test) + const struct npar_test *test, + bool exact UNUSED, + double timer UNUSED) { const struct dictionary *dict = dataset_dict (ds); int v, i; @@ -348,7 +350,8 @@ chisquare_execute (const struct dataset *ds, struct hsh_table *freq_hash = NULL; struct casereader *reader = casereader_create_filter_missing (casereader_clone (input), - &ost->vars[v], 1, exclude, NULL); + &ost->vars[v], 1, exclude, + NULL, NULL); struct tab_table *freq_table = create_variable_frequency_table(dict, reader, cst, v, &freq_hash); @@ -418,7 +421,8 @@ chisquare_execute (const struct dataset *ds, double total_obs = 0.0; struct casereader *reader = casereader_create_filter_missing (casereader_clone (input), - &ost->vars[v], 1, exclude, NULL); + &ost->vars[v], 1, exclude, + NULL, NULL); struct hsh_table *freq_hash = create_freq_hash_with_range (dict, reader, ost->vars[v], cst->lo, cst->hi);