/* PSPP - computes sample statistics.
Copyright (C) 2006 Free Software Foundation, Inc.
- Written by John Darrington <john@darrington.wattle.id.au>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
struct casefilter
{
- bool exclude_user_missing;
+ enum mv_class class;
const struct variable **vars;
int n_vars;
const struct ccase *c,
const struct variable *var)
{
- const union value *val = case_data (c, var->fv) ;
-
- if ( var_get_type (var) != ALPHA && val->f == SYSMIS )
- return true;
-
- if ( filter->exclude_user_missing &&
- var_is_value_user_missing (var, val) )
- return true;
-
- return false;
+ const union value *val = case_data (c, var) ;
+ return var_is_value_missing (var, val, filter->class);
}
-/* Create a new casefilter.
- If EXCL is true, then the filter user missing values to be missing,
- otherwise they are considered at their face value.
+/* Create a new casefilter that drops cases in which any of the
+ N_VARS variables in VARS are in the given CLASS of missing values.
VARS is an array of variables which if *any* of them are missing.
N_VARS is the size of VARS.
*/
struct casefilter *
-casefilter_create (bool excl, struct variable **vars, int n_vars)
+casefilter_create (enum mv_class class, struct variable **vars, int n_vars)
{
int i;
struct casefilter * filter = xmalloc (sizeof (*filter)) ;
- filter->exclude_user_missing = excl ;
+ filter->class = class;
filter->vars = xnmalloc (n_vars, sizeof (*filter->vars) );
for ( i = 0 ; i < n_vars ; ++i )
filter considers. N_VARS is the size of VARS */
void
casefilter_add_variables (struct casefilter *filter,
- struct variable **vars, int n_vars)
+ struct variable *const *vars, int n_vars)
{
int i;
free (filter->vars);
free (filter);
}
-
-