/*
 * tree.h - Craig Kelley 
 *
 * This is the header file for tree-- it contains all the function
 * prototypes.  For a more detailed explanation of each procedure,
 * see the source code in "tree.c".
 */

#include <stdlib.h>
#include <stdio.h>

#define T_OBJECT int            /* the object that our tree holds */
#define T_TOP (void*) NULL      /* a null pointer to determine the top */
#define T_END (void*) NULL      /* a null pointer to determine the end */ 
#define T_LEFT 1		/* the left child code */
#define T_RIGHT 2		/* the right child code */
#define T_OK 1			/* if a procedure succeeds */
#define T_FAIL 0		/* if a procedure fails */
   
/* 
 * Type Definitions 
 */

typedef struct T_NODE {                     
   T_OBJECT value;	       		    /* the char of this node */
   struct T_NODE* parent;		    /* the parent of this node */
   struct T_NODE* l_child;
   struct T_NODE* r_child;
} tree_node;
typedef tree_node* node_ptr;

/* 
 * Function Prototypes 
 */

int T_new_child(node_ptr node, int child, T_OBJECT value);
int T_replace_node(node_ptr node, node_ptr newnode);
int T_delete_branch(node_ptr node);
node_ptr T_new(T_OBJECT value);
T_OBJECT T_retrieve(node_ptr node);
int T_change(node_ptr node, T_OBJECT newvalue);
node_ptr T_next(node_ptr node, int child);
node_ptr T_previous(node_ptr node);
node_ptr new_node(T_OBJECT value, node_ptr parent);




