/* * Definition of a generic list. The visible list functions are: * * List NewList() * PutList(List l, ListElem e) * ListElem PullList(List l) * PushList(List l, ListElem e) * ListElem PopList(List l) * ListElem GetNthList(List l, int n) * ListElem DelNthList(List l, int n) * int ListLen(List l) * ListElem EnumList(List l) * ResetListEnum(l) * PrintList(list l) * * * List elements have the following opaque structure: * * ListElem Data; * List Next; * List Prev; * */ #ifndef list_included #define list_included typedef char *ListElem; typedef struct ListItemStruct { ListElem Data; struct ListItemStruct *Next; struct ListItemStruct *Prev; } *ListItem; typedef struct ListStruct { ListItem First; ListItem Last; int Size; ListItem EnumState; } *List; /* * Visible functions. */ List NewList(); PutList(/* List l, ListElem e */); ListElem PullList(/* List l */); PushList(/* List l, ListElem e */); ListElem PopList(/* List l */); ListElem GetNthList(/* List l, int n */); ListElem DelNthList(/* List l, int n */); int ListLen(/* List l */); ListElem EnumList(/* List l */); ResetListEnum(/* l */); PrintList(/* list l */); #endif