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