X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=28065cafa111f6b6da32288e6e94f842d8c61a9d;hb=b8e2dc45abf0cf7a398cb8cef9d9faa24bee6f6c;hp=3a5024034088210d775c135239eed1de5c36acad;hpb=72147c12357446b304264b6944b8a1d92c45f53c;p=pspp-builds.git diff --git a/src/data/variable.c b/src/data/variable.c index 3a502403..28065caf 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -64,10 +64,9 @@ struct variable struct vardict_info vardict; /* Short name, used only for system and portable file input - and output. Upper case only. There is no index for short - names. Short names are not necessarily unique. Any - variable may have no short name, indicated by an empty - string. */ + and output. Upper case only. Short names are not necessarily + unique. Any variable may have no short name, indicated by an + empty string. */ char short_name[SHORT_NAME_LEN + 1]; /* Each command may use these fields as needed. */ @@ -467,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, @@ -900,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; @@ -957,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; }