|
|
1.1 root 1: 1.1.1.3 ! root 2: /******************************************************************************\ ! 3: * This is a part of the Microsoft Source Code Samples. ! 4: * Copyright (C) 1993 Microsoft Corporation. ! 5: * All rights reserved. ! 6: * This source code is only intended as a supplement to ! 7: * Microsoft Development Tools and/or WinHelp documentation. ! 8: * See these sources for detailed information regarding the ! 9: * Microsoft samples programs. ! 10: \******************************************************************************/ 1.1 root 11: 1.1.1.3 ! root 12: #ifndef LINKLIST_H 1.1 root 13: 1.1.1.3 ! root 14: #define LINKLIST_H 1.1.1.2 root 15: 1.1.1.3 ! root 16: // public typedefs and defines ! 17: // ----------------------------------------------------------------------- ! 18: #define LIST_NO_ERROR 1 ! 19: #define LIST_ERROR_NO_NODE -1 ! 20: #define LIST_ERROR_NO_MATCH -2 ! 21: #define LIST_ERROR_NO_FREE_MEM -3 ! 22: #define LIST_ERROR_DEREFERENCE_NULL -99 ! 23: ! 24: #define LIST_LEFT_OF -1 ! 25: #define LIST_MATCH 0 ! 26: #define LIST_RIGHT_OF 1 ! 27: ! 28: #ifndef TRUE ! 29: #define TRUE 1 ! 30: #define FALSE 0 ! 31: typedef int BOOL; ! 32: #endif 1.1.1.2 root 33: 1.1.1.3 ! root 34: typedef void* PVOID; 1.1.1.2 root 35: 36: //-- definition of a node 1.1.1.3 ! root 37: typedef struct NODE_STRUCT* PNODE; 1.1.1.2 root 38: typedef struct NODE_STRUCT { 1.1.1.3 ! root 39: PVOID pNodeData; ! 40: PNODE pLeftLink; ! 41: PNODE pRightLink; 1.1.1.2 root 42: } NODE; 43: 44: //-- definition of a list 45: typedef struct LIST_STRUCT* PLIST; 46: typedef struct LIST_STRUCT { 1.1.1.3 ! root 47: PVOID pListData; 1.1.1.2 root 48: PNODE pFirstNode; 49: PNODE pCurrentNode; 50: PNODE pLastNode; 51: int (*OrderFunction)(PNODE, PNODE); 1.1.1.3 ! root 52: int ListError; 1.1.1.2 root 53: } LIST; 54: 1.1.1.3 ! root 55: // public function prototypes ! 56: // ----------------------------------------------------------------------- ! 57: BOOL CreateList( PLIST* ppList, int (*OrderFunction)( PNODE pNodeOne, PNODE pNodeTwo ) ); ! 58: BOOL CreateNode( PNODE* ppNewNode ); ! 59: BOOL InsertNode( PLIST pList, PNODE pNewNode ); ! 60: BOOL SetCurrentNode( PLIST pList, PNODE pKeyNode, int (*MatchFunction)( PNODE pNodeOne, PNODE pNodeTwo ) ); ! 61: BOOL SetCurrentNodeEx( PLIST pList, PNODE pKeyNode, int (*MatchFunction)( PNODE pNodeOne, PNODE pNodeTwo ), int Occurence ); ! 62: BOOL GetCurrentNode( PLIST pList, PNODE* ppNode ); ! 63: BOOL GetFirstNode( PLIST pList, PNODE* ppNode ); ! 64: BOOL GetLastNode( PLIST pList, PNODE* ppNode ); ! 65: BOOL GetNextNode( PLIST pList, PNODE* ppNode ); ! 66: BOOL GetPrevNode( PLIST pList, PNODE* ppNode ); ! 67: BOOL DeleteCurrentNode( PLIST pList ); ! 68: BOOL DestroyNode( PNODE pNode ); ! 69: BOOL DestroyList( PLIST pList ); ! 70: int GetListError( PLIST pList ); 1.1 root 71: 1.1.1.2 root 72: #endif // LINKLIST_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.