TORCS  1.3.9
The Open Racing Car Simulator
Tail Queue Management API

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

Macros

#define GF_TAILQ_HEAD(name, type)
 Head type definition. More...
 
#define GF_TAILQ_ENTRY(type)
 Entry in structure. More...
 
#define GF_TAILQ_FIRST(head)   ((head)->tqh_first)
 First element of a TAILQ. More...
 
#define GF_TAILQ_NEXT(elm, field)   ((elm)->field.tqe_next)
 Next element of a TAILQ. More...
 
#define GF_TAILQ_END(head)   NULL
 End of a TAILQ. More...
 
#define GF_TAILQ_LAST(head, headname)   (*(((struct headname *)((head)->tqh_last))->tqh_last))
 Last element of a TAILQ. More...
 
#define GF_TAILQ_PREV(elm, headname, field)   (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 Previous element of a TAILQ. More...
 
#define GF_TAILQ_INIT(head)
 Head initialization (Mandatory) More...
 
#define GF_TAILQ_INIT_ENTRY(elm, field)
 Entry initialization (optionnal if inserted) More...
 
#define GF_TAILQ_INSERT_HEAD(head, elm, field)
 Insert an element at the head. More...
 
#define GF_TAILQ_INSERT_TAIL(head, elm, field)
 Insert an element at the tail. More...
 
#define GF_TAILQ_INSERT_AFTER(head, listelm, elm, field)
 Insert an element after another element. More...
 
#define GF_TAILQ_INSERT_BEFORE(listelm, elm, field)
 Insert an element before another element. More...
 
#define GF_TAILQ_REMOVE(head, elm, field)
 Remove an element. More...
 

Detailed Description

This is the management of tail queues.

Macro Definition Documentation

◆ GF_TAILQ_END

#define GF_TAILQ_END (   head)    NULL

End of a TAILQ.

Definition at line 470 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 456 of file tgf.h.

◆ GF_TAILQ_FIRST

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

First element of a TAILQ.

Definition at line 464 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 448 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 485 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 492 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 520 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 532 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 499 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 511 of file tgf.h.

◆ GF_TAILQ_LAST

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

Last element of a TAILQ.

Definition at line 473 of file tgf.h.

◆ GF_TAILQ_NEXT

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

Next element of a TAILQ.

Definition at line 467 of file tgf.h.

◆ GF_TAILQ_PREV

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

Previous element of a TAILQ.

Definition at line 477 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 541 of file tgf.h.