]> git.saurik.com Git - apple/libc.git/blob - include/search.h
Libc-1244.1.7.tar.gz
[apple/libc.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 */
8
9 #ifndef _SEARCH_H_
10 #define _SEARCH_H_
11
12 #include <sys/cdefs.h>
13 #include <_types.h>
14 #include <sys/_types/_size_t.h>
15
16 typedef struct entry {
17 char *key;
18 void *data;
19 } ENTRY;
20
21 typedef enum {
22 FIND, ENTER
23 } ACTION;
24
25 typedef enum {
26 preorder,
27 postorder,
28 endorder,
29 leaf
30 } VISIT;
31
32 #ifdef _SEARCH_PRIVATE
33 typedef struct node {
34 char *key;
35 struct node *llink, *rlink;
36 } node_t;
37
38 struct que_elem {
39 struct que_elem *next;
40 struct que_elem *prev;
41 };
42 #endif
43
44 __BEGIN_DECLS
45 int hcreate(size_t);
46 void hdestroy(void);
47 ENTRY *hsearch(ENTRY, ACTION);
48 void insque(void *, void *);
49 void *lfind(const void *, const void *, size_t *, size_t,
50 int (*)(const void *, const void *));
51 void *lsearch(const void *, void *, size_t *, size_t,
52 int (*)(const void *, const void *));
53 void remque(void *);
54 void *tdelete(const void * __restrict, void ** __restrict,
55 int (*)(const void *, const void *));
56 void *tfind(const void *, void * const *,
57 int (*)(const void *, const void *));
58 void *tsearch(const void *, void **, int (*)(const void *, const void *));
59 void twalk(const void *, void (*)(const void *, VISIT, int));
60 __END_DECLS
61
62 #endif /* !_SEARCH_H_ */