forked from adesutherland/CMS-370-BREXX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bintree.h
56 lines (47 loc) · 1.3 KB
/
bintree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
* $Id: bintree.h,v 1.4 2008/07/15 07:40:07 bnv Exp $
* $Log: bintree.h,v $
* Revision 1.4 2008/07/15 07:40:07 bnv
* MVS, CMS support
*
* Revision 1.3 2002/06/11 12:37:56 bnv
* Added: CDECL
*
* Revision 1.2 2001/06/25 18:52:04 bnv
* Header -> Id
*
* Revision 1.1 1998/07/02 17:35:50 bnv
* Initial revision
*
*/
#include "lstring.h"
#ifndef __BINTREE_H__
#define __BINTREE_H__
#define BALANCE_START 7
#define BALANCE_INC 8
typedef struct binleaf_st {
Lstr key;
struct binleaf_st *left, *right;
void *value;
} BinLeaf;
typedef BinLeaf *PBinLeaf;
typedef struct {
PBinLeaf parent;
int items;
int maxdepth;
int balancedepth;
} BinTree;
#define BINTREEINIT(t) {(t).parent=NULL; (t).items=0; \
(t).maxdepth=0; (t).balancedepth=BALANCE_START;}
/* =================== function prototypes =================== */
PBinLeaf __CDECL BinAdd( BinTree *tree, PLstr name, void *dat );
PBinLeaf __CDECL BinFind( BinTree *tree, PLstr name );
void __CDECL BinDisposeLeaf( BinTree *tree, PBinLeaf leaf,
void (__CDECL *BinFreeData)(void *) );
void __CDECL BinDisposeTree( BinTree *tree,
void (__CDECL *BinFreeData)(void *) );
void __CDECL BinDel( BinTree *tree, PLstr name,
void (__CDECL *BinFreeData)(void *) );
void __CDECL BinPrint( PBinLeaf leaf );
void __CDECL BinBalance( BinTree *tree );
#endif