dll.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:2k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* dll.h - doubly linked list library */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,25apr02,jhw  Added C++ support (SPR 76304).
  7. 01c,11oct95,ms  removed "static __inline__" (SPR #4500)
  8. 01b,05apr95,ms  cleanup + fixes for when !define(__GNUC__).
  9. 01a,10oct94,rrr written.
  10. */
  11. #ifndef _INCdllh
  12. #define _INCdllh
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. typedef struct __dll
  17.     {
  18.     struct __dll *__dll_next;
  19.     struct __dll *__dll_prev;
  20.     } dll_t;
  21. #define __dll_init(d) ((d)->__dll_next = (d)->__dll_prev = (d))
  22. #define __dll_remove(d) ((d)->__dll_prev->__dll_next = (d)->__dll_next, 
  23.  (d)->__dll_next->__dll_prev = (d)->__dll_prev)
  24. #define __dll_head(d) ((d)->__dll_next)
  25. #define __dll_tail(d) ((d)->__dll_prev)
  26. #define __dll_next(d) ((d)->__dll_next)
  27. #define __dll_prev(d) ((d)->__dll_prev)
  28. #define __dll_end(d) (d)
  29. #define __dll_empty(d)  ((d)->__dll_next == (d))
  30. #define __dll_insert(pNode, pPrev) {            
  31.     __dll_next(pNode) = __dll_next(pPrev);      
  32.     __dll_prev(pNode) = (pPrev);                
  33.     __dll_next(pPrev) = (pNode);                
  34.     __dll_prev(__dll_next(pNode)) = (pNode);    
  35.     }
  36. #define dll_empty(pList) __dll_empty(pList)
  37. #define dll_insert(pNode, pPrev) __dll_insert(pNode, pPrev)
  38. #define dll_init(pNode) __dll_init(pNode)
  39. #define dll_remove(pNode) __dll_remove(pNode)
  40. #define dll_head(pNode) __dll_head(pNode)
  41. #define dll_tail(pNode) __dll_tail(pNode)
  42. #define dll_next(pNode) __dll_next(pNode)
  43. #define dll_prev(pNode) __dll_prev(pNode)
  44. #define dll_end(pNode) __dll_end(pNode)
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif /* _INCdllh */