Until now, var_create_internal has always created a numeric variable.
In the long run we wish to phase out the use of internal variables
entirely, but this change should help Jason get some work done in the
short term.
return new_var;
}
-/* Create a variable to be used for internal calculations only.
- The variable is assigned a unique dictionary index and a case
- index of CASE_IDX. */
+/* Create a variable of the specified WIDTH to be used for
+ internal calculations only. The variable is assigned a unique
+ dictionary index and a case index of CASE_IDX. */
struct variable *
-var_create_internal (int case_idx)
+var_create_internal (int case_idx, int width)
{
- struct variable *v = var_create ("$internal", 0);
+ struct variable *v = var_create ("$internal", width);
struct vardict_info vdi;
static int counter = INT_MAX / 2;
struct variable *var_create (const char *name, int width);
struct variable *var_clone (const struct variable *);
void var_destroy (struct variable *);
-struct variable *var_create_internal (int case_idx);
+struct variable *var_create_internal (int case_idx, int width);
/* Variable names. */
proto = caseproto_add_width (proto, 0);
if ( ! iter->subject)
- iter->subject = var_create_internal (0);
+ iter->subject = var_create_internal (0, 0);
if ( ! iter->weight)
- iter->weight = var_create_internal (1);
+ iter->weight = var_create_internal (1, 0);
subcase_init_var (&ordering, iter->subject, SC_ASCEND);
iter->writer = sort_create_writer (&ordering, proto);
struct wilcoxon_state *ws = xcalloc (sizeof (*ws), t2s->n_pairs);
const struct variable *weight = dict_get_weight (dict);
- struct variable *weightx = var_create_internal (WEIGHT_IDX);
+ struct variable *weightx = var_create_internal (WEIGHT_IDX, 0);
struct caseproto *proto;
input =
struct subcase ordering;
variable_pair *vp = &t2s->pairs[i];
- ws[i].sign = var_create_internal (0);
- ws[i].absdiff = var_create_internal (1);
+ ws[i].sign = var_create_internal (0, 0);
+ ws[i].absdiff = var_create_internal (1, 0);
r = casereader_create_filter_missing (r, *vp, 2,
exclude,
}
}
}
- result->intr = var_create_internal (0);
+ result->intr = var_create_internal (0, 0);
return result;
}