agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
clist.h File Reference
#include <zrtos/types.h>
Include dependency graph for clist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zrtos_clist_node_t
 
struct  _zrtos_clist_t
 

Macros

#define ZRTOS_CLIST__EACH_BEGIN(thiz, node, container, member)
 
#define ZRTOS_CLIST__EACH_END
 

Typedefs

typedef struct _zrtos_clist_node_t zrtos_clist_node_t
 
typedef struct _zrtos_clist_t zrtos_clist_t
 

Functions

zrtos_clist_node_tzrtos_clist__get_root (zrtos_clist_t *thiz)
 
void zrtos_clist__set_root (zrtos_clist_t *thiz, zrtos_clist_node_t *node)
 
bool zrtos_clist_node__init (zrtos_clist_node_t *thiz)
 
zrtos_clist_node_tzrtos_clist_node__get_next_node (zrtos_clist_node_t *node)
 
bool zrtos_clist_node__has_next_node (zrtos_clist_node_t *node)
 
zrtos_clist_node_tzrtos_clist_node__get_previous_node (zrtos_clist_node_t *node)
 
bool zrtos_clist__init (zrtos_clist_t *thiz)
 
zrtos_clist_node_tzrtos_clist__get_first_node (zrtos_clist_t *thiz)
 
zrtos_clist_node_tzrtos_clist__get_last_node (zrtos_clist_t *thiz)
 
static void zrtos_clist_node__append (zrtos_clist_node_t *thiz, zrtos_clist_node_t *node)
 
bool zrtos_clist__push (zrtos_clist_t *thiz, zrtos_clist_node_t *node)
 
bool zrtos_clist__delete (zrtos_clist_t *thiz, zrtos_clist_node_t *node)
 
zrtos_clist_node_tzrtos_clist__pop (zrtos_clist_t *thiz)
 
bool zrtos_clist__unshift (zrtos_clist_t *thiz, zrtos_clist_node_t *node)
 
zrtos_clist_node_tzrtos_clist__shift (zrtos_clist_t *thiz)
 
void zrtos_clist__shift_and_push (zrtos_clist_t *thiz)
 
void zrtos_clist__each (zrtos_clist_t *thiz, bool(*callback)(zrtos_clist_node_t *node, void *arg), void *arg)
 

Macro Definition Documentation

◆ ZRTOS_CLIST__EACH_BEGIN

#define ZRTOS_CLIST__EACH_BEGIN (   thiz,
  node,
  container,
  member 
)
Value:
do{\
zrtos_clist_t *clist = thiz;\
zrtos_clist_node_t *tmp = zrtos_clist__get_root(clist);\
zrtos_clist_node_t *next;\
container *node;\
if(tmp){\
do{\
next = tmp->next;\
tmp,container,member\
);\
do{
zrtos_clist_node_t * zrtos_clist__get_root(zrtos_clist_t *thiz)
Definition: clist.h:25
#define zrtos_types__get_container_of(ptr, type, member)
Definition: types.h:69

Definition at line 159 of file clist.h.

◆ ZRTOS_CLIST__EACH_END

#define ZRTOS_CLIST__EACH_END
Value:
}while(0);\
tmp = next;\
}while(tmp != zrtos_clist__get_root(clist));\
}\
}while(0)
zrtos_clist_node_t * zrtos_clist__get_root(zrtos_clist_t *thiz)
Definition: clist.h:25

Definition at line 173 of file clist.h.

Typedef Documentation

◆ zrtos_clist_node_t

◆ zrtos_clist_t

typedef struct _zrtos_clist_t zrtos_clist_t

Function Documentation

◆ zrtos_clist__delete()

bool zrtos_clist__delete ( zrtos_clist_t thiz,
zrtos_clist_node_t node 
)

Definition at line 95 of file clist.h.

