RCSID updates, warning fixes
[dfdiff.git] / include / search.h
blobf3f94cffaf5a50184734163c2a7dffe757df97e6
1 /* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
2 /* $FreeBSD: src/include/search.h,v 1.3.2.1 2000/08/17 07:38:34 jhb Exp $ */
3 /* $DragonFly: src/include/search.h,v 1.5 2003/11/15 19:28:42 asmodai Exp $ */
5 /*
6 * Written by J.T. Conklin <jtc@netbsd.org>
7 * Public domain.
8 */
10 #ifndef _SEARCH_H_
11 #define _SEARCH_H_
13 #include <sys/cdefs.h>
14 #include <machine/stdint.h>
16 #ifndef _SIZE_T_DECLARED
17 #define _SIZE_T_DECLARED
18 typedef __size_t size_t;
19 #endif
21 typedef struct entry {
22 char *key;
23 void *data;
24 } ENTRY;
26 typedef enum {
27 FIND, ENTER
28 } ACTION;
30 typedef enum {
31 preorder,
32 postorder,
33 endorder,
34 leaf
35 } VISIT;
37 #ifdef _SEARCH_PRIVATE
38 typedef struct node {
39 char *key;
40 struct node *llink, *rlink;
41 } node_t;
42 #endif
44 __BEGIN_DECLS
45 int hcreate (size_t);
46 void hdestroy (void);
47 ENTRY *hsearch (ENTRY, ACTION);
48 void *tdelete (const void *, void **,
49 int (*)(const void *, const void *));
50 void *tfind (const void *, void **,
51 int (*)(const void *, const void *));
52 void *tsearch (const void *, void **,
53 int (*)(const void *, const void *));
54 void twalk (const void *, void (*)(const void *, VISIT, int));
55 __END_DECLS
57 #endif /* !_SEARCH_H_ */