///////////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 1998 Active Voice Corporation. All Rights Reserved. // // Active Agent(r) and Unified Communications(tm) are trademarks of Active Voice Corporation. // // Other brand and product names used herein are trademarks of their respective owners. // // The entire program and user interface including the structure, sequence, selection, // and arrangement of the dialog, the exclusively "yes" and "no" choices represented // by "1" and "2," and each dialog message are protected by copyrights registered in // the United States and by international treaties. // // Protected by one or more of the following United States patents: 5,070,526, 5,488,650, // 5,434,906, 5,581,604, 5,533,102, 5,568,540, 5,625,676, 5,651,054. // // Active Voice Corporation // Seattle, Washington // USA // ///////////////////////////////////////////////////////////////////////////////////////// //// // list.h - interface for linked list functions in list.c //// #ifndef __LIST_H__ #define __LIST_H__ #include "winlocal.h" #define LIST_VERSION 0x00000100 // handle to a list // DECLARE_HANDLE32(HLIST); // handle to a list node // DECLARE_HANDLE32(HLISTNODE); // list data element // typedef LPVOID LISTELEM; #ifdef __cplusplus extern "C" { #endif //// // list constructor and destructor functions //// // ListCreate - list constructor // (i) must be LIST_VERSION // (i) instance handle of calling module // return new list handle (NULL if error) // HLIST DLLEXPORT WINAPI ListCreate(DWORD dwVersion, HINSTANCE hInst); // ListDestroy - list destructor // (i) handle returned from ListCreate // return 0 if success // NOTE: any nodes within list are destroyed also // int DLLEXPORT WINAPI ListDestroy(HLIST hList); //// // list status functions //// // ListGetCount - return count of nodes in list // (i) handle returned from ListCreate // return node count (-1 if error) // long DLLEXPORT WINAPI ListGetCount(HLIST hList); // ListIsEmpty - return TRUE if list has no nodes // (i) handle returned from ListCreate // return TRUE or FALSE // BOOL DLLEXPORT WINAPI ListIsEmpty(HLIST hList); //// // list iteration functions //// // ListGetHeadNode - get list head node // (i) handle returned from ListCreate // return list head node (NULL if error or empty) // HLISTNODE DLLEXPORT WINAPI ListGetHeadNode(HLIST hList); // ListGetTailNode - get list tail node // (i) handle returned from ListCreate // return list tail node (NULL if error or empty) // HLISTNODE DLLEXPORT WINAPI ListGetTailNode(HLIST hList); // ListGetNextNode - get node which follows specified node // (i) handle returned from ListCreate // (i) node handle // return node which follows specified node (NULL if error or none) // HLISTNODE DLLEXPORT WINAPI ListGetNextNode(HLIST hList, HLISTNODE hNode); // ListGetPrevNode - get node which precedes specified node // (i) handle returned from ListCreate // (i) node handle // return node which precedes specified node (NULL if error or none) // HLISTNODE DLLEXPORT WINAPI ListGetPrevNode(HLIST hList, HLISTNODE hNode); //// // list element insertion functions //// // ListAddHead - add new node with data to head of list, // (i) handle returned from ListCreate // (i) new data element // returns new node handle (NULL if error) // HLISTNODE DLLEXPORT WINAPI ListAddHead(HLIST hList, LISTELEM elem); // ListAddTail - add new node with data to tail of list, // (i) handle returned from ListCreate // (i) new data element // returns new node handle (NULL if error) // HLISTNODE DLLEXPORT WINAPI ListAddTail(HLIST hList, LISTELEM elem); // ListInsertBefore - insert new node with data before specified node // (i) handle returned from ListCreate // (i) node handle // (i) new data element // return handle to new node (NULL if error) // HLISTNODE DLLEXPORT WINAPI ListInsertBefore(HLIST hList, HLISTNODE hNode, LISTELEM elem); // ListInsertAfter - insert new node with data after specified node // (i) handle returned from ListCreate // (i) node handle // (i) new data element // return handle to new node (NULL if error) // HLISTNODE DLLEXPORT WINAPI ListInsertAfter(HLIST hList, HLISTNODE hNode, LISTELEM elem); //// // list element removal functions //// // ListRemoveHead - remove node from head of list, // (i) handle returned from ListCreate // returns removed data element // LISTELEM DLLEXPORT WINAPI ListRemoveHead(HLIST hList); // ListRemoveTail - remove node from tail of list, // (i) handle returned from ListCreate // returns removed data element // LISTELEM DLLEXPORT WINAPI ListRemoveTail(HLIST hList); // ListRemoveAt - remove specified node from list, // (i) handle returned from ListCreate // (i) node handle // returns removed data element // LISTELEM DLLEXPORT WINAPI ListRemoveAt(HLIST hList, HLISTNODE hNode); // ListRemoveAll - remove all nodes from list // (i) handle returned from ListCreate // return 0 if success // int DLLEXPORT WINAPI ListRemoveAll(HLIST hList); //// // list element get/set value functions //// // ListGetHead - return data element from head node // (i) handle returned from ListCreate // return data element // LISTELEM DLLEXPORT WINAPI ListGetHead(HLIST hList); // ListGetTail - return data element from tail node // (i) handle returned from ListCreate // return data element // LISTELEM DLLEXPORT WINAPI ListGetTail(HLIST hList); // ListGetAt - return data element from specified node // (i) handle returned from ListCreate // (i) node handle // return data element // LISTELEM DLLEXPORT WINAPI ListGetAt(HLIST hList, HLISTNODE hNode); // ListSetAt - set data element in specified node // (i) handle returned from ListCreate // (i) node handle // (i) data element // return 0 if success // int DLLEXPORT WINAPI ListSetAt(HLIST hList, HLISTNODE hNode, LISTELEM elem); //// // list search functions //// // ListFind - search list for node with matching element // (i) handle returned from ListCreate // (i) data element to match // (i) node handle to begin search after // NULL start search at head node // return matching node (NULL if error or none) // HLISTNODE DLLEXPORT WINAPI ListFind(HLIST hList, LISTELEM elem, HLISTNODE hNodeAfter); // ListFindIndex - search list for nth node in list // (i) handle returned from ListCreate // (i) zero based index into list // return handle to node (NULL if error) // HLISTNODE DLLEXPORT WINAPI ListFindIndex(HLIST hList, long nIndex); #ifdef __cplusplus } #endif #endif // __LIST_H__