24#define CDT_VERSION 20050420L
31#define CDT_API __declspec(dllexport)
33#define CDT_API __declspec(dllimport)
45typedef void* (*Dtsearch_f)(
Dt_t*,
void*,int);
93#define DTDISC(dc, ky, sz, lk, mkf, frf, cmpf) \
94 ( (dc)->key = (ky), (dc)->size = (sz), (dc)->link = (lk), \
95 (dc)->makef = (mkf), (dc)->freef = (frf), \
96 (dc)->comparf = (cmpf) )
120#define DT_SET 0000001
121#define DT_OSET 0000004
122#define DT_OBAG 0000010
123#define DT_METHODS 0000377
126#define DT_INSERT 0000001
127#define DT_DELETE 0000002
128#define DT_SEARCH 0000004
129#define DT_NEXT 0000010
130#define DT_PREV 0000020
131#define DT_RENEW 0000040
132#define DT_CLEAR 0000100
133#define DT_FIRST 0000200
134#define DT_LAST 0000400
135#define DT_MATCH 0001000
136#define DT_VSEARCH 0002000
137#define DT_DETACH 0010000
164#define _DT(dt) ((Dt_t*)(dt))
165#define _DTDSC(dc,ky,sz,lk,cmpf) \
166 (ky = dc->key, sz = dc->size, lk = dc->link, cmpf = dc->comparf)
167#define _DTLNK(o,lk) ((Dtlink_t*)((char*)(o) + lk) )
168#define _DTOBJ(e,lk) (lk < 0 ? ((Dthold_t*)(e))->obj : (void*)((char*)(e) - lk) )
169#define _DTKEY(o,ky,sz) (void*)(sz < 0 ? *((char**)((char*)(o)+ky)) : ((char*)(o)+ky))
171#define _DTCMP(k1, k2, cmpf, sz) \
172 (cmpf ? (cmpf)(k1, k2) : \
173 (sz <= 0 ? strcmp(k1,k2) : memcmp(k1,k2,(size_t)sz)) )
175#define dtlink(d,e) (((Dtlink_t*)(e))->right)
176#define dtobj(d,e) _DTOBJ((e), _DT(d)->disc->link)
177#define dtfinger(d) (_DT(d)->data.here ? dtobj((d), _DT(d)->data.here) : NULL)
179#define dtfirst(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_FIRST)
180#define dtnext(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_NEXT)
181#define dtlast(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_LAST)
182#define dtprev(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_PREV)
183#define dtsearch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_SEARCH)
184#define dtmatch(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_MATCH)
185#define dtinsert(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_INSERT)
186#define dtdelete(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DELETE)
187#define dtdetach(d,o) (*(_DT(d)->searchf))((d),(void*)(o),DT_DETACH)
188#define dtclear(d) (*(_DT(d)->searchf))((d),(void*)(0),DT_CLEAR)
void *(* Dtmake_f)(void *, Dtdisc_t *)
CDT_API int dtwalk(Dt_t *, int(*)(void *, void *), void *)
CDT_API Dtmethod_t * dtmethod(Dt_t *, Dtmethod_t *)
int(* Dtcompar_f)(void *, void *)
CDT_API Dtmethod_t * Dtset
set with unique elements
CDT_API Dtlink_t * dtflatten(Dt_t *)
CDT_API Dtmethod_t * Dtobag
ordered multiset
CDT_API Dtlink_t * dtextract(Dt_t *)
CDT_API int dtsize(Dt_t *)
CDT_API unsigned int dtstrhash(void *, int)
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
CDT_API Dtmethod_t * Dttree
CDT_API int dtclose(Dt_t *)
CDT_API void * dtrenew(Dt_t *, void *)
CDT_API Dtmethod_t * Dtoset
ordered set (self-adjusting tree)
void *(* Dtsearch_f)(Dt_t *, void *, int)
CDT_API int dtstat(Dt_t *, Dtstat_t *, int)
CDT_API int dtrestore(Dt_t *, Dtlink_t *)
CDT_API Dtdisc_t * dtdisc(Dt_t *dt, Dtdisc_t *)
CDT_API Dt_t * dtopen(Dtdisc_t *, Dtmethod_t *)
Dtdata_t data
sharable data