95  {
97 
98  if(prev != node){
99  prev->next = node->next;
100  }else{
101  thiz->root = 0;
102  }
103  node->next = node;
104 
105  return true;
106 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
zrtos_clist_node_t * root
Definition: clist.h:22
zrtos_clist_node_t * zrtos_clist_node__get_previous_node(zrtos_clist_node_t *node)
Definition: clist.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_clist__each()

void zrtos_clist__each ( zrtos_clist_t thiz,
bool(*)(zrtos_clist_node_t *node, void *arg)  callback,
void *  arg 
)

Definition at line 143 of file clist.h.

147  {
149  if(node){
150  zrtos_clist_node_t *next;
151  do{
152  next = zrtos_clist_node__get_next_node(node);
153  }while(callback(node,arg)
154  && (node = next) != zrtos_clist__get_root(thiz)
155  );
156  }
157 }
zrtos_clist_node_t * zrtos_clist__get_root(zrtos_clist_t *thiz)
Definition: clist.h:25
zrtos_clist_node_t * zrtos_clist_node__get_next_node(zrtos_clist_node_t *node)
Definition: clist.h:38
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_clist__get_first_node()

zrtos_clist_node_t* zrtos_clist__get_first_node ( zrtos_clist_t thiz)

Definition at line 66 of file clist.h.

66  {
67  return thiz->root;
68 }
zrtos_clist_node_t * root
Definition: clist.h:22
Here is the caller graph for this function:

◆ zrtos_clist__get_last_node()

zrtos_clist_node_t* zrtos_clist__get_last_node ( zrtos_clist_t thiz)

Definition at line 70 of file clist.h.

70  {
72  return root
74  : root;
75 }
zrtos_clist_node_t * zrtos_clist__get_root(zrtos_clist_t *thiz)
Definition: clist.h:25
zrtos_clist_node_t * zrtos_clist_node__get_previous_node(zrtos_clist_node_t *node)
Definition: clist.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_clist__get_root()

zrtos_clist_node_t* zrtos_clist__get_root ( zrtos_clist_t thiz)

Definition at line 25 of file clist.h.

25  {
26  return thiz->root;
27 }
zrtos_clist_node_t * root
Definition: clist.h:22
Here is the caller graph for this function:

◆ zrtos_clist__init()

bool zrtos_clist__init ( zrtos_clist_t thiz)

Definition at line 61 of file clist.h.

61  {
62  thiz->root = 0;
63  return true;
64 }
zrtos_clist_node_t * root
Definition: clist.h:22
Here is the caller graph for this function:

◆ zrtos_clist__pop()

zrtos_clist_node_t* zrtos_clist__pop ( zrtos_clist_t thiz)

Definition at line 108 of file clist.h.

108  {
110  if(ret){
111  zrtos_clist__delete(thiz,ret);
112  }
113  return ret;
114 }
bool zrtos_clist__delete(zrtos_clist_t *thiz, zrtos_clist_node_t *node)
Definition: clist.h:95
zrtos_clist_node_t * zrtos_clist__get_last_node(zrtos_clist_t *thiz)
Definition: clist.h:70
Here is the call graph for this function:

◆ zrtos_clist__push()

bool zrtos_clist__push ( zrtos_clist_t thiz,
zrtos_clist_node_t node 
)

Definition at line 85 of file clist.h.

85  {
87  if(last){
88  zrtos_clist_node__append(last,node);
89  }else{
90  thiz->root = node;
91  }
92  return true;
93 }
static void zrtos_clist_node__append(zrtos_clist_node_t *thiz, zrtos_clist_node_t *node)
Definition: clist.h:77
zrtos_clist_node_t * root
Definition: clist.h:22
zrtos_clist_node_t * zrtos_clist__get_last_node(zrtos_clist_t *thiz)
Definition: clist.h:70
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_clist__set_root()

void zrtos_clist__set_root ( zrtos_clist_t thiz,
zrtos_clist_node_t node 
)

Definition at line 29 of file clist.h.

29  {
30  thiz->root = node;
31 }
zrtos_clist_node_t * root
Definition: clist.h:22
Here is the caller graph for this function:

◆ zrtos_clist__shift()

zrtos_clist_node_t* zrtos_clist__shift ( zrtos_clist_t thiz)

Definition at line 125 of file clist.h.

125  {
127  if(ret){
128  zrtos_clist__delete(thiz,ret);
129  }
130  return ret;
131 }
bool zrtos_clist__delete(zrtos_clist_t *thiz, zrtos_clist_node_t *node)
Definition: clist.h:95
zrtos_clist_node_t * zrtos_clist__get_first_node(zrtos_clist_t *thiz)
Definition: clist.h:66
Here is the call graph for this function:

◆ zrtos_clist__shift_and_push()

void zrtos_clist__shift_and_push ( zrtos_clist_t thiz)

Definition at line 133 of file clist.h.

133  {
135  if(node){
137  thiz
139  );
140  }
141 }
zrtos_clist_node_t * zrtos_clist__get_first_node(zrtos_clist_t *thiz)
Definition: clist.h:66
zrtos_clist_node_t * zrtos_clist_node__get_next_node(zrtos_clist_node_t *node)
Definition: clist.h:38
void zrtos_clist__set_root(zrtos_clist_t *thiz, zrtos_clist_node_t *node)
Definition: clist.h:29
Here is the call graph for this function:

◆ zrtos_clist__unshift()

bool zrtos_clist__unshift ( zrtos_clist_t thiz,
zrtos_clist_node_t node 
)

Definition at line 116 of file clist.h.

116  {
117  if(thiz->root){
118  node->next = thiz->root;
119  }
120  thiz->root = node;
121 
122  return true;
123 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
zrtos_clist_node_t * root
Definition: clist.h:22

◆ zrtos_clist_node__append()

static void zrtos_clist_node__append ( zrtos_clist_node_t thiz,
zrtos_clist_node_t node 
)
static

Definition at line 77 of file clist.h.

80  {
81  node->next = thiz->next;
82  thiz->next = node;
83 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
Here is the caller graph for this function:

◆ zrtos_clist_node__get_next_node()

zrtos_clist_node_t* zrtos_clist_node__get_next_node ( zrtos_clist_node_t node)

Definition at line 38 of file clist.h.

40  {
41  return node->next;
42 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
Here is the caller graph for this function:

◆ zrtos_clist_node__get_previous_node()

zrtos_clist_node_t* zrtos_clist_node__get_previous_node ( zrtos_clist_node_t node)

Definition at line 50 of file clist.h.

52  {
53  zrtos_clist_node_t *ret = node;
54  zrtos_clist_node_t *next;
55  while((next = ret->next) != node){
56  ret = next;
57  }
58  return ret;
59 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
Here is the caller graph for this function:

◆ zrtos_clist_node__has_next_node()

bool zrtos_clist_node__has_next_node ( zrtos_clist_node_t node)

Definition at line 44 of file clist.h.

46  {
47  return node->next != node;
48 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18

◆ zrtos_clist_node__init()

bool zrtos_clist_node__init ( zrtos_clist_node_t thiz)

Definition at line 33 of file clist.h.

33  {
34  thiz->next = thiz;
35  return true;
36 }
struct _zrtos_clist_node_t * next
Definition: clist.h:18
Here is the caller graph for this function: