From: Martin H. <mh...@us...> - 2005-07-23 08:50:43
|
Update of /cvsroot/opengtoolkit/serial/c_source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12158/c_source Added Files: lv_error.c plist.c Log Message: changed to .c --- NEW FILE: lv_error.c --- /* lv_error.cpp * * LabVIEW Error Cluster Utilities * * Martin Henz Systemtechnik, Stuttgart * * */ #define _WIN32_WINNT 0x0500 #include <windows.h> #include <crtdbg.h> #include "lv_error.h" /* lv_ErrBld * * Setzt den Fehler oder Warnungsstatus des Error Clusters * * parameter * lfStatus neuer Fehlerstatus * lCode neuer Fehlercode * pszSource Fehlerquelle * pError ErrorCluster * */ void lv_ErrBld(LVBoolean lfStatus, long lCode, char *pszSource, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lfStatus == LVTRUE || (pError->lCode == 0 && lCode != 0) ) { pError->lfStatus = lfStatus; pError->lCode = lCode; LStrPrintf(pError->shSource,(CStr)"%s", pszSource); } } } /* lv_ErrBldMsg * * Setzt den Fehler oder Warnungsstatus des Error Clusters * * parameter * lfStatus neuer Fehlerstatus * lCode neuer Fehlercode * pszSource Fehlerquelle * pszMsg Nachricht * pError ErrorCluster * */ void lv_ErrBldMsg(LVBoolean lfStatus, long lCode, char *pszSource, char *pszMsg, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lfStatus == LVTRUE || (pError->lCode == 0 && lCode != 0) ) { pError->lfStatus = lfStatus; pError->lCode = lCode; LStrPrintf(pError->shSource,(CStr)"%s: %s", pszSource, pszMsg); } } } /* lv_ErrBldOpt * * Setzt den Fehler oder Warnungsstatus des Error Clusters * * parameter * lfStatus neuer Fehlerstatus * lCode neuer Fehlercode * pszSource Fehlerquelle * pszMsg Nachricht * pszOptMsg Optionale Nachricht * pError ErrorCluster */ void lv_ErrBldOpt(LVBoolean lfStatus, long lCode, char *pszSource, char *pszMsg, char *pszOptMsg, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lfStatus == LVTRUE || (pError->lCode == 0 && lCode != 0) ) { pError->lfStatus = lfStatus; pError->lCode = lCode; if (pszMsg != NULL) { if (pszOptMsg != NULL) LStrPrintf(pError->shSource,(CStr)"%s: %s (%s)", pszSource, pszMsg, pszOptMsg); else LStrPrintf(pError->shSource,(CStr)"%s: %s", pszSource, pszMsg); } else { if (pszOptMsg != NULL) LStrPrintf(pError->shSource,(CStr)"%s (%s)", pszSource, pszOptMsg); else LStrPrintf(pError->shSource,(CStr)"%s", pszSource); } } } } /* lv_ErrBuilder * * Setzt den Fehler oder Warnungsstatus des Error Clusters * * parameter * lfStatus neuer Fehlerstatus * lCode neuer Fehlercode * pszSource Fehlerquelle * pszMsg Nachricht * pszOptMsg Optionale Nachricht * pszReason mögliche Ursache * pError ErrorCluster */ void lv_ErrBuilder(LVBoolean lfStatus, long lCode, char *pszSource, char *pszMsg, char *pszOptMsg, char *pszReason, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lfStatus == LVTRUE || (pError->lCode == 0 && lCode != 0) ) { pError->lfStatus = lfStatus; pError->lCode = lCode; if (pszMsg != NULL) { if (pszOptMsg != NULL) { if (pszReason != NULL) LStrPrintf(pError->shSource,(CStr)"%s: %s (%s)<err>%s", pszSource, pszMsg, pszOptMsg, pszReason); else LStrPrintf(pError->shSource,(CStr)"%s: %s (%s)", pszSource, pszMsg, pszOptMsg); } else { if (pszReason != NULL) LStrPrintf(pError->shSource,(CStr)"%s: %s<err>%s", pszSource, pszMsg, pszReason); else LStrPrintf(pError->shSource,(CStr)"%s: %s", pszSource, pszMsg); } } else { if (pszOptMsg != NULL) { if (pszReason != NULL) LStrPrintf(pError->shSource,(CStr)"%s (%s)<err>%s", pszSource, pszOptMsg, pszReason); else LStrPrintf(pError->shSource,(CStr)"%s (%s)", pszSource, pszOptMsg); } else { if (pszReason != NULL) LStrPrintf(pError->shSource,(CStr)"%s<err>%s", pszSource, pszReason); else LStrPrintf(pError->shSource,(CStr)"%s", pszSource); } } } } } /* lv_EasyErrBld * * Setzt den Fehlerstatus des Error Clusters * * parameter * lCode neuer Fehlercode * pszSource Fehlerquelle * pError ErrorCluster */ void lv_EasyErrBld(long lCode, char *pszSource, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lCode != 0) { pError->lfStatus = LVTRUE; pError->lCode = lCode; LStrPrintf(pError->shSource, (CStr)"%s", pszSource); } } } /* lv_WinErrBld * * Setzt den Windows Fehlerstatus des Error Clusters * * input * lCode neuer Fehlercode * pszSource Fehlerquelle * pError ErrorCluster * * output * error ErrorCluster */ void lv_WinErrBld(long lCode, char *pszSource, pErrC pError) { char * pszWinErrMsg; //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lCode != 0) { pError->lfStatus = LVTRUE; pError->lCode = lCode; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, lCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR) &pszWinErrMsg, 0, NULL); if (pszWinErrMsg != NULL) { LStrPrintf(pError->shSource, (CStr)"%s<err>%s", pszSource, pszWinErrMsg); LocalFree(pszWinErrMsg); } else LStrPrintf(pError->shSource, (CStr)"%s", pszSource); } } } /* lv_WarnOrErrBld * * Setzt den Fehlerstatus des Error Clusters. The error status will be set * for Error Codes lower than 60000. * * parameter * lCode neuer Fehlercode * pszSource Fehlerquelle * pError ErrorCluster * */ void lv_WarnOrErrBld(long lCode, char *pszSource, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(pszSource); if (lCode != 0) { pError->lfStatus = lCode < 60000 ? LVTRUE : LVFALSE; pError->lCode = lCode; LStrPrintf(pError->shSource, (CStr)"%s", pszSource); } } } /* lv_LStrErrBld * * Setzt den Fehler oder Warnungsstatus des Error Clusters * * parameter * lfStatus neuer Fehlerstatus * lCode neuer Fehlercode * shSource Fehlerquelle * pError ErrorCluster */ void lv_LStrErrBld(LVBoolean *plfStatus, long lCode, LStrHandle shSource, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(!DSCheckHandle(shSource)); if (*plfStatus == LVTRUE || (pError->lCode == 0 && lCode != 0)) { pError->lfStatus = *plfStatus; pError->lCode = lCode; LStrPrintf(pError->shSource, (CStr)"%H", shSource); } } } /* lv_LStrEasyErrBld * * Setzt den Fehlerstatus des Error Clusters * * parameter * lCode neuer Fehlercode * shSource Fehlerquelle * pError ErrorCluster */ void lv_LStrEasyErrBld(long lCode, LStrHandle shSource, pErrC pError) { //error pointer test _ASSERT(!DSCheckPtr(pError)); /* Der ErrorCluster wird nur verändert, wenn der aktuelle Status False ist, oder * wenn der aktuelle Errorcode 0 ist (für Warnungen) */ if ( pError->lfStatus == LVFALSE ) { _ASSERT(!DSCheckHandle(shSource)); if ( lCode != 0 ) { pError->lfStatus = LVTRUE; pError->lCode = lCode; LStrPrintf(pError->shSource, (CStr)"%H", shSource); } } } --- NEW FILE: plist.c --- /* plist.cpp * * Simple pList Implementation * * Martin Henz Systemtechnik, Stuttgart * */ #include <stdlib.h> #include "plist.h" #pragma pack(1) __inline PLIST InitializeList(PLIST pList); __inline PLINK GetPrevLink(PLINK pLink); __inline PLINK GetNextLink(PLINK pLink); __inline PLINK GetHeadOfList(PLIST pList); __inline PLINK GetTailOfList(PLIST pList); __inline void * GetElementPtr(PLINK pLink); __inline void SetElementPtr(PLINK pLink, void *pElement); __inline unsigned long GetListLength(PLIST pList); __inline PLINK AddToList(PLIST pList, PLINK pDstLink, PLINK pSrcLink); __inline PLINK AddToFrontOfList(PLIST pList, PLINK pLink); __inline PLINK AddToEndOfList(PLIST pList, PLINK pLink); __inline void AddLinkToLink(PLINK pDstLink, PLINK pSrcLink); __inline PLINK DeleteFromList(PLIST pList, PLINK pLink); __inline PLINK DeleteFromFrontOfList(PLIST pList); __inline PLINK DeleteFromEndOfList(PLIST pList); /* InitializeList * * Initializes a list * * parameter * pList list pointer * * return * list pointer */ __inline PLIST InitializeList(PLIST pList) { pList->pHead = (PLINK) 0L; pList->pTail = (PLINK) 0L; pList->ulLength = 0; return pList; } /* GetPrevLink * * Gets the previous link * * parameter * pLink link pointer * * return * the previous link */ __inline PLINK GetPrevLink(PLINK pLink) { return pLink->pPrev; } /* GetNextLink * * Gets the next link * * parameter * pLink link pointer * * return * the next link */ __inline PLINK GetNextLink(PLINK pLink) { return pLink->pNext; } /* GetHeadOfList * * Gets the head of the list * * parameter * pList list pointer * * return * the list head link */ __inline PLINK GetHeadOfList(PLIST pList) { return pList->pHead; } /* GetTailOfList * * Gets the tail of the list * * parameter * pList list pointer * * return * the list tail link */ __inline PLINK GetTailOfList(PLIST pList) { return pList->pTail; } /* GetElementPtr * * Gets the element data pointer * * parameter * pLink link * * return * element data pointer */ __inline void * GetElementPtr(PLINK pLink) { return pLink->pElement; } /* SetElementPtr * * Sets the element data pointer * * parameter * pLink link * pElement element data pointer */ __inline void SetElementPtr(PLINK pLink, void *pElement) { pLink->pElement = pElement; } /* GetListLength * * Gets the length of the list * * parameter * pLink link * * return * element data pointer */ __inline unsigned long GetListLength(PLIST pList) { return pList->ulLength; } /* AddLinkToLink * * Links two links together * * parameter * pDstLink destination link * pSrcLink source link */ __inline void AddLinkToLink(PLINK pDstLink, PLINK pSrcLink) { //Make the source link point at the destination link. pSrcLink->pPrev = pDstLink; pSrcLink->pNext = pDstLink->pNext; // Make the destination link point at the source link. pDstLink->pNext->pPrev = pSrcLink; pDstLink->pNext = pSrcLink; } /* AddToList * * Adds a link to the list. If the source link is NULL, the functions appends * the destination link at the end of the list. If the destination link is * NULL, the source link will be appended at the front of the list. If neither * source and destination link is NULL, it links them together. * * parameter * pList list pointer * DstLink destination link * SrcLink source link * * return * the added link pointer */ __inline PLINK AddToList(PLIST pList, PLINK pDstLink, PLINK pSrcLink) { //Grow the list length by one. pList->ulLength++; //If SrcLink is NULL then add DstLink to the end of the list. if ( pSrcLink == (PLINK) 0L ) { //If the tail pointer is NULL then the list is empty. if ( pList->pTail != (PLINK) 0L ) { AddLinkToLink(pList->pTail, pDstLink); } else { pDstLink->pPrev = pDstLink; pDstLink->pNext = pDstLink; pList->pHead = pDstLink; } return (pList->pTail = pDstLink); } //If DstLink is NULL then add SrcLink to the front of the list. if ( pDstLink == (PLINK) 0L ) { //If the head pointer is NULL then the list is empty. if ( pList->pHead != (PLINK) 0L ) { AddLinkToLink(pList->pHead, pSrcLink); } else { pSrcLink->pPrev = pSrcLink; pSrcLink->pNext = pSrcLink; pList->pTail = pSrcLink; } return (pList->pHead = pSrcLink); } //Neither pDstLink nor SrcLink is NULL so link them together. AddLinkToLink(pDstLink, pSrcLink); return pSrcLink; } /* DeleteFromList * * Deletes a link from the list * * parameter * pList list pointer * pLink link pointer * * return * the deleted link pointer */ __inline PLINK DeleteFromList(PLIST pList, PLINK pLink) { //If the list is empty then return NULL. if ( pList->ulLength != 0 ) { /* If the list length is not zero then we may need to fixup head and * tail pointers in the event we delete the first or last link, * respectively. */ if ( --pList->ulLength != 0 ) { // If we are deleting the front link then fixup the head pointer. if ( pList->pHead == pLink ) { pList->pHead = pList->pHead->pNext; } //If we are deleting the end link then fixup the tail pointer. if ( pList->pTail == pLink ) { pList->pTail = pList->pTail->pPrev; } // Now we can unlink this link from the list. pLink->pNext->pPrev = pLink->pPrev; pLink->pPrev->pNext = pLink->pNext; } else { // There is only one link on the list and we just deleted it. pList->pHead = (PLINK) 0L; pList->pTail = (PLINK) 0L; } return pLink; } return (PLINK) 0L; } /* AddToFrontOfList * * Adds a link at the front of the list * * parameter * pList list pointer * pLink link pointer * * return * the added link pointer */ __inline PLINK AddToFrontOfList(PLIST pList, PLINK pLink) { return AddToList(pList, (PLINK) 0L, pLink); } /* AddToEndOfList * * Adds a link at the end of the list * * parameter * pList list pointer * pLink link pointer * * return * the added link pointer */ __inline PLINK AddToEndOfList(PLIST pList, PLINK pLink) { return AddToList(pList, pLink, (PLINK) 0L); } /* DeleteFromFrontOfList * * Deletes a link from the front of the list * * parameter * pList list pointer * pLink link pointer * * return * the deleted link pointer */ __inline PLINK DeleteFromFrontOfList(PLIST pList) { return DeleteFromList(pList, GetHeadOfList(pList)); } /* DeleteFromEndOfList * * Deletes a link from the end of the list * * parameter * pList list pointer * pLink link pointer * * return * the deleted link pointer */ __inline PLINK DeleteFromEndOfList(PLIST pList) { return DeleteFromList(pList, GetTailOfList(pList)); } #pragma pack() /* ListCreate * * The function allocates the memory needed for a new list and initialises * the list as an empty list. * * parameter * * return * pointer to list */ PLIST ListCreate(void) { PLIST pList; if ( (pList = (PLIST)malloc(sizeof(LIST))) == NULL) return NULL; InitializeList(pList); return pList; } /* ListDispose * * Releases the momory allocated for the list * * parameter * pList list pointer * * return * 0 if no error or 1 if the pList argument is not valid */ int ListDispose(PLIST pList) { if (pList == NULL) return 1; InitializeList(pList); free(pList); return 0; } /* ListAppendElement * * Appends a new element at the end of the list. * * parameter * pList list pointer * pElement element data pointer * * return * element handle */ void * ListAppendElement(PLIST pList, void *pElement) { PLINK pLink; if (pList == NULL) return NULL; if ( (pLink = (PLINK)malloc(sizeof(LINK))) == NULL) return NULL; pLink->pElement = pElement; AddToEndOfList(pList, pLink); //return the element handle return pLink; } /* ListRemoveHandle * * Removes an element from the list * * parameter * pList list pointer * hElement element handle * * return * the removed elements data pointer * */ void * ListRemoveHandle(PLIST pList, void *hElement) { void *pElement; if (pList == NULL || hElement == NULL) return NULL; if (DeleteFromList(pList, (PLINK)hElement) == NULL) return NULL; pElement = ((PLINK)hElement)->pElement; ((PLINK)hElement)->pNext = NULL; ((PLINK)hElement)->pPrev = NULL; ((PLINK)hElement)->pElement = NULL; free(hElement); return pElement; } /* ListRemoveFirstElement * * Removes the first element of the list * * parameter * pList list pointer * * return * the removed element data pointer */ void * ListRemoveFirstElement(PLIST pList) { PLINK pLink; void *pElement; if (pList == NULL) return NULL; pLink = DeleteFromFrontOfList(pList); if (pLink != NULL) { pElement = pLink->pElement; pLink->pNext = NULL; pLink->pPrev = NULL; pLink->pElement = NULL; free(pLink); return pElement; } return NULL; } /* ListRemoveLastElement * * Removes the last element from the list * * parameter * pList list pointer * * return * the removes element data pointer */ void * ListRemoveLastElement(PLIST pList) { PLINK pLink; void *pElement; if (pList == NULL) return NULL; pLink = DeleteFromEndOfList(pList); if (pLink != NULL) { pElement = pLink->pElement; pLink->pNext = NULL; pLink->pPrev = NULL; pLink->pElement = NULL; free(pLink); return pElement; } return NULL; } /* ListGetElement * * Returns the elements data pointer referenced by the element handle * * parameter * pList list pointer * hElement element handle * * return * the elements data pointer */ void * ListGetElement(PLIST pList, void *hElement) { if (pList == NULL || hElement == NULL) return NULL; return ((PLINK)hElement)->pElement; } /* ListGetLength * * Retrieves the length of the list (number of elements in the list) * * parameter * pList list pointer * * return * ulLength of the list */ int ListGetLength(PLIST pList) { if (pList == NULL) return -1; return GetListLength(pList); } /* ListCheckHandle * * Checks an element handle * * parameter * pList list pointer * hElement element handle * * return * 0, if the handle is valid * 1, if the handle is not a valid element handle * in case of an error, the function returns a negative number */ int ListCheckHandle(PLIST pList, void *hElement) { PLINK pLink; unsigned long i; if (pList == NULL) return -1; for ( i = 0, pLink = GetHeadOfList(pList); i < GetListLength(pList); i++, pLink = GetNextLink(pLink)) { if (pLink == hElement) return 0; } return 1; } /* ListCheckElement * * Checks an element data pointer * * parameter * pList list pointer * pElement element data pointer * * return * 0, if the pointer is valid * 1, if the pointer is not a valid element handle * in case of an error, the function returns a negative number */ int ListCheckElement(PLIST pList, void *pElement) { PLINK pLink; unsigned long i; if (pList == NULL) return -1; for ( i = 0, pLink=GetHeadOfList(pList); i < GetListLength(pList); i++, pLink = GetNextLink(pLink)) { if (pLink->pElement == pElement) return 0; } return 1; } /* ListGetFirstElement * * Returns the first element of the list * * parameter * pList list pointer * * return * the elements data pointer * */ void * ListGetFirstElement(PLIST pList) { if (pList == NULL) return NULL; return (GetHeadOfList(pList))->pElement; } /* ListGetNextElement * * Returns the next element of the list * * parameter * pList list pointer * pElement element pointer * * return * the next elements data pointer * */ void * ListGetNextElement(PLIST pList, void *pElement) { PLINK pLink; unsigned long i; if (pList == NULL) return NULL; for ( i = 0, pLink=GetHeadOfList(pList); i < GetListLength(pList) && pLink->pElement != pElement; i++) { pLink = GetNextLink(pLink); } if (i >= GetListLength(pList)) return NULL; pLink = GetNextLink(pLink); return pLink->pElement; } /* ListGetFirstHandle * * Retruns the first element of the list * * parameter * pList list pointer * * return * the elements handle */ void * ListGetFirstHandle(PLIST pList) { if (pList == NULL) return NULL; return GetHeadOfList(pList); } /* ListGetNextHandle * * Returns the next handle of the list * * parameter * pList list pointer * hElement element handle * * return * the next elements handle * */ void * ListGetNextHandle(PLIST pList, void *hElement) { PLINK pLink; unsigned long i; if (pList == NULL) return NULL; for ( i = 0, pLink=GetHeadOfList(pList); i < GetListLength(pList) && pLink != hElement; i++) { pLink = GetNextLink(pLink); } if (i >= GetListLength(pList)) return NULL; pLink = GetNextLink(pLink); return pLink; } /* ListFindElement * * Searches for an element in the list * * parameter * pList list pointer * pElement element pointer * * return * element pointer, or NULL if not found */ void * ListFindElement(PLIST pList, void *pElement, int ( __cdecl *compare ) ( const void *, const void *) ) { PLINK pLink; unsigned long i; if (pList == NULL) return NULL; for ( i = 0, pLink = GetHeadOfList(pList); i < GetListLength(pList); i++, pLink = GetNextLink(pLink)) { if (compare(pElement, pLink->pElement) == 0) return pLink->pElement; } return NULL; } /* Compare Function template for ListFindElement int ElmCmp( char *arg1, MY_STRUCT arg2 ) { // Compare all of both strings: return _stricmp( arg1, arg2->struct_element ); } */ /* ListFindElmHandle * * Searches for an element in the list * * parameter * pList list pointer * pElement element pointer * * return * element handle, or NULL if not found */ void * ListFindElmHandle(PLIST pList, void *pElement, int ( __cdecl *compare ) ( const void *, const void *) ) { PLINK pLink; unsigned long i; if (pList == NULL) return NULL; for ( i = 0, pLink = GetHeadOfList(pList); i < GetListLength(pList); i++, pLink = GetNextLink(pLink)) { if (compare(pElement, pLink->pElement) == 0) return pLink; } return NULL; } /* Compare Function template for ListFindElmHandle int ElmCmp( char *arg1, MY_STRUCT arg2 ) { // Compare all of both strings: return _stricmp( arg1, arg2->struct_element ); } */ /* ListFindHandle * * Searches for an handle in the list * * parameter * pList list pointer * hElement element handle * * return * element handle or NULL if not found */ void * ListFindHandle(PLIST pList, void *hElement, int ( __cdecl *compare ) ( const void *, const void *) ) { PLINK pLink; unsigned long i; if (pList == NULL) return NULL; for ( i = 0, pLink = GetHeadOfList(pList); i < GetListLength(pList); i++, pLink = GetNextLink(pLink)) { if (compare(((PLINK)hElement)->pElement, pLink->pElement) == 0) return hElement; } return NULL; } /* Compare function template for ListFindHandle int HndlCmp( MY_STRUCT arg1, MY_STRUCT arg2 ) { // Compare all of both strings: return _stricmp( arg1->struct_element, arg2->struct_element ); } */ |