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