Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. rdpll
  5. Abstract:
  6. Contains cut-and-paste of link list macros from ntsrv.h
  7. Author:
  8. Tad Brockway (tadb) 9/99
  9. Revision History:
  10. --*/
  11. #ifndef __RDPLL_H__
  12. #define __RDPLL_H__
  13. #undef InitializeListHead
  14. #undef IsListEmpty
  15. #undef RemoveHeadList
  16. #undef RemoveTailList
  17. #undef RemoveEntryList
  18. #undef InsertTailList
  19. #undef InsertHeadList
  20. #undef PopEntryList
  21. #undef PushEntryList
  22. //
  23. // VOID
  24. // InitializeListHead(
  25. // PLIST_ENTRY ListHead
  26. // );
  27. //
  28. #define InitializeListHead(ListHead) (\
  29. (ListHead)->Flink = (ListHead)->Blink = (ListHead))
  30. //
  31. // BOOLEAN
  32. // IsListEmpty(
  33. // PLIST_ENTRY ListHead
  34. // );
  35. //
  36. #define IsListEmpty(ListHead) \
  37. ((ListHead)->Flink == (ListHead))
  38. //
  39. // PLIST_ENTRY
  40. // RemoveHeadList(
  41. // PLIST_ENTRY ListHead
  42. // );
  43. //
  44. #define RemoveHeadList(ListHead) \
  45. (ListHead)->Flink;\
  46. {RemoveEntryList((ListHead)->Flink)}
  47. //
  48. // PLIST_ENTRY
  49. // RemoveTailList(
  50. // PLIST_ENTRY ListHead
  51. // );
  52. //
  53. #define RemoveTailList(ListHead) \
  54. (ListHead)->Blink;\
  55. {RemoveEntryList((ListHead)->Blink)}
  56. //
  57. // VOID
  58. // RemoveEntryList(
  59. // PLIST_ENTRY Entry
  60. // );
  61. //
  62. #define RemoveEntryList(Entry) {\
  63. PLIST_ENTRY _EX_Blink;\
  64. PLIST_ENTRY _EX_Flink;\
  65. _EX_Flink = (Entry)->Flink;\
  66. _EX_Blink = (Entry)->Blink;\
  67. _EX_Blink->Flink = _EX_Flink;\
  68. _EX_Flink->Blink = _EX_Blink;\
  69. }
  70. //
  71. // VOID
  72. // InsertTailList(
  73. // PLIST_ENTRY ListHead,
  74. // PLIST_ENTRY Entry
  75. // );
  76. //
  77. #define InsertTailList(ListHead,Entry) {\
  78. PLIST_ENTRY _EX_Blink;\
  79. PLIST_ENTRY _EX_ListHead;\
  80. _EX_ListHead = (ListHead);\
  81. _EX_Blink = _EX_ListHead->Blink;\
  82. (Entry)->Flink = _EX_ListHead;\
  83. (Entry)->Blink = _EX_Blink;\
  84. _EX_Blink->Flink = (Entry);\
  85. _EX_ListHead->Blink = (Entry);\
  86. }
  87. //
  88. // VOID
  89. // InsertHeadList(
  90. // PLIST_ENTRY ListHead,
  91. // PLIST_ENTRY Entry
  92. // );
  93. //
  94. #define InsertHeadList(ListHead,Entry) {\
  95. PLIST_ENTRY _EX_Flink;\
  96. PLIST_ENTRY _EX_ListHead;\
  97. _EX_ListHead = (ListHead);\
  98. _EX_Flink = _EX_ListHead->Flink;\
  99. (Entry)->Flink = _EX_Flink;\
  100. (Entry)->Blink = _EX_ListHead;\
  101. _EX_Flink->Blink = (Entry);\
  102. _EX_ListHead->Flink = (Entry);\
  103. }
  104. //
  105. //
  106. // PSINGLE_LIST_ENTRY
  107. // PopEntryList(
  108. // PSINGLE_LIST_ENTRY ListHead
  109. // );
  110. //
  111. #define PopEntryList(ListHead) \
  112. (ListHead)->Next;\
  113. {\
  114. PSINGLE_LIST_ENTRY FirstEntry;\
  115. FirstEntry = (ListHead)->Next;\
  116. if (FirstEntry != NULL) { \
  117. (ListHead)->Next = FirstEntry->Next;\
  118. } \
  119. }
  120. //
  121. // VOID
  122. // PushEntryList(
  123. // PSINGLE_LIST_ENTRY ListHead,
  124. // PSINGLE_LIST_ENTRY Entry
  125. // );
  126. //
  127. #define PushEntryList(ListHead,Entry) \
  128. (Entry)->Next = (ListHead)->Next; \
  129. (ListHead)->Next = (Entry)
  130. #endif