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

Go to the source code of this file.

Data Structures

struct  _zrtos_list_node_t
 
struct  _zrtos_list_t
 

Typedefs

typedef struct _zrtos_list_node_t zrtos_list_node_t
 
typedef struct _zrtos_list_t zrtos_list_t
 

Functions

zrtos_list_node_tzrtos_list__get_first_node (zrtos_list_t *thiz)
 
zrtos_list_node_tzrtos_list__get_last_node (zrtos_list_t *thiz)
 
bool zrtos_list_node__init (zrtos_list_node_t *thiz)
 
zrtos_list_node_tzrtos_list_node__get_next_node (zrtos_list_node_t *node)
 
bool zrtos_list_node__has_next_node (zrtos_list_node_t *node)
 
bool zrtos_list__init (zrtos_list_t *thiz)
 
bool zrtos_list__push (zrtos_list_t *thiz, zrtos_list_node_t *node)
 
bool zrtos_list__unshift (zrtos_list_t *thiz, zrtos_list_node_t *node)
 
zrtos_list_node_tzrtos_list__shift (zrtos_list_t *thiz)
 
void zrtos_list__shift_and_push (zrtos_list_t *thiz)
 
void zrtos_list__delete (zrtos_list_t *thiz, zrtos_list_node_t *node)
 
bool zrtos_list__is_empty (zrtos_list_t *thiz)
 
void zrtos_list__deinit (zrtos_list_t *thiz, void(*callback)(zrtos_list_t *thiz, zrtos_list_node_t *node))
 
void zrtos_list__each (zrtos_list_t *thiz, bool(*callback)(zrtos_list_node_t *node, void *arg), void *arg)
 

Typedef Documentation

◆ zrtos_list_node_t

◆ zrtos_list_t

typedef struct _zrtos_list_t zrtos_list_t

Function Documentation

◆ zrtos_list__deinit()

void zrtos_list__deinit ( zrtos_list_t thiz,
void(*)(zrtos_list_t *thiz, zrtos_list_node_t *node)  callback 
)

Definition at line 115 of file list.h.

118  {
119  while(!zrtos_list__is_empty(thiz)){
120  zrtos_list_node_t *node = zrtos_list__shift(thiz);
121  callback(thiz,node);
122  }
123 }
bool zrtos_list__is_empty(zrtos_list_t *thiz)
Definition: list.h:111
zrtos_list_node_t * zrtos_list__shift(zrtos_list_t *thiz)
Definition: list.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_list__delete()

void zrtos_list__delete ( zrtos_list_t thiz,
zrtos_list_node_t node 
)

Definition at line 96 of file list.h.

96  {
97  zrtos_list_node_t *next;
99  if(node == prev){
100  zrtos_list__shift(thiz);
101  }else{
102  while((next = prev->next) != node){
103  prev = next;
104  }
105  if((prev->next = node->next) == 0){
106  thiz->last = prev;
107  }
108  }
109 }
zrtos_list_node_t * last
Definition: list.h:23
struct _zrtos_list_node_t * next
Definition: list.h:18
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
Definition: list.h:26
zrtos_list_node_t * zrtos_list__shift(zrtos_list_t *thiz)
Definition: list.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_list__each()

void zrtos_list__each ( zrtos_list_t thiz,
bool(*)(zrtos_list_node_t *node, void *arg)  callback,
void *  arg 
)

Definition at line 125 of file list.h.

129  {
131  zrtos_list_node_t *root = node;
132  if(node){
133  zrtos_list_node_t *next;
134  do{
135  next = node->next;
136  }while(callback(node,arg) && (node = next) != root);
137  }
138 }
struct _zrtos_list_node_t * next
Definition: list.h:18
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
Definition: list.h:26
Here is the call graph for this function:

◆ zrtos_list__get_first_node()

zrtos_list_node_t* zrtos_list__get_first_node ( zrtos_list_t thiz)

Definition at line 26 of file list.h.

26  {
27  return thiz->first;
28 }
zrtos_list_node_t * first
Definition: list.h:22
Here is the caller graph for this function:

