Header to include: ilist.h
Ilist *ilistNew(int dsize, int asize)
void ilistTruncate(Ilist *list, int size)
void ilistQuantum(Ilist *list, int size)
Ilist *ilistDup(Ilist *list)
void ilistDelete(Ilist *list)
void *ilistFirst(Ilist *list)
void *ilistNext(Ilist *list)
void *ilistLast(Ilist *list)
void *ilistItem(Ilist *list, int element)
int ilistSize(Ilist *list)
int ilistAppend(Ilist *list, void *data)
void ilistRemove(Ilist *list, int element)
int ilistSwap(Ilist *list, int e1, int e2)
int ilistPush(Ilist *list, void *data)
void *ilistPop(Ilist *list)
int ilistFloat(Ilist *list, int element)
int ilistInsert(Ilist *list, void *data, int element)
void ilistShift(Ilist *list, int start, int amount)
The Ilist structure is described by:
typedef struct ilist_struct { void *data; /* Pointer to data */ int dsize; /* Size of data element in bytes */ int current; /* Current item */ int size; /* Number of items on list */ int store; /* Number of items space allocated for */ int quantum; /* Increment when allocating more space */ }Ilist;
Gets a new list with data size given by dsize, initial allocation by asize. Returns NULL for error.
Limits the size of list to size
Sets the quantum for increasing the size of list when needed to size
Returns a duplicate of list, or NULL for an error
Deletes list and frees all memory
Returns a pointer to the first item from list, or NULL for an error or empty list.
Returns a pointer to the next item from list, or NULL at the end of the list
Returns a pointer to the last item from list, or NULL for an error or empty list.
Returns a pointer to the item in list at the index given by element, or NULL for error.
Returns size of list
Appends data to the end of list, where the argument should be a pointer to the item to be copied into the list. Returns 1 if memory error, but retains previous state.
Removes the item at element from list
Swaps the two elements e1 and e2 on list; returns 1 if error
Inserts the item pointed to by data on the front of list; returns 1 if error
Pops an item off the front of list and returns it; returns NULL if error. The item has been malloc'ed and must be freed
Moves the item at element to the front of list; returns 1 if error
Inserts an item pointed to by data into list at the position given by element; returns 1 if error
Shift all items in list from the point given by start to the end by amount.