TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
Tail Queue Management API

This is the management of tail queues. More...

Macros

#define GF_TAILQ_HEAD(name, type)
 Head type definition.
#define GF_TAILQ_ENTRY(type)
 Entry in structure.
#define GF_TAILQ_FIRST(head)
 First element of a TAILQ.
#define GF_TAILQ_NEXT(elm, field)
 Next element of a TAILQ.
#define GF_TAILQ_END(head)
 End of a TAILQ.
#define GF_TAILQ_LAST(head, headname)
 Last element of a TAILQ.
#define GF_TAILQ_PREV(elm, headname, field)
 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.

Detailed Description

This is the management of tail queues.

Macro Definition Documentation

◆ GF_TAILQ_END

#define GF_TAILQ_END ( head)
Value:
NULL

End of a TAILQ.

Definition at line 469 of file tgf.h.

◆ GF_TAILQ_ENTRY

#define GF_TAILQ_ENTRY ( type)
Value:
struct { \
type *tqe_next; /* next element */ \
type **tqe_prev; /* address of previous next element */ \
}

Entry in structure.

Definition at line 455 of file tgf.h.

◆ GF_TAILQ_FIRST

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

First element of a TAILQ.

Definition at line 463 of file tgf.h.

◆ GF_TAILQ_HEAD

#define GF_TAILQ_HEAD ( name,
type )
Value:
typedef struct name { \
type *tqh_first; /* first element */ \
type **tqh_last; /* addr of last next element */ \
} t ## name

Head type definition.

Definition at line 447 of file tgf.h.

◆ GF_TAILQ_INIT

#define GF_TAILQ_INIT ( head)
Value:
do { \
(head)->tqh_first = NULL; \
(head)->tqh_last = &(head)->tqh_first; \
} while (0)

Head initialization (Mandatory)

Definition at line 484 of file tgf.h.

◆ GF_TAILQ_INIT_ENTRY

#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)

Definition at line 491 of file tgf.h.

◆ GF_TAILQ_INSERT_AFTER

#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.

Definition at line 519 of file tgf.h.

◆ GF_TAILQ_INSERT_BEFORE

#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.

Definition at line 531 of file tgf.h.

◆ GF_TAILQ_INSERT_HEAD

#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.

Definition at line 498 of file tgf.h.

◆ GF_TAILQ_INSERT_TAIL

#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.

Definition at line 510 of file tgf.h.

◆ GF_TAILQ_LAST

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

Last element of a TAILQ.

Definition at line 472 of file tgf.h.

◆ GF_TAILQ_NEXT

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

Next element of a TAILQ.

Definition at line 466 of file tgf.h.

◆ GF_TAILQ_PREV

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

Previous element of a TAILQ.

Definition at line 476 of file tgf.h.

◆ GF_TAILQ_REMOVE

#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.

Definition at line 540 of file tgf.h.