[ Maverik Level 1 functions ]
mav_listNew
mav_listNew, mav_listOrderedNew, mav_listDelete, mav_listEmpty, mav_listItemAdd, mav_listItemRmv, mav_listPointerReset, mav_listPointerPush, mav_listPointerPop, mav_listItemNext, mav_listSize, mav_listItemContains
Summary
List management functions.
Syntax
MAV_list *mav_listNew(void);
MAV_list *mav_listOrderedNew(void);
void mav_listDelete(MAV_list *l);
void mav_listEmpty(MAV_list *l);
void mav_listItemAdd(MAV_list *l, void *d);
void mav_listItemRmv(MAV_list *l, void *d);
void mav_listPointerReset(MAV_list *l);
void mav_listPointerPush(MAV_list *l);
void mav_listPointerPop(MAV_list *l);
int mav_listItemNext(MAV_list *l, void **d);
int mav_listSize(MAV_list *l);
int mav_listItemContains(MAV_list *l, void *d);
Description
-  mav_listNew
creates a new list, and returns a handle to the list.  Lists created using
this function do not guarantee to preserve elements in the order in which
they were inserted.
 
-  mav_listOrderedNew
creates a list which guarantees to preserve elements in the order in which
they were inserted into the list.
 
Each list created using mav_listNew or mav_listOrderedNew has its own
private "list pointer", and a stack on which to save it, which can be used
to conveniently step through the list (see mav_listItemNext and related
functions).
-  mav_listDelete
deletes all the nodes in list l. It
does not, however, delete any data referenced by nodes in the list. After
calling this function, l is undefined.
 
-  mav_listEmpty
deletes all the nodes from list l.  It
does not, however, delete any data referenced by nodes in the list. After
calling this function, l refers to an empty list, which can be used again.
 
-  mav_listItemAdd
adds a new item list l. The
created by mav_listOrderedNew), the new item is appended to the list; If
l is a non-ordered list (as created by mav_listNew), the new item may be
placed anywhere in the list.
 
-  mav_listItemRmv
searches list l for an
item containing data pointer d, and removes the item from the list.
 
-  mav_listPointerReset
sets the list pointer of list l
to point to the beginning of the list.
 
-  mav_listPointerPush
This function pushes the list pointer for list
l onto its stack. The value of the list pointer is unchanged.
 
-  mav_listPointerPop
pops the list pointer for list l
from its stack.
 
-  mav_listItemNext
returns, in d, the date of
the list item currently pointed to by the list pointer of list l. The
return value of the function is MAV_TRUE if the data was successfully
returned, otherwise MAV_FALSE. The pointer is then moved onto the next item.
 
-  mav_listSize
returns the number of items in list l.
 
-  mav_listItemContains
searches list l for an
item containing data d. The function returns MAV_TRUE if the the item is
located, otherwise MAV_FALSE.
 
Back to the index page.