add ellVerify()

This commit is contained in:
Jeff Hill
1998-02-05 21:28:29 +00:00
parent 104c5960ab
commit e8856b480e
4 changed files with 92 additions and 0 deletions

View File

@@ -28,16 +28,21 @@
* -----------------
* .01 jrw 07-02-92 created
* .02 rcz 08-26-92 moved to libCom
* .03 joh 12-12-97 added ellverify()
*/
/* #define DEBUG_DRIVER */
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <epicsAssert.h>
#define epicsExportSharedSymbols
#include "ellLib.h"
@@ -487,6 +492,43 @@ ELLLIST *pList;
return;
}
/****************************************************************************
*
* This function verifies that the list is consistent.
* joh 12-12-97
*
*****************************************************************************/
void epicsShareAPI ellVerify (ELLLIST *pList)
{
ELLNODE *pNode;
ELLNODE *pNext;
int count;
assert (pList);
count = 0u;
pNode = ellFirst(pList);
if (pNode) {
assert (ellPrevious(pNode)==NULL);
while (1) {
count++;
pNext = ellNext(pNode);
if (pNext) {
assert (ellPrevious(pNext)==pNode);
}
else {
break;
}
pNode = pNext;
}
assert (ellNext(pNode)==NULL);
}
assert (pNode==ellLast(pList));
assert (count==ellCount(pList));
}
#ifdef DEBUG_DRIVER
/****************************************************************************
*

View File

@@ -29,6 +29,7 @@
* .01 jrw 07-02-92 created
* .02 rcz 07-23-93 changed name
* .03 rcz 07-26-93 changed name again
* .04 joh 12-12-97 added ellverify()
*/
#ifndef INCellLibh
#define INCellLibh
@@ -92,6 +93,7 @@ epicsShareFunc ELLNODE * epicsShareAPI ellNth (ELLLIST *pList, int nodeNum);
epicsShareFunc ELLNODE * epicsShareAPI ellNStep (ELLNODE *pNode, int nStep);
epicsShareFunc int epicsShareAPI ellFind (ELLLIST *pList, ELLNODE *pNode);
epicsShareFunc void epicsShareAPI ellFree (ELLLIST *pList);
epicsShareFunc void epicsShareAPI ellVerify (ELLLIST *pList);
#else /*__STDC__*/
@@ -132,6 +134,8 @@ epicsShareFunc ELLNODE * epicsShareAPI ellNth ();
epicsShareFunc ELLNODE * epicsShareAPI ellNStep ();
epicsShareFunc int epicsShareAPI ellFind ();
epicsShareFunc void epicsShareAPI ellFree ();
epicsShareFunc void ellVerify ();
#endif /*__STDC__*/
#ifdef __cplusplus

View File

@@ -28,16 +28,21 @@
* -----------------
* .01 jrw 07-02-92 created
* .02 rcz 08-26-92 moved to libCom
* .03 joh 12-12-97 added ellverify()
*/
/* #define DEBUG_DRIVER */
#ifdef vxWorks
#include <vxWorks.h>
#endif
#include <stdlib.h>
#include <epicsAssert.h>
#define epicsExportSharedSymbols
#include "ellLib.h"
@@ -487,6 +492,43 @@ ELLLIST *pList;
return;
}
/****************************************************************************
*
* This function verifies that the list is consistent.
* joh 12-12-97
*
*****************************************************************************/
void epicsShareAPI ellVerify (ELLLIST *pList)
{
ELLNODE *pNode;
ELLNODE *pNext;
int count;
assert (pList);
count = 0u;
pNode = ellFirst(pList);
if (pNode) {
assert (ellPrevious(pNode)==NULL);
while (1) {
count++;
pNext = ellNext(pNode);
if (pNext) {
assert (ellPrevious(pNext)==pNode);
}
else {
break;
}
pNode = pNext;
}
assert (ellNext(pNode)==NULL);
}
assert (pNode==ellLast(pList));
assert (count==ellCount(pList));
}
#ifdef DEBUG_DRIVER
/****************************************************************************
*

View File

@@ -29,6 +29,7 @@
* .01 jrw 07-02-92 created
* .02 rcz 07-23-93 changed name
* .03 rcz 07-26-93 changed name again
* .04 joh 12-12-97 added ellverify()
*/
#ifndef INCellLibh
#define INCellLibh
@@ -92,6 +93,7 @@ epicsShareFunc ELLNODE * epicsShareAPI ellNth (ELLLIST *pList, int nodeNum);
epicsShareFunc ELLNODE * epicsShareAPI ellNStep (ELLNODE *pNode, int nStep);
epicsShareFunc int epicsShareAPI ellFind (ELLLIST *pList, ELLNODE *pNode);
epicsShareFunc void epicsShareAPI ellFree (ELLLIST *pList);
epicsShareFunc void epicsShareAPI ellVerify (ELLLIST *pList);
#else /*__STDC__*/
@@ -132,6 +134,8 @@ epicsShareFunc ELLNODE * epicsShareAPI ellNth ();
epicsShareFunc ELLNODE * epicsShareAPI ellNStep ();
epicsShareFunc int epicsShareAPI ellFind ();
epicsShareFunc void epicsShareAPI ellFree ();
epicsShareFunc void ellVerify ();
#endif /*__STDC__*/
#ifdef __cplusplus