+/* Lookup the set of control variables described by MT, C and NOT_WILD,
+ in the hash table MAP. If there is no such entry, then create a
+ cell with these paremeters and add is to MAP.
+ If the generated cell has childen, repeat for all the children.
+ Returns the root cell.
+*/
+static struct cell *
+service_cell_map (const struct means *means, const struct mtable *mt,
+ const struct ccase *c,
+ unsigned int not_wild,
+ struct hmap *map,
+ const struct cell *pcell,
+ int level,
+ const struct workspace *ws)
+{
+ struct cell *cell = NULL;
+ if (map)
+ {
+ if (!control_var_missing (means, mt, not_wild, c, ws))
+ {
+ /* Lookup this set of values in the cell's hash table. */
+ unsigned int hash = generate_hash (mt, c, not_wild, ws);
+ cell = lookup_cell (mt, map, hash, c, not_wild, ws);
+
+ /* If it has not been seen before, then create a new
+ subcell, with this set of values, and insert it
+ into the table. */
+ if (cell == NULL)
+ {
+ cell = generate_cell (means, mt, c, not_wild, pcell, ws);
+ hmap_insert (map, &cell->hmap_node, hash);
+ }
+ }
+ }
+ else
+ {
+ /* This condition should only happen in the root node case. */
+ cell = ws->root_cell;
+ if (cell == NULL &&
+ !control_var_missing (means, mt, not_wild, c, ws))
+ cell = generate_cell (means, mt, c, not_wild, pcell, ws);
+ }