map->map[to] = from;
}
+/* Returns a copy of OLD, if OLD is nonnull, and otherwise returns NULL. */
+struct case_map *
+case_map_clone (const struct case_map *old)
+{
+ if (!old)
+ return NULL;
+
+ size_t n_values = caseproto_get_n_widths (old->proto);
+ struct case_map *new = xmalloc (sizeof *new);
+ *new = (struct case_map) {
+ .proto = caseproto_ref (old->proto),
+ .map = xmemdup (old->proto, n_values * sizeof *new->map),
+ };
+ return new;
+}
+
/* Destroys case map MAP. */
void
case_map_destroy (struct case_map *map)
struct ccase;
struct dictionary;
-struct case_map *case_map_create (void);
+struct case_map *case_map_clone (const struct case_map *);
void case_map_destroy (struct case_map *);
struct ccase *case_map_execute (const struct case_map *, struct ccase *);
return reader;
}
+bool
+dataset_delete_vars (struct dataset *ds, struct variable **vars, size_t n)
+{
+ dict_delete_vars (ds->dict, vars, n);
+
+ if (ds->source)
+ {
+ struct case_map *map = case_map_to_compact_dict (ds->d, 0);
+ ds->source = case_map_create_input_translator (map, ds->source);
+ }
+ dict_compact_values (ds->dict);
+}
+
/* Returns a number unique to DS. It can be used to distinguish one dataset
from any other within a given program run, even datasets that do not exist
at the same time. */
bool dataset_set_source (struct dataset *, struct casereader *);
struct casereader *dataset_steal_source (struct dataset *);
+bool dataset_delete_vars (struct dataset *, struct variable **, size_t n);
+
unsigned int dataset_seqno (const struct dataset *);
struct dataset_callbacks