Listing 2

/*  list.h - List Management Header File
 *           Copyright 1988-90 by Cnapse
 *           Written by: M. de Champlain
 */


typedef struct link
          {
          struct link  *previous;
          struct link  *next;
          } LINK;


extern void  *List_Allocate(word theNumberOfNodes, word theNodeSize);
extern void   List_Free(void *theList);
extern void  *List_RemoveHead(void *fromTheList);
extern void  *List_RemoveTail(void *fromTheList);
extern void  *List_Remove(void *theNode);
extern void   List_InsertHead(void *theNode, void *toTheList);
extern void   List_InsertTail(void *theNode, void *toTheList);
extern void   List_InsertAfter(void *theNode, void *afterThisNode);
extern void   List_InsertBefore(void *theNode, void *beforeThisNode);


#define List_IsEmpty(theList)     ((bool)                        \
                             ( ((LINK *)theList) ==        \
                               ((LINK *)theList)->next ))