Colored, doubly-linked lists. More...
#include "tredmill/debug.h"
Go to the source code of this file.
Data Structures | |
struct | tm_list |
Defines | |
#define | tm_list_color(l) (((tm_list*) (l))->_prev._c._color) |
The color of a tm_list element. | |
#define | tm_list_set_color(l, c) (((tm_list*) (l))->_prev._c._color = (c)) |
Sets the color of a tm_list element. | |
#define | tm_list_set_next(l, x) (((tm_list*) (l))->_next = (x)) |
Sets the next pointer of a tm_list element. | |
#define | tm_list_set_prev(l, x) (((tm_list*) (l))->_prev._c._bits = ((unsigned long) (x) >> 2)) |
Sets the prev pointer of a tm_list element. | |
#define | tm_list_next(l) ((void*) ((tm_list*) (l))->_next) |
The next element of a tm_list element. | |
#define | tm_list_prev(l) ((void*) ((unsigned long) ((tm_list*) (l))->_prev._word & ~ 0x3UL)) |
The prev element of a tm_list element. | |
#define | tm_list_INIT(N) tm_list _##N = { &_##N, { &_##N } }, *N = &_##N; |
Initialize a static tm_list element as empty and color == 0. | |
#define | tm_list_LOOP(l, x) do { tm_list *__l = (tm_list*) (l), *__x = tm_list_next(__l); while ( (void *) __x != (void *) (l) ) { x = (void*) __x; __x = tm_list_next(__x); { |
Begin a loop on tm_list l, for each element x. | |
#define | tm_list_LOOP_END }}} while(0) |
End a loop. | |
Functions | |
static __inline void | tm_list_init (void *l) |
Initialize a tm_list element as empty and color == 0;. | |
static __inline int | tm_list_empty (void *l) |
Returns true if a tm_list element is empty. | |
static __inline void * | tm_list_first (void *l) |
Returns the first element of a tm_list element. | |
static __inline void * | tm_list_last (void *l) |
Returns the last element of a tm_list element. | |
static __inline void | tm_list_remove (void *_p) |
Removes a tm_list element from its list. | |
static __inline void | tm_list_insert (void *l, void *p) |
Inserts tm_list element p at front of tm_list l. | |
static __inline void | tm_list_append (void *l, void *p) |
Appends tm_list element p at end of tm_list l. | |
static __inline void | tm_list_append_list (void *l, void *p) |
Appends tm_list p at end of tm_list l. | |
static __inline void | tm_list_remove_and_insert (void *l, void *p) |
Removes tm_list element p and inserts into tm_list l. | |
static __inline void | tm_list_remove_and_append (void *l, void *p) |
Removes tm_list element p and appends into tm_list l. | |
static __inline void * | tm_list_take_first (void *_l) |
Task first element from tm_list l. | |
static __inline void | tm_list_assert_layout () |
Assert tm_list layout. |
Colored, doubly-linked lists.
Definition in file list.h.