torcs - 1.2.2

Tail Queue Management


Detailed Description

This is the management of tail queues.


Defines

#define GF_TAILQ_HEAD(name, type)
 Head type definition.

#define GF_TAILQ_ENTRY(type)
 Entry in structure.

#define GF_TAILQ_FIRST(head)   ((head)->tqh_first)
 First element of a TAILQ.

#define GF_TAILQ_NEXT(elm, field)   ((elm)->field.tqe_next)
 Next element of a TAILQ.

#define GF_TAILQ_END(head)   NULL
 End of a TAILQ.

#define GF_TAILQ_LAST(head, headname)   (*(((struct headname *)((head)->tqh_last))->tqh_last))
 Last element of a TAILQ.

#define GF_TAILQ_PREV(elm, headname, field)   (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 Previous element of a TAILQ.

#define GF_TAILQ_INIT(head)
 Head initialization (Mandatory).

#define GF_TAILQ_INIT_ENTRY(elm, field)
 Entry initialization (optionnal if inserted).

#define GF_TAILQ_INSERT_HEAD(head, elm, field)
 Insert an element at the head.

#define GF_TAILQ_INSERT_TAIL(head, elm, field)
 Insert an element at the tail.

#define GF_TAILQ_INSERT_AFTER(head, listelm, elm, field)
 Insert an element after another element.

#define GF_TAILQ_INSERT_BEFORE(listelm, elm, field)
 Insert an element before another element.

#define GF_TAILQ_REMOVE(head, elm, field)
 Remove an element.


Define Documentation

#define GF_TAILQ_END head   )     NULL
 

End of a TAILQ.

#define GF_TAILQ_ENTRY type   ) 
 

Value:

struct {                                                                \
        type *tqe_next;                                 \
        type **tqe_prev;                \
}
Entry in structure.

#define GF_TAILQ_FIRST head   )     ((head)->tqh_first)
 

First element of a TAILQ.

#define GF_TAILQ_HEAD name,
type   ) 
 

Value:

typedef struct name {                                                   \
        type *tqh_first;                                \
        type **tqh_last;                        \
} t ## name
Head type definition.

#define GF_TAILQ_INIT head   ) 
 

Value:

do {                                    \
        (head)->tqh_first = NULL;                                       \
        (head)->tqh_last = &(head)->tqh_first;                          \
} while (0)
Head initialization (Mandatory).

#define GF_TAILQ_INIT_ENTRY elm,
field   ) 
 

Value:

do {    \
  (elm)->field.tqe_next = 0;                    \
  (elm)->field.tqe_prev = 0;                    \
} while (0)
Entry initialization (optionnal if inserted).

#define GF_TAILQ_INSERT_AFTER head,
listelm,
elm,
field   ) 
 

Value:

do {            \
        if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
                (elm)->field.tqe_next->field.tqe_prev =                 \
                    &(elm)->field.tqe_next;                             \
        else                                                            \
                (head)->tqh_last = &(elm)->field.tqe_next;              \
        (listelm)->field.tqe_next = (elm);                              \
        (elm)->field.tqe_prev = &(listelm)->field.tqe_next;             \
} while (0)
Insert an element after another element.

#define GF_TAILQ_INSERT_BEFORE listelm,
elm,
field   ) 
 

Value:

do {            \
        (elm)->field.tqe_prev = (listelm)->field.tqe_prev;              \
        (elm)->field.tqe_next = (listelm);                              \
        *(listelm)->field.tqe_prev = (elm);                             \
        (listelm)->field.tqe_prev = &(elm)->field.tqe_next;             \
} while (0)
Insert an element before another element.

#define GF_TAILQ_INSERT_HEAD head,
elm,
field   ) 
 

Value:

do {                    \
        if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)        \
                (head)->tqh_first->field.tqe_prev =                     \
                    &(elm)->field.tqe_next;                             \
        else                                                            \
                (head)->tqh_last = &(elm)->field.tqe_next;              \
        (head)->tqh_first = (elm);                                      \
        (elm)->field.tqe_prev = &(head)->tqh_first;                     \
} while (0)
Insert an element at the head.

#define GF_TAILQ_INSERT_TAIL head,
elm,
field   ) 
 

Value:

do {                    \
        (elm)->field.tqe_next = NULL;                                   \
        (elm)->field.tqe_prev = (head)->tqh_last;                       \
        *(head)->tqh_last = (elm);                                      \
        (head)->tqh_last = &(elm)->field.tqe_next;                      \
} while (0)
Insert an element at the tail.

#define GF_TAILQ_LAST head,
headname   )     (*(((struct headname *)((head)->tqh_last))->tqh_last))
 

Last element of a TAILQ.

#define GF_TAILQ_NEXT elm,
field   )     ((elm)->field.tqe_next)
 

Next element of a TAILQ.

#define GF_TAILQ_PREV elm,
headname,
field   )     (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 

Previous element of a TAILQ.

#define GF_TAILQ_REMOVE head,
elm,
field   ) 
 

Value:

do {                            \
        if (((elm)->field.tqe_next) != NULL)                            \
                (elm)->field.tqe_next->field.tqe_prev =                 \
                    (elm)->field.tqe_prev;                              \
        else                                                            \
                (head)->tqh_last = (elm)->field.tqe_prev;               \
        *(elm)->field.tqe_prev = (elm)->field.tqe_next;                 \
} while (0)
Remove an element.


Generated at Thu Feb 26 21:54:23 2004 for torcs by doxygen 1.3.3 written by Dimitri van Heesch, © 1997-1999
TORCS © Eric Espié 1999, 2002.