~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/dplayx/dplayx_queue.h

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /* A queue definition based on sys/queue.h TAILQ definitions
  2  *
  3  * Copyright 2000 Peter Hunnisett
  4  *
  5  * This library is free software; you can redistribute it and/or
  6  * modify it under the terms of the GNU Lesser General Public
  7  * License as published by the Free Software Foundation; either
  8  * version 2.1 of the License, or (at your option) any later version.
  9  *
 10  * This library is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  * Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser General Public
 16  * License along with this library; if not, write to the Free Software
 17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 18  *
 19  * NOTES
 20  *  o Linked list implementation for dplay/dplobby. Based off of the BSD
 21  *    version found in <sys/queue.h>
 22  *  o Port it to <wine/list.h> ?
 23  *
 24  */
 25 
 26 #ifndef __WINE_DPLAYX_QUEUE_H
 27 #define __WINE_DPLAYX_QUEUE_H
 28 
 29 #include <stdarg.h>
 30 
 31 #include "windef.h"
 32 #include "winbase.h"
 33 
 34 #define DPQ_INSERT(a,b,c) DPQ_INSERT_IN_TAIL(a,b,c)
 35 
 36 /*
 37  * Tail queue definitions.
 38  */
 39 #define DPQ_HEAD(type)                                           \
 40 struct {                                                         \
 41         struct type *lpQHFirst; /* first element */              \
 42         struct type **lpQHLast; /* addr of last next element */  \
 43 }
 44 
 45 #define DPQ_ENTRY(type)                                               \
 46 struct {                                                              \
 47         struct type *lpQNext;  /* next element */                     \
 48         struct type **lpQPrev; /* address of previous next element */ \
 49 }
 50 
 51 /*
 52  * Tail queue functions.
 53  */
 54 #define DPQ_INIT(head)                       \
 55 do{                                          \
 56         (head).lpQHFirst = NULL;             \
 57         (head).lpQHLast = &(head).lpQHFirst; \
 58 } while(0)
 59 
 60 /* Front of the queue */
 61 #define DPQ_FIRST( head ) ( (head).lpQHFirst )
 62 
 63 /* Check if the queue has any elements */
 64 #define DPQ_IS_EMPTY( head ) ( DPQ_FIRST(head) == NULL )
 65 
 66 /* Next entry -- FIXME: Convert everything over to this macro ... */
 67 #define DPQ_NEXT( elem ) (elem).lpQNext
 68 
 69 #define DPQ_IS_ENDOFLIST( elem ) \
 70     ( DPQ_NEXT(elem) == NULL )
 71 
 72 /* Insert element at end of queue */
 73 #define DPQ_INSERT_IN_TAIL(head, elm, field)     \
 74 do {                                             \
 75         (elm)->field.lpQNext = NULL;             \
 76         (elm)->field.lpQPrev = (head).lpQHLast;  \
 77         *(head).lpQHLast = (elm);                \
 78         (head).lpQHLast = &(elm)->field.lpQNext; \
 79 } while(0)
 80 
 81 /* Remove element from the queue */
 82 #define DPQ_REMOVE(head, elm, field)                    \
 83 do {                                                    \
 84         if (((elm)->field.lpQNext) != NULL)             \
 85                 (elm)->field.lpQNext->field.lpQPrev =   \
 86                     (elm)->field.lpQPrev;               \
 87         else                                            \
 88                 (head).lpQHLast = (elm)->field.lpQPrev; \
 89         *(elm)->field.lpQPrev = (elm)->field.lpQNext;   \
 90 } while(0)
 91 
 92 /* head - pointer to DPQ_HEAD struct
 93  * elm  - how to find the next element
 94  * field - to be concatenated to rc to compare with fieldToCompare
 95  * fieldToCompare - The value that we're comparing against
 96  * fieldCompareOperator - The logical operator to compare field and
 97  *                        fieldToCompare.
 98  * rc - Variable to put the return code. Same type as (head).lpQHFirst
 99  */
