Ignore:
Timestamp:
Oct 6, 2000, 9:49:06 PM (25 years ago)
Author:
hugh
Message:

Updated to latest WINE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/DPlayX/dplayx_queue.h

    r4317 r4446  
    1 // $Id: dplayx_queue.h,v 1.2 2000-09-24 22:47:39 hugh Exp $
     1// $Id: dplayx_queue.h,v 1.3 2000-10-06 19:49:06 hugh Exp $
    22/* A queue definition based on sys/queue.h TAILQ definitions
    33 *
     
    7979#define DPQ_FIND_ENTRY( head, elm, field, fieldCompareOperator, fieldToCompare, rc )\
    8080do {                                                           \
    81   (rc) = (head).lpQHFirst; /* NULL head? */                    \
     81  (rc) = DPQ_FIRST(head); /* NULL head? */                     \
    8282                                                               \
    8383  while( rc )                                                  \
     
    100100/* head - pointer to DPQ_HEAD struct
    101101 * elm  - how to find the next element
     102 * field - to be concatenated to rc to compare with fieldToCompare
     103 * fieldToCompare - The value that we're comparing against
     104 * compare_cb - Callback to invoke to determine if comparision should continue.
     105 *              Callback must be defined with DPQ_DECL_COMPARECB.
     106 * rc - Variable to put the return code. Same type as (head).lpQHFirst
     107 */
     108#define DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
     109do {                                                           \
     110  (rc) = DPQ_FIRST(head); /* NULL head? */                     \
     111                                                               \
     112  while( rc )                                                  \
     113  {                                                            \
     114      /* What we're searching for? */                          \
     115      if( compare_cb( &((rc)->field), &(fieldToCompare) ) )    \
     116      {                                                        \
     117        break; /* no more */                                   \
     118      }                                                        \
     119                                                               \
     120      /* End of list check */                                  \
     121      if( ( (rc) = (rc)->elm.lpQNext ) == (head).lpQHFirst )   \
     122      {                                                        \
     123        rc = NULL;                                             \
     124        break;                                                 \
     125      }                                                        \
     126  }                                                            \
     127} while(0)
     128
     129/* How to define the method to be passed to DPQ_DELETEQ */
     130#define DPQ_DECL_COMPARECB( name, type ) BOOL name( const type* elem1, const type* elem2 )
     131
     132
     133/* head - pointer to DPQ_HEAD struct
     134 * elm  - how to find the next element
    102135 * field - to be concatenated to rc to compare with fieldToEqual
    103136 * fieldToCompare - The value that we're comparing against
     
    117150} while(0)
    118151
     152/* head - pointer to DPQ_HEAD struct
     153 * elm  - how to find the next element
     154 * field - to be concatenated to rc to compare with fieldToCompare
     155 * fieldToCompare - The value that we're comparing against
     156 * compare_cb - Callback to invoke to determine if comparision should continue.
     157 *              Callback must be defined with DPQ_DECL_COMPARECB.
     158 * rc - Variable to put the return code. Same type as (head).lpQHFirst
     159 */
     160#define DPQ_REMOVE_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc )\
     161do {                                                           \
     162  DPQ_FIND_ENTRY_CB( head, elm, field, compare_cb, fieldToCompare, rc );\
     163                                                               \
     164  /* Was the element found? */                                 \
     165  if( rc )                                                     \
     166  {                                                            \
     167    DPQ_REMOVE( head, rc, elm );                               \
     168  }                                                            \
     169} while(0)
     170
     171
    119172/* Delete the entire queue
    120173 * head - pointer to the head of the queue
     
    123176 * df - a delete function to be called. Declared with DPQ_DECL_DELETECB.
    124177 */
    125 #define DPQ_DELETEQ( head, field, type, df )            \
    126 while( !DPQ_IS_EMPTY(head) )                               \
    127 {                                                       \
    128   type holder = (head).lpQHFirst;                      \
    129   DPQ_REMOVE( head, holder, field );                    \
    130   df( holder );                                \
    131 }
     178#define DPQ_DELETEQ( head, field, type, df )     \
     179do                                               \
     180{                                                \
     181  while( !DPQ_IS_EMPTY(head) )                   \
     182  {                                              \
     183    type holder = DPQ_FIRST(head);               \
     184    DPQ_REMOVE( head, holder, field );           \
     185    df( holder );                                \
     186  }                                              \
     187} while(0)
    132188
    133189/* How to define the method to be passed to DPQ_DELETEQ */
Note: See TracChangeset for help on using the changeset viewer.