bus: Change device_getenv_int interface a little bit
[dragonfly.git] / include / search.h
1 /*-
2  * Written by J.T. Conklin <jtc@netbsd.org>
3  * Public domain.
4  *
5  *      $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
6  * $FreeBSD: src/include/search.h,v 1.10 2002/10/16 14:29:23 robert Exp $
7  * $DragonFly: src/include/search.h,v 1.6 2008/05/19 10:05:18 corecode Exp $
8  */
9
10 #ifndef _SEARCH_H_
11 #define _SEARCH_H_
12
13 #include <sys/cdefs.h>
14 #include <sys/types.h>
15
16 #ifndef _SIZE_T_DECLARED
17 typedef __size_t        size_t;
18 #define _SIZE_T_DECLARED
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
43 struct que_elem {
44         struct que_elem *next;
45         struct que_elem *prev;
46 };
47 #endif
48
49 __BEGIN_DECLS
50 int      hcreate(size_t);
51 void     hdestroy(void);
52 ENTRY   *hsearch(ENTRY, ACTION);
53 void     insque(void *, void *);
54 void    *lfind(const void *, const void *, size_t *, size_t,
55                int (*)(const void *, const void *));
56 void    *lsearch(const void *, void *, size_t *, size_t,
57                  int (*)(const void *, const void *));
58 void     remque(void *);
59 void    *tdelete(const void * __restrict, void ** __restrict,
60                  int (*)(const void *, const void *));
61 void    *tfind(const void *, void * const *,
62                int (*)(const void *, const void *));
63 void    *tsearch(const void *, void **, int (*)(const void *, const void *));
64 void     twalk(const void *, void (*)(const void *, VISIT, int));
65 __END_DECLS
66
67 #endif /* !_SEARCH_H_ */