/* 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
{
bool warn = true;
float i_d;
- struct ccase c;
+ struct ccase *c;
struct hsh_table *freq_hash =
hsh_create (4, compare_freq, hash_freq,
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;
}
(*existing_fr)->count += fr->count;
free (fr);
- case_destroy (&c);
+ case_unref (c);
}
if (casereader_destroy (input))
return freq_hash;
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)
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;
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);
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);