TABLE OF CONTENTS

List.lib/List
List.lib/pOS_ListAddHead
List.lib/pOS_ListAddTail
List.lib/pOS_ListCheckMember
List.lib/pOS_ListCntSucc
List.lib/pOS_ListEnqueue
List.lib/pOS_ListEnqueueName
List.lib/pOS_ListEnqueueIName
List.lib/pOS_ListFindIName
List.lib/pOS_ListFindINameV
List.lib/pOS_ListFindName
List.lib/pOS_ListGetSuccNodeCnt
List.lib/pOS_ListInit
List.lib/pOS_ListInsert
List.lib/pOS_ListIsEmpty
List.lib/pOS_ListMoveListHead
List.lib/pOS_ListMoveListInsert
List.lib/pOS_ListMoveListTail
List.lib/pOS_ListPred
List.lib/pOS_ListRemHead
List.lib/pOS_ListRemove
List.lib/pOS_ListRemTail
List.lib/pOS_ListSucc
List.lib/pOS_ListSwapNode


List.lib/List

 STRUCTURS

 struct pOS_ExList
 struct pOS_ExNode
 struct pOS_List
 struct pOS_Node

 INCLUDES

 pExec/List.h
 pExec/Node.h
 proto/pList.h

 ENUMS

 enum pOS_ExNodeType




List.lib/pOS_ListInit (V_1)

  SYNOPSIS
    VOID pOS_ListInit
      (
        pOS_List *list
      );

  FUNCTION
    Initialize an empty list.

  INPUT
    list (_R_A0)
      Pointer to the affected list

  NOTE
    Before a list may be used it has to be initialized!

    /* Head points to the first entry or lh_Tail in an empty list */
    list->lh_Head     =(pOS_Node*)&list->lh_Tail;
    /* Tail is always NULL */
    list->lh_Tail     =NULL;
    /* TailPred points to the last entry or lh_Head in an empty list */
    list->lh_TailPred =(pOS_Node*)&list->lh_Head;

  AMIGA FUNCTION
    VOID NewList(struct List *list);



List.lib/pOS_ListInsert (V_1)

  SYNOPSIS
    VOID pOS_ListInsert
      (
        pOS_List *list,
        pOS_Node *node,
        const pOS_Node *pred
      );

  FUNCTION
    Insert a node into a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert. This node may not be a member
      of another list.
    pred (_R_A2)
      Pointer to the node after which the new node should be inserted.
      If NULL the node is inserted at the top.

  SEE ALSO
    pOS_ListAddHead(), pOS_ListAddTail(), pOS_ListRemove()

  AMIGA FUNCTION
    VOID Insert(struct List *list, struct Node *node, struct Node *pred);



List.lib/pOS_ListAddHead (V_1)

  SYNOPSIS
    VOID pOS_ListAddHead
      (
        pOS_List *list,
        pOS_Node *node
      );

  FUNCTION
    Add a node to the top of a list (as first member).

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert. This may not be a member of
      another list.

  SEE ALSO
    pOS_ListInsert(), pOS_ListAddTail(), pOS_ListRemHead(),
    pOS_ListRemove()

  AMIGA FUNCTION
    VOID AddHead(struct List *list, struct Node *node);



List.lib/pOS_ListAddTail (V_1)

  SYNOPSIS
    VOID pOS_ListAddTail
      (
        pOS_List *list,
        pOS_Node *node
      );

  FUNCTION
    Add a node to the end of a list (as last member).

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert. This may not be a member of
      another list.

  SEE ALSO
    pOS_ListInsert(), pOS_ListAddHead(), pOS_ListRemTail(),
    pOS_ListRemove()

  AMIGA FUNCTION
    VOID AddTail(struct List *list, struct Node *node);



List.lib/pOS_ListRemove (V_1)

  SYNOPSIS
    VOID pOS_ListRemove
      (
        pOS_Node *node
      );

  FUNCTION
    Remove a node from a list.

  INPUT
    node (_R_A0)
      Pointer to the affected node.

  NOTE
    In debugmode the succ- and pred-pointer are set to NULL after
    the node has been removed.

  SEE ALSO
    pOS_ListInsert(), pOS_ListAddHead(), pOS_ListAddTail()

  AMIGA FUNCTION
    VOID Remove(struct Node *node);



