17c478bd9Sstevel@tonic-gate /* tree.h - declare structures used by tree library
27c478bd9Sstevel@tonic-gate  *
37c478bd9Sstevel@tonic-gate  * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes]
47c478bd9Sstevel@tonic-gate  * vix 27jun86 [broken out of tree.c]
57c478bd9Sstevel@tonic-gate  *
6*9525b14bSRao Shoaib  * $Id: tree.h,v 1.3 2005/04/27 04:56:18 sra Exp $
77c478bd9Sstevel@tonic-gate  */
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate #ifndef	_TREE_H_INCLUDED
117c478bd9Sstevel@tonic-gate #define	_TREE_H_INCLUDED
127c478bd9Sstevel@tonic-gate 
137c478bd9Sstevel@tonic-gate 
147c478bd9Sstevel@tonic-gate #ifndef __P
157c478bd9Sstevel@tonic-gate # if defined(__STDC__) || defined(__GNUC__)
167c478bd9Sstevel@tonic-gate #  define __P(x) x
177c478bd9Sstevel@tonic-gate # else
187c478bd9Sstevel@tonic-gate #  define __P(x) ()
197c478bd9Sstevel@tonic-gate # endif
207c478bd9Sstevel@tonic-gate #endif
217c478bd9Sstevel@tonic-gate 
22*9525b14bSRao Shoaib /*%
237c478bd9Sstevel@tonic-gate  * tree_t is our package-specific anonymous pointer.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate #if defined(__STDC__) || defined(__GNUC__)
267c478bd9Sstevel@tonic-gate typedef	void *tree_t;
277c478bd9Sstevel@tonic-gate #else
287c478bd9Sstevel@tonic-gate typedef	char *tree_t;
297c478bd9Sstevel@tonic-gate #endif
307c478bd9Sstevel@tonic-gate 
31*9525b14bSRao Shoaib /*%
327c478bd9Sstevel@tonic-gate  * Do not taint namespace
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate #define	tree_add	__tree_add
357c478bd9Sstevel@tonic-gate #define	tree_delete	__tree_delete
367c478bd9Sstevel@tonic-gate #define	tree_init	__tree_init
377c478bd9Sstevel@tonic-gate #define	tree_mung	__tree_mung
387c478bd9Sstevel@tonic-gate #define	tree_srch	__tree_srch
397c478bd9Sstevel@tonic-gate #define	tree_trav	__tree_trav
40*9525b14bSRao Shoaib 
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate typedef	struct tree_s {
437c478bd9Sstevel@tonic-gate 		tree_t		data;
447c478bd9Sstevel@tonic-gate 		struct tree_s	*left, *right;
457c478bd9Sstevel@tonic-gate 		short		bal;
467c478bd9Sstevel@tonic-gate 	}
477c478bd9Sstevel@tonic-gate 	tree;
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate void	tree_init	__P((tree **));
517c478bd9Sstevel@tonic-gate tree_t	tree_srch	__P((tree **, int (*)(), tree_t));
527c478bd9Sstevel@tonic-gate tree_t	tree_add	__P((tree **, int (*)(), tree_t, void (*)()));
537c478bd9Sstevel@tonic-gate int	tree_delete	__P((tree **, int (*)(), tree_t, void (*)()));
547c478bd9Sstevel@tonic-gate int	tree_trav	__P((tree **, int (*)()));
557c478bd9Sstevel@tonic-gate void	tree_mung	__P((tree **, void (*)()));
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate #endif	/* _TREE_H_INCLUDED */
59*9525b14bSRao Shoaib /*! \file */
60