/*
 * csll_.h
 *
 * Header file for a Circular Singly Linked List (with 1 tail pointer)
 *
 * For reasonable operation, the user must:
 *
 * 1.  declare a structure
 *     ( where the name can be anything and the info can be any type,
 *       but the first field MUST be a struct SllNode).
 *
 *     typedef struct anyNode
 *       {
 *         struct SllNode sS;
 *         anytype    info;
 *       };
 *
 * 2.  declare the tail of the list
 *     void  *tail;
 *
 * 3.  initialize the list to empty
 *     Init_List(&tail);
 *
 * 4.  Call Fetch_A_Node to allocate the space and initialize the links, 
 *     whenever a new node is needed.
 *     p = Fetch_A_Node(sizeof(struct anyNode));
 *
 * 5.  put the user information into the node
 *     p->info = some_compatible_value;
 *
 * 6.  insert the node into the list
 *     Insert_Left((void *) p, &tail);
 *     or
 *     Insert_Right((void *) p, &tail);
 *
 *
 * Copyright (c) 2000 by Bill McDaniel 
 */

#ifndef __SllNode__
#define __SllNode__
typedef struct SllNode
  {
    struct SllNode *next;
  } SllNode;

void    Init_List     (void **tail);
void  * Fetch_A_Node  (long int size);
void    Insert_Left   (void *p, void **tail);
void    Insert_Right  (void *p, void **tail);
void  * Remove_Left   (void **tail);
void  * Remove_Right  (void **tail);
void  * First_Node    (void *tail);
void  * Next_Node     (void *p, void *tail);
void    Sort          (void ** tail_pointer, int (*comp) (void *, void *));
void    Traverse      (void *tail_pointer, void (*visit) (void *));
#endif