undo: always collect history of the file
[dragonfly.git] / include / search.h
blob1e9b99c51f0d631c28ab3ee7af504a1bb026801c
1 /*-
2 * Written by J.T. Conklin <jtc@netbsd.org>
3 * Public domain.
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 */
10 #ifndef _SEARCH_H_
11 #define _SEARCH_H_
13 #include <sys/cdefs.h>
14 #include <sys/types.h>
16 #ifndef _SIZE_T_DECLARED
17 typedef __size_t size_t;
18 #define _SIZE_T_DECLARED
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;
43 struct que_elem {
44 struct que_elem *next;
45 struct que_elem *prev;
47 #endif
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
67 #endif /* !_SEARCH_H_ */