/*	avl.h		Definitions for avl routines

	Copyright 1988 Zinn Computer Company
			by Mark E. Mallett

	All Rights Reserved
	All rights reserved;
	This software may be used at will, provided that all credits
and style be left in place, and that its distribution is not restricted.
Bug fixes and improvements are welcomed, please send these back to
me at mem@zinn.MV.COM


*/

#ifndef	H_AVL				/* Prevent multiple inclusions */
#define	H_AVL

#ifndef	TRUE				/* Same old jazz */
#define	TRUE	1
#define	FALSE	0
#endif	TRUE

#ifndef	NULL
#define	NULL	((char *)0)
#endif	NULL

#ifndef	NUL
#define	NUL	'\0'
#endif	NUL

	/* Structures */

/* Structure of an avl tree node.  Note that this node is meant to
   be used as a header or component of an application-specific structure,
   since there is no key or data information present in the avlnode
   structure.
*/

typedef					/* A node in an AVL tree */
  struct avlnode {
    struct avlnode *n_leftP;		/* Ptr to left subtree */
    struct avlnode *n_rightP;		/* Ptr to right subtree */
    int		n_balance;		/* Balance count */
  } AVLNODE;


typedef					/* The header for an AVL tree */
  struct {
    /* Tree parameters */
    AVLNODE	*t_rootP;		/* Ptr to root node */

    /* Handler functions for the tree */
    int		(*t_cmprtc)();		/* Compare two keys */
    AVLNODE	*(*t_mknode)();		/* Node maker */
    int		(*t_rmnode)();		/* Node destroyer */
  } AVLTREE;


#endif	H_AVL;
