2
This software may only be used by you under license from AT&T Corp.
3
("AT&T"). A copy of AT&T's Source Code Agreement is available at
4
AT&T's Internet website having the URL:
5
<http://www.research.att.com/sw/tools/graphviz/license/source.html>
6
If you received this software without first entering into a license
7
with AT&T, you have an infringing copy of this software and cannot use
8
it without violating AT&T's intellectual property rights.
16
/* Change search method.
18
** Written by Kiem-Phong Vo (05/25/96)
22
Dtmethod_t* dtmethod(Dt_t* dt, Dtmethod_t* meth)
24
Dtmethod_t* dtmethod(dt, meth)
29
reg Dtlink_t *list, *r;
30
reg Dtdisc_t* disc = dt->disc;
31
reg Dtmethod_t* oldmeth = dt->meth;
33
if(!meth || meth->type == oldmeth->type)
37
(*disc->eventf)(dt,DT_METH,(Void_t*)meth,disc) < 0)
38
return NIL(Dtmethod_t*);
40
/* get the list of elements */
43
if(dt->data->type&(DT_LIST|DT_STACK|DT_QUEUE) )
44
dt->data->head = NIL(Dtlink_t*);
45
else if(dt->data->type&(DT_SET|DT_BAG) )
46
{ if(dt->data->ntab > 0)
47
(*dt->memoryf)(dt,(Void_t*)dt->data->htab,0,disc);
49
dt->data->htab = NIL(Dtlink_t**);
52
dt->data->here = NIL(Dtlink_t*);
53
dt->data->type = (dt->data->type&~(DT_METHODS|DT_FLATTEN)) | meth->type;
55
if(dt->searchf == oldmeth->searchf)
56
dt->searchf = meth->searchf;
58
if(meth->type&(DT_LIST|DT_STACK|DT_QUEUE) )
59
{ if(!(oldmeth->type&(DT_LIST|DT_STACK|DT_QUEUE)) )
62
for(t = r->right; t; r = t, t = t->right )
67
dt->data->head = list;
69
else if(meth->type&(DT_OSET|DT_OBAG))
73
(*meth->searchf)(dt,(Void_t*)list,DT_RENEW);
77
else if(!((meth->type&DT_BAG) && (oldmeth->type&DT_SET)) )
79
if((meth->type&(DT_SET|DT_BAG)) && !(oldmeth->type&(DT_SET|DT_BAG)))
83
dt->data->size = dt->data->loop = 0;
87
{ reg Void_t* key = OBJ(list,disc->link);
88
key = KEY(key,disc->key,disc->size);
89
list->hash = HASH(dt,key,disc,disc->size);
91
(void)(*meth->searchf)(dt,(Void_t*)list,DT_RENEW);