• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $
7  */
8 
9 #ifndef _SEARCH_H_
10 #define _SEARCH_H_
11 
12 #ifndef _MSC_FULL_VER
13 #include <sys/cdefs.h>
14 #endif  /* _MSC_FULL_VER */
15 #if !defined(__BEGIN_DECLS) || !defined(__END_DECLS)
16 #if defined(__cplusplus)
17 #define	__BEGIN_DECLS	extern "C" {
18 #define	__END_DECLS	};
19 #else  /* !__cplusplus */
20 #define	__BEGIN_DECLS
21 #define	__END_DECLS
22 #endif /* !__cplusplus */
23 #endif /* !__BEGIN_DECLS || !__END_DECLS */
24 #include <sys/types.h>
25 
26 typedef	enum {
27 	preorder,
28 	postorder,
29 	endorder,
30 	leaf
31 } VISIT;
32 
33 #ifdef _SEARCH_PRIVATE
34 typedef	struct node {
35 	char         *key;
36 	struct node  *llink, *rlink;
37 } node_t;
38 #endif
39 
40 __BEGIN_DECLS
41 void	*tdelete(const void * __restrict, void ** __restrict,
42 	    int (*)(const void *, const void *));
43 void	*tfind(const void *, void * const *,
44 	    int (*)(const void *, const void *));
45 void	*tsearch(const void *, void **, int (*)(const void *, const void *));
46 void	 twalk(const void *, void (*)(const void *, VISIT, int));
47 void	 tdestroy(void *, void (*)(void *));
48 __END_DECLS
49 
50 #endif /* !_SEARCH_H_ */
51