kernel tree reorganization stage 1: Major cvs repository work (not logged as
[dragonfly.git] / include / search.h
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.2 2003/06/17 04:25:56 dillon Exp $ */
4
5 /*
6  * Written by J.T. Conklin <jtc@netbsd.org>
7  * Public domain.
8  */
9
10 #ifndef _SEARCH_H_
11 #define _SEARCH_H_
12
13 #include <sys/cdefs.h>
14 #include <machine/ansi.h>
15
16 #ifdef  _BSD_SIZE_T_
17 typedef _BSD_SIZE_T_    size_t;
18 #undef  _BSD_SIZE_T_
19 #endif
20
21 typedef struct entry {
22         char *key;
23         void *data;
24 } ENTRY;
25
26 typedef enum {
27         FIND, ENTER
28 } ACTION;
29
30 typedef enum {
31         preorder,
32         postorder,
33         endorder,
34         leaf
35 } VISIT;
36
37 #ifdef _SEARCH_PRIVATE
38 typedef struct node {
39         char         *key;
40         struct node  *llink, *rlink;
41 } node_t;
42 #endif
43
44 __BEGIN_DECLS
45 int      hcreate __P((size_t));
46 void     hdestroy __P((void));
47 ENTRY   *hsearch __P((ENTRY, ACTION));
48 void    *tdelete __P((const void *, void **,
49                       int (*)(const void *, const void *)));
50 void    *tfind __P((const void *, void **,
51                       int (*)(const void *, const void *)));
52 void    *tsearch __P((const void *, void **, 
53                       int (*)(const void *, const void *)));
54 void      twalk __P((const void *, void (*)(const void *, VISIT, int)));
55 __END_DECLS
56
57 #endif /* !_SEARCH_H_ */