Annotation of libwww/Library/src/HTBTree.html, revision 2.6

1.1       timbl       1: <PRE>
                      2: /*             Balanced Binary Tree for sorting things         HTBTree.h
                      3: **             =======================================
                      4: **
2.6     ! secret      5: **  Tree creation, traversal and freeing.  User-supplied
1.1       timbl       6: **  comparison routine.
                      7: */
                      8: 
                      9: 
                     10: typedef struct _HTBTree_element {
                     11:     void                       *object;        /* User object */
                     12:     struct _HTBTree_element    *up;
                     13:     struct _HTBTree_element    *left;
                     14:     int                                left_depth;
                     15:     struct _HTBTree_element    *right;
                     16:     int                                right_depth;
                     17: } HTBTElement;
                     18: 
2.6     ! secret     19: typedef int (*HTComparer) PARAMS((void * a, void * b));
1.1       timbl      20: 
                     21: typedef struct _HTBTree_top {
                     22:     HTComparer                 compare;
                     23:     struct _HTBTree_element    *top;   
                     24: } HTBTree;
                     25: 
                     26: 
                     27: /*     Create a binary tree given its discrimination routine
                     28: **     -----------------------------------------------------
                     29: */
                     30: 
                     31: extern HTBTree * HTBTree_new PARAMS((HTComparer comp));
                     32: 
                     33: 
2.6     ! secret     34: 
        !            35: /*      Free storage of the tree but not of the objects
        !            36: **      -----------------------------------------------
1.1       timbl      37: */
                     38: extern void HTBTree_free PARAMS((HTBTree* tree));
2.6     ! secret     39: 
        !            40: 
        !            41: 
        !            42: /*      Free storage of the tree and of the objects
        !            43: **      -----------------------------------------------
        !            44: */
        !            45: extern void HTBTreeAndObject_free PARAMS((HTBTree* tree));
        !            46: 
1.1       timbl      47: 
                     48: 
                     49: /*     Add an object to a binary tree
                     50: **     ------------------------------
                     51: */
                     52: 
                     53: extern void HTBTree_add PARAMS((HTBTree* tree, void * object));
                     54: 
                     55: 
                     56: /*     Find user object for element
                     57: **     ---------------------------
                     58: */
                     59: 
1.2       timbl      60: #define HTBTree_object(element)  ((element)->object)
1.1       timbl      61: 
                     62: 
                     63: /*     Find next element in depth-first order
                     64: **     -------------------------------------
                     65: **
                     66: ** On entry,
                     67: **     ele             if NULL, start with leftmost element.
                     68: **                     if != 0 give next object to the right.
                     69: **
                     70: ** returns             Pointer to element ot NULL if none left.
                     71: **
                     72: */
                     73: 
                     74: extern HTBTElement * HTBTree_next PARAMS((HTBTree* tree, HTBTElement * ele));
                     75: 
                     76: 
                     77: </PRE>

Webmaster