home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / queue.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  2KB  |  59 lines

  1.  
  2. //=============================================================================
  3. //  Microsoft (R) Bloodhound (tm). Copyright (C) 1991-1993.
  4. //
  5. //  MODULE: queue.h
  6. //
  7. //  Modification History
  8. //
  9. //  raypa           03/17/93    Created.
  10. //=============================================================================
  11.  
  12. #if !defined(_QUEUE_)
  13.  
  14. #include "list.h"
  15.  
  16. #define _QUEUE_
  17. #pragma pack(1)
  18.  
  19. //=============================================================================
  20. //  Macros.
  21. //=============================================================================
  22.  
  23. typedef LIST QUEUE;                         //... Queue is a special list.
  24.  
  25. typedef QUEUE *LPQUEUE;
  26.  
  27. //=============================================================================
  28. //  Macros.
  29. //=============================================================================
  30.  
  31. #ifndef NO_INLINE
  32.  
  33. #define GetQueueHead(Queue)                 ((LPVOID) (((LPQUEUE) (Queue))->Head))
  34.  
  35. #define GetQueueTail(Queue)                 ((LPVOID) (((LPQUEUE) (Queue))->Tail))
  36.  
  37. #define GetQueueLength(Queue)               (((LPQUEUE) (Queue))->Length)
  38.  
  39. #define AddToFrontOfList(List, Link)        AddToList((List), NULL, (Link))
  40.  
  41. #define AddToEndOfList(List, Link)          AddToList((List), (Link), NULL)
  42.  
  43. #define DeleteFromFrontOfList(List)         DeleteFromList((List), GetHeadOfList(List))
  44.  
  45. #define DeleteFromEndOfList(List)           DeleteFromList((List), GetTailOfList(List))
  46.  
  47. #define InitializeQueue(Queue)              InitializeList(Queue)
  48.  
  49. #define Enqueue(Queue, Link)                AddToEndOfList(Queue, Link)
  50.  
  51. #define Requeue(Queue, Link)                AddToFrontOfList(Queue, Link)
  52.  
  53. #define Dequeue(Queue)                      ((LPVOID) DeleteFromFrontOfList(Queue))
  54.  
  55. #endif
  56.  
  57. #pragma pack()
  58. #endif
  59.