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.

96 lines
3.0 KiB

  1. // Copyright (c) 1992, Microsoft Corporation, all rights reserved
  2. //
  3. // dtl.h
  4. // Double-threaded linked list header
  5. //
  6. // 06/28/92 Steve Cobb
  7. #ifndef _DTL_H_
  8. #define _DTL_H_
  9. #include <nouiutil.h> // Heap definitions
  10. // Forward declarations
  11. //
  12. typedef struct _DTLNODE DTLNODE;
  13. typedef struct _DTLLIST DTLLIST;
  14. // Double-threaded linked list node control block. There is one node for each
  15. // entry in a list.
  16. //
  17. // Applications should not access this structure directly.
  18. //
  19. typedef struct
  20. _DTLNODE
  21. {
  22. DTLNODE* pdtlnodePrev; // Address of previous node or NULL if none
  23. DTLNODE* pdtlnodeNext; // Address of next node or NULL if none
  24. VOID* pData; // Address of user's data
  25. LONG_PTR lNodeId; // User-defined node identification code
  26. }
  27. DTLNODE;
  28. // Double-threaded linked list control block. There is one for each list.
  29. //
  30. // Applications should not access this structure directly.
  31. //
  32. typedef struct
  33. _DTLLIST
  34. {
  35. DTLNODE* pdtlnodeFirst; // Address of first node or NULL if none
  36. DTLNODE* pdtlnodeLast; // Address of last node or NULL if none
  37. LONG lNodes; // Number of nodes in list
  38. LONG_PTR lListId; // User-defined list identification code
  39. }
  40. DTLLIST;
  41. // List node duplication function. See DuplicateList.
  42. //
  43. typedef DTLNODE* (*PDUPNODE)( IN DTLNODE* );
  44. // List node free function. See FreeList.
  45. //
  46. typedef VOID (*PDESTROYNODE)( IN DTLNODE* );
  47. // List node comparison function. See MergeSort.
  48. //
  49. typedef IN (*PCOMPARENODE)( IN DTLNODE*, IN DTLNODE* );
  50. // Macros and function prototypes.
  51. //
  52. #define DtlGetData( pdtlnode ) ((pdtlnode)->pData)
  53. #define DtlGetNodeId( pdtlnode ) ((pdtlnode)->lNodeId)
  54. #define DtlGetFirstNode( pdtllist ) ((pdtllist)->pdtlnodeFirst)
  55. #define DtlGetListId( pdtllist ) ((pdtllist)->lListId)
  56. #define DtlGetNextNode( pdtlnode ) ((pdtlnode)->pdtlnodeNext)
  57. #define DtlGetNodes( pdtllist ) ((pdtllist)->lNodes)
  58. #define DtlGetPrevNode( pdtlnode ) ((pdtlnode)->pdtlnodePrev)
  59. #define DtlGetLastNode( pdtllist ) ((pdtllist)->pdtlnodeLast)
  60. #define DtlPutData( pdtlnode, p ) ((pdtlnode)->pData = (p))
  61. #define DtlPutNodeId( pdtlnode, l ) ((pdtlnode)->lNodeId = (LONG )(l))
  62. #define DtlPutListCode( pdtllist, l ) ((pdtllist)->lListId = (LONG )(l))
  63. DTLNODE* DtlAddNodeAfter( DTLLIST*, DTLNODE*, DTLNODE* );
  64. DTLNODE* DtlAddNodeBefore( DTLLIST*, DTLNODE*, DTLNODE* );
  65. DTLNODE* DtlAddNodeFirst( DTLLIST*, DTLNODE* );
  66. DTLNODE* DtlAddNodeLast( DTLLIST*, DTLNODE* );
  67. DTLLIST* DtlCreateList( LONG );
  68. DTLNODE* DtlCreateNode( VOID*, LONG_PTR );
  69. DTLNODE* DtlCreateSizedNode( LONG, LONG_PTR );
  70. VOID DtlDestroyList( DTLLIST*, PDESTROYNODE );
  71. VOID DtlDestroyNode( DTLNODE* );
  72. DTLNODE* DtlDeleteNode( DTLLIST*, DTLNODE* );
  73. DTLLIST* DtlDuplicateList( DTLLIST*, PDUPNODE, PDESTROYNODE );
  74. VOID DtlMergeSort( DTLLIST*, PCOMPARENODE );
  75. VOID DtlSwapLists( DTLLIST*, DTLLIST* );
  76. DTLNODE* DtlNodeFromIndex( DTLLIST*, LONG );
  77. DTLNODE* DtlRemoveNode( DTLLIST*, DTLNODE* );
  78. #endif // _DTL_H_