10Sstevel@tonic-gate /* tree.h - declare structures used by tree library 20Sstevel@tonic-gate * 30Sstevel@tonic-gate * vix 22jan93 [revisited; uses RCS, ANSI, POSIX; has bug fixes] 40Sstevel@tonic-gate * vix 27jun86 [broken out of tree.c] 50Sstevel@tonic-gate * 6*11038SRao.Shoaib@Sun.COM * $Id: tree.h,v 1.3 2005/04/27 04:56:18 sra Exp $ 70Sstevel@tonic-gate */ 80Sstevel@tonic-gate 90Sstevel@tonic-gate 100Sstevel@tonic-gate #ifndef _TREE_H_INCLUDED 110Sstevel@tonic-gate #define _TREE_H_INCLUDED 120Sstevel@tonic-gate 130Sstevel@tonic-gate 140Sstevel@tonic-gate #ifndef __P 150Sstevel@tonic-gate # if defined(__STDC__) || defined(__GNUC__) 160Sstevel@tonic-gate # define __P(x) x 170Sstevel@tonic-gate # else 180Sstevel@tonic-gate # define __P(x) () 190Sstevel@tonic-gate # endif 200Sstevel@tonic-gate #endif 210Sstevel@tonic-gate 22*11038SRao.Shoaib@Sun.COM /*% 230Sstevel@tonic-gate * tree_t is our package-specific anonymous pointer. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate #if defined(__STDC__) || defined(__GNUC__) 260Sstevel@tonic-gate typedef void *tree_t; 270Sstevel@tonic-gate #else 280Sstevel@tonic-gate typedef char *tree_t; 290Sstevel@tonic-gate #endif 300Sstevel@tonic-gate 31*11038SRao.Shoaib@Sun.COM /*% 320Sstevel@tonic-gate * Do not taint namespace 330Sstevel@tonic-gate */ 340Sstevel@tonic-gate #define tree_add __tree_add 350Sstevel@tonic-gate #define tree_delete __tree_delete 360Sstevel@tonic-gate #define tree_init __tree_init 370Sstevel@tonic-gate #define tree_mung __tree_mung 380Sstevel@tonic-gate #define tree_srch __tree_srch 390Sstevel@tonic-gate #define tree_trav __tree_trav 40*11038SRao.Shoaib@Sun.COM 410Sstevel@tonic-gate 420Sstevel@tonic-gate typedef struct tree_s { 430Sstevel@tonic-gate tree_t data; 440Sstevel@tonic-gate struct tree_s *left, *right; 450Sstevel@tonic-gate short bal; 460Sstevel@tonic-gate } 470Sstevel@tonic-gate tree; 480Sstevel@tonic-gate 490Sstevel@tonic-gate 500Sstevel@tonic-gate void tree_init __P((tree **)); 510Sstevel@tonic-gate tree_t tree_srch __P((tree **, int (*)(), tree_t)); 520Sstevel@tonic-gate tree_t tree_add __P((tree **, int (*)(), tree_t, void (*)())); 530Sstevel@tonic-gate int tree_delete __P((tree **, int (*)(), tree_t, void (*)())); 540Sstevel@tonic-gate int tree_trav __P((tree **, int (*)())); 550Sstevel@tonic-gate void tree_mung __P((tree **, void (*)())); 560Sstevel@tonic-gate 570Sstevel@tonic-gate 580Sstevel@tonic-gate #endif /* _TREE_H_INCLUDED */ 59*11038SRao.Shoaib@Sun.COM /*! \file */ 60