◆ zrtos_list__get_last_node()

zrtos_list_node_t* zrtos_list__get_last_node ( zrtos_list_t thiz)

Definition at line 30 of file list.h.

30  {
31  return thiz->last;
32 }
zrtos_list_node_t * last
Definition: list.h:23
Here is the caller graph for this function:

◆ zrtos_list__init()

bool zrtos_list__init ( zrtos_list_t thiz)

Definition at line 51 of file list.h.

51  {
52  thiz->first = 0;
53  thiz->last = 0;
54  return true;
55 }
zrtos_list_node_t * first
Definition: list.h:22
zrtos_list_node_t * last
Definition: list.h:23
Here is the caller graph for this function:

◆ zrtos_list__is_empty()

bool zrtos_list__is_empty ( zrtos_list_t thiz)

Definition at line 111 of file list.h.

111  {
112  return zrtos_list__get_first_node(thiz) == 0;
113 }
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
Definition: list.h:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_list__push()

bool zrtos_list__push ( zrtos_list_t thiz,
zrtos_list_node_t node 
)

Definition at line 57 of file list.h.

57  {
59  if(last){
60  thiz->last = last->next = node;
61  }else{
62  thiz->first = thiz->last = node;
63  }
64  return true;
65 }
zrtos_list_node_t * first
Definition: list.h:22
zrtos_list_node_t * last
Definition: list.h:23
struct _zrtos_list_node_t * next
Definition: list.h:18
zrtos_list_node_t * zrtos_list__get_last_node(zrtos_list_t *thiz)
Definition: list.h:30
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_list__shift()

zrtos_list_node_t* zrtos_list__shift ( zrtos_list_t thiz)

Definition at line 78 of file list.h.

78  {
80  if(ret){
81  thiz->first = ret->next;
82  if(thiz->first == 0){
83  thiz->last = 0;
84  }
85  }
86  return ret;
87 }
zrtos_list_node_t * first
Definition: list.h:22
zrtos_list_node_t * last
Definition: list.h:23
struct _zrtos_list_node_t * next
Definition: list.h:18
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
Definition: list.h:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_list__shift_and_push()

void zrtos_list__shift_and_push ( zrtos_list_t thiz)

Definition at line 89 of file list.h.

89  {
91  if(node){
92  zrtos_list__push(thiz,node);
93  }
94 }
bool zrtos_list__push(zrtos_list_t *thiz, zrtos_list_node_t *node)
Definition: list.h:57
zrtos_list_node_t * zrtos_list__shift(zrtos_list_t *thiz)
Definition: list.h:78
Here is the call graph for this function:

◆ zrtos_list__unshift()

bool zrtos_list__unshift ( zrtos_list_t thiz,
zrtos_list_node_t node 
)

Definition at line 67 of file list.h.

67  {
69  if(first){
70  thiz->first = node;
71  node->next = first;
72  }else{
73  thiz->first = thiz->last = node;
74  }
75  return true;
76 }
zrtos_list_node_t * first
Definition: list.h:22
zrtos_list_node_t * last
Definition: list.h:23
struct _zrtos_list_node_t * next
Definition: list.h:18
zrtos_list_node_t * zrtos_list__get_first_node(zrtos_list_t *thiz)
Definition: list.h:26
Here is the call graph for this function:

◆ zrtos_list_node__get_next_node()

zrtos_list_node_t* zrtos_list_node__get_next_node ( zrtos_list_node_t node)

Definition at line 39 of file list.h.

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

◆ zrtos_list_node__has_next_node()

bool zrtos_list_node__has_next_node ( zrtos_list_node_t node)

Definition at line 45 of file list.h.

47  {
48  return node->next != 0;
49 }
struct _zrtos_list_node_t * next
Definition: list.h:18
Here is the caller graph for this function:

◆ zrtos_list_node__init()

bool zrtos_list_node__init ( zrtos_list_node_t thiz)

Definition at line 34 of file list.h.

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