X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=28065cafa111f6b6da32288e6e94f842d8c61a9d;hb=48386ee68a5283653435d05a9ea4e449710fd370;hp=cf576b12ed2872954c1eb24e1dd3d1a27e37738f;hpb=08e4a9535a7e1de9cc4b6e619e70805ab951b323;p=pspp diff --git a/src/data/variable.c b/src/data/variable.c index cf576b12ed..28065cafa1 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -466,64 +466,32 @@ var_has_missing_values (const struct variable *v) return !mv_is_empty (&v->miss); } -/* Returns true if VALUE is system missing or user-missing value - for V, false otherwise. */ +/* Returns true if VALUE is in the given CLASS of missing values + in V, false otherwise. */ bool -var_is_value_missing (const struct variable *v, const union value *value) +var_is_value_missing (const struct variable *v, const union value *value, + enum mv_class class) { - return mv_is_value_missing (&v->miss, value); + return mv_is_value_missing (&v->miss, value, class); } -/* Returns true if D is system missing or a missing value in V, - false otherwise. +/* Returns true if D is in the given CLASS of missing values in + V, false otherwise. V must be a numeric variable. */ bool -var_is_num_missing (const struct variable *v, double d) +var_is_num_missing (const struct variable *v, double d, enum mv_class class) { - return mv_is_num_missing (&v->miss, d); + return mv_is_num_missing (&v->miss, d, class); } /* Returns true if S[] is a missing value for V, false otherwise. S[] must contain exactly as many characters as V's width. V must be a string variable. */ bool -var_is_str_missing (const struct variable *v, const char s[]) +var_is_str_missing (const struct variable *v, const char s[], + enum mv_class class) { - return mv_is_str_missing (&v->miss, s); -} - -/* Returns true if VALUE is a missing value for V, false - otherwise. */ -bool -var_is_value_user_missing (const struct variable *v, const union value *value) -{ - return mv_is_value_user_missing (&v->miss, value); -} - -/* Returns true if D is a user-missing value for V, false - otherwise. V must be a numeric variable. */ -bool -var_is_num_user_missing (const struct variable *v, double d) -{ - return mv_is_num_user_missing (&v->miss, d); -} - -/* Returns true if S[] is a missing value for V, false otherwise. - V must be a string variable. - S[] must contain exactly as many characters as V's width. */ -bool -var_is_str_user_missing (const struct variable *v, const char s[]) -{ - return mv_is_str_user_missing (&v->miss, s); -} - -/* Returns true if V is a numeric variable and VALUE is the - system missing value. */ -bool -var_is_value_system_missing (const struct variable *v, - const union value *value) -{ - return mv_is_value_system_missing (&v->miss, value); + return mv_is_str_missing (&v->miss, s, class); } /* Returns variable V's value labels, @@ -899,9 +867,10 @@ var_get_aux (const struct variable *v) cleared, AUX_DTOR(V) will be called. (var_dtor_free, below, may be appropriate for use as AUX_DTOR.) */ void * -var_attach_aux (struct variable *v, +var_attach_aux (const struct variable *v_, void *aux, void (*aux_dtor) (struct variable *)) { + struct variable *v = (struct variable *) v_ ; /* cast away const */ assert (v->aux == NULL); assert (aux != NULL); v->aux = aux; @@ -956,8 +925,9 @@ var_get_obs_vals (const struct variable *v) /* Sets V's observed categorical values to CAT_VALS. */ void -var_set_obs_vals (struct variable *v, struct cat_vals *cat_vals) +var_set_obs_vals (const struct variable *v_, struct cat_vals *cat_vals) { + struct variable *v = (struct variable *) v_ ; /* cast away const */ cat_stored_values_destroy (v->obs_vals); v->obs_vals = cat_vals; }