1#include "dthdr.h"
2
3/* Extract objects of a dictionary.
4**
5** Written by Kiem-Phong Vo (5/25/96).
6*/
7
8Dtlink_t* dtextract(reg Dt_t* dt)
9{
10 reg Dtlink_t *list, **s, **ends;
11
12 if(dt->data->type&(DT_OSET|DT_OBAG) )
13 list = dt->data->here;
14 else if(dt->data->type&(DT_SET|DT_BAG))
15 { list = dtflatten(dt);
16 for(ends = (s = dt->data->htab) + dt->data->ntab; s < ends; ++s)
17 *s = NIL(Dtlink_t*);
18 }
19 else /*if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE))*/
20 { list = dt->data->head;
21 dt->data->head = NIL(Dtlink_t*);
22 }
23
24 dt->data->type &= ~DT_FLATTEN;
25 dt->data->size = 0;
26 dt->data->here = NIL(Dtlink_t*);
27
28 return list;
29}
30