26#ifndef __WINE_DPLAYX_QUEUE_H
27#define __WINE_DPLAYX_QUEUE_H
34#define DPQ_INSERT(a,b,c) DPQ_INSERT_IN_TAIL(a,b,c)
39#define DPQ_HEAD(type) \
41 struct type *lpQHFirst; \
42 struct type **lpQHLast; \
45#define DPQ_ENTRY(type) \
47 struct type *lpQNext; \
48 struct type **lpQPrev; \
54#define DPQ_INIT(head) \
56 (head).lpQHFirst = NULL; \
57 (head).lpQHLast = &(head).lpQHFirst; \
61#define DPQ_FIRST( head ) ( (head).lpQHFirst )
64#define DPQ_IS_EMPTY( head ) ( DPQ_FIRST(head) == NULL )
67#define DPQ_NEXT( elem ) (elem).lpQNext
69#define DPQ_IS_ENDOFLIST( elem ) \
70 ( DPQ_NEXT(elem) == NULL )
73#define DPQ_INSERT_IN_TAIL(head, elm, field) \
75 (elm)->field.lpQNext = NULL; \
76 (elm)->field.lpQPrev = (head).lpQHLast; \
77 *(head).lpQHLast = (elm); \
78 (head).lpQHLast = &(elm)->field.lpQNext; \
82#define DPQ_REMOVE(head, elm, field) \
84 if (((elm)->field.lpQNext) != NULL) \
85 (elm)->field.lpQNext->field.lpQPrev = \
86 (elm)->field.lpQPrev; \
88 (head).lpQHLast = (elm)->field.lpQPrev; \
89 *(elm)->field.lpQPrev = (elm)->field.lpQNext; \
100#define DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\
102 (rc) = DPQ_FIRST(head); \
107 if( (rc)->field fieldCompareOperator (fieldToCompare) ) \
113 if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst ) \
129#define DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
131 (rc) = DPQ_FIRST(head); \
136 if( compare_cb( &((rc)->field), &(fieldToCompare) ) ) \
142 if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst ) \
151#define DPQ_DECL_COMPARECB( name, type ) BOOL name( const type* elem1, const type* elem2 )
162#define DPQ_REMOVE_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\
164 DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc );\
169 DPQ_REMOVE( head, rc, elm ); \
181#define DPQ_REMOVE_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
183 DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc );\
188 DPQ_REMOVE( head, rc, elm ); \
199#define DPQ_DELETEQ( head, field, type, df ) \
202 while( !DPQ_IS_EMPTY(head) ) \
204 type holder = DPQ_FIRST(head); \
205 DPQ_REMOVE( head, holder, field ); \
211#define DPQ_DECL_DELETECB( name, type ) void name( type elem )
#define DPQ_DECL_DELETECB(name, type)