11 static void* dttree(
Dt_t* dt,
void* obj,
int type)
33 {
while((t = root->left) )
39 (*dt->
memoryf)(dt,(
void*)root,0,disc);
49 {
while((t = root->
right) )
53 {
while((t = root->left) )
70 if(
_DTCMP(dt,key,k,disc,cmpf,sz) != 0)
74 l->
right = root->left;
75 r->left = root->
right;
93 else if(root &&
_DTOBJ(root,lk) != obj)
99 for(t = root, n = 0; n < minp; ++n)
101 if((cmp =
_DTCMP(dt,key,k,disc,cmpf,sz)) == 0)
111 for(n = 0; n < minp; n += 2)
143 if((cmp =
_DTCMP(dt,key,k,disc,cmpf,sz)) == 0)
146 {
if((t = root->left) )
148 if((cmp =
_DTCMP(dt,key,k,disc,cmpf,sz)) < 0)
151 if(!(root = t->left) )
162 if(!(root = t->
right) )
173 {
if((t = root->
right) )
175 if((cmp =
_DTCMP(dt,key,k,disc,cmpf,sz)) > 0)
178 if(!(root = t->
right) )
189 if(!(root = t->left) )
205 l->
right = root->left;
206 r->left = root->
right;
210 root->left = link.
right;
211 root->
right = link.left;
214 while((t = root->left) )
216 while((r = t->
right) )
222 if(
_DTCMP(dt,key,k,disc,cmpf,sz) != 0)
231 { root->left = link.
right;
235 if((root = link.left) )
236 {
while((t = root->left) )
238 link.left = root->
right;
244 { root->
right = link.left;
248 if((root = link.
right) )
249 {
while((t = root->
right) )
251 link.right = root->left;
261 (*disc->
freef)(dt,obj,disc);
263 (*dt->
memoryf)(dt,(
void*)root,0,disc);
273 root->
right = link.left;
278 else if(type&DT_RENEW)
281 (*disc->
freef)(dt,obj,disc);
283 (*dt->
memoryf)(dt,(
void*)me,0,disc);
287 me->
right = link.left;
301 else if(type&DT_PREV)
305 while((t = r->left) )
307 r->left = link.
right;
309 return (type&DT_DELETE) ? obj :
NIL(
void*);
314 obj = (*disc->
makef)(dt,obj,disc);
325 (*disc->
freef)(dt,obj,disc);
335 else if(type&DT_RENEW)
int(* Dtcompar_f)(Dt_t *, void *, void *, Dtdisc_t *)
CDT_API Dtmethod_t * Dtoset
CDT_API Dtmethod_t * Dtorder
#define _DTDSC(dc, ky, sz, lk, cmpf)
#define _DTCMP(dt, k1, k2, dc, cmpf, sz)
struct _dthold_s Dthold_t
CDT_API Dtmethod_t _Dttree
CDT_API Dtmethod_t * Dttree
#define _DTKEY(o, ky, sz)
CDT_API Dtmethod_t * Dtobag