Merge from vendor branch INTEL_ACPICA:
[dragonfly.git] / include / search.h
CommitLineData
984263bc
MD
1/* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
2/* $FreeBSD: src/include/search.h,v 1.3.2.1 2000/08/17 07:38:34 jhb Exp $ */
a81b3ef3 3/* $DragonFly: src/include/search.h,v 1.5 2003/11/15 19:28:42 asmodai Exp $ */
984263bc
MD
4
5/*
6 * Written by J.T. Conklin <jtc@netbsd.org>
7 * Public domain.
8 */
9
10#ifndef _SEARCH_H_
11#define _SEARCH_H_
12
13#include <sys/cdefs.h>
e2565a42 14#include <machine/stdint.h>
984263bc 15
a81b3ef3
JR
16#ifndef _SIZE_T_DECLARED
17#define _SIZE_T_DECLARED
e2565a42 18typedef __size_t size_t;
984263bc
MD
19#endif
20
21typedef struct entry {
22 char *key;
23 void *data;
24} ENTRY;
25
26typedef enum {
27 FIND, ENTER
28} ACTION;
29
30typedef enum {
31 preorder,
32 postorder,
33 endorder,
34 leaf
35} VISIT;
36
37#ifdef _SEARCH_PRIVATE
38typedef struct node {
39 char *key;
40 struct node *llink, *rlink;
41} node_t;
42#endif
43
44__BEGIN_DECLS
7c4af8e1
MD
45int hcreate (size_t);
46void hdestroy (void);
47ENTRY *hsearch (ENTRY, ACTION);
48void *tdelete (const void *, void **,
49 int (*)(const void *, const void *));
50void *tfind (const void *, void **,
51 int (*)(const void *, const void *));
52void *tsearch (const void *, void **,
53 int (*)(const void *, const void *));
54void twalk (const void *, void (*)(const void *, VISIT, int));
984263bc
MD
55__END_DECLS
56
57#endif /* !_SEARCH_H_ */