Ignore:
Timestamp:
Apr 8, 2001, 9:17:16 AM (24 years ago)
Author:
umoeller
Message:

misc changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/tree.c

    r55 r56  
    2424 *      a tree-like structure.
    2525 *
    26  *      For this, the functions here use the TREE structure. You can
    27  *      easily see that this has the "left" and "right" members,
    28  *      which make up the tree.
    29  *
    30  *      In addition, each tree has a "tree root" item, from which all
    31  *      other tree nodes can be reached by following the "left" and
    32  *      "right" pointers.
     26 *      While lists have "next" and "previous" pointers, trees have
     27 *      "left" and "right" pointers which keep the tree sorted at
     28 *      all times.
    3329 *
    3430 *      Per definition, in our trees, if you follow the "left" pointer,
     
    3632 *      Reversely, following the "right" pointer will lead you to a
    3733 *      node which is "less than" the current node.
     34 *
     35 *      What is considered "less" or "greater" is determined by a
     36 *      comparison callback to be supplied by the caller.
     37 *
     38 *      For this, the functions here use the TREE structure. You can
     39 *      easily see that this has the "left" and "right" members,
     40 *      which make up the tree.
     41 *
     42 *      In addition, each tree has a "tree root" item, from which all
     43 *      other tree nodes can be reached by following the "left" and
     44 *      "right" pointers.
    3845 *
    3946 *      The implementation here has the following characteristics:
     
    6673 *      that the first member in the structure is a TREE structure
    6774 *      (i.e. it has the left, right, parent, id, and colour members).
    68  *      The tree functions don't care what follows.
     75 *      The tree functions don't care what follows, since they do
     76 *      not manage any memory themselves.
    6977 *
    7078 *      So the implementation here is slightly different from the
     
    106114 *         the TREE structure instead. If this flavor is used, an
    107115 *         internal comparison function is used for comparing the
    108  *         "id" fields, which are plain ULONGs.
     116 *         "id" fields, which are assumed to be plain ULONGs.
    109117 *
    110118 *      <B>Trees vs. linked lists</B>
     
    139147 *      -- As opposed to a LISTNODE, the TREE structure (which
    140148 *         represents a tree node) does not contain a data pointer,
    141  *         as said above.
     149 *         as said above. The caller must do all memory management.
    142150 *
    143151 *@@added V0.9.5 (2000-09-29) [umoeller]
     
    245253 +
    246254 +          treeInsertID(&TreeRoot,
    247  +                     (TREE*)pTreeItem,
    248  +                     FALSE);
     255 +                       (TREE*)pTreeItem,
     256 +                       FALSE);
    249257 *
    250258 *      Returns:
     
    699707                   unsigned long id)
    700708{
    701     TREE
    702        *current = *root,
    703        *found = NULL;
     709    TREE    *current = *root,
     710            *found = NULL;
    704711
    705712    while (current != TREE_NULL)
     
    725732                   unsigned long idFind)
    726733{
    727     TREE
    728        *current = *root,
    729        *found;
     734    TREE    *current = *root,
     735            *found;
    730736
    731737    found = NULL;
     
    752758                     FNTREE_COMPARE_NODES *comp)
    753759{
    754     TREE
    755        *current = *root,
    756        *found;
     760    TREE    *current = *root,
     761            *found;
    757762
    758763    found = NULL;
     
    780785                     FNTREE_COMPARE_NODES *comp)
    781786{
    782     TREE
    783        *current = *root,
    784        *found;
     787    TREE    *current = *root,
     788            *found;
    785789
    786790    found = NULL;
     
    807811                     FNTREE_COMPARE_NODES *comp)
    808812{
    809     TREE
    810        *current = *root,
    811        *found;
     813    TREE    *current = *root,
     814            *found;
    812815
    813816    found = NULL;
     
    834837                     FNTREE_COMPARE_NODES *comp)
    835838{
    836     TREE
    837        *current = *root,
    838        *found;
     839    TREE    *current = *root,
     840            *found;
    839841
    840842    found = NULL;
     
    861863                     FNTREE_COMPARE_NODES *comp)
    862864{
    863     TREE
    864        *current = *root,
    865        *found;
     865    TREE    *current = *root,
     866            *found;
    866867
    867868    found = NULL;
Note: See TracChangeset for help on using the changeset viewer.