lili.h File Reference

Go to the source code of this file.

Data Structures

struct  LILI_NODE
 Node object structure. More...
struct  LILI
 List object structure. More...

Defines

#define LiLiIsLifo(list)   (((list)->lst_flags & LILI_F_ORDER) == LILI_F_LIFO)
 Return true if the given list is a last in, first out queue.
#define LiLiIsFifo(list)   (((list)->lst_flags & LILI_F_ORDER) == LILI_F_FIFO)
 Return true if the given list is a first in, first out queue.
#define LiLiIsSorted(list)   (((list)->lst_flags & LILI_F_ORDER) == LILI_F_SORT)
 Return true if the given list is sorted.
#define LiLiIsEmpty(list)   ((list)->lst_head == NULL)
 Return true if the given list is empty.
#define LiLiHasUniqueItems(list)   (((list)->lst_flags & LILI_F_UNIQUE) == LILI_F_UNIQUE)
 Return true if the given list has unique items only.
#define LiLiFirstNode(list)   ((list)->lst_head)
 Return the first node object of a given list.
#define LiLiLastNode(list)   ((list)->lst_tail)
 Return the last node object of a given list.
#define LiLiNextNode(node)   ((node)->nod_nxt)
 Return the next node object of a given node.
#define LiLiPreviousNode(node)   ((node)->nod_prv)
 Return the previous node object of a given node.
#define LiLiNodeItem(node)   ((node)->nod_itm)
 Return the item reference of a given node.

Typedefs

typedef intptr_t LILI_ITEMREF
 Type of an item reference.
typedef LILI_ITEMREF(* LiLiItemCreateFunc )(LILI_ITEMREF)
typedef void(* LiLiItemDestroyFunc )(LILI_ITEMREF)
typedef int(* LiLiItemCompareFunc )(LILI_ITEMREF, LILI_ITEMREF)

Functions

LILI * LiLiCreate (uint8_t flags, LiLiItemCreateFunc cre, LiLiItemDestroyFunc des, LiLiItemCompareFunc cmp)
 Create a linked list.
void LiLiClean (LILI *list)
 Remove all items from a list.
void LiLiDestroy (LILI *list)
 Destroy a linked list.
int LiLiNodes (LILI *list)
 Return the number of nodes in a given list.
int LiLiPushItem (LILI *list, LILI_ITEMREF ref)
 Add an item to the list.
int LiLiPopItem (LILI *list, LILI_ITEMREF *refp)
 Remove the next item from the list.
LILI_NODE * LiLiFindItem (LILI *list, LILI_ITEMREF ref)
 Find the node of a given item.
LILI_NODE * LiLiLocateItem (LILI *list, LILI_ITEMREF ref)
 Find the node's location by a given item.
LILI_NODE * LiLiInsertItemAfterNode (LILI *list, LILI_NODE *node, LILI_ITEMREF ref)
LILI_NODE * LiLiInsertItemBeforeNode (LILI *list, LILI_NODE *node, LILI_ITEMREF ref)
void LiLiRemoveNode (LILI *list, LILI_NODE *node)
 Remove a given node from the list.
LILI_ITEMREF LiLiCreateStringItemCopy (LILI_ITEMREF ref)
 Create a copy of a referenced string item.
void LiLiDestroyStringItemCopy (LILI_ITEMREF ref)
 Destroy the string item copy.
int LiLiCompareStringItems (LILI_ITEMREF ref1, LILI_ITEMREF ref2)
 Compare two string items.

List attribute flags



#define LILI_F_LIFO   0x00
 Last in, first out queue.
#define LILI_F_FIFO   0x01
 First in, first out queue.
#define LILI_F_SORT   0x02
 Sorted list.
#define LILI_F_ORDER   0x03
 List order mask.
#define LILI_F_UNIQUE   0x80
 Allow unique items only.

© 2000-2010 by contributors - visit http://www.ethernut.de/