From 13a13ed91417798576f55ea5a1d7385f442b810c Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Wed, 25 Jun 1997 06:17:38 +0000 Subject: [PATCH] fixed warnings --- src/ca/acctst.c | 17 +-- src/db/dbAddr.h | 10 +- src/gdd/Makefile.Host | 1 - src/gdd/aitHelpers.cc | 7 +- src/gdd/gdd.cc | 9 +- src/gdd/gddAppFuncTable.cc | 211 ------------------------------------- src/gdd/gddAppFuncTable.h | 179 +++++++++++++++++++++++++++++++ src/gdd/gddNewDel.cc | 4 + src/gdd/gddSemaphore.h | 6 +- src/gdd/gddTest.cc | 9 +- 10 files changed, 220 insertions(+), 233 deletions(-) delete mode 100644 src/gdd/gddAppFuncTable.cc diff --git a/src/ca/acctst.c b/src/ca/acctst.c index 6ad84e6b6..25744f814 100644 --- a/src/ca/acctst.c +++ b/src/ca/acctst.c @@ -7,6 +7,9 @@ static char *sccsId = "@(#) $Id$"; /* * $Log$ + * Revision 1.46 1997/06/13 09:14:09 jhill + * connect/search proto changes + * * Revision 1.45 1997/04/29 06:07:16 jhill * local host connect compatible * @@ -490,7 +493,7 @@ int doacctst(char *pname) iter = (unsigned long) (FLT_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } floatTest(chix1, base, incr, epsil, iter); } @@ -501,7 +504,7 @@ int doacctst(char *pname) iter = (unsigned long) (FLT_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } floatTest(chix1, base, incr, epsil, iter); } @@ -512,7 +515,7 @@ int doacctst(char *pname) iter = (unsigned long) (FLT_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } floatTest(chix1, base, incr, epsil, iter); } @@ -542,7 +545,7 @@ int doacctst(char *pname) iter = (unsigned long) (DBL_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } doubleTest(chix1, base, incr, epsil, iter); } @@ -553,7 +556,7 @@ int doacctst(char *pname) iter = (unsigned long) (DBL_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } doubleTest(chix1, base, incr, epsil, iter); } @@ -564,7 +567,7 @@ int doacctst(char *pname) iter = (unsigned long) (DBL_MAX/fabs(incr)); } else { - iter = 10.0; + iter = 10ul; } doubleTest(chix1, base, incr, epsil, iter); } @@ -856,7 +859,7 @@ int doacctst(char *pname) pT1 = pWF; pEF = &pWF[ca_element_count(chix1)]; while(pT1, ",(int)str,str); + fprintf(stderr,"this=%p ", this); + if(str) fprintf(stderr,"string=%p<%s>, ",str,str); else fprintf(stderr,"no string present, "); fprintf(stderr,"length=%d, ",(int)len); if(type==aitStrConst) fprintf(stderr,"type=Constant\n"); diff --git a/src/gdd/gdd.cc b/src/gdd/gdd.cc index b773fc9a2..57f49464e 100644 --- a/src/gdd/gdd.cc +++ b/src/gdd/gdd.cc @@ -4,6 +4,9 @@ // $Id$ // // $Log$ +// Revision 1.21 1997/04/23 17:12:57 jhill +// fixed export of symbols from WIN32 DLL +// // Revision 1.20 1997/03/21 01:56:01 jbk // *** empty log message *** // @@ -834,8 +837,8 @@ int gdd::flattenDDs(gddContainer* dd, void* buf, size_t size) gddStatus gdd::convertOffsetsToAddress(void) { aitUint8* pdd = (aitUint8*)this; - aitUint32 bnds = (aitUint32)(bounds); - aitUint32 dp = (aitUint32)(dataPointer()); + unsigned long bnds = (unsigned long)(bounds); + unsigned long dp = (unsigned long)(dataPointer()); gdd* tdd; gddContainer* cdd; gddCursor cur; @@ -853,7 +856,7 @@ gddStatus gdd::convertOffsetsToAddress(void) for(tdd=cur.first();tdd;tdd=cur.next()) { - if(tdd->next()) tdd->setNext((gdd*)(pdd+(aitUint32)tdd->next())); + if(tdd->next()) tdd->setNext((gdd*)(pdd+(unsigned long)tdd->next())); tdd->convertOffsetsToAddress(); } } diff --git a/src/gdd/gddAppFuncTable.cc b/src/gdd/gddAppFuncTable.cc deleted file mode 100644 index 797a3a2d1..000000000 --- a/src/gdd/gddAppFuncTable.cc +++ /dev/null @@ -1,211 +0,0 @@ -/* - * $Id$ - * - * Author Jeffrey O. Hill - * johill@lanl.gov - * 505 665 1831 - * - * Experimental Physics and Industrial Control System (EPICS) - * - * Copyright 1991, the Regents of the University of California, - * and the University of Chicago Board of Governors. - * - * This software was produced under U.S. Government contracts: - * (W-7405-ENG-36) at the Los Alamos National Laboratory, - * and (W-31-109-ENG-38) at Argonne National Laboratory. - * - * Initial development by: - * The Controls and Automation Group (AT-8) - * Ground Test Accelerator - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Co-developed with - * The Controls and Computing Group - * Accelerator Systems Division - * Advanced Photon Source - * Argonne National Laboratory - * - * - * History - * $Log$ - * - */ - -#include - -// -// gddAppFuncTable::installReadFunc() -// -// The 2nd parameter has type "gddAppReadFunc" which is -// a ptr to member function. The member function should -// be declared as follows: -// -// gddAppFuncTableStatus PV::memberFunction(gdd &value); -// -// The typedef is not used here because of portability -// problems resulting from compiler weaknesses -// -template -gddAppFuncTableStatus gddAppFuncTable::installReadFunc( - const unsigned type, - gddAppFuncTableStatus (PV::*pMFuncIn)(gdd &value)) -{ - // - // Attempt to expand the table if the app type will not fit - // - if (type>=this->appTableNElem) { - this->newTbl(type); - if (type>=this->appTableNElem) { - return S_gddAppFuncTable_noMemory; - } - } - this->pMFuncRead[type]=pMFuncIn; - return S_gddAppFuncTable_Success; -} - -// -// installReadFunc() -// -// The 2nd parameter has type "gddAppReadFunc" which is -// a ptr to member function. The member function should -// be declared as follows: -// -// gddAppFuncTableStatus PV::memberFunction(gdd &value); -// -template -gddAppFuncTableStatus gddAppFuncTable::installReadFunc( - const char * const pName, - gddAppFuncTableStatus (PV::*pMFuncIn)(gdd &value)) -{ - aitUint32 type; - gddStatus rc; - - rc = gddApplicationTypeTable:: - app_table.registerApplicationType (pName, type); - if (rc!=0 && rc!=gddErrorAlreadyDefined) { - printf( -"at gdd lib limit => read of PV attribute \"%s\" will fail\n", pName); - return S_gddAppFuncTable_gddLimit; - } -# ifdef DEBUG - printf("installing PV attribute %s = %d\n", pName, type); -# endif - return this->installReadFunc(type, pMFuncIn); -} - -// -// gddAppFuncTable::newTbl() -// -// The total number of application tags to manage should be -// hidden from the application -// -// The typedef is not used here because of portability -// problems resulting from compiler weaknesses -// -template -void gddAppFuncTable::newTbl(unsigned newApplTypeMax) -{ - gddAppReadFunc *pMNewFuncTbl; - unsigned maxApp; - unsigned i; - - if (this->appTableNElem>newApplTypeMax) { - return; - } - maxApp = newApplTypeMax+(1u<<6u); -# ifdef _MSC_VER - // - // Right now all MS Visual C++ compilers allocate the - // wrong amount of memory (i.e. too little) - // for member function pointers, - // only explicit calculation via sizeof() works. - // For future versions this may become "if _MSC_VER < ???"... - // - pMNewFuncTbl = (gddAppReadFunc *) - new char[sizeof(gddAppReadFunc) * maxApp]; -# else - pMNewFuncTbl = new gddAppReadFunc[maxApp]; -# endif - if (pMNewFuncTbl) { - for (i=0u; iappTableNElem) { - pMNewFuncTbl[i] = this->pMFuncRead[i]; - } - else { - // - // some versions of NULL include (void *) cast - // (so I am using vanilla zero here) - // - pMNewFuncTbl[i] = 0; - } - } - if (this->pMFuncRead) { - delete [] this->pMFuncRead; - } - this->pMFuncRead = pMNewFuncTbl; - this->appTableNElem = maxApp; - } -} - - -// -// gddAppFuncTable::read() -// -template -gddAppFuncTableStatus gddAppFuncTable::read(PV &pv, gdd &value) -{ - gddAppFuncTableStatus status; - - // - // if this gdd is a container then step through it - // and fetch all of the values inside - // - if (value.isContainer()) { - gddContainer *pCont = (gddContainer *) &value; - gddCursor curs = pCont->getCursor(); - gdd *pItem; - - status = S_gddAppFuncTable_Success; - for (pItem=curs.first(); pItem; pItem=curs.next()) - { - status = this->read(pv, *pItem); - if (status) { - break; - } - } - return status; - } - return callReadFunc(pv, value); -} - -// -// gddAppFuncTable::callReadFunc() -// -template -gddAppFuncTableStatus gddAppFuncTable::callReadFunc (PV &pv, gdd &value) -{ - unsigned type = value.applicationType(); - gddAppReadFunc pFunc; - - // - // otherwise call the function associated - // with this application type - // - type = value.applicationType(); - if (type>=this->appTableNElem) { - errPrintf (S_gddAppFuncTable_badType, __FILE__, - __LINE__, "- large appl type code = %u\n", - type); - return S_gddAppFuncTable_badType; - } - pFunc = this->pMFuncRead[type]; - if (pFunc==NULL) { - errPrintf (S_gddAppFuncTable_badType, __FILE__, - __LINE__, "- ukn appl type code = %u\n", - type); - return S_gddAppFuncTable_badType; - } - return (pv.*pFunc)(value); -} - diff --git a/src/gdd/gddAppFuncTable.h b/src/gdd/gddAppFuncTable.h index b6018a089..d91c08da6 100644 --- a/src/gdd/gddAppFuncTable.h +++ b/src/gdd/gddAppFuncTable.h @@ -29,6 +29,9 @@ * * History * $Log$ + * Revision 1.4 1996/11/22 20:37:19 jhill + * converted large inline templ funcs + * * Revision 1.3 1996/09/04 20:58:18 jhill * changes for MS VISC++ * @@ -137,5 +140,181 @@ private: void newTbl(unsigned neMaxType); }; +// +// gddAppFuncTable::installReadFunc() +// +// The 2nd parameter has type "gddAppReadFunc" which is +// a ptr to member function. The member function should +// be declared as follows: +// +// gddAppFuncTableStatus PV::memberFunction(gdd &value); +// +// The typedef is not used here because of portability +// problems resulting from compiler weaknesses +// +template +gddAppFuncTableStatus gddAppFuncTable::installReadFunc( + const unsigned type, + gddAppFuncTableStatus (PV::*pMFuncIn)(gdd &value)) +{ + // + // Attempt to expand the table if the app type will not fit + // + if (type>=this->appTableNElem) { + this->newTbl(type); + if (type>=this->appTableNElem) { + return S_gddAppFuncTable_noMemory; + } + } + this->pMFuncRead[type]=pMFuncIn; + return S_gddAppFuncTable_Success; +} + +// +// installReadFunc() +// +// The 2nd parameter has type "gddAppReadFunc" which is +// a ptr to member function. The member function should +// be declared as follows: +// +// gddAppFuncTableStatus PV::memberFunction(gdd &value); +// +template +gddAppFuncTableStatus gddAppFuncTable::installReadFunc( + const char * const pName, + gddAppFuncTableStatus (PV::*pMFuncIn)(gdd &value)) +{ + aitUint32 type; + gddStatus rc; + + rc = gddApplicationTypeTable:: + app_table.registerApplicationType (pName, type); + if (rc!=0 && rc!=gddErrorAlreadyDefined) { + printf( +"at gdd lib limit => read of PV attribute \"%s\" will fail\n", pName); + return S_gddAppFuncTable_gddLimit; + } +# ifdef DEBUG + printf("installing PV attribute %s = %d\n", pName, type); +# endif + return this->installReadFunc(type, pMFuncIn); +} + +// +// gddAppFuncTable::newTbl() +// +// The total number of application tags to manage should be +// hidden from the application +// +// The typedef is not used here because of portability +// problems resulting from compiler weaknesses +// +template +void gddAppFuncTable::newTbl(unsigned newApplTypeMax) +{ + gddAppReadFunc *pMNewFuncTbl; + unsigned maxApp; + unsigned i; + + if (this->appTableNElem>newApplTypeMax) { + return; + } + maxApp = newApplTypeMax+(1u<<6u); +# ifdef _MSC_VER + // + // Right now all MS Visual C++ compilers allocate the + // wrong amount of memory (i.e. too little) + // for member function pointers, + // only explicit calculation via sizeof() works. + // For future versions this may become "if _MSC_VER < ???"... + // + pMNewFuncTbl = (gddAppReadFunc *) + new char[sizeof(gddAppReadFunc) * maxApp]; +# else + pMNewFuncTbl = new gddAppReadFunc[maxApp]; +# endif + if (pMNewFuncTbl) { + for (i=0u; iappTableNElem) { + pMNewFuncTbl[i] = this->pMFuncRead[i]; + } + else { + // + // some versions of NULL include (void *) cast + // (so I am using vanilla zero here) + // + pMNewFuncTbl[i] = 0; + } + } + if (this->pMFuncRead) { + delete [] this->pMFuncRead; + } + this->pMFuncRead = pMNewFuncTbl; + this->appTableNElem = maxApp; + } +} + + +// +// gddAppFuncTable::read() +// +template +gddAppFuncTableStatus gddAppFuncTable::read(PV &pv, gdd &value) +{ + gddAppFuncTableStatus status; + + // + // if this gdd is a container then step through it + // and fetch all of the values inside + // + if (value.isContainer()) { + gddContainer *pCont = (gddContainer *) &value; + gddCursor curs = pCont->getCursor(); + gdd *pItem; + + status = S_gddAppFuncTable_Success; + for (pItem=curs.first(); pItem; pItem=curs.next()) + { + status = this->read(pv, *pItem); + if (status) { + break; + } + } + return status; + } + return callReadFunc(pv, value); +} + +// +// gddAppFuncTable::callReadFunc() +// +template +gddAppFuncTableStatus gddAppFuncTable::callReadFunc (PV &pv, gdd &value) +{ + unsigned type = value.applicationType(); + gddAppReadFunc pFunc; + + // + // otherwise call the function associated + // with this application type + // + type = value.applicationType(); + if (type>=this->appTableNElem) { + errPrintf (S_gddAppFuncTable_badType, __FILE__, + __LINE__, "- large appl type code = %u\n", + type); + return S_gddAppFuncTable_badType; + } + pFunc = this->pMFuncRead[type]; + if (pFunc==NULL) { + errPrintf (S_gddAppFuncTable_badType, __FILE__, + __LINE__, "- ukn appl type code = %u\n", + type); + return S_gddAppFuncTable_badType; + } + return (pv.*pFunc)(value); +} + + #endif // gddAppFuncTableH diff --git a/src/gdd/gddNewDel.cc b/src/gdd/gddNewDel.cc index 7e4e08f3d..772284031 100644 --- a/src/gdd/gddNewDel.cc +++ b/src/gdd/gddNewDel.cc @@ -4,6 +4,9 @@ // $Id$ // // $Log$ +// Revision 1.1 1996/06/25 19:11:45 jbk +// new in EPICS base +// // // *Revision 1.2 1996/06/24 03:15:37 jbk @@ -11,6 +14,7 @@ // *Revision 1.1 1996/05/31 13:15:31 jbk // *add new stuff +#define epicsExportSharedSymbols #include "gddNewDel.h" #include diff --git a/src/gdd/gddSemaphore.h b/src/gdd/gddSemaphore.h index adfe564c2..9d6e70cfa 100644 --- a/src/gdd/gddSemaphore.h +++ b/src/gdd/gddSemaphore.h @@ -7,10 +7,14 @@ * * $Id$ * $Log$ + * Revision 1.1 1997/03/21 01:56:10 jbk + * *** empty log message *** + * * */ #include "aitTypes.h" +#include "shareLib.h" // ------------------------- semaphores --------------------------- @@ -25,7 +29,7 @@ typedef enum { gddSemEmpty, gddSemFull } gddSemType; // Semaphores default to "Full" -class gddSemaphore +class epicsShareClass gddSemaphore { public: gddSemaphore(void); diff --git a/src/gdd/gddTest.cc b/src/gdd/gddTest.cc index 7b9858d36..2bcbfd67b 100644 --- a/src/gdd/gddTest.cc +++ b/src/gdd/gddTest.cc @@ -4,6 +4,9 @@ // $Id$ // // $Log$ +// Revision 1.7 1997/04/23 17:13:05 jhill +// fixed export of symbols from WIN32 DLL +// // Revision 1.6 1996/12/20 13:11:42 jbk // More strings yet printed now // @@ -74,7 +77,7 @@ void gdd::dumpInfo(void) prt_tot=sz_elem>max?max:sz_elem; - fprintf(stderr,"----------dump This=%8.8x---------\n",(unsigned int)this); + fprintf(stderr,"----------dump This=%p---------\n", this); fprintf(stderr," dimension=%d ",(int)dimension()); fprintf(stderr,"app-type=%d ",(int)applicationType()); @@ -235,9 +238,9 @@ void gdd::dumpInfo(void) if(!isScalar()) { if(destruct) - fprintf(stderr," destructor=%8.8x\n",(int)destruct); + fprintf(stderr," destructor=%p\n", destruct); else - fprintf(stderr," destructor=NULL\n",(int)destruct); + fprintf(stderr," destructor=NULL\n"); } for(i=0;i