{
if ( var_is_numeric (var))
{
- if ( var_is_value_missing (var, val, MV_SYSTEM))
+ if (var_is_value_missing (var, val) == MV_SYSTEM)
return newSVpvn ("", 0);
return newSVnv (val->f);
union value uv;
int ret;
make_value_from_scalar (&uv, val, var);
- ret = var_is_value_missing (var, &uv, MV_ANY);
+ ret = var_is_value_missing (var, &uv) != 0;
value_destroy (&uv, var_get_width (var));
RETVAL = ret;
OUTPUT:
{
struct casereader_filter_weight *cfw = cfw_;
double value = case_num (c, cfw->weight_var);
- if (value >= 0.0 && !var_is_num_missing (cfw->weight_var, value, MV_ANY))
+ if (value >= 0.0 && !var_is_num_missing (cfw->weight_var, value))
return true;
else
{
casenumber *n_missing,
struct casewriter *exclude)
{
- if (n_vars > 0 && class != MV_NEVER)
+ if (n_vars > 0 && class)
{
struct casereader_filter_missing *cfm = xmalloc (sizeof *cfm);
cfm->vars = xmemdup (vars, sizeof *vars * n_vars);
{
struct variable *var = cfm->vars[i];
const union value *value = case_data (c, var);
- if (var_is_value_missing (var, value, cfm->class))
+ if (var_is_value_missing (var, value) & cfm->class)
{
if (cfm->n_missing)
(*cfm->n_missing)++;
csv_write_var (struct csv_writer *w, const struct csv_var *cv,
const union value *value)
{
- if (mv_is_value_missing (&cv->missing, value, MV_USER))
+ if (mv_is_value_missing (&cv->missing, value) == MV_USER)
{
union value missing;
{
struct variable *filter_var = filter_var_;
double f = case_num (*c, filter_var);
- return (f != 0.0 && !var_is_num_missing (filter_var, f, MV_ANY)
+ return (f != 0.0 && !var_is_num_missing (filter_var, f)
? TRNS_CONTINUE : TRNS_DROP_CASE);
}
XXX only checking "user" here because not sure of correct other
cases. */
- if (var_is_value_missing (var, value, MV_USER))
- write_attr (writer, "missing", "user");
- else if (var_is_value_missing (var, value, MV_SYSTEM))
- write_attr (writer, "missing", "system");
+ enum mv_class miss = var_is_value_missing (var, value);
+ if (miss)
+ write_attr (writer, "missing", miss == MV_USER ? "user" : "system");
/* <properties/> */
xmlTextWriterStartElement (writer, _xml ("properties"));
NOT_REACHED ();
}
-/* Returns true if V is a missing value in the given CLASS in MV,
- false otherwise. */
-bool
-mv_is_value_missing (const struct missing_values *mv, const union value *v,
- enum mv_class class)
+/* Returns MV_USER if V is a user-missing value in MV, MV_SYSTEM if V is
+ system-missing (and MV is numeric), or 0 if V is not missing. */
+enum mv_class
+mv_is_value_missing (const struct missing_values *mv, const union value *v)
{
return (mv->width == 0
- ? mv_is_num_missing (mv, v->f, class)
- : mv_is_str_missing (mv, v->s, class));
+ ? mv_is_num_missing (mv, v->f)
+ : mv_is_str_missing (mv, v->s));
}
-/* Returns true if D is a missing value in the given CLASS in MV,
- false otherwise.
- MV must be a set of numeric missing values. */
-bool
-mv_is_num_missing (const struct missing_values *mv, double d,
- enum mv_class class)
+/* Returns MV_USER if V is a user-missing value in MV, MV_SYSTEM if V is
+ system-missing, or 0 if V is not missing. MV must be a set of numeric
+ missing values. */
+enum mv_class
+mv_is_num_missing (const struct missing_values *mv, double d)
{
assert (mv->width == 0);
- return ((class & MV_SYSTEM && d == SYSMIS)
- || (class & MV_USER && is_num_user_missing (mv, d)));
+ return (d == SYSMIS ? MV_SYSTEM
+ : is_num_user_missing (mv, d) ? MV_USER
+ : 0);
}
-/* Returns true if S[] is a missing value in the given CLASS in
- MV, false otherwise.
- MV must be a set of string missing values.
- S[] must contain exactly as many characters as MV's width. */
-bool
-mv_is_str_missing (const struct missing_values *mv, const uint8_t s[],
- enum mv_class class)
+/* Returns MV_USER if S[] is a user-missing value in MV, or 0 if V is not
+ missing. MV must be a set of string missing values. S[] must contain
+ exactly as many characters as MV's width. */
+enum mv_class
+mv_is_str_missing (const struct missing_values *mv, const uint8_t s[])
{
assert (mv->width > 0);
- return class & MV_USER && is_str_user_missing (mv, s);
+ return is_str_user_missing (mv, s) ? MV_USER : 0;
}
-/* Like mv_is_value_missing(), this tests whether V is a missing value
- in the given CLASS in MV. It supports the uncommon case where V
- and MV might have different widths: the caller must specify VW, the
- width of V. MV and VW must be both numeric or both string.
+/* Like mv_is_value_missing(), this tests whether V is a missing value in MV.
+ It supports the uncommon case where V and MV might have different widths:
+ the caller must specify VW, the width of V. MV and VW must be both numeric
+ or both string.
- Comparison of strings of different width is done by conceptually
- extending both strings to infinite width by appending spaces. */
-bool
+ Comparison of strings of different width is done by conceptually extending
+ both strings to infinite width by appending spaces. */
+enum mv_class
mv_is_value_missing_varwidth (const struct missing_values *mv,
- const union value *v, int vw,
- enum mv_class class)
+ const union value *v, int vw)
{
int mvw = mv->width;
if (mvw == vw)
- return mv_is_value_missing (mv, v, class);
+ return mv_is_value_missing (mv, v);
/* Make sure they're both strings. */
assert (mvw && vw);
- if (!(class & MV_USER) || mv->type == MVT_NONE)
+ if (mv->type == MVT_NONE)
return false;
for (int i = 0; i < mv->type; i++)
if (!buf_compare_rpad (CHAR_CAST_BUG (const char *, mv->values[i].s), mvw,
CHAR_CAST_BUG (const char *, v->s), vw))
- return true;
- return false;
+ return MV_USER;
+ return 0;
}
char *
union value values[3]; /* Missing values. [1], [2] are the range. */
};
-/* Classes of missing values. */
+/* Classes of missing values.
+
+ These are useful as individual values and as masks, and they are used both
+ ways. */
enum mv_class
{
- MV_NEVER = 0, /* Never considered missing. */
- MV_USER = 1, /* Missing if value is user-missing. */
- MV_SYSTEM = 2, /* Missing if value is system-missing. */
- MV_ANY = MV_USER | MV_SYSTEM /* Missing if it is user or system-missing. */
+ MV_USER = 1, /* User-missing. */
+ MV_SYSTEM = 2 /* System-missing. */
+#define MV_ANY (MV_USER | MV_SYSTEM)
};
/* Is a value missing? */
-bool mv_is_value_missing (const struct missing_values *, const union value *,
- enum mv_class);
-bool mv_is_num_missing (const struct missing_values *, double, enum mv_class);
-bool mv_is_str_missing (const struct missing_values *, const uint8_t[],
- enum mv_class);
-bool mv_is_value_missing_varwidth (const struct missing_values *,
- const union value *, int value_width,
- enum mv_class);
+enum mv_class mv_is_value_missing (const struct missing_values *,
+ const union value *);
+enum mv_class mv_is_num_missing (const struct missing_values *, double);
+enum mv_class mv_is_str_missing (const struct missing_values *,
+ const uint8_t[]);
+enum mv_class mv_is_value_missing_varwidth (const struct missing_values *,
+ const union value *,
+ int value_width);
/* Initializing missing value sets. */
void mv_init (struct missing_values *, int width);
return !mv_is_empty (&v->miss);
}
-/* 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,
- enum mv_class class)
+/* Returns MV_SYSTEM if VALUE is system-missing, MV_USER if VALUE is
+ user-missing for V, and otherwise 0. */
+enum mv_class
+var_is_value_missing (const struct variable *v, const union value *value)
{
- return mv_is_value_missing (&v->miss, value, class);
+ return mv_is_value_missing (&v->miss, value);
}
-/* 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, enum mv_class class)
+/* Returns MV_SYSTEM if VALUE is system-missing, MV_USER if VALUE is
+ user-missing for V, and otherwise 0. V must be a numeric variable. */
+enum mv_class
+var_is_num_missing (const struct variable *v, double d)
{
- return mv_is_num_missing (&v->miss, d, class);
+ return mv_is_num_missing (&v->miss, d);
}
-/* 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 uint8_t s[],
- enum mv_class class)
+/* Returns MV_USER if VALUE is user-missing for V and otherwise 0. V must be
+ a string variable. */
+enum mv_class
+var_is_str_missing (const struct variable *v, const uint8_t s[])
{
- return mv_is_str_missing (&v->miss, s, class);
+ return mv_is_str_missing (&v->miss, s);
}
\f
/* Returns variable V's value labels,
double
var_force_valid_weight (const struct variable *wv, double w, bool *warn_on_invalid)
{
- if (w < 0.0 || (wv && var_is_num_missing (wv, w, MV_ANY)))
+ if (w < 0.0 || (wv && var_is_num_missing (wv, w)))
w = 0.0;
if (w == 0.0 && warn_on_invalid != NULL && *warn_on_invalid)
void var_clear_missing_values (struct variable *);
bool var_has_missing_values (const struct variable *);
-bool var_is_value_missing (const struct variable *, const union value *,
- enum mv_class);
-bool var_is_num_missing (const struct variable *, double, enum mv_class);
-bool var_is_str_missing (const struct variable *, const uint8_t[], enum mv_class);
+enum mv_class var_is_value_missing (const struct variable *, const union value *);
+enum mv_class var_is_num_missing (const struct variable *, double);
+enum mv_class var_is_str_missing (const struct variable *, const uint8_t[]);
/* Value labels. */
const char *var_lookup_value_label (const struct variable *,
= case_data_idx (file->data, src_field->case_index);
int width = src_field->width;
- if (!mv_is_value_missing (file->mv[i], src_value, MV_ANY)
+ if (!mv_is_value_missing (file->mv[i], src_value)
&& !(width > 0 && value_is_spaces (src_value, width)))
value_copy (case_data_rw_idx (output, dst_field->case_index),
src_value, width);
value->numeric.show = SETTINGS_VALUE_SHOW_VALUE;
else
value->string.show = SETTINGS_VALUE_SHOW_VALUE;
- if (var_is_value_missing (vars[i], &vl->value, MV_USER))
+ if (var_is_value_missing (vars[i], &vl->value) == MV_USER)
pivot_value_add_footnote (value, missing_footnote);
int row = pivot_category_create_leaf (group, value);
if (var)
{
double d = case_num (c, var);
- if (!var_is_num_missing (var, d, MV_USER))
+ if (var_is_num_missing (var, d) != MV_USER)
return d;
}
return SYSMIS;
num_var v;
{
double d = case_num (c, v);
- return !var_is_num_missing (v, d, MV_USER) ? d : SYSMIS;
+ return var_is_num_missing (v, d) ? SYSMIS : d;
}
no_opt string operator STR_VAR ()
if (c != NULL)
{
double x = case_num (c, v);
- return !var_is_num_missing (v, x, MV_USER) ? x : SYSMIS;
+ return var_is_num_missing (v, x) ? SYSMIS : x;
}
else
return SYSMIS;
if (c != NULL)
{
double x = case_num (c, v);
- return !var_is_num_missing (v, x, MV_USER) ? x : SYSMIS;
+ return var_is_num_missing (v, x) ? SYSMIS : x;
}
else
return SYSMIS;
const union value *v = case_data (input, iter->src);
int src_width = var_get_width (iter->src);
- if (var_is_value_missing (iter->src, v, iter->exclude))
+ if (var_is_value_missing (iter->src, v) & iter->exclude)
{
switch (iter->function)
{
struct arc_item *item = xmalloc (sizeof *item);
item->width = width;
value_clone (&item->from, value, width);
- item->missing = mv_is_value_missing_varwidth (&spec->mv, value, spec->width,
- MV_ANY);
+ item->missing = mv_is_value_missing_varwidth (&spec->mv, value,
+ spec->width);
item->value_label = ds_steal_cstr (&value_label);
hmap_insert (&spec->items->ht, &item->hmap_node, hash);
const struct variable *var = ost->vars[v];
double value = case_num (c, var);
- if (var_is_num_missing (var, value, exclude))
+ if (var_is_num_missing (var, value) & exclude)
continue;
if (bst->cutpoint != SYSMIS)
const struct variable *var = ct->vars[v];
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
if (ch.success == SYSMIS)
else if (lex_match_id (lexer, "INCLUDE"))
proc.exclude = MV_SYSTEM;
else if (lex_match_id (lexer, "REPORT"))
- proc.exclude = MV_NEVER;
+ proc.exclude = 0;
else
{
lex_error (lexer, NULL);
assert (proc.n_cells < CRS_N_CELLS);
/* Missing values. */
- if (proc.mode == GENERAL && proc.exclude == MV_NEVER)
+ if (proc.mode == GENERAL && !proc.exclude)
{
msg (SE, _("Missing mode %s not allowed in general mode. "
"Assuming %s."), "REPORT", "MISSING=TABLE");
const struct variable *var = xt->vars[j].var;
const struct var_range *range = get_var_range (xt->proc, var);
- if (var_is_value_missing (var, case_data (c, var), exclude))
+ if (var_is_value_missing (var, case_data (c, var)) & exclude)
return false;
if (range != NULL)
if (table)
display_crosstabulation (proc, &x, table, crs_leaves);
- if (proc->exclude == MV_NEVER)
+ if (proc->exclude == 0)
delete_missing (&x);
if (chisq)
{
struct pivot_value *value = pivot_value_new_var_value (
var->var, &var->values[j]);
- if (var_is_value_missing (var->var, &var->values[j], MV_ANY))
+ if (var_is_value_missing (var->var, &var->values[j]))
pivot_value_add_footnote (value, missing_footnote);
pivot_category_create_leaf (group, value);
}
for (r = 0; r < n_rows; r++)
if (var_is_num_missing (xt->vars[ROW_VAR].var,
- xt->vars[ROW_VAR].values[r].f, MV_USER))
+ xt->vars[ROW_VAR].values[r].f) == MV_USER)
{
for (c = 0; c < n_cols; c++)
xt->mat[c + r * n_cols] = 0.;
for (c = 0; c < n_cols; c++)
if (var_is_num_missing (xt->vars[COL_VAR].var,
- xt->vars[COL_VAR].values[c].f, MV_USER))
+ xt->vars[COL_VAR].values[c].f) == MV_USER)
{
for (r = 0; r < n_rows; r++)
xt->mat[c + r * n_cols] = 0.;
if (t->filter)
{
double f = case_num (*c, t->filter);
- if (f == 0.0 || var_is_num_missing (t->filter, f, MV_ANY))
+ if (f == 0.0 || var_is_num_missing (t->filter, f))
{
descriptives_set_all_sysmis_zscores (t, *c);
return TRNS_CONTINUE;
for (vars = t->vars; vars < t->vars + t->n_vars; vars++)
{
double score = case_num (*c, *vars);
- if (var_is_num_missing (*vars, score, t->exclude))
+ if (var_is_num_missing (*vars, score) & t->exclude)
{
descriptives_set_all_sysmis_zscores (t, *c);
return TRNS_CONTINUE;
double *output = case_num_rw (*c, z->z_var);
if (z->mean == SYSMIS || z->std_dev == SYSMIS
- || var_is_num_missing (z->src_var, input, t->exclude))
+ || var_is_num_missing (z->src_var, input) & t->exclude)
*output = SYSMIS;
else
*output = (input - z->mean) / z->std_dev;
if (filter)
{
double f = case_num (c, filter);
- if (f == 0.0 || var_is_num_missing (filter, f, MV_ANY))
+ if (f == 0.0 || var_is_num_missing (filter, f))
continue;
}
struct dsc_var *dv = &dsc->vars[i];
double x = case_num (c, dv->v);
- if (var_is_num_missing (dv->v, x, dsc->exclude))
+ if (var_is_num_missing (dv->v, x) & dsc->exclude)
{
dv->missing += weight;
continue;
if (filter)
{
double f = case_num (c, filter);
- if (f == 0.0 || var_is_num_missing (filter, f, MV_ANY))
+ if (f == 0.0 || var_is_num_missing (filter, f))
continue;
}
struct dsc_var *dv = &dsc->vars[i];
double x = case_num (c, dv->v);
- if (var_is_num_missing (dv->v, x, dsc->exclude))
+ if (var_is_num_missing (dv->v, x) & dsc->exclude)
continue;
if (dv->moments != NULL)
struct dsc_var *dv = &dsc->vars[i];
double x = case_num (c, dv->v);
- if (var_is_num_missing (dv->v, x, dsc->exclude))
+ if (var_is_num_missing (dv->v, x) & dsc->exclude)
return true;
}
return false;
append_value_name (const struct variable *var, const union value *val, struct string *str)
{
var_append_value_name (var, val, str);
- if (var_is_value_missing (var, val, MV_ANY))
+ if (var_is_value_missing (var, val))
ds_put_cstr (str, _(" (missing)"));
}
struct pivot_footnote *missing_footnote)
{
struct pivot_value *pv = pivot_value_new_var_value (var, value);
- if (var_is_value_missing (var, value, MV_USER))
+ if (var_is_value_missing (var, value) == MV_USER)
pivot_value_add_footnote (pv, missing_footnote);
return pv;
}
{
const struct variable *var = examine->dep_vars[v];
- if (var_is_value_missing (var, case_data (c, var), examine->dep_excl))
+ if (var_is_value_missing (var, case_data (c, var))
+ & examine->dep_excl)
{
es[v].missing += weight;
this_case_is_missing = true;
const struct variable *var = examine->dep_vars[v];
const double x = case_num (c, var);
- if (var_is_value_missing (var, case_data (c, var), examine->dep_excl))
+ if (var_is_value_missing (var, case_data (c, var)) & examine->dep_excl)
{
es[v].missing += weight;
continue;
}
else if (lex_match_id (lexer, "REPORT"))
{
- examine.fctr_excl = MV_NEVER;
+ examine.fctr_excl = 0;
}
else if (lex_match_id (lexer, "NOREPORT"))
{
const struct freq *f = f_;
const struct variable *v = v_;
- return !var_is_value_missing (v, f->values, MV_ANY);
+ return !var_is_value_missing (v, f->values);
}
const struct variable *var,
const union value *value)
{
- if (!chart->include_missing && var_is_value_missing (var, value, MV_ANY))
+ if (!chart->include_missing && var_is_value_missing (var, value))
return false;
if (var_is_numeric (var)
for (v = 0; v < cmd->n_by_vars; ++v)
{
if (var_is_value_missing (cmd->by_var[v],
- case_data (c, cmd->by_var[v]),
- cmd->fctr_excl))
+ case_data (c, cmd->by_var[v]))
+ & cmd->fctr_excl)
break;
}
const struct variable *var = cmd->dep_vars[v];
const double x = case_num (c, var);
- if (var_is_value_missing (var, case_data (c, var), cmd->dep_excl))
+ if (var_is_value_missing (var, case_data (c, var)) & cmd->dep_excl)
{
cmd->es[v].missing += weight;
continue;
}
else if (lex_match_id (lexer, "REPORT"))
{
- graph.fctr_excl = MV_NEVER;
+ graph.fctr_excl = 0;
}
else if (lex_match_id (lexer, "NOREPORT"))
{
const struct variable *var = ost->vars[v];
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
minimize (&ks[v].test_min, val->f);
const double weight = dict_get_case_weight (dict, c, &warn);
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
cc += weight;
double weight = dict_get_case_weight (cmd->dict, c, &res->warn_bad_weight);
const union value *depval = case_data (c, cmd->dep_var);
- if (var_is_value_missing (cmd->dep_var, depval, cmd->exclude))
+ if (var_is_value_missing (cmd->dep_var, depval) & cmd->exclude)
{
missing = true;
}
for (v = 0; v < cmd->n_indep_vars; ++v)
{
const union value *val = case_data (c, cmd->indep_vars[v]);
- if (var_is_value_missing (cmd->indep_vars[v], val, cmd->exclude))
+ if (var_is_value_missing (cmd->indep_vars[v], val) & cmd->exclude)
{
missing = true;
break;
error = true;
}
}
- else if (var_is_num_missing (var, d, MV_USER))
+ else if (var_is_num_missing (var, d) == MV_USER)
{
if (get->user.treatment == MGET_RECODE)
d = get->user.substitute;
{
struct variable *var = dict_get_var (d, cs + x);
double value = case_num (rows[y], var);
- if (var_is_num_missing (var, value, MV_ANY))
+ if (var_is_num_missing (var, value))
{
n_missing++;
value = 0.0;
const union value *value0 = case_data (c, (*vp)[0]);
const union value *value1 = case_data (c, (*vp)[1]);
- if (var_is_value_missing ((*vp)[0], value0, exclude))
+ if (var_is_value_missing ((*vp)[0], value0) & exclude)
continue;
- if (var_is_value_missing ((*vp)[1], value1, exclude))
+ if (var_is_value_missing ((*vp)[1], value1) & exclude)
continue;
const struct variable *var = layer->factor_vars[ws->control_idx[l]];
const union value *vv = case_data (c, var);
- miss = var_is_value_missing (var, vv, means->ctrl_exclude);
+ miss = (var_is_value_missing (var, vv) & means->ctrl_exclude) != 0;
if (miss)
break;
}
{
const struct variable *dep_var = mt->dep_vars[v];
const union value *vv = case_data (c, dep_var);
- if (var_is_value_missing (dep_var, vv, means->dep_exclude))
+ if (var_is_value_missing (dep_var, vv) & means->dep_exclude)
continue;
for (int stat = 0; stat < means->n_statistics; ++stat)
const struct variable *var = mt->dep_vars[dv];
const union value *vv = case_data (c, var);
/* First check if the dependent variable is missing. */
- if (var_is_value_missing (var, vv, means->dep_exclude))
+ if (var_is_value_missing (var, vv) & means->dep_exclude)
summ->n_missing += weight;
/* If the dep var is not missing, then check each
control variable. */
const struct variable *var
= layer->factor_vars[ws->control_idx[l]];
const union value *vv = case_data (c, var);
- if (var_is_value_missing (var, vv, means->ctrl_exclude))
+ if (var_is_value_missing (var, vv) & means->ctrl_exclude)
{
summ->n_missing += weight;
break;
for (; (c = casereader_read (rr)) != NULL;)
{
- if (var_is_value_missing (var, case_data (c, var), exclude))
+ if (var_is_value_missing (var, case_data (c, var)) & exclude)
{
case_unref (c);
continue;
const union value *val = case_data (c, var);
const union value *indep_val = case_data (c, nst->indep_var);
- if (var_is_value_missing (var, case_data (c, var), exclude))
+ if (var_is_value_missing (var, case_data (c, var)) & exclude)
{
continue;
}
if (MISS_ANALYSIS == cmd->missing_type)
{
- if (var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val) & cmd->exclude)
continue;
}
if (MISS_ANALYSIS == cmd->missing_type)
{
- if (var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val) & cmd->exclude)
continue;
}
if (MISS_ANALYSIS == cmd->missing_type)
{
- if (var_is_value_missing (v, val, cmd->exclude))
+ if (var_is_value_missing (v, val) & cmd->exclude)
continue;
}
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
NOT_REACHED ();
dist += pow2 (gsl_matrix_get (kmeans->centers, which, j) - val->f);
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
{
missing = true;
break;
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
continue;
dist += pow2 (gsl_matrix_get (kmeans->centers, i, j) - val->f);
for (j = 0; j < qc->n_vars; j++)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
missing = true;
}
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
continue;
double *x = gsl_matrix_ptr (kmeans->updated_centers, group, j);
*x += val->f * (qc->wv ? case_num (c, qc->wv) : 1.0);
for (j = 0; j < qc->n_vars; ++j)
{
const union value *val = case_data (c, qc->vars[j]);
- if (var_is_value_missing (qc->vars[j], val, qc->exclude))
+ if (var_is_value_missing (qc->vars[j], val) & qc->exclude)
continue;
double *x = gsl_matrix_ptr (kmeans->updated_centers, group, j);
const union value *v = case_data (c, roc->vars[i]);
const double result = v->f;
- if (mv_is_value_missing (var_get_missing_values (roc->vars[i]), v, roc->exclude))
+ if (mv_is_value_missing (var_get_missing_values (roc->vars[i]), v)
+ & roc->exclude)
continue;
minimize (&rs[i].min, result);
{
const double w = weight ? case_num (c, weight) : 1.0;
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
x = val->f;
cc += w;
{
const union value *val = case_data (c, var);
const double w = weight ? case_num (c, weight) : 1.0;
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
{
case_unref (c);
continue;
const double x = val->f;
struct run_state *run = &rs[v];
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
run->cutpoint += x * w;
double d = x - run->cutpoint;
short sign = 0;
- if (var_is_value_missing (var, val, exclude))
+ if (var_is_value_missing (var, val) & exclude)
continue;
if (d >= 0)
const union value *value1 = case_data (c, (*vp)[1]);
const double diff = value0->f - value1->f;
- if (var_is_value_missing ((*vp)[0], value0, exclude))
+ if (var_is_value_missing ((*vp)[0], value0) & exclude)
continue;
- if (var_is_value_missing ((*vp)[1], value1, exclude))
+ if (var_is_value_missing ((*vp)[1], value1) & exclude)
continue;
if (diff > 0)
for (v = 0; v < tt->n_vars; ++v)
{
const union value *val = case_data (c, tt->vars[v]);
- if (var_is_value_missing (tt->vars[v], val, tt->exclude))
+ if (var_is_value_missing (tt->vars[v], val) & tt->exclude)
continue;
moments_pass_one (ps[v].mom[grp], val->f, w);
for (v = 0; v < tt->n_vars; ++v)
{
const union value *val = case_data (c, tt->vars[v]);
- if (var_is_value_missing (tt->vars[v], val, tt->exclude))
+ if (var_is_value_missing (tt->vars[v], val) & tt->exclude)
continue;
moments_pass_two (ps[v].mom[grp], val->f, w);
for (v = 0; v < tt->n_vars; ++v)
{
const union value *val = case_data (c, tt->vars[v]);
- if (var_is_value_missing (tt->vars[v], val, tt->exclude))
+ if (var_is_value_missing (tt->vars[v], val) & tt->exclude)
continue;
levene_pass_three (ps[v].nl, val->f, w, gv);
const struct per_var_stats *per_var_stats = &os.stats[i];
const struct variable *var = per_var_stats->var;
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, tt->exclude))
+ if (var_is_value_missing (var, val) & tt->exclude)
continue;
moments_pass_one (per_var_stats->mom, val->f, w);
struct per_var_stats *per_var_stats = &os.stats[i];
const struct variable *var = per_var_stats->var;
const union value *val = case_data (c, var);
- if (var_is_value_missing (var, val, tt->exclude))
+ if (var_is_value_missing (var, val) & tt->exclude)
continue;
moments_pass_two (per_var_stats->mom, val->f, w);
struct pair_stats *pp = &ps.ps[i];
const union value *val0 = case_data (c, pp->var0);
const union value *val1 = case_data (c, pp->var1);
- if (var_is_value_missing (pp->var0, val0, tt->exclude))
+ if (var_is_value_missing (pp->var0, val0) & tt->exclude)
continue;
- if (var_is_value_missing (pp->var1, val1, tt->exclude))
+ if (var_is_value_missing (pp->var1, val1) & tt->exclude)
continue;
moments_pass_one (pp->mom0, val0->f, w);
struct pair_stats *pp = &ps.ps[i];
const union value *val0 = case_data (c, pp->var0);
const union value *val1 = case_data (c, pp->var1);
- if (var_is_value_missing (pp->var0, val0, tt->exclude))
+ if (var_is_value_missing (pp->var0, val0) & tt->exclude)
continue;
- if (var_is_value_missing (pp->var1, val1, tt->exclude))
+ if (var_is_value_missing (pp->var1, val1) & tt->exclude)
continue;
moments_pass_two (pp->mom0, val0->f, w);
break;
}
- if (var_is_num_missing (crit->vars[i], x, MV_ANY)
+ if (var_is_num_missing (crit->vars[i], x)
&& (x == SYSMIS
? crit->count_system_missing
: crit->count_user_missing))
match = value == in->x.f;
break;
case MAP_MISSING:
- match = var_is_num_missing (v, value, MV_ANY);
+ match = var_is_num_missing (v, value) != 0;
break;
case MAP_RANGE:
match = value >= in->x.f && value <= in->y.f;
break;
}
case MAP_MISSING:
- match = var_is_str_missing (src_var, value, MV_ANY);
+ match = var_is_str_missing (src_var, value) != 0;
break;
default:
NOT_REACHED ();
const union value *val = case_data (c, var);
- return var_is_value_missing (var, val, cov->exclude);
+ return (var_is_value_missing (var, val) & cov->exclude) != 0;
}
const struct ccase *c, enum mv_class exclude)
{
for (size_t i = 0; i < iact->n_vars; ++i)
- if (var_is_value_missing (iact->vars[i], case_data (c, iact->vars[i]),
- exclude))
+ if (var_is_value_missing (iact->vars[i], case_data (c, iact->vars[i]))
+ & exclude)
return true;
return false;
ds_init_empty (&dst->label);
- if (var_is_value_missing (var, &src->values[0], MV_ANY))
+ if (var_is_value_missing (var, &src->values[0]))
ds_assign_cstr (&dst->label, _("*MISSING*"));
else
var_append_value_name (var, &src->values[0], &dst->label);
{
struct string label;
ds_init_empty (&label);
- if (var_is_value_missing (spc->byvar,val,MV_ANY))
+ if (var_is_value_missing (spc->byvar,val))
ds_put_cstr (&label,"missing");
else
var_append_value_name (spc->byvar,val,&label);
unlabeled_value (PsppireDataStore *store, const struct variable *variable, const union value *val)
{
if (var_is_numeric (variable) &&
- var_is_value_missing (variable, val, MV_SYSTEM))
+ var_is_value_missing (variable, val) == MV_SYSTEM)
return g_strdup ("");
const struct fmt_spec *fmt = var_get_print_format (variable);
if (psppire_value_entry_get_value (ve, &val, width))
{
- if (var_is_value_missing (var, &val, MV_SYSTEM))
+ if (var_is_value_missing (var, &val) == MV_SYSTEM)
{
result = TRUE;
}
result = psppire_value_entry_get_value (PSPPIRE_VALUE_ENTRY (rd->state_value), &val, width);
- if (var_is_value_missing (var, &val, MV_SYSTEM))
+ if (var_is_value_missing (var, &val) == MV_SYSTEM)
result = FALSE;
value_destroy (&val, width);