100 #define DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\
101 do {                                                           \
102   (rc) = DPQ_FIRST(head); /* NULL head? */                     \
103                                                                \
104   while( rc )                                                  \
105   {                                                            \
106       /* What we're searching for? */                          \
107       if( (rc)->field fieldCompareOperator (fieldToCompare) )  \
108       {                                                        \
109         break; /* rc == correct element */                     \
110       }                                                        \
111                                                                \
112       /* End of list check */                                  \
113       if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst )   \
114       {                                                        \
115         rc = NULL;                                             \
116         break;                                                 \
117       }                                                        \
118   }                                                            \
119 } while(0)
120 
121 /* head - pointer to DPQ_HEAD struct
122  * elm  - how to find the next element
123  * field - to be concatenated to rc to compare with fieldToCompare
124  * fieldToCompare - The value that we're comparing against
125  * compare_cb - Callback to invoke to determine if comparison should continue.
126  *              Callback must be defined with DPQ_DECL_COMPARECB.
127  * rc - Variable to put the return code. Same type as (head).lpQHFirst
128  */
129 #define DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
130 do {                                                           \
131   (rc) = DPQ_FIRST(head); /* NULL head? */                     \
132                                                                \
133   while( rc )                                                  \
134   {                                                            \
135       /* What we're searching for? */                          \
136       if( compare_cb( &((rc)->field), &(fieldToCompare) ) )    \
137       {                                                        \
138         break; /* no more */                                   \
139       }                                                        \
140                                                                \
141       /* End of list check */                                  \
142       if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst )   \
143       {                                                        \
144         rc = NULL;                                             \
145         break;                                                 \
146       }                                                        \
147   }                                                            \
148 } while(0)
149 
150 /* How to define the method to be passed to DPQ_DELETEQ */
151 #define DPQ_DECL_COMPARECB( name, type ) BOOL name( const type* elem1, const type* elem2 )
152 
153 
154 /* head - pointer to DPQ_HEAD struct
155  * elm  - how to find the next element
156  * field - to be concatenated to rc to compare with fieldToEqual
157  * fieldToCompare - The value that we're comparing against
158  * fieldCompareOperator - The logical operator to compare field and
159  *                        fieldToCompare.
160  * rc - Variable to put the return code. Same type as (head).lpQHFirst
161  */
162 #define DPQ_REMOVE_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\
163 do {                                                           \
164   DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc );\
165                                                                \
166   /* Was the element found? */                                 \
167   if( rc )                                                     \
168   {                                                            \
169     DPQ_REMOVE( head, rc, elm );                               \
170   }                                                            \
171 } while(0)
172 
173 /* head - pointer to DPQ_HEAD struct
174  * elm  - how to find the next element
175  * field - to be concatenated to rc to compare with fieldToCompare
176  * fieldToCompare - The value that we're comparing against
177  * compare_cb - Callback to invoke to determine if comparison should continue.
178  *              Callback must be defined with DPQ_DECL_COMPARECB.
179  * rc - Variable to put the return code. Same type as (head).lpQHFirst
180  */
181 #define DPQ_REMOVE_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
182 do {                                                           \
183   DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc );\
184                                                                \
185   /* Was the element found? */                                 \
186   if( rc )                                                     \
187   {                                                            \
188     DPQ_REMOVE( head, rc, elm );                               \
189   }                                                            \
190 } while(0)
191 
192 
193 /* Delete the entire queue
194  * head - pointer to the head of the queue
195  * field - field to access the next elements of the queue
196  * type - type of the pointer to the element element
197  * df - a delete function to be called. Declared with DPQ_DECL_DELETECB.
198  */
199 #define DPQ_DELETEQ( head, field, type, df )     \
200 do                                               \
201 {                                                \
202   while( !DPQ_IS_EMPTY(head) )                   \
203   {                                              \
204     type holder = DPQ_FIRST(head);               \
205     DPQ_REMOVE( head, holder, field );           \
206     df( holder );                                \
207   }                                              \
208 } while(0)
209 
210 /* How to define the method to be passed to DPQ_DELETEQ */
211 #define DPQ_DECL_DELETECB( name, type ) void name( type elem )
212 
213 /* Prototype of a method which just performs a HeapFree on the elem */
214 DPQ_DECL_DELETECB( cbDeleteElemFromHeap, LPVOID );
215 
216 #endif /* __WINE_DPLAYX_QUEUE_H */
217 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.