List.lib/pOS_ListRemHead (V_1)

  SYNOPSIS
    pOS_Node *res = pOS_ListRemHead
      (
        pOS_List *list
      );

  FUNCTION
    Remove the fist node in a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list

  RESULT
    res (_R_D0)
      Pointer to the removed node or NULL if list is empty.

  NOTE
    In debugmode the succ- and pred-pointers of the removed node
    are set to NULL.

  SEE ALSO
    pOS_ListRemTail(), pOS_ListRemove()

  AMIGA FUNCTION
    struct Node *RemHead(struct Node *node);



List.lib/pOS_ListRemTail (V_1)

  SYNOPSIS
    pOS_Node *res = pOS_ListRemTail
      (
        pOS_List *list
      );

  FUNCTION
    Remove the last node from a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list

  RESULT
    res (_R_D0)
      Pointer to the removed node or NULL list is empty.

  NOTE
    In debugmode the succ- and pred-pointers of the removed node
    are set to NULL.

  SEE ALSO
    pOS_ListRemHead(), pOS_ListRemove()

  AMIGA FUNCTION
    struct Node *RemTail(struct Node *node);



List.lib/pOS_ListMoveListTail (V_1)

  SYNOPSIS
    VOID pOS_ListMoveListTail
      (
        pOS_List *listsource,
        pOS_List *listdest
      );

  FUNCTION
    Append a list to the end of another list. All nodes from listsource
    are moved to listdest.

  INPUT
    listsource (_R_A0)
      Pointer to the source list. Its nodes are added to the end
      of listdest.
    listdest (_R_A1)
      Pointer to the destination list which will receive the nodes.

  NOTE
    After this call the source list is empty and may be used like
    any other empty list.

  SEE ALSO
    pOS_ListMoveListHead(), pOS_ListMoveListInsert(),
    pOS_ListAddTail()

  AMIGA FUNCTION



List.lib/pOS_ListMoveListHead (V_1)

  SYNOPSIS
    VOID pOS_ListMoveListHead
      (
        pOS_List *listsource,
        pOS_List *listdest
      );

  FUNCTION
    Add a list to the top of another list. All nodes from listsource
    are moved to listdest.

  INPUT
    listsource (_R_A0)
      Pointer to the source list. Its nodes are added to the top
      of listdest.
    listdest (_R_A1)
      Pointer to the destination list which will receive the nodes.

  NOTE
    After this call the source list is empty and may be used like
    any other empty list.

  SEE ALSO
    pOS_ListMoveListTail(), pOS_ListMoveListInsert(),
    pOS_ListAddHead()

  AMIGA FUNCTION



List.lib/pOS_ListMoveListInsert (V_1)

  SYNOPSIS
    VOID pOS_ListMoveListInsert
     (
       pOS_List *listsource,
       pOS_List *listdest,
       pOS_Node *pred
     );

  FUNCTION
    Insert all nodes from one list after a given node of another list.

  INPUT
    listsource (_R_A0)
      Pointer to the source list. Its nodes are inserted into listdest.
    listdest (_R_A1)
      Pointer to the destination list which will receive the nodes.
    pred (_R_A2)
      Pointer to the node after which the nodes from listsource should
      be inserted. Use NULL for top of listdest.

  NOTE
    After this call the source list is empty and may be used like
    any other empty list.

  SEE ALSO
    pOS_ListMoveListHead(), pOS_ListMoveListTail(),
    pOS_ListInsert()

  AMIGA FUNCTION



List.lib/pOS_ListCntSucc (V_1)

  SYNOPSIS
    pOS_Node *res = pOS_ListCntSucc
      (
        const pOS_List *list,
        const pOS_Node *node,
        ULONG cnt
      );

  FUNCTION
    Get a node by its position in a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node from which the search starts or NULL for
      the top of the list.
    cnt (_R_D0)
      Position to return (relative to node or absolute if node=NULL)

  RESULT
    res (_R_D0)
      Node that is located at the requested position or NULL.

  SEE ALSO
    pOS_ListGetSuccNodeCnt()

  AMIGA FUNCTION



