X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fcasefilter.c;h=fb23e4f674ad104c547d439d64b50dc1c4d7530e;hb=68af3306969829d17a05cfab5c9d46cb920b7607;hp=ada1fa38f14083cbb5dae5b5bcc2c4eb54149081;hpb=164d1274fcb70c54897f2a03fc7c27152ed4821a;p=pspp-builds.git diff --git a/src/data/casefilter.c b/src/data/casefilter.c index ada1fa38..fb23e4f6 100644 --- a/src/data/casefilter.c +++ b/src/data/casefilter.c @@ -29,7 +29,7 @@ struct casefilter { - bool exclude_user_missing; + enum mv_class class; const struct variable **vars; int n_vars; @@ -58,30 +58,21 @@ casefilter_variable_missing (const struct casefilter *filter, const struct variable *var) { const union value *val = case_data (c, var) ; - - if ( var_is_numeric (var) && val->f == SYSMIS ) - return true; - - if ( filter->exclude_user_missing && - var_is_value_user_missing (var, val) ) - return true; - - return false; + 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 ) @@ -97,7 +88,7 @@ casefilter_create (bool excl, struct variable **vars, int n_vars) 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; @@ -117,5 +108,3 @@ casefilter_destroy (struct casefilter *filter) free (filter->vars); free (filter); } - -