BeRTOS
Data Structures | Defines | Functions
list.h File Reference
#include <cfg/compiler.h>
#include <cfg/debug.h>

Go to the source code of this file.

Data Structures

struct  Node
 This structure represents a node for bidirectional lists. More...
struct  List
 Head of a doubly-linked list of Node structs. More...
struct  PriNode
 Extended node for priority queues. More...

Defines

#define DECLARE_NODE_ANON(T)   T *succ; T *pred;
 Template for a naked node in a list of T structures.
#define DECLARE_NODE_TYPE(T)   typedef struct T##Node { T *succ; T *pred; } T##Node
 Declare a typesafe node for structures of type T.
#define DECLARE_LIST_TYPE(T)
 Template for a list of T structures.
#define LIST_HEAD(l)   ((l)->head.succ)
 Get a pointer to the first node in a list.
#define LIST_TAIL(l)   ((l)->tail.pred)
 Get a pointer to the last node in a list.
#define FOREACH_NODE(n, l)
 Iterate over all nodes in a list.
#define REVERSE_FOREACH_NODE(n, l)
 Iterate backwards over all nodes in a list.
#define LIST_INIT(l)
 Initialize a list.
#define LIST_ASSERT_VALID(l)
 Make sure that a list is valid (it was initialized and is not corrupted).
#define LIST_ASSERT_NOT_CONTAINS(list, node)
 Checks that a node isn't part of a given list.
#define LIST_EMPTY(l)   ( (void *)((l)->head.succ) == (void *)(&(l)->tail) )
 Tell whether a list is empty.
#define ADDHEAD(l, n)
 Add node to list head.
#define ADDTAIL(l, n)
 Add node to list tail.
#define INSERT_BEFORE(n, ln)
 Insert node n before node ln.
#define REMOVE(n)
 Remove n from whatever list it is in.
#define LIST_ENQUEUE_HEAD(list, node)
 Insert a priority node in a priority queue.
#define LIST_ENQUEUE(list, node)
 Insert a priority node in a priority queue.

Functions

Nodelist_remHead (List *l)
 Unlink a node from the head of the list l.
Nodelist_remTail (List *l)
 Unlink a node from the tail of the list l.

Detailed Description

Definition in file list.h.