7 > Created (Julienne Walker): September 10, 2005
9 This code is in the public domain. Anyone may
10 use it or change it in any way that they see
11 fit. The author assumes no responsibility for
12 damages incurred through use of the original
13 code or any variations thereof.
15 It is requested, but not required, that due
16 credit is given to the original author and
17 anyone who has modified the code through
18 a header comment, such as this one.
21 /* code modified for inclusion in zpm */
26 typedef struct jsw_atree jsw_atree_t;
27 typedef struct jsw_atrav jsw_atrav_t;
29 /* User-defined item handling */
31 typedef int (*cmp_f) ( const void *p1, const void *p2 );
33 typedef void *(*dup_f) ( void *p );
34 typedef void (*rel_f) ( void *p );
36 /* Andersson tree functions */
37 jsw_atree_t *jsw_anew (
38 int (cmp)(const void *, const void *),
42 void jsw_adelete ( jsw_atree_t *tree );
43 void *jsw_afind ( jsw_atree_t *tree, void *data );
44 int jsw_ainsert ( jsw_atree_t *tree, void *data );
45 int jsw_aerase ( jsw_atree_t *tree, void *data );
46 size_t jsw_asize ( jsw_atree_t *tree );
48 /* Traversal functions */
49 jsw_atrav_t *jsw_atnew ( void );
50 void jsw_atdelete ( jsw_atrav_t *trav );
51 void *jsw_atfirst ( jsw_atrav_t *trav, jsw_atree_t *tree );
52 void *jsw_atlast ( jsw_atrav_t *trav, jsw_atree_t *tree );
53 void *jsw_atnext ( jsw_atrav_t *trav );
54 void *jsw_atprev ( jsw_atrav_t *trav );