List.lib/pOS_ListGetSuccNodeCnt (V_1)

  SYNOPSIS
    ULONG res = pOS_ListGetSuccNodeCnt
      (
        const pOS_Node *node
      );

  FUNCTION
    Get a nodes` position in a list. The first node is at position 0.

  INPUT
    node (_R_A1)
      Pointer to the node

  RESULT
    res (_R_D0)
      The nodes` position.

  NOTE
    If node=NULL this call returns 0.
    If the node is the first in the list, this call returns also 0.

  SEE ALSO
    pOS_ListCntSucc()

  AMIGA FUNCTION



List.lib/pOS_ListSucc (V_1)

  SYNOPSIS
    pOS_Node *res = pOS_ListSucc
      (
        const pOS_List *list,
        const pOS_Node *node
      );

  FUNCTION
    Get the successor of a node.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node for which the successor should be returned
      or NULL if the first node of the list should be returned.

  RESULT
    res (_R_D0)
      Next node in the list or NULL there are no more nodes.

  EXAMPLE
    /* get all nodes in a list */
    pOS_List *liste;  // may be initialized using pOS_ListInit()
                      // and filled using pOS_ListInsert()
    pOS_Node *hilf;
    for(hilf=NULL; hilf=pOS_ListSucc(liste,hilf); )
      printf("Node 0x%08lX\n",hilf);

  SEE ALSO
    pOS_ListPred(), pOS_ListIsEmpty()

  AMIGA FUNCTION



List.lib/pOS_ListPred (V_1)

  SYNOPSIS
    pOS_Node *res = pOS_ListPred
      (
        const pOS_List *list,
        const pOS_Node *node
      );

  FUNCTION
    Get a nodes predecessor.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node for which the predecessor should be returned
      or NULL if the last node of the list should be returned.

  RESULT
    res (_R_D0)
      Next node in the list or NULL there are no more nodes.

  SEE ALSO
    pOS_ListSucc(), pOS_ListIsEmpty()

  AMIGA FUNCTION



List.lib/pOS_ListIsEmpty (V_1)

  SYNOPSIS
    BOOL pOS_ListIsEmpty
      (
        const pOS_List *list
      );

  FUNCTION
    Check if a list is empty.

  INPUT
    list (_R_A0)
      Pointer to the affected list

  RESULT
    res (_R_D0)
      TRUE if list is empty, else FALSE.

  SEE ALSO
    pOS_ListSucc(), pOS_ListPred()

  AMIGA FUNCTION
    BOOL IsListEmpty(struct List *list);



List.lib/pOS_ListCheckMember (V_1)

  SYNOPSIS
    BOOL pOS_ListCheckMember
      (
        const pOS_List *list,
        const pOS_Node *node
      );

  FUNCTION
    Check if a node is a member of a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to check

  RESULT
    res (_R_D0)
      TRUE if the node is a member of the list, else FALSE.

  AMIGA FUNCTION



List.lib/pOS_ListEnqueue (V_1)

  SYNOPSIS
    VOID pOS_ListEnqueue
      (
        pOS_ExList *list,
        pOS_ExNode *node
      );

  FUNCTION
    Insert a node into a list depending on its priority.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert depening on node->ln_Pri.
      This node may not be a member of another list.

  NOTE
    If there exist already one or more nodes with the same priority
    the new node is inserted after these nodes.

  SEE ALSO
    pOS_ListEnqueueName(), pOS_ListEnqueueIName()

  AMIGA FUNCTION
    VOID Enqueue(struct List *list, struct Node *node);



List.lib/pOS_ListEnqueueName (V_1)

  SYNOPSIS
    VOID pOS_ListEnqueueName
      (
        pOS_ExList *list,
        pOS_ExNode *node,
        SLONG mode
      );

  FUNCTION
    Insert a node depending on its name. This call is case-
    sensitive.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert depending on node->ln_Name.
      This node may not be a member of another list.
    mode (_R_D0)
      1: insert ascending (A,B,C..a,b,c...)
      0: insert descending (...,c,b,a,...,C,B,A)

  NOTE
    If you change the mode while inserting several nodes into the
    list it will not be sorted correctly!

  SEE ALSO
    pOS_ListEnqueue(), pOS_ListEnqueueIName()

  AMIGA FUNCTION



