Lines Matching refs:dt

25 **	dt:	dictionary
34 static void dthtab(Dt_t* dt)
36 static void dthtab(dt)
37 Dt_t* dt;
43 if(dt->data->minp > 0 && dt->data->ntab > 0) /* fixed table size */
45 dt->data->minp = 0;
47 n = dt->data->ntab;
48 if(dt->disc && dt->disc->eventf &&
49 (*dt->disc->eventf)(dt, DT_HASHSIZE, &n, dt->disc) > 0 )
51 { dt->data->minp = 1;
52 if(dt->data->ntab > 0 )
65 { if((n = dt->data->ntab) == 0)
67 while(dt->data->size > HLOAD(n))
70 if(n == dt->data->ntab)
74 olds = dt->data->ntab == 0 ? NIL(Dtlink_t**) : dt->data->htab;
75 if(!(s = (Dtlink_t**)(*dt->memoryf)(dt,olds,n*sizeof(Dtlink_t*),dt->disc)) )
77 olds = s + dt->data->ntab;
78 dt->data->htab = s;
79 dt->data->ntab = n;
100 static Void_t* dthash(Dt_t* dt, reg Void_t* obj, int type)
102 static Void_t* dthash(dt,obj,type)
103 Dt_t* dt;
116 UNFLATTEN(dt);
119 disc = dt->disc; _DTDSC(disc,ky,sz,lk,cmpf);
120 dt->type &= ~DT_FOUND;
126 if(dt->data->size <= 0 || !(type&(DT_CLEAR|DT_FIRST|DT_LAST)) )
129 ends = (s = dt->data->htab) + dt->data->ntab;
140 (*disc->freef)(dt,_DTOBJ(t,lk),disc);
142 (*dt->memoryf)(dt,(Void_t*)t,0,disc);
146 dt->data->here = NIL(Dtlink_t*);
147 dt->data->size = 0;
148 dt->data->loop = 0;
159 dt->data->loop += 1;
160 dt->data->here = t;
166 if(dt->meth->type == DT_BAG && (type&(DT_DELETE|DT_DETACH)) )
167 { if(!dtsearch(dt,obj) )
170 s = dt->data->htab + HINDEX(dt->data->ntab,dt->data->here->hash);
175 if(t == dt->data->here)
180 p = r; t = dt->data->here;
186 hsh = _DTHSH(dt,key,disc,sz);
197 { if((t = dt->data->here) && _DTOBJ(t,lk) == obj)
199 s = dt->data->htab + HINDEX(dt->data->ntab,hsh);
204 hsh = _DTHSH(dt,key,disc,sz);
206 t = dt->data->ntab <= 0 ? NIL(Dtlink_t*) :
207 *(s = dt->data->htab + HINDEX(dt->data->ntab,hsh));
211 if(_DTCMP(dt,key,k,disc,cmpf,sz) == 0)
219 dt->type |= DT_FOUND;
224 if(p && (dt->data->type&DT_SET) && dt->data->loop <= 0)
230 dt->data->here = t;
234 { if(t && (dt->data->type&DT_SET) )
235 { dt->data->here = t;
240 !(obj = (*disc->makef)(dt,obj,disc)) )
245 { r = (Dtlink_t*)(*dt->memoryf)
246 (dt,NIL(Void_t*),sizeof(Dthold_t),disc);
251 (*disc->freef)(dt,obj,disc);
259 if((dt->data->size += 1) > HLOAD(dt->data->ntab) && dt->data->loop <= 0 )
260 dthtab(dt);
261 if(dt->data->ntab == 0)
262 { dt->data->size -= 1;
264 (*disc->freef)(dt,obj,disc);
266 (*disc->memoryf)(dt,(Void_t*)r,0,disc);
269 s = dt->data->htab + HINDEX(dt->data->ntab,hsh);
278 dt->data->here = r;
283 { for(ends = dt->data->htab+dt->data->ntab, s += 1; s < ends; ++s)
297 for(s -= 1, ends = dt->data->htab; s >= ends; --s)
307 if(!(dt->data->here = p) )
309 if((dt->data->loop -= 1) < 0)
310 dt->data->loop = 0;
311 if(dt->data->size > HLOAD(dt->data->ntab) && dt->data->loop <= 0)
312 dthtab(dt);
316 { dt->data->type |= DT_WALK;
321 { if(!t || (dt->data->type&DT_BAG) )
325 (*disc->freef)(dt,obj,disc);
327 (*dt->memoryf)(dt,(Void_t*)r,0,disc);
346 dt->data->size -= 1;
347 dt->data->here = p;
349 (*disc->freef)(dt,obj,disc);
351 (*dt->memoryf)(dt,(Void_t*)t,0,disc);