Added Unicode ctype support.
[wine.git] / dlls / dplayx / dplayx_queue.h
blob471f25c0e74a9a6863cfc104947a11b5c14f44f0
1 /* A queue definition based on sys/queue.h TAILQ definitions
2 *
3 * Blame any implementation mistakes on Peter Hunnisett
4 * <hunnise@nortelnetworks.com>
5 */
7 #ifndef __WINE_DPLAYX_QUEUE_H
8 #define __WINE_DPLAYX_QUEUE_H
10 #define DPQ_INSERT(a,b,c) DPQ_INSERT_IN_TAIL(a,b,c)
13 * Tail queue definitions.
15 #define DPQ_HEAD(type) \
16 struct { \
17 struct type *lpQHFirst; /* first element */ \
18 struct type **lpQHLast; /* addr of last next element */ \
21 #define DPQ_ENTRY(type) \
22 struct { \
23 struct type *lpQNext; /* next element */ \
24 struct type **lpQPrev; /* address of previous next element */ \
28 * Tail queue functions.
30 #define DPQ_INIT(head) \
31 do{ \
32 (head).lpQHFirst = NULL; \
33 (head).lpQHLast = &(head).lpQHFirst; \
34 } while(0)
36 #define DPQ_INSERT_IN_TAIL(head, elm, field) \
37 do { \
38 (elm)->field.lpQNext = NULL; \
39 (elm)->field.lpQPrev = (head).lpQHLast; \
40 *(head).lpQHLast = (elm); \
41 (head).lpQHLast = &(elm)->field.lpQNext; \
42 } while(0)
44 #define DPQ_REMOVE(head, elm, field) \
45 do { \
46 if (((elm)->field.lpQNext) != NULL) \
47 (elm)->field.lpQNext->field.lpQPrev = \
48 (elm)->field.lpQPrev; \
49 else \
50 (head).lpQHLast = (elm)->field.lpQPrev; \
51 *(elm)->field.lpQPrev = (elm)->field.lpQNext; \
52 } while(0)
54 /* head - pointer to DPQ_HEAD struct
55 * elm - how to find the next element
56 * field - to be concatenated to rc to compare with fieldToEqual
57 * fieldToEqual - The value that we're looking for
58 * rc - Variable to put the return code. Same type as (head).lpQHFirst
60 #define DPQ_FIND_ENTRY( head, elm, field, fieldToEqual, rc ) \
61 do { \
62 (rc) = (head).lpQHFirst; /* NULL head? */ \
64 while( rc ) \
65 { \
66 /* What we're searching for? */ \
67 if( (rc)->field == (fieldToEqual) ) \
68 { \
69 break; /* rc == correct element */ \
70 } \
72 /* End of list check */ \
73 if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst ) \
74 { \
75 rc = NULL; \
76 break; \
77 } \
78 } \
79 } while(0)
81 /* head - pointer to DPQ_HEAD struct
82 * elm - how to find the next element
83 * field - to be concatenated to rc to compare with fieldToEqual
84 * fieldToEqual - The value that we're looking for
85 * rc - Variable to put the return code. Same type as (head).lpQHFirst
87 #define DPQ_REMOVE_ENTRY( head, elm, field, fieldToEqual, rc ) \
88 do { \
89 DPQ_FIND_ENTRY( head, elm, field, fieldToEqual, rc ); \
91 /* Was the element found? */ \
92 if( rc ) \
93 { \
94 DPQ_REMOVE( head, rc, elm ); \
95 } \
96 } while(0)
98 #endif /* __WINE_DPLAYX_QUEUE_H */