xref: /illumos-gate/usr/src/lib/libresolv2/include/isc/tree.h (revision e7cbe64f7a72dae5cb44f100db60ca88f3313c65)
1 /*
2  * Copyright 2003 by Sun Microsystems, Inc.	All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /* tree.h - declare structures used by tree library
7  *
8  * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
9  * vix 27jun86 [broken out of tree.c]
10  *
11  * $Id: tree.h,v 8.3 2002/12/03 05:26:48 marka Exp $
12  */
13 
14 #pragma ident	"%Z%%M%	%I%	%E% SMI"
15 
16 #ifndef	_TREE_H_INCLUDED
17 #define	_TREE_H_INCLUDED
18 
19 
20 #ifndef __P
21 # if defined(__STDC__) || defined(__GNUC__)
22 #  define __P(x) x
23 # else
24 #  define __P(x) ()
25 # endif
26 #endif
27 
28 /*
29  * tree_t is our package-specific anonymous pointer.
30  */
31 #if defined(__STDC__) || defined(__GNUC__)
32 typedef	void *tree_t;
33 #else
34 typedef	char *tree_t;
35 #endif
36 
37 #ifdef	ORIGINAL_ISC_CODE
38 /*
39  * Do not taint namespace
40  */
41 #define	tree_add	__tree_add
42 #define	tree_delete	__tree_delete
43 #define	tree_init	__tree_init
44 #define	tree_mung	__tree_mung
45 #define	tree_srch	__tree_srch
46 #define	tree_trav	__tree_trav
47 #else
48 #endif
49 
50 typedef	struct tree_s {
51 		tree_t		data;
52 		struct tree_s	*left, *right;
53 		short		bal;
54 	}
55 	tree;
56 
57 
58 void	tree_init	__P((tree **));
59 tree_t	tree_srch	__P((tree **, int (*)(), tree_t));
60 tree_t	tree_add	__P((tree **, int (*)(), tree_t, void (*)()));
61 int	tree_delete	__P((tree **, int (*)(), tree_t, void (*)()));
62 int	tree_trav	__P((tree **, int (*)()));
63 void	tree_mung	__P((tree **, void (*)()));
64 
65 
66 #endif	/* _TREE_H_INCLUDED */
67