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