struct dictionary *d;
size_t i;
- assert (s != NULL);
-
d = dict_create ();
for (i = 0; i < s->var_cnt; i++)
{
/* FIXME? Should we really clear case_limit, label, documents?
Others are necessarily cleared by deleting all the variables.*/
- assert (d != NULL);
-
while (d->var_cnt > 0 )
{
dict_delete_var (d, d->var[d->var_cnt - 1]);
{
int i;
- assert (d != NULL);
-
for (i = 0; i < d->var_cnt; i++)
var_clear_aux (d->var[i]);
}
size_t
dict_get_var_cnt (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->var_cnt;
}
struct variable *
dict_get_var (const struct dictionary *d, size_t idx)
{
- assert (d != NULL);
assert (idx < d->var_cnt);
return d->var[idx];
size_t count;
size_t i;
- assert (d != NULL);
- assert (vars != NULL);
- assert (cnt != NULL);
assert (exclude == (exclude & DC_ALL));
count = 0;
{
/* FIXME: this can be done in O(count) time, but this algorithm
is O(count**2). */
- assert (d != NULL);
assert (count == 0 || vars != NULL);
while (count-- > 0)
/* 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 (var_get_dict_class (d->var[i]) == DC_SCRATCH)
dict_delete_var (d, d->var[i]);
struct variable **new_var;
size_t i;
- assert (d != NULL);
assert (count == 0 || order != NULL);
assert (count <= d->var_cnt);
struct variable *
dict_get_weight (const struct dictionary *d)
{
- assert (d != NULL);
assert (d->weight == NULL || dict_contains_var (d, d->weight));
return d->weight;
dict_get_case_weight (const struct dictionary *d, const struct ccase *c,
bool *warn_on_invalid)
{
- assert (d != NULL);
assert (c != NULL);
if (d->weight == NULL)
void
dict_set_weight (struct dictionary *d, struct variable *v)
{
- assert (d != NULL);
assert (v == NULL || dict_contains_var (d, v));
assert (v == NULL || var_is_numeric (v));
struct variable *
dict_get_filter (const struct dictionary *d)
{
- assert (d != NULL);
assert (d->filter == NULL || dict_contains_var (d, d->filter));
return d->filter;
void
dict_set_filter (struct dictionary *d, struct variable *v)
{
- assert (d != NULL);
assert (v == NULL || dict_contains_var (d, v));
assert (v == NULL || var_is_numeric (v));
casenumber
dict_get_case_limit (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->case_limit;
}
void
dict_set_case_limit (struct dictionary *d, casenumber case_limit)
{
- assert (d != NULL);
-
d->case_limit = case_limit;
}
int
dict_get_next_value_idx (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->next_value_idx;
}
size_t
dict_get_case_size (const struct dictionary *d)
{
- assert (d != NULL);
-
return sizeof (union value) * dict_get_next_value_idx (d);
}
const struct variable *const *
dict_get_split_vars (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->split;
}
size_t
dict_get_split_cnt (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->split_cnt;
}
dict_set_split_vars (struct dictionary *d,
struct variable *const *split, size_t cnt)
{
- assert (d != NULL);
assert (cnt == 0 || split != NULL);
d->split_cnt = cnt;
const char *
dict_get_label (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->label;
}
void
dict_set_label (struct dictionary *d, const char *label)
{
- assert (d != NULL);
-
free (d->label);
d->label = label != NULL ? xstrndup (label, 60) : NULL;
}
{
size_t i;
- assert (var != NULL);
assert (cnt > 0);
for (i = 0; i < cnt; i++)
assert (dict_contains_var (d, var[i]));
const struct vector *
dict_get_vector (const struct dictionary *d, size_t idx)
{
- assert (d != NULL);
assert (idx < d->vector_cnt);
return d->vector[idx];
size_t
dict_get_vector_cnt (const struct dictionary *d)
{
- assert (d != NULL);
-
return d->vector_cnt;
}