#if !defined(SPLAYTRE_H)
#define SPLAYTRE_H
/********************************************************* Tab width = 8 *

FUNCTION

  General splay tree header - see splaytre.c for function prototypes and
documentation.

NOTES

  o All routines take a POINTER to the root: use st_AsRoot always.
  o Don't modify the definition of an Snode - one is usually allocated on
  the stack when you call any function in this module.
    o place it as the FIRST component of your node structure and use
    st_AsRoot below for function calls in this module.
    o ANSI C specifies that components of structures live in seperate name
    spaces. If, despite this, you feel the need to modify the names of
    st_less and st_more, then sync the Left() and Right() macros in
    splaytre.c.
  o If x is the "value" of A, and y is the "value" of B, then cmp(A, B)
  is (x-y) when x and y are int and the type of cmp() is Scmp.
  o Contact me reguarding commercial use.

AUTHOR

  (C) 1993 Peter Thompson, pdt@cs.mu.oz.au

*************************************************************************/

typedef struct snode {
  struct snode *st_less;
  struct snode *st_more;
} Snode;

#define st_Left(x) (((Snode *) (x))->st_less)
#define st_Right(x) (((Snode *) (x))->st_more)
#define st_AsRoot(x) (&((Snode *) (x)))
#define st_Zero(x) { st_Left(x) = NULL; st_Right(x) = NULL; }

 /* An Scmp function returns values as if it were being used in a qsort()
 ** or bsearch() function call.
 */

typedef int (*Scmp)(const void *, const Snode *);
#endif
