4 #ident "University of Edinburgh $Id: 3ef0e2c8562fa955c61e9e757fc9e672c10da307 $" 6 static char _HGUDlpList_h[] =
"University of Edinburgh $Id: 3ef0e2c8562fa955c61e9e757fc9e672c10da307 $";
81 typedef struct _HGUDlpListItem
83 void (*freeFn)(
void *);
85 struct _HGUDlpListItem *next;
86 struct _HGUDlpListItem *prev;
89 typedef struct _HGUDlpList
115 int (*entryCompFn)(
void *,
void *));
118 HGUDlpListItem *item);
121 HGUDlpListItem *item);
126 HGUDlpListItem *item,
127 HGUDlpListDirection dir);
132 HGUDlpListItem *item);
135 HGUDlpListItem *item,
142 HGUDlpListItem *before,
void *entry,
143 void (*freeFn)(
void *));
146 HGUDlpListItem *after,
148 void (*freeFn)(
void *));
151 HGUDlpListItem *item0,
152 HGUDlpListItem *item1);
157 HGUDlpListItem *item);
162 HGUDlpListItem *item);
165 HGUDlpListItem *item,
166 HGUDlpListDirection dir,
167 int (*iterFn)(HGUDlpList *, HGUDlpListItem *,
176 HGUDlpListItem *item);
179 HGUDlpListItem *item);
182 HGUDlpListItem *item,
183 HGUDlpListDirection dir,
void * HGUDlpListEntrySet(HGUDlpList *list, HGUDlpListItem *item, void *entry)
Sets the given items entry and returns the previous entry. Entries are NEVER freed by this function...
Definition: HGUDlpList.c:713
HGUDlpListItem * HGUDlpListInsert(HGUDlpList *list, HGUDlpListItem *before, void *entry, void(*freeFn)(void *))
Inserts the given entry into the list before the given item.
Definition: HGUDlpList.c:160
enum _HGUDlpListDirection HGUDlpListDirection
HGUDlpListItem * HGUDlpListIterate(HGUDlpList *list, HGUDlpListItem *item, HGUDlpListDirection dir, int(*iterFn)(HGUDlpList *, HGUDlpListItem *, void *), void *iterData)
void HGUDlpListItem
Opaque handle for doubly linked list item.
Definition: HGUDlpList.h:105
_HGUDlpListDirection
List traversal direction; Typedef: HGUDlpListDirection.
Definition: HGUDlpList.h:57
HGUDlpListItem * HGUDlpListRemoveAll(HGUDlpList *list)
Definition: HGUDlpList.h:75
HGUDlpListItem * HGUDlpListAppend(HGUDlpList *list, HGUDlpListItem *after, void *entry, void(*freeFn)(void *))
Appends the given entry into the list after the given item.
Definition: HGUDlpList.c:230
Definition: HGUDlpList.h:73
HGUDlpList * HGUDlpListCreate(HGUDlpListState(*lockFn)(void *, HGUDlpListState))
void HGUDlpList
Opaque handle for doubly linked list of pointers.
Definition: HGUDlpList.h:111
int HGUDlpListItemIsTail(HGUDlpList *list, HGUDlpListItem *item)
Looks to see if the given item is at the tail of the given list.
Definition: HGUDlpList.c:666
Definition: HGUDlpList.h:74
HGUDlpListItem * HGUDlpListExchange(HGUDlpList *list, HGUDlpListItem *item0, HGUDlpListItem *item1)
Exchanges the two given list item entries and not the items, so that head is still head and tail is s...
Definition: HGUDlpList.c:298
Definition: HGUDlpList.h:60
Definition: HGUDlpList.h:59
HGUDlpListItem * HGUDlpListPrev(HGUDlpList *list, HGUDlpListItem *item)
Returns the prev list item.
Definition: HGUDlpList.c:789
enum _HGUDlpListState HGUDlpListState
HGUDlpListItem * HGUDlpListDeleteAll(HGUDlpList *list)
Deletes all list items from the head on down to and including the tail. Where delete implies both the...
Definition: HGUDlpList.c:330
int HGUDlpListOffset(HGUDlpList *list, HGUDlpListItem *item, HGUDlpListDirection dir)
Counts the number of items from the given item to the item with a NULL next/prev item, which is at the head or tail of list. The offset between an item and itself is defined to be zero.
Definition: HGUDlpList.c:603
int HGUDlpListItemIsHead(HGUDlpList *list, HGUDlpListItem *item)
Looks to see if the given item is at the head of the given list.
Definition: HGUDlpList.c:638
HGUDlpListItem * HGUDlpListTail(HGUDlpList *list)
Returns the tail list item.
Definition: HGUDlpList.c:737
int HGUDlpListCount(HGUDlpList *list)
Returns the number of items in the list.
Definition: HGUDlpList.c:805
_HGUDlpListState
State of list locking mechanism. Typedef: HGUDlpListState.
Definition: HGUDlpList.h:69
HGUDlpListItem * HGUDlpListHead(HGUDlpList *list)
Returns the head list item.
Definition: HGUDlpList.c:753
HGUDlpListItem * HGUDlpListDelete(HGUDlpList *list, HGUDlpListItem *item)
Deletes the given list item from the list with the given list. Where delete implies both the removal ...
Definition: HGUDlpList.c:354
int HGUDlpListSort(HGUDlpList *list, int(*entryCompFn)(void *, void *))
Sorts the entire list using the given entry comparison function.
Definition: HGUDlpList.c:398
HGUDlpList * HGUDlpListDup(HGUDlpList *list)
Duplicates a list data structure, but NOT its items. Ie head and tail are both NULL and the item coun...
Definition: HGUDlpList.c:116
Definition: HGUDlpList.h:71
HGUDlpListItem * HGUDlpListNth(HGUDlpList *list, HGUDlpListItem *item, HGUDlpListDirection dir, int num)
Finds the n'th item from the given item in the list. The n'th item from the head or tail can be found...
Definition: HGUDlpList.c:516
HGUDlpListItem * HGUDlpListNext(HGUDlpList *list, HGUDlpListItem *item)
Returns the next list item.
Definition: HGUDlpList.c:771
void HGUDlpListDestroy(HGUDlpList *list)
Destroys the given list list data structure and any list items.
Definition: HGUDlpList.c:132
Definition: HGUDlpList.h:72
void * HGUDlpListEntryGet(HGUDlpList *list, HGUDlpListItem *item)
Returns the list items entry.
Definition: HGUDlpList.c:693
Definition: HGUDlpList.h:76
HGUDlpListItem * HGUDlpListRemove(HGUDlpList *list, HGUDlpListItem *item)
Removes the item from the list withe the given list. Where remove implies the removal of the item fro...
Definition: HGUDlpList.c:374