search.h revision 1.9 1 /* $NetBSD: search.h,v 1.9 1995/08/08 21:14:45 jtc Exp $ */
2
3 /*
4 * Written by J.T. Conklin <jtc (at) netbsd.org>
5 * Public domain.
6 */
7
8 #ifndef _SEARCH_H_
9 #define _SEARCH_H_
10 #include <sys/cdefs.h>
11 #include <machine/ansi.h>
12
13 #ifdef _BSD_SIZE_T_
14 typedef _BSD_SIZE_T_ size_t;
15 #undef _BSD_SIZE_T_
16 #endif
17
18 typedef struct entry {
19 char *key;
20 char *data;
21 } ENTRY;
22
23 typedef enum {
24 FIND, ENTER
25 } ACTION;
26
27 typedef enum {
28 preorder,
29 postorder,
30 endorder,
31 leaf
32 } VISIT;
33
34 __BEGIN_DECLS
35 extern void *bsearch __P((const void *, const void *, size_t, size_t,
36 int (*)(const void *, const void *)));
37 extern int hcreate __P((unsigned int));
38 extern void hdestroy __P((void));
39 extern ENTRY *hsearch __P((ENTRY, ACTION));
40
41 extern void *lfind __P((const void *, const void *, size_t *, size_t,
42 int (*)(const void *, const void *)));
43 extern void *lsearch __P((const void *, const void *, size_t *, size_t,
44 int (*)(const void *, const void *)));
45 extern void insque __P((void *, void *));
46 extern void remque __P((void *));
47
48 extern void *tdelete __P((const void *, void **,
49 int (*)(const void *, const void *)));
50 extern void *tfind __P((const void *, void **,
51 int (*)(const void *, const void *)));
52 extern void *tsearch __P((const void *, void **,
53 int (*)(const void *, const void *)));
54 extern void twalk __P((const void *, void (*)(const void *, VISIT, int)));
55 __END_DECLS
56
57 #endif
58