xref: /illumos-gate/usr/src/lib/libresolv2/include/isc/tree.h (revision 89b2a9fbeabf42fa54594df0e5927bcc50a07cc9)
1 /* tree.h - declare structures used by tree library
2  *
3  * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
4  * vix 27jun86 [broken out of tree.c]
5  *
6  * $Id: tree.h,v 1.3 2005/04/27 04:56:18 sra Exp $
7  */
8 
9 
10 #ifndef	_TREE_H_INCLUDED
11 #define	_TREE_H_INCLUDED
12 
13 
14 #ifndef __P
15 # if defined(__STDC__) || defined(__GNUC__)
16 #  define __P(x) x
17 # else
18 #  define __P(x) ()
19 # endif
20 #endif
21 
22 /*%
23  * tree_t is our package-specific anonymous pointer.
24  */
25 #if defined(__STDC__) || defined(__GNUC__)
26 typedef	void *tree_t;
27 #else
28 typedef	char *tree_t;
29 #endif
30 
31 /*%
32  * Do not taint namespace
33  */
34 #define	tree_add	__tree_add
35 #define	tree_delete	__tree_delete
36 #define	tree_init	__tree_init
37 #define	tree_mung	__tree_mung
38 #define	tree_srch	__tree_srch
39 #define	tree_trav	__tree_trav
40 
41 
42 typedef	struct tree_s {
43 		tree_t		data;
44 		struct tree_s	*left, *right;
45 		short		bal;
46 	}
47 	tree;
48 
49 
50 void	tree_init	__P((tree **));
51 tree_t	tree_srch	__P((tree **, int (*)(), tree_t));
52 tree_t	tree_add	__P((tree **, int (*)(), tree_t, void (*)()));
53 int	tree_delete	__P((tree **, int (*)(), tree_t, void (*)()));
54 int	tree_trav	__P((tree **, int (*)()));
55 void	tree_mung	__P((tree **, void (*)()));
56 
57 
58 #endif	/* _TREE_H_INCLUDED */
59 /*! \file */
60