Minimal Double-Linked Lists

    #include <mplib1/min_list.h>

    struct Min_List
    {
    struct Min_Node ln_Head;
    struct Min_Node ln_Tail;
    };

    struct Min_Node
    {
    struct Min_Node *ln_Succ;
    struct Min_Node *ln_Pred;
    };

The min_list routines are a suite of minmal double-linked list functions based on the same linkage principle as the standard double-linked list routines.


Initialisation Routines

The Min_List and Min_Node must be initialised before they can be used.
    int Init_Min_List ( Min_List *list );
This function initialises a Min_List structure for subsequent use.

    int Init_Min_Node( Min_Node *node );
This function initialises a Min_Node structure for use in a Min_List.


Add functions

The two main add functions are as follows.
    int Add_To_Min_Head( Min_List *list, Min_Node *node );

    int Add_To_Min_Tail( Min_List *list, Min_Node *node );
These functions add the supplied min_node to the head and tail of the supplied min_list respectively.

There is another pair of add functions. These are for use when manipulating items somewhere in the Min_List.

    int Add_Min_After( Min_Node *node1, Min_Node *node2 );

    int Add_Min_Before( Min_Node *node1, Min_Node *node2 );
This pair adds node2 to the list before and after node1 respectively.


Remove Function

There is a single remove function.
    int Remove_Min_Node( Min_Node *node );