From 725ebc33508f33a4659a069b36f6a1774eeedca7 Mon Sep 17 00:00:00 2001 From: Bob Zieman Date: Wed, 8 Sep 1993 11:29:00 +0000 Subject: [PATCH] put away working version --- src/libCom/errMtst.c | 11 +- src/libCom/errSymLib.c | 310 ++++++++++++++++------------------- src/libCom/error/errSymLib.c | 310 ++++++++++++++++------------------- 3 files changed, 280 insertions(+), 351 deletions(-) diff --git a/src/libCom/errMtst.c b/src/libCom/errMtst.c index 597882c22..b498a68e4 100644 --- a/src/libCom/errMtst.c +++ b/src/libCom/errMtst.c @@ -36,7 +36,12 @@ #endif #include -#include + +#ifdef __STDC__ +void errSymTest(unsigned short modnum, unsigned short begErrNum, unsigned short endErrNum); +#else +void errSymTest(); +#endif /* __STDC__ */ /**************************************************************** @@ -45,18 +50,14 @@ #ifndef vxWorks main() { - printf("calling errSymBld from main in errMtst.c\n"); errSymBld(); #if 0 - printf("calling errSymDump from main in errMtst.c\n"); errSymDump(); #endif #if 0 - printf("calling errSymFindTst from main in errMtst.c\n"); errSymFindTst(); #endif #if 1 - printf("calling errSymTest from main in errMtst.c\n"); errSymTest((unsigned short)501, 1, 17); #endif } diff --git a/src/libCom/errSymLib.c b/src/libCom/errSymLib.c index 4b9014923..c18b0f17f 100644 --- a/src/libCom/errSymLib.c +++ b/src/libCom/errSymLib.c @@ -61,42 +61,6 @@ * rcz of errSymTable lookup. */ -/* - * TODO - * 1. Put everything in errSymLib.c - DONE - * get rid of error.h - DONE - * function prototypes in errMdef.h - (DONE ???) - * 2. Nick to fix calink.h error comments. - * 3. Fix trailing blanks on S_... -- DONE - * 4. In iocinit - make a call to errSymBld to make it initialize. - * - */ - -/****************************** - * FUNCTIONS - * errhash - NEW - * errPrintf - N/C - * errPrintStatus - N/C - * verrPrintStatus - N/C - * errSymBld - complete rework - * errSymbolAdd - NEW - * errSymbolFind - NEW - * errSymFind - * UnixSymFind - N/C - * ModSymFind - * errSymDump - NEW - * errSymFindTst - NEW - * main - in errMtst.c - * Program errMtst calls: - * errSymBld - * errSymDump - * errSymFindTst - * - * errSymTest - in errMtst.c - not implemented yet (not needed ??? ) - * errSymTest(501, 0, 100) - * errSymTest(int modnum, int begErrNum, int endErrNum) - ***********************************/ - #include #include #include @@ -113,17 +77,47 @@ extern SYMTAB_ID statSymTbl; extern int errToLogMsg; #else -#include -#include #include extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif +#define LOCAL static +#ifndef NELEMENTS +#define NELEMENTS(array) /* number of elements in an array */ \ + (sizeof (array) / sizeof ((array) [0])) +#endif + +typedef struct /* ERRSYMBOL - entry in symbol table */ + { + char *name; /* pointer to symbol name */ + long errNum; /* errMessage symbol number */ + } ERRSYMBOL; +typedef struct /* ERRSYMTAB - symbol table */ + { + short nsymbols; /* current number of symbols in table */ + ERRSYMBOL *symbols; /* ptr to array of symbol entries */ + } ERRSYMTAB; +typedef ERRSYMTAB *ERRSYMTAB_ID; +#ifdef vxWorks +#define MYERRNO (errnoGet()&0xffff) +#else +#define MYERRNO errno +#endif + +typedef struct errnumnode { + ELLNODE node; + long errNum; + struct errnumnode *hashnode; + char *message; + long pad; +} ERRNUMNODE; +#define NHASH 256 + static ELLLIST errnumlist; -static ERRNUMNODE hashtable[NHASH]; +static ERRNUMNODE **hashtable; static int initialized = FALSE; extern ERRSYMTAB_ID errSymTbl; @@ -135,6 +129,64 @@ int errToLogMsg = FALSE; /*Declare storage for errVerbose( defined in errMdef.h)*/ int errVerbose=0; + + + +/**************************************************************** + * ERRSYMBLD + * + * Create the normal ell LIST of sorted error messages nodes + * Followed by linked hash lists - that thread together those + * ell nodes that have a common hash number. + * + * The hash will get you to the top of a singly linked hash list + * A linear search is then performed to find the place to + * plant/retrieve the next hashed link/message. + ***************************************************************/ +int errSymBld() +{ + ERRSYMBOL *errArray = errSymTbl->symbols; + ELLLIST *perrnumlist = &errnumlist; + ERRNUMNODE *perrNumNode = NULL; + ERRNUMNODE *pNextNode = NULL; + ERRNUMNODE **phashnode = NULL; + int i; + int modnum; + unsigned short hashInd; + + if(initialized) return(0); + hashtable = (ERRNUMNODE**)dbCalloc(NHASH, sizeof(ERRNUMNODE*)); + + for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) { + modnum = errArray->errNum >> 16; + if (modnum < 501) { + printf("errSymBld: ERROR - Module number in errSymTbl < 501\n"); + return (-1); + } + if ((errSymbolAdd(errArray->errNum, errArray->name)) <0 ) { + printf("errSymBld: ERROR - errSymbolAdd() failed \n"); + return (-1); + } + } + perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); + while (perrNumNode) { + /* hash each perrNumNode->errNum */ + hashInd = errhash(perrNumNode->errNum); + phashnode = (ERRNUMNODE**)&hashtable[hashInd]; + pNextNode = (ERRNUMNODE*) *phashnode; + /* search for last node (NULL) of hashnode linked list */ + while (pNextNode) { + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; + } + *phashnode = perrNumNode; + perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); + } + initialized = TRUE; + return(0); +} + + /**************************************************************** * HASH @@ -154,7 +206,7 @@ unsigned short errnum; modnum = errNum >> 16; errnum = errNum & 0xffff; - return((((modnum - 500) * 10) + errnum) % NHASH); + return((((modnum - 500) * 20) + errnum) % NHASH); } /**************************************************************** @@ -255,66 +307,6 @@ va_dcl return; } -/**************************************************************** - * ERRSYMBLD - * - * Create the normal ell LIST of sorted error messages nodes - * Followed by linked hash lists - that thread together those - * ell nodes that have a common hash number. - * - * The hash will get you to the top of a singly linked hash list - * A linear search is then performed to find the place to - * plant/retrieve the next hashed link/message. - ***************************************************************/ -int errSymBld() -{ - ERRSYMBOL *errArray = errSymTbl->symbols; - ERRSYMBOL *perrArray; - ELLLIST *perrnumlist = &errnumlist; - ERRNUMNODE *perrNumNode = NULL; - ERRNUMNODE *pNextNode = NULL; - ERRNUMNODE *pLastNode = NULL; - ERRNUMNODE *phashtable = hashtable; - int i; - int modnum; - unsigned short hashInd; - - for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) { - modnum = errArray->errNum >> 16; - if (modnum < 501) { - printf("errSymBld: ERROR - Module number in errSymTbl < 501\n"); - return (-1); - } - if ((errSymbolAdd(errArray->errNum, errArray->name)) <0 ) { - printf("errSymBld: ERROR - errSymbolAdd() failed \n"); - return (-1); - } - } - perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); - while (perrNumNode) { - /* hash each perrNumNode->errNum */ - hashInd = errhash(perrNumNode->errNum); - - /* if the hash table entry is empty - fill it */ - if ( phashtable[hashInd].hashnode == NULL ) { - phashtable[hashInd].hashnode = perrNumNode; - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - continue; /* and go to next entry */ - } - /* else search for the end of this hashed link list */ - pNextNode = phashtable[hashInd].hashnode; - /* search for last node (NULL) of hashnode linked list */ - while (pNextNode) { - pLastNode = pNextNode; - pNextNode = pNextNode->hashnode; - } - pLastNode->hashnode = perrNumNode; - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - } - initialized = TRUE; - return(0); -} - /**************************************************************** * ERRPRINTSTATUS ***************************************************************/ @@ -385,7 +377,6 @@ va_list pvar; "Error status (module %hu, number %hu) not in symbol table", modnum, errnum); } - if(pFormatString){ namelen = strlen(name); formatlen = strlen(pFormatString); @@ -429,37 +420,9 @@ va_list pvar; return rtnval; } -/**************************************************************** - * ERRSYMBOLFIND - ***************************************************************/ -#ifdef __STDC__ -static ERRNUMNODE *errSymbolFind (long errNum) -#else -static ERRNUMNODE *errSymbolFind(errNum) -long errNum; -#endif /* __STDC__ */ -{ - unsigned short hashInd; - ERRNUMNODE *pNextNode = NULL; - ERRNUMNODE *phashtable = hashtable; - - hashInd = errhash(errNum); - if ((pNextNode = phashtable[hashInd].hashnode) == NULL) { - return (NULL); - } - pNextNode = phashtable[hashInd].hashnode; - /* search for match of errNum */ - while (pNextNode) { - if (pNextNode->errNum == errNum) - return(pNextNode); - pNextNode = pNextNode->hashnode; - } - return (NULL); -} - /**************************************************************** * ERRSYMBOLADD - * adds symbols to the master errnumlist in sorted errNum order + * adds symbols to the master errnumlist as compiled from errSymTbl.c ***************************************************************/ #ifdef __STDC__ int errSymbolAdd (long errNum,char *name) @@ -471,32 +434,11 @@ char *name; { ELLLIST *perrnumlist = &errnumlist; ERRNUMNODE *pNew; - ERRNUMNODE *perrNumNode; - ERRNUMNODE *prevNumNode; - int insert; - int len; pNew = (ERRNUMNODE*)dbCalloc(1, sizeof(ERRNUMNODE)); pNew->errNum = errNum; - len = strlen(name); - pNew->message = (char *)dbCalloc(1, len+1); - memcpy(pNew->message, name, len); - /* find the place to put the new node */ - perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); - insert = 0; - while (perrNumNode) { - if (perrNumNode->errNum >= errNum) { /* too far */ - insert = 1; - break; - } - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - } - if (insert) { - prevNumNode = (ERRNUMNODE*)ellPrevious(perrNumNode); - ellInsert(perrnumlist,(ELLNODE*)prevNumNode,(ELLNODE*)pNew); - } else { - ellAdd(perrnumlist,(ELLNODE*)pNew); - } + pNew->message = name; + ellAdd(perrnumlist,(ELLNODE*)pNew); return(0); } @@ -536,20 +478,29 @@ int ModSymFind(status, pname, pvalue) #endif /* __STDC__ */ { unsigned short modNum; - ERRNUMNODE *pRetNode; + unsigned short hashInd; + ERRNUMNODE *pNextNode; + ERRNUMNODE **phashnode = NULL; modNum = (status >> 16); if (modNum < 501) { *pvalue = -1; return; } - if ((pRetNode = errSymbolFind(status)) == NULL) { - *pvalue = -1; - return; + hashInd = errhash(status); + phashnode = (ERRNUMNODE**)&hashtable[hashInd]; + pNextNode = *phashnode; + while (pNextNode) { + if (pNextNode->errNum == status) { + strcpy(pname, pNextNode->message); + *pvalue = status; + return; + } + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; } - strcpy(pname, pRetNode->message); - *pvalue = status; - return; + *pvalue = -1; + return ; } /**************************************************************** @@ -589,13 +540,14 @@ int errSymFind(status, name) else return (0); } + +#if 1 /**************************************************************** * ERRSYMFINDTST ***************************************************************/ void errSymFindTst() { - ERRNUMNODE *phashtable = hashtable; ERRNUMNODE *pNextNode; char message[128]; unsigned short modnum; @@ -603,7 +555,7 @@ void errSymFindTst() int i; for ( i=0; ierrNum >> 16; errnum = pNextNode->errNum & 0xffff; - printf("\tmodule=%d errnum=%d\n\tmessage=\"%s\"\n" + printf("\tmod %d num %d \"%s\"\n" , modnum , errnum , pNextNode->message); msgcount++; - pLastNode = pNextNode; - pNextNode=pNextNode->hashnode; + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; } } printf("\nerrSymDump: total number of error messages=%d\n", msgcount); @@ -676,16 +636,20 @@ long errNum; unsigned short modnum; unsigned short errnum; + if (!initialized) + errSymBld(); + message[0] = '\0'; modnum = errNum >> 16; errnum = errNum & 0xffff; if (modnum < 501) { + printf("Usage: errSymTestPrint(long errNum) \n"); printf("errSymTestPrint: module number < 501 \n"); return; } errSymFind(errNum, message); if ( message[0] == '\0' ) return; - printf("module %hu number %hu message='%s'\n", + printf("module %hu number %hu message=\"%s\"\n", modnum, errnum, message); return; } diff --git a/src/libCom/error/errSymLib.c b/src/libCom/error/errSymLib.c index 4b9014923..c18b0f17f 100644 --- a/src/libCom/error/errSymLib.c +++ b/src/libCom/error/errSymLib.c @@ -61,42 +61,6 @@ * rcz of errSymTable lookup. */ -/* - * TODO - * 1. Put everything in errSymLib.c - DONE - * get rid of error.h - DONE - * function prototypes in errMdef.h - (DONE ???) - * 2. Nick to fix calink.h error comments. - * 3. Fix trailing blanks on S_... -- DONE - * 4. In iocinit - make a call to errSymBld to make it initialize. - * - */ - -/****************************** - * FUNCTIONS - * errhash - NEW - * errPrintf - N/C - * errPrintStatus - N/C - * verrPrintStatus - N/C - * errSymBld - complete rework - * errSymbolAdd - NEW - * errSymbolFind - NEW - * errSymFind - * UnixSymFind - N/C - * ModSymFind - * errSymDump - NEW - * errSymFindTst - NEW - * main - in errMtst.c - * Program errMtst calls: - * errSymBld - * errSymDump - * errSymFindTst - * - * errSymTest - in errMtst.c - not implemented yet (not needed ??? ) - * errSymTest(501, 0, 100) - * errSymTest(int modnum, int begErrNum, int endErrNum) - ***********************************/ - #include #include #include @@ -113,17 +77,47 @@ extern SYMTAB_ID statSymTbl; extern int errToLogMsg; #else -#include -#include #include extern int errno; extern int sys_nerr; extern char *sys_errlist[]; #endif +#define LOCAL static +#ifndef NELEMENTS +#define NELEMENTS(array) /* number of elements in an array */ \ + (sizeof (array) / sizeof ((array) [0])) +#endif + +typedef struct /* ERRSYMBOL - entry in symbol table */ + { + char *name; /* pointer to symbol name */ + long errNum; /* errMessage symbol number */ + } ERRSYMBOL; +typedef struct /* ERRSYMTAB - symbol table */ + { + short nsymbols; /* current number of symbols in table */ + ERRSYMBOL *symbols; /* ptr to array of symbol entries */ + } ERRSYMTAB; +typedef ERRSYMTAB *ERRSYMTAB_ID; +#ifdef vxWorks +#define MYERRNO (errnoGet()&0xffff) +#else +#define MYERRNO errno +#endif + +typedef struct errnumnode { + ELLNODE node; + long errNum; + struct errnumnode *hashnode; + char *message; + long pad; +} ERRNUMNODE; +#define NHASH 256 + static ELLLIST errnumlist; -static ERRNUMNODE hashtable[NHASH]; +static ERRNUMNODE **hashtable; static int initialized = FALSE; extern ERRSYMTAB_ID errSymTbl; @@ -135,6 +129,64 @@ int errToLogMsg = FALSE; /*Declare storage for errVerbose( defined in errMdef.h)*/ int errVerbose=0; + + + +/**************************************************************** + * ERRSYMBLD + * + * Create the normal ell LIST of sorted error messages nodes + * Followed by linked hash lists - that thread together those + * ell nodes that have a common hash number. + * + * The hash will get you to the top of a singly linked hash list + * A linear search is then performed to find the place to + * plant/retrieve the next hashed link/message. + ***************************************************************/ +int errSymBld() +{ + ERRSYMBOL *errArray = errSymTbl->symbols; + ELLLIST *perrnumlist = &errnumlist; + ERRNUMNODE *perrNumNode = NULL; + ERRNUMNODE *pNextNode = NULL; + ERRNUMNODE **phashnode = NULL; + int i; + int modnum; + unsigned short hashInd; + + if(initialized) return(0); + hashtable = (ERRNUMNODE**)dbCalloc(NHASH, sizeof(ERRNUMNODE*)); + + for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) { + modnum = errArray->errNum >> 16; + if (modnum < 501) { + printf("errSymBld: ERROR - Module number in errSymTbl < 501\n"); + return (-1); + } + if ((errSymbolAdd(errArray->errNum, errArray->name)) <0 ) { + printf("errSymBld: ERROR - errSymbolAdd() failed \n"); + return (-1); + } + } + perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); + while (perrNumNode) { + /* hash each perrNumNode->errNum */ + hashInd = errhash(perrNumNode->errNum); + phashnode = (ERRNUMNODE**)&hashtable[hashInd]; + pNextNode = (ERRNUMNODE*) *phashnode; + /* search for last node (NULL) of hashnode linked list */ + while (pNextNode) { + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; + } + *phashnode = perrNumNode; + perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); + } + initialized = TRUE; + return(0); +} + + /**************************************************************** * HASH @@ -154,7 +206,7 @@ unsigned short errnum; modnum = errNum >> 16; errnum = errNum & 0xffff; - return((((modnum - 500) * 10) + errnum) % NHASH); + return((((modnum - 500) * 20) + errnum) % NHASH); } /**************************************************************** @@ -255,66 +307,6 @@ va_dcl return; } -/**************************************************************** - * ERRSYMBLD - * - * Create the normal ell LIST of sorted error messages nodes - * Followed by linked hash lists - that thread together those - * ell nodes that have a common hash number. - * - * The hash will get you to the top of a singly linked hash list - * A linear search is then performed to find the place to - * plant/retrieve the next hashed link/message. - ***************************************************************/ -int errSymBld() -{ - ERRSYMBOL *errArray = errSymTbl->symbols; - ERRSYMBOL *perrArray; - ELLLIST *perrnumlist = &errnumlist; - ERRNUMNODE *perrNumNode = NULL; - ERRNUMNODE *pNextNode = NULL; - ERRNUMNODE *pLastNode = NULL; - ERRNUMNODE *phashtable = hashtable; - int i; - int modnum; - unsigned short hashInd; - - for (i = 0; i < errSymTbl->nsymbols; i++, errArray++) { - modnum = errArray->errNum >> 16; - if (modnum < 501) { - printf("errSymBld: ERROR - Module number in errSymTbl < 501\n"); - return (-1); - } - if ((errSymbolAdd(errArray->errNum, errArray->name)) <0 ) { - printf("errSymBld: ERROR - errSymbolAdd() failed \n"); - return (-1); - } - } - perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); - while (perrNumNode) { - /* hash each perrNumNode->errNum */ - hashInd = errhash(perrNumNode->errNum); - - /* if the hash table entry is empty - fill it */ - if ( phashtable[hashInd].hashnode == NULL ) { - phashtable[hashInd].hashnode = perrNumNode; - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - continue; /* and go to next entry */ - } - /* else search for the end of this hashed link list */ - pNextNode = phashtable[hashInd].hashnode; - /* search for last node (NULL) of hashnode linked list */ - while (pNextNode) { - pLastNode = pNextNode; - pNextNode = pNextNode->hashnode; - } - pLastNode->hashnode = perrNumNode; - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - } - initialized = TRUE; - return(0); -} - /**************************************************************** * ERRPRINTSTATUS ***************************************************************/ @@ -385,7 +377,6 @@ va_list pvar; "Error status (module %hu, number %hu) not in symbol table", modnum, errnum); } - if(pFormatString){ namelen = strlen(name); formatlen = strlen(pFormatString); @@ -429,37 +420,9 @@ va_list pvar; return rtnval; } -/**************************************************************** - * ERRSYMBOLFIND - ***************************************************************/ -#ifdef __STDC__ -static ERRNUMNODE *errSymbolFind (long errNum) -#else -static ERRNUMNODE *errSymbolFind(errNum) -long errNum; -#endif /* __STDC__ */ -{ - unsigned short hashInd; - ERRNUMNODE *pNextNode = NULL; - ERRNUMNODE *phashtable = hashtable; - - hashInd = errhash(errNum); - if ((pNextNode = phashtable[hashInd].hashnode) == NULL) { - return (NULL); - } - pNextNode = phashtable[hashInd].hashnode; - /* search for match of errNum */ - while (pNextNode) { - if (pNextNode->errNum == errNum) - return(pNextNode); - pNextNode = pNextNode->hashnode; - } - return (NULL); -} - /**************************************************************** * ERRSYMBOLADD - * adds symbols to the master errnumlist in sorted errNum order + * adds symbols to the master errnumlist as compiled from errSymTbl.c ***************************************************************/ #ifdef __STDC__ int errSymbolAdd (long errNum,char *name) @@ -471,32 +434,11 @@ char *name; { ELLLIST *perrnumlist = &errnumlist; ERRNUMNODE *pNew; - ERRNUMNODE *perrNumNode; - ERRNUMNODE *prevNumNode; - int insert; - int len; pNew = (ERRNUMNODE*)dbCalloc(1, sizeof(ERRNUMNODE)); pNew->errNum = errNum; - len = strlen(name); - pNew->message = (char *)dbCalloc(1, len+1); - memcpy(pNew->message, name, len); - /* find the place to put the new node */ - perrNumNode = (ERRNUMNODE *) ellFirst(perrnumlist); - insert = 0; - while (perrNumNode) { - if (perrNumNode->errNum >= errNum) { /* too far */ - insert = 1; - break; - } - perrNumNode = (ERRNUMNODE *) ellNext((ELLNODE *) perrNumNode); - } - if (insert) { - prevNumNode = (ERRNUMNODE*)ellPrevious(perrNumNode); - ellInsert(perrnumlist,(ELLNODE*)prevNumNode,(ELLNODE*)pNew); - } else { - ellAdd(perrnumlist,(ELLNODE*)pNew); - } + pNew->message = name; + ellAdd(perrnumlist,(ELLNODE*)pNew); return(0); } @@ -536,20 +478,29 @@ int ModSymFind(status, pname, pvalue) #endif /* __STDC__ */ { unsigned short modNum; - ERRNUMNODE *pRetNode; + unsigned short hashInd; + ERRNUMNODE *pNextNode; + ERRNUMNODE **phashnode = NULL; modNum = (status >> 16); if (modNum < 501) { *pvalue = -1; return; } - if ((pRetNode = errSymbolFind(status)) == NULL) { - *pvalue = -1; - return; + hashInd = errhash(status); + phashnode = (ERRNUMNODE**)&hashtable[hashInd]; + pNextNode = *phashnode; + while (pNextNode) { + if (pNextNode->errNum == status) { + strcpy(pname, pNextNode->message); + *pvalue = status; + return; + } + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; } - strcpy(pname, pRetNode->message); - *pvalue = status; - return; + *pvalue = -1; + return ; } /**************************************************************** @@ -589,13 +540,14 @@ int errSymFind(status, name) else return (0); } + +#if 1 /**************************************************************** * ERRSYMFINDTST ***************************************************************/ void errSymFindTst() { - ERRNUMNODE *phashtable = hashtable; ERRNUMNODE *pNextNode; char message[128]; unsigned short modnum; @@ -603,7 +555,7 @@ void errSymFindTst() int i; for ( i=0; ierrNum >> 16; errnum = pNextNode->errNum & 0xffff; - printf("\tmodule=%d errnum=%d\n\tmessage=\"%s\"\n" + printf("\tmod %d num %d \"%s\"\n" , modnum , errnum , pNextNode->message); msgcount++; - pLastNode = pNextNode; - pNextNode=pNextNode->hashnode; + phashnode = &pNextNode->hashnode; + pNextNode = *phashnode; } } printf("\nerrSymDump: total number of error messages=%d\n", msgcount); @@ -676,16 +636,20 @@ long errNum; unsigned short modnum; unsigned short errnum; + if (!initialized) + errSymBld(); + message[0] = '\0'; modnum = errNum >> 16; errnum = errNum & 0xffff; if (modnum < 501) { + printf("Usage: errSymTestPrint(long errNum) \n"); printf("errSymTestPrint: module number < 501 \n"); return; } errSymFind(errNum, message); if ( message[0] == '\0' ) return; - printf("module %hu number %hu message='%s'\n", + printf("module %hu number %hu message=\"%s\"\n", modnum, errnum, message); return; }