exclude ordinary, system, and/or scratch variables. */
void
dict_get_vars (const struct dictionary *d, struct variable ***vars,
- size_t *cnt, unsigned exclude_classes)
+ int *cnt, unsigned exclude_classes)
{
size_t count;
size_t i;
v->init = 1;
v->reinit = dict_class_from_id (v->name) != DC_SCRATCH;
v->index = d->var_cnt;
- v->miss_type = MISSING_NONE;
+ mv_init (&v->miss, width);
if (v->type == NUMERIC)
{
v->print = f8_2;
the same short name. */
nv->init = 1;
nv->reinit = ov->reinit;
- nv->miss_type = ov->miss_type;
- memcpy (nv->missing, ov->missing, sizeof nv->missing);
+ mv_copy (&nv->miss, &ov->miss);
nv->print = ov->print;
nv->write = ov->write;
val_labs_destroy (nv->val_labs);
dict_delete_var (d, *vars++);
}
+/* Deletes scratch variables from dictionary D. */
+void
+dict_delete_scratch_vars (struct dictionary *d)
+{
+ int i;
+
+ /* FIXME: this can be done in O(count) time, but this algorithm
+ is O(count**2). */
+ assert (d != NULL);
+
+ for (i = 0; i < d->var_cnt; )
+ if (dict_class_from_id (d->var[i]->name) == DC_SCRATCH)
+ dict_delete_var (d, d->var[i]);
+ else
+ i++;
+}
+
/* Moves V to 0-based position IDX in D. Other variables in D,
if any, retain their relative positions. Runs in time linear
in the distance moved. */
else
{
double w = case_num (c, d->weight->fv);
- if ( w < 0.0 || w == SYSMIS || is_num_user_missing(w, d->weight) )
+ if (w < 0.0 || mv_is_num_missing (&d->weight->miss, w))
w = 0.0;
if ( w == 0.0 && *warn_on_invalid ) {
*warn_on_invalid = 0;