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