ZEDA  1.6.18
Data Structures | Macros | Typedefs | Functions
zeda_list.h File Reference

list operation. More...

#include <zeda/zeda_misc.h>
Include dependency graph for zeda_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __zListCell
 
struct  __zList
 
struct  __zIntListCell
 a list of integer numbers More...
 
struct  __zIntList
 

Macros

#define zListClass(list_t, cell_t, data_t)
 generate bidirectional ring list class. More...
 
#define zListCellPrev(c)   (c)->prev
 a pointer to the previous cell of c. More...
 
#define zListCellNext(c)   (c)->next
 a pointer to the next cell of c. More...
 
#define zListCellSetPrev(c, p)   ( zListCellPrev(c) = (p) )
 set the previous cell of c for p. More...
 
#define zListCellSetNext(c, n)   ( zListCellNext(c) = (n) )
 set the next cell of c for n. More...
 
#define zListCellInit(c)
 initialize a list cell c. More...
 
#define zListCellBind(l, f)
 bind two list cells l and f. l is the latter, while f is the former. More...
 
#define zListCellInsertNext(c, n)
 insert a list cell n to the next of c. More...
 
#define zListCellInsertPrev(c, p)
 insert a list cell p to the previous of c. More...
 
#define zListCellPurge(c)
 purge a cell c from a list. More...
 
#define zListCellDeleteNext(c, n)
 delete the next cell of c from a list. The deleted cell is stored into n. More...
 
#define zListCellDeletePrev(c, p)
 delete the previous cell from a list. The deleted cell is stored into p. More...
 
#define zListCellSwap(cell_t, c1, c2)
 swap the positions of two list cells c1 and c2. cell_t is the type of list cells. More...
 
#define zListCellFPrint(f, c)
 print connections around a list cell c to the file f. More...
 
#define zListCellPrint(c)   zListCellFPrint( stdout, c )
 print pointing information of a list cell c to the standard output. More...
 
#define zListSize(l)   (l)->size
 the size of a list l. More...
 
#define zListRoot(l)   ( &(l)->root )
 the root cell of a list l. More...
 
#define zListHead(l)   zListCellPrev( zListRoot( l ) )
 the head cell (the previous of the root) of a list l. More...
 
#define zListTail(l)   zListCellNext( zListRoot( l ) )
 the tail cell (the next of the root) of a list l. More...
 
#define zListSetSize(l, n)   ( zListSize(l) = (n) )
 set the size of a list l for n (unpreferable to be used). More...
 
#define zListIncSize(l)   ( zListSize(l)++ )
 increment the size of a list l (unpreferable to be used). More...
 
#define zListDecSize(l)   ( zListSize(l)-- )
 decrement the size of a list l (unpreferable to be used). More...
 
#define zListIsEmpty(l)   ( zListSize(l) == 0 )
 check if a list l is empty. More...
 
#define zListInit(l)
 initialize a list l. More...
 
#define zListDestroy(t, l)
 destroy a list l. t is the type of list cells. More...
 
#define zListInsertNext(l, c, n)
 insert a list cell n to the next of c in a list l. More...
 
#define zListInsertPrev(l, c, p)
 insert a list cell p to the previous of c in a list l. More...
 
#define zListInsertHead(l, c)   zListInsertPrev( l, zListRoot(l), c )
 insert a list cell c to the head of a list l. More...
 
#define zListInsertTail(l, c)   zListInsertNext( l, zListRoot(l), c )
 insert a list cell c to the tail of a list l. More...
 
#define zListDeleteNext(l, c, n)
 delete the next cell of c of a list l. The deleted cell is stored into n. More...
 
#define zListDeletePrev(l, c, p)
 delete the previous cell of c of a list l. The deleted cell is stored into p. More...
 
#define zListDeleteHead(l, c)   zListDeletePrev( l, zListRoot(l), c )
 delete the head cell of a list l. The deleted cell is stored into c. More...
 
#define zListDeleteTail(l, c)   zListDeleteNext( l, zListRoot(l), c )
 delete the tail cell of a list l. The deleted cell is stored into c. More...
 
#define zListPurge(l, c)
 purge a list cell c in a list l. More...
 
#define zListAppendA(a, p)
 append all cells in a list p to the head of another list a. As the result, p will be empty. More...
 
#define zListAppendZ(a, p)
 append all cells in a list p to the tail of another list a. As the result, p will be empty. More...
 
#define zListAppend(a, p)   zListAppendZ(a,p)
 
#define zListMove(src, dst)
 move a list to another. More...
 
#define zListSwap(cell_t, l1, l2)
 swap two lists l1 and l2. More...
 
#define zListToHead(l, c)   for( ; (c)!=zListRoot(l); (c)=zListCellNext(c) )
 succeed a process for each cell of a list l from the current c to the head. More...
 
#define zListToTail(l, c)   for( ; (c)!=zListRoot(l); (c)=zListCellPrev(c) )
 succeed a process for each cell of a list l from the current c to the tail. More...
 
#define zListForEach(l, c)   for( (c)=zListTail(l); (c)!=zListRoot(l); (c)=zListCellNext(c) )
 succeed a process for each cell in a list l. Each cell is pointed by c from the tail to the head. More...
 
#define zListForEachRew(l, c)   for( (c)=zListHead(l); (c)!=zListRoot(l); (c)=zListCellPrev(c) )
 succeed a process for each cell in a list l. Each cell is pointed by c from the head back to the tail. More...
 
#define zListItem(list, i, cp)
 refer the i 'th cell of a list list, and let cp point the cell. More...
 
#define zListQuickSortDef(list_t, cell_t)
 define the quick sort method for a list class. More...
 
#define zListFPrint(f, l)   _zListFPrint( f, (zList *)(l) )
 
#define zListPrint(l)   zListFPrint( stdout, l )
 
#define zStackPush(s, v)   zListInsertHead(s,v)
 stack push operation. More...
 
#define zStackPop(s, c)   zListDeleteHead(s,c)
 stack pop operation. More...
 
#define zQueueEnqueue(q, v)   zListInsertTail(q,v)
 enqueue operation. More...
 
#define zQueueDequeue(q, c)   zListDeleteHead(q,c)
 dequeue operation. More...
 

Typedefs

typedef struct __zListCell zListCell
 
typedef struct __zList zList
 
typedef struct __zIntListCell zIntListCell
 a list of integer numbers More...
 
typedef struct __zIntList zIntList
 

Functions

void _zListFPrint (FILE *fp, zList *list)
 print connection information of a list. More...
 
bool zIntListAdd (zIntList *list, int i)
 a list of integer numbers More...
 

Detailed Description

list operation.

Author
Zhidao

Typedef Documentation

◆ zIntListCell

typedef struct __zIntListCell zIntListCell

a list of integer numbers

◆ zIntList

typedef struct __zIntList zIntList

Function Documentation

◆ zIntListAdd()

bool zIntListAdd ( zIntList list,
int  i 
)

a list of integer numbers