Nut/OS  4.10.3
API Reference
lili.h File Reference
#include <compiler.h>
#include <stdint.h>
Include dependency graph for lili.h:
This graph shows which files directly or indirectly include this file:

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)
typedef struct _LILI_NODE LILI_NODE
 Node object type.
typedef struct _LILI LILI
 List object type.

Functions

LILILiLiCreate (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_NODELiLiFindItem (LILI *list, LILI_ITEMREF ref)
 Find the node of a given item.
LILI_NODELiLiLocateItem (LILI *list, LILI_ITEMREF ref)
 Find the node's location by a given item.
LILI_NODELiLiInsertItemAfterNode (LILI *list, LILI_NODE *node, LILI_ITEMREF ref)
LILI_NODELiLiInsertItemBeforeNode (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.