• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/arm-none-eabi/include/
1/*	$NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $	*/
2/* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */
3
4/*
5 * Written by J.T. Conklin <jtc@netbsd.org>
6 * Public domain.
7 */
8
9#ifndef _SEARCH_H_
10#define _SEARCH_H_
11
12#include <sys/cdefs.h>
13#include <machine/ansi.h>
14#include <sys/types.h>
15
16typedef struct entry {
17	char *key;
18	void *data;
19} ENTRY;
20
21typedef enum {
22	FIND, ENTER
23} ACTION;
24
25typedef enum {
26	preorder,
27	postorder,
28	endorder,
29	leaf
30} VISIT;
31
32#ifdef _SEARCH_PRIVATE
33typedef struct node {
34	char         *key;
35	struct node  *llink, *rlink;
36} node_t;
37#endif
38
39struct hsearch_data
40{
41  struct internal_head *htable;
42  size_t htablesize;
43};
44
45__BEGIN_DECLS
46int	 hcreate(size_t);
47void	 hdestroy(void);
48ENTRY	*hsearch(ENTRY, ACTION);
49int	 hcreate_r(size_t, struct hsearch_data *);
50void	 hdestroy_r(struct hsearch_data *);
51int	hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
52void	*tdelete(const void *, void **, int (*)(const void *, const void *));
53void	tdestroy (void *, void (*)(void *));
54void	*tfind(const void *, void **, int (*)(const void *, const void *));
55void	*tsearch(const void *, void **, int (*)(const void *, const void *));
56void      twalk(const void *, void (*)(const void *, VISIT, int));
57__END_DECLS
58
59#endif /* !_SEARCH_H_ */
60