2 rbl.h -- header file for rbl.c
3 Copyright (C) 2000 Ivo Timmermans <itimmermans@bigfoot.com>,
4 2000 Guus Sliepen <guus@sliepen.warande.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 $Id: rbl.h,v 1.1.2.8 2000/11/24 23:13:00 guus Exp $
26 #define RBL_FOREACH(tree,rbl) for(rbl = tree->head; rbl; rbl = rbl->next)
30 /* 'red-black tree' part */
32 struct rbltree_t *tree;
40 /* 'linked list' part */
51 typedef int (*rbl_compare_t) (const void *, const void *);
52 typedef void (*rbl_action_t) (const void *);
53 typedef void (*rbl_action_rbl_t) (const struct rbl_t *);
55 typedef struct rbltree_t
57 /* callback functions */
59 rbl_compare_t compare;
79 extern rbltree_t *new_rbltree(rbl_compare_t, rbl_action_t);
80 extern void free_rbltree(rbltree_t *);
81 extern rbl_t *new_rbl(void);
82 extern void free_rbl(rbl_t *);
84 extern void *rbl_search(rbltree_t *, void *);
85 extern void *rbl_search_closest(rbltree_t *, void *);
86 extern void *rbl_search_closest_greater(rbltree_t *, void *);
87 extern void *rbl_search_closest_smaller(rbltree_t *, void *);
88 extern rbl_t *rbl_search_rbl(rbltree_t *, void *);
89 extern rbl_t *rbl_search_closest_rbl(rbltree_t *, void *);
90 extern rbl_t *rbl_search_closest_greater_rbl(rbltree_t *, void *);
91 extern rbl_t *rbl_search_closest_smaller_rbl(rbltree_t *, void *);
92 extern rbl_t *rbl_insert(rbltree_t *, void *);
93 extern rbl_t *rbl_unlink(rbltree_t *, void *);
94 extern void rbl_delete(rbltree_t *, void *);
95 extern rbl_t *rbl_insert_rbl(rbltree_t *, rbl_t *);
96 extern rbl_t *rbl_unlink_rbl(rbl_t *);
97 extern void rbl_delete_rbl(rbl_t *);
98 extern void rbl_unlink_rbltree(rbltree_t *);
99 extern void rbl_delete_rbltree(rbltree_t *);
101 extern void rbl_foreach(rbltree_t *, rbl_action_t);
102 extern void rbl_foreach_rbl(rbltree_t *, rbl_action_rbl_t);
104 #endif /* __RBL_H__ */