tree/p.tree.h File Reference

Go to the source code of this file.

Functions

void tree_init (tree **ppr_tree)
tree_t tree_srch (tree **ppr_tree, int(*pfi_compare)(), tree_t p_user)
void tree_add (tree **ppr_tree, int(*pfi_compare)(), tree_t p_user, void(*pfv_uar)())
int tree_delete (tree **ppr_p, int(*pfi_compare)(), tree_t p_user, void(*pfv_uar)())
int tree_trav (tree **ppr_tree, int(*pfi_uar)())
void tree_mung (tree **ppr_tree, void(*pfv_uar)())


Function Documentation

void tree_add ( tree **  ppr_tree,
int(*)()  pfi_compare,
tree_t  p_user,
void(*)()  pfv_uar 
)

Definition at line 80 of file tree.c.

References ENTER, EXITV, FALSE, and sprout().

00082 {
00083     int i_balance = FALSE;
00084 
00085     ENTER("tree_add");
00086     sprout(ppr_tree, p_user, &i_balance, pfi_compare, pfv_uar);
00087     EXITV;
00088 }

int tree_delete ( tree **  ppr_p,
int(*)()  pfi_compare,
tree_t  p_user,
void(*)()  pfv_uar 
)

Definition at line 91 of file tree.c.

References ENTER, EXIT, and FALSE.

00093 {
00094     int i_balance = FALSE, i_uar_called = FALSE;
00095 
00096     ENTER("tree_delete");
00097     EXIT(delete(ppr_p, pfi_compare, p_user, pfv_uar, &i_balance,
00098             &i_uar_called));
00099 } int tree_trav(tree ** ppr_tree, int (*pfi_uar) ( /* ??? */ ))

void tree_init ( tree **  ppr_tree  ) 

Definition at line 47 of file tree.c.

References ENTER, and EXITV.

00048 {
00049     ENTER("tree_init");
00050     *ppr_tree = NULL;
00051     EXITV;
00052 }

void tree_mung ( tree **  ppr_tree,
void(*)()  pfv_uar 
)

Definition at line 114 of file tree.c.

References ENTER, EXITV, and tree_mung().

00115 {
00116     ENTER("tree_mung");
00117     if (*ppr_tree) {
00118         tree_mung(&(**ppr_tree).tree_l, pfv_uar);
00119         tree_mung(&(**ppr_tree).tree_r, pfv_uar);
00120         if (pfv_uar)
00121             (*pfv_uar) ((**ppr_tree).tree_p);
00122         free(*ppr_tree);
00123         *ppr_tree = NULL;
00124     }
00125     EXITV;
00126 }

tree_t tree_srch ( tree **  ppr_tree,
int(*)()  pfi_compare,
tree_t  p_user 
)

Definition at line 55 of file tree.c.

References ENTER, EXIT, i_comp(), and tree_srch().

00057 {
00058     register int i_comp;
00059 
00060     ENTER("tree_srch");
00061 
00062     if (*ppr_tree) {
00063         i_comp = (*pfi_compare) (p_user, (**ppr_tree).tree_p);
00064         if (i_comp > 0)
00065             EXIT(tree_srch(&(**ppr_tree).tree_r, pfi_compare, p_user));
00066         if (i_comp < 0)
00067             EXIT(tree_srch(&(**ppr_tree).tree_l, pfi_compare, p_user));
00068 
00069         /* not higher, not lower... this must be the one.
00070          */
00071         EXIT((**ppr_tree).tree_p);
00072     }
00073 
00074     /* grounded. NOT found.
00075      */
00076     EXIT(NULL);
00077 }

int tree_trav ( tree **  ppr_tree,
int(*)()  pfi_uar 
)

Definition at line 99 of file tree.c.

00100 {
00101     ENTER("tree_trav");
00102 
00103     if (!*ppr_tree)
00104         EXIT(TRUE);
00105 
00106     if (!tree_trav(&(**ppr_tree).tree_l, pfi_uar))
00107         EXIT(FALSE);
00108     if (!(*pfi_uar) ((**ppr_tree).tree_p))
00109         EXIT(FALSE);
00110     if (!tree_trav(&(**ppr_tree).tree_r, pfi_uar))
00111         EXIT(FALSE);
00112     EXIT(TRUE);
00113 }


Generated on Mon May 28 04:25:26 2007 for BattletechMUX by  doxygen 1.4.7