List.lib/pOS_ListEnqueueIName (V_1)

  SYNOPSIS
    VOID pOS_ListEnqueueIName
      (
        pOS_ExList *list,
        pOS_ExNode *node,
        SLONG mode
      );

  FUNCTION
    Insert a node into a list depending on its name. This call
    is case-insensitive.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node (_R_A1)
      Pointer to the node to insert depending on node->ln_Name.
      This node may not be a member of another list.
    mode (_R_D0)
      1: insert ascending (A=a,B=b,C=c..)
      0: insert descending (...,C=c,B=b,A=a)

  NOTE
    If you change the mode while inserting several nodes into the
    list it will not be sorted correctly!

  SEE ALSO
    pOS_ListEnqueue(), pOS_ListEnqueueName()

  AMIGA FUNCTION



List.lib/pOS_ListFindName (V_1)

  SYNOPSIS
    pOS_ExNode *res = pOS_ListFindName
      (
        const pOS_ExList *list,
        const CHAR *name
      );

  FUNCTION
    Find a node by its name. This call is case-sensitive.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    name (_R_A1)
      Name to search for (case-sensitive).

  RESULT
    res (_R_D0)
      Pointer to a matching node or NULL if none was found.

  SEE ALSO
    pOS_ListFindIName(), pOS_ListFindINameV()

  AMIGA FUNCTION
    struct Node *FindName(struct List *list, STRPTR name);



List.lib/pOS_ListFindIName (V_1)

  SYNOPSIS
    pOS_ExNode *res = pOS_ListFindIName
      (
        const pOS_ExList *list,
        const CHAR *name
      );

  FUNCTION
    Find a node by its name. This call is case-insensitive.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    name (_R_A1)
      Name to search for (case-insensitive).

  RESULT
    res (_R_D0)
      Pointer to a matching node or NULL if none was found.

  SEE ALSO
    pOS_ListFindName(), pOS_ListFindINameV()

  AMIGA FUNCTION



List.lib/pOS_ListFindINameV (V_1)

  SYNOPSIS
    pOS_ExNode *res = pOS_ListFindINameV
      (
        const pOS_ExList *list,
        const CHAR *name,
        pOS_ExNode *node
      );

  FUNCTION
    Find a node by its name starting after another node. This call
    is case-insensitive.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    name (_R_A1)
      Name to search for (case-insensitive).
    node (_R_A2)
      Pointer to the node after which the search should start
      or NULL to search the complete list.

  RESULT
    res (_R_D0)
      Pointer to a matching node or NULL if none was found.

  EXAMPLE
    const pOS_ExList *liste;  // Liste to search in
    const CHAR       *name;   // Name to search
    const pOS_ExNode *hilf;
    for(hilf=NULL; hilf=pOS_ListFindINameV(liste,name,hilf); ) {
      printf("Node 0x%08lX, Name '%s'\n",hilf,hilf->ln_Name);
      if((hilf=pOS_ListSucc(liste,hilf)) == NULL) break;
    }

  SEE ALSO
    pOS_ListFindName(), pOS_ListFindIName()

  AMIGA FUNCTION



List.lib/pOS_ListSwapNode (V_1)

  SYNOPSIS
    VOID pOS_ListSwapNode
      (
        _R_A0 const pOS_List *list,
        _R_A1 pOS_Node *node1,
        _R_A2 pOS_Node *node2
      );

  FUNCTION
    Exchange two nodes in a list.

  INPUT
    list (_R_A0)
      Pointer to the affected list
    node1 (_R_A1)
      Pointer to the first node.
    node2 (_R_A2)
      Pointer to  the second node.

  SEE ALSO
    pOS_ListInsert(), pOS_ListRemove()

  AMIGA FUNCTION


