diff --git a/src/as/asDbLib.c b/src/as/asDbLib.c index 099a01c57..df003e308 100644 --- a/src/as/asDbLib.c +++ b/src/as/asDbLib.c @@ -114,7 +114,11 @@ static long asInitCommon(void) firstTime = FALSE; if(!pacf) return(0); /*access security will NEVER be turned on*/ } else { - if(!asActive) return(S_asLib_asNotActive); + if(!asActive) { + printf("Access security is NOT enabled." + " Was asSetFilename specified before iocInit?\n"); + return(S_asLib_asNotActive); + } if(pacf) { asCaStop(); } else { /*Just leave everything as is */ @@ -131,9 +135,6 @@ static long asInitCommon(void) int asInit(void) { - - /*If no access configuration file defined return success*/ - if(!pacf) return(0); return(asInitCommon()); } diff --git a/src/bpt/cvtBpt.c b/src/bpt/cvtBpt.c index a05cb647a..529d91c34 100644 --- a/src/bpt/cvtBpt.c +++ b/src/bpt/cvtBpt.c @@ -50,28 +50,19 @@ extern struct dbBase *pdbbase; static brkTable *findBrkTable(short linr) { - brkTable *pbrkTable; dbMenu *pdbMenu; - char name[50]; - char *pname = name; - int len,ind; - pdbMenu = dbFindMenu(pdbbase,"menuConvert"); - len = strlen(pdbMenu->papChoiceValue[linr]); - if(len>=sizeof(name)) { - epicsPrintf("Break Tables(findBrkTable) choice name too long\n"); + if(!pdbMenu) { + epicsPrintf("findBrkTable: menuConvert does not exist\n"); return(0); } - strcpy(pname,pdbMenu->papChoiceValue[linr]); - for(ind=0; ind=pdbMenu->nChoice) { + epicsPrintf("findBrkTable linr %d but menuConvert has %d choices\n", + linr,pdbMenu->nChoice); + return(0); } - pbrkTable = dbFindBrkTable(pdbbase,pname); - return(pbrkTable); + return(dbFindBrkTable(pdbbase,pdbMenu->papChoiceValue[linr])); } long cvtRawToEngBpt(double *pval,short linr,short init, void **ppbrk, diff --git a/src/cxxTemplates/resourceLib.h b/src/cxxTemplates/resourceLib.h index 219d1d93d..dd42fe8fa 100644 --- a/src/cxxTemplates/resourceLib.h +++ b/src/cxxTemplates/resourceLib.h @@ -1,7 +1,9 @@ /* * $Id$ * - * Author Jeffrey O. Hill + * Author Jeffrey O. Hill + * (string hash alg by Marty Kraimer and Peter K. Pearson) + * * johill@lanl.gov * 505 665 1831 * @@ -29,6 +31,19 @@ * * History * $Log$ + * Revision 1.22 1999/01/29 23:03:02 jhill + * doc + * + * Revision 1.21 1999/01/29 22:51:09 jhill + * reinstalled const cast away + * + * Revision 1.20 1999/01/29 22:36:53 jhill + * removed const cast away + * + * Revision 1.19 1998/10/23 19:23:46 jhill + * fixed problem associated with deleting "const char *" + * on the solaris compiler + * * Revision 1.18 1998/10/23 00:20:40 jhill * attempted to clean up HP-UX warnings * @@ -692,13 +707,16 @@ stringId::~stringId() // // the HP-UX compiler gives us a warning on // each cast away of const, but in this case - // it cant be avoided + // it cant be avoided. + // + // The DEC compiler complains that const isnt + // really significant in a cast if it is present. // // I hope that deleting a pointer to "char" // is the same as deleting a pointer to // "const char" on all compilers // - delete [] (char * const) this->pStr; + delete [] (char *) this->pStr; } } } diff --git a/src/cxxTemplates/tsBTree.h b/src/cxxTemplates/tsBTree.h index 27bad465a..0a9043ad2 100644 --- a/src/cxxTemplates/tsBTree.h +++ b/src/cxxTemplates/tsBTree.h @@ -22,6 +22,8 @@ public: T * const pNewSeg; }; +template class tsBTree; + // // tsBTreeNode // @@ -53,16 +55,18 @@ private: T *pLeft; T *pRight; - static void traverse(T &self, void (T::*pCB)()) + // + // run callback for evey item in the B-Treee in sort order + // + static void traverse (T &item, void (T::*pCallBack)()) { - if (self.tsBTreeNode::pLeft) { - tsBTreeNode::traverse - (*self.tsBTreeNode::pLeft, pCB); + tsBTreeNode &node = item; + if (node.pLeft) { + tsBTreeNode::traverse (*node.pLeft, pCallBack); } - (self.*pCB)(); - if (self.tsBTreeNode::pRight) { - tsBTreeNode::traverse - (*self.tsBTreeNode::pRight, pCB); + (item.*pCallBack)(); + if (node.pRight) { + tsBTreeNode::traverse (*node.pRight, pCallBack); } } @@ -73,23 +77,22 @@ private: // static void insert(T &self, T &item) { + tsBTreeNode &node = self; btCmp result = item.tsBTreeCompare(self); if (result==btLessOrEqual) { - if (self.tsBTreeNode::pLeft) { - tsBTreeNode::insert - (*self.tsBTreeNode::pLeft, item); + if (node.pLeft) { + tsBTreeNode::insert (*node.pLeft, item); } else { - self.tsBTreeNode::pLeft = &item; + node.pLeft = &item; } } else if(result==btGreater) { - if (self.tsBTreeNode::pRight) { - tsBTreeNode::insert - (*self.tsBTreeNode::pRight, item); + if (node.pRight) { + tsBTreeNode::insert (*node.pRight, item); } else { - self.tsBTreeNode::pRight = &item; + node.pRight = &item; } } else { @@ -104,51 +107,50 @@ private: // static tsBTreeRMRet remove(T &self, T &item) { + tsBTreeNode &node = self; if (&self == &item) { - if (self.tsBTreeNode::pLeft) { - if (self.tsBTreeNode::pRight) { - T *pR = self.tsBTreeNode::pLeft->tsBTreeNode::pRight; + if (node.pLeft) { + if (node.pRight) { + tsBTreeNode *pLeftNode = node.pLeft; + tsBTreeNode *pRightNode = node.pRight; + T *pR = pLeftNode->pRight; if (pR) { - tsBTreeNode::insert - (*pR, *self.tsBTreeNode::pRight); + tsBTreeNode::insert (*pR, *node.pRight); } else { - self.tsBTreeNode::pLeft->tsBTreeNode::pRight = - self.tsBTreeNode::pRight; + pLeftNode->pRight = node.pRight; } } - return tsBTreeRMRet(tsbtrrFound, self.tsBTreeNode::pLeft); // found it + return tsBTreeRMRet(tsbtrrFound, node.pLeft); // found it } else { - return tsBTreeRMRet(tsbtrrFound, self.tsBTreeNode::pRight); // found it + return tsBTreeRMRet(tsbtrrFound, node.pRight); // found it } } btCmp result = item.tsBTreeCompare(self); if (result==btLessOrEqual) { - if (self.tsBTreeNode::pLeft) { - tsBTreeRMRet ret = tsBTreeNode:: - remove(*self.tsBTreeNode::pLeft, item); + if (node.pLeft) { + tsBTreeRMRet ret = tsBTreeNode::remove(*node.pLeft, item); if (ret.foundIt==tsbtrrFound) { - self.tsBTreeNode::pLeft= ret.pNewSeg; - return tsBTreeRMRet(tsbtrrFound,&self); // TRUE - found it + node.pLeft= ret.pNewSeg; + return tsBTreeRMRet (tsbtrrFound, &self); // TRUE - found it } } return tsBTreeRMRet(tsbtrrNotFound, 0u); // not found } else if(result==btGreater) { - if (self.tsBTreeNode::pRight) { - tsBTreeRMRet ret = tsBTreeNode:: - remove(*self.tsBTreeNode::pRight, item); + if (node.pRight) { + tsBTreeRMRet ret = tsBTreeNode::remove(*node.pRight, item); if (ret.foundIt==tsbtrrFound) { - self.tsBTreeNode::pRight = ret.pNewSeg; + node.pRight = ret.pNewSeg; return tsBTreeRMRet(tsbtrrFound,&self); // TRUE - found it } } return tsBTreeRMRet(tsbtrrNotFound, 0u); // not found } else { - assert(0); + return tsBTreeRMRet(tsbtrrNotFound, 0u); // not found } } // @@ -156,30 +158,30 @@ private: // static unsigned verify(const T &self, const T &item) { + const tsBTreeNode &node = self; + if (&self == &item) { return 1u; // TRUE -item is present } btCmp result = item.tsBTreeCompare(self); if (result==btLessOrEqual) { - if (self.tsBTreeNode::pLeft) { - return tsBTreeNode::verify - (*self.tsBTreeNode::pLeft, item); + if (node.pLeft) { + return tsBTreeNode::verify (*node.pLeft, item); } else { return 0u; // FALSE - not found } } else if(result==btGreater) { - if (self.tsBTreeNode::pRight) { - return tsBTreeNode::verify - (*self.tsBTreeNode::pRight, item); + if (node.pRight) { + return tsBTreeNode::verify (*node.pRight, item); } else { return 0u; // FALSE - not found } } else { - assert(0); + return 0u; // FALSE - not found } } }; @@ -242,14 +244,14 @@ public: return 0u; // FALSE - not found } } - // - // Call (pT->*pCB) () for each item in the table - // - // where pT is a pointer to type T and pCB is - // a pointer to a memmber function of T with - // no parameters and returning void - // - void traverse(void (T::*pCB)()) + // + // Call (pT->*pCB) () for each item in the table + // + // where pT is a pointer to type T and pCB is + // a pointer to a memmber function of T with + // no parameters and returning void + // + void traverse(void (T::*pCB)()) { if (this->pRoot) { tsBTreeNode::traverse(*this->pRoot, pCB); diff --git a/src/cxxTemplates/tsDLList.h b/src/cxxTemplates/tsDLList.h index 1495b6c9b..9344feec7 100644 --- a/src/cxxTemplates/tsDLList.h +++ b/src/cxxTemplates/tsDLList.h @@ -31,6 +31,15 @@ * * History * $Log$ + * Revision 1.16 1999/05/03 15:39:57 jhill + * made compatible with visual C++ 6.0 + * + * Revision 1.15 1999/02/01 21:49:04 jhill + * removed redundant API + * + * Revision 1.14 1998/10/23 00:20:41 jhill + * attempted to clean up HP-UX warnings + * * Revision 1.13 1998/06/16 03:01:44 jhill * cosmetic * @@ -206,9 +215,6 @@ public: T *first(void) const { return this->pFirst; } T *last(void) const { return this->pLast; } -protected: - T *getFirst(void) const { return pFirst; } - T *getLast(void) const { return pLast; } private: T *pFirst; T *pLast; @@ -244,7 +250,17 @@ public: tsDLIterBD (T *pInitialEntry) : pEntry(pInitialEntry) {} - tsDLIterBD (const class tsDLIterBD ©In); + // + // This is apparently required by some compiler, causes + // trouble with MS Visual C 6.0, but should not be + // required by any compiler. I am assuming that the + // other compiler is a past version of MS Visual C. + // +# if defined(_MSC_VER) && _MSC_VER < 1200 + template + tsDLIterBD (const class tsDLIterBD ©In) : + pEntry(copyIn.pEntry) {} +# endif tsDLIterBD & operator = (T *pNewEntry) { @@ -325,7 +341,7 @@ public: private: T *pEntry; }; - + // // tsDLIter // @@ -498,15 +514,6 @@ public: void remove (); }; -// -// MS Visual C 6.0 requires that this code is not provided in -// the class definition because the class isnt fully defined yet -// -template -inline tsDLIterBD::tsDLIterBD(const class tsDLIterBD ©In) : - pEntry(copyIn.pEntry) {} - - // // tsDLList::remove () // diff --git a/src/cxxTemplates/tsSLList.h b/src/cxxTemplates/tsSLList.h index 6d38afeca..209798234 100644 --- a/src/cxxTemplates/tsSLList.h +++ b/src/cxxTemplates/tsSLList.h @@ -31,6 +31,14 @@ * * History * $Log$ + * Revision 1.15 1998/12/18 19:02:46 jhill + * Changed the remove() function in tsSLList class because users were + * confused by it. The name is now removeNextItem() and it is now a private + * member of class tsSLNode. + * + * Revision 1.14 1998/10/23 16:40:47 jhill + * fixed missing new line at EOF + * * Revision 1.13 1998/10/23 00:20:41 jhill * attempted to clean up HP-UX warnings * @@ -105,6 +113,20 @@ public: private: T *pNext; + + // + // removeNextItem () + // + // removes the item after this node + // + void removeNextItem () + { + T *pItem = this->pNext; + if (pItem) { + tsSLNode *pNode = pItem; + this->pNext = pNode->pNext; + } + } }; @@ -136,21 +158,6 @@ public: this->insert (item, *this); } - // - // remove () - // **** removes item after "itemBefore" **** - // (itemBefore might be the list header object and therefore - // will not always be of type T) - // - void remove (tsSLNode &itemBefore) - { - T *pItem = itemBefore.pNext; - if (pItem) { - tsSLNode *pNode = pItem; - itemBefore.pNext = pNode->pNext; - } - } - // // get () // @@ -158,7 +165,7 @@ public: { tsSLNode *pThisNode = this; T *pItem = pThisNode->pNext; - this->remove(*this); + pThisNode->removeNextItem(); return pItem; } diff --git a/src/db/callback.c b/src/db/callback.c index 5dce07798..6e1fdf1e1 100644 --- a/src/db/callback.c +++ b/src/db/callback.c @@ -186,7 +186,7 @@ static void ProcessCallback(CALLBACK *pCallback) callbackGetUser(pRec, pCallback); dbScanLock(pRec); - (*((struct rset *)pRec->rset)->process)(pRec); + (*pRec->rset->process)(pRec); dbScanUnlock(pRec); } void callbackRequestProcessCallback(CALLBACK *pCallback, diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index 9b5ef0d36..6f7487028 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -531,8 +531,8 @@ void dbScanFwdLink(struct link *plink) */ long dbProcess(dbCommon *precord) { - struct rset *prset = (struct rset *)precord->rset; - dbRecordType *pdbRecordType = (dbRecordType *)precord->rdes; + struct rset *prset = precord->rset; + dbRecordType *pdbRecordType = precord->rdes; unsigned char tpro=precord->tpro; unsigned long lset; long status = 0; @@ -624,7 +624,7 @@ long dbProcess(dbCommon *precord) /* locate record processing routine */ /* put this in iocInit() !!! */ - if (!(prset=(struct rset *)precord->rset) || !(prset->process)) { + if (!(prset=precord->rset) || !(prset->process)) { precord->pact=1;/*set pact TRUE so error is issued only once*/ recGblRecordError(S_db_noRSET, (void *)precord, "dbProcess"); status = S_db_noRSET; diff --git a/src/db/dbCommon.dbd b/src/db/dbCommon.dbd index 10441812c..1de51b6b6 100644 --- a/src/db/dbCommon.dbd +++ b/src/db/dbCommon.dbd @@ -118,6 +118,7 @@ } field(ACKT,DBF_MENU) { prompt("Alarm Ack Transient") + promptgroup(GUI_ALARMS) special(SPC_NOMOD) interest(2) menu(menuYesNo) @@ -159,25 +160,25 @@ prompt("addr of PUTNOTIFY") special(SPC_NOMOD) interest(4) - extra("void *ppn") + extra("struct putNotify *ppn") } field(PPNN,DBF_NOACCESS) { prompt("next record PUTNOTIFY") special(SPC_NOMOD) interest(4) - extra("void *ppnn") + extra("struct pnWaitNode *ppnn") } field(SPVT,DBF_NOACCESS) { prompt("Scan Private") special(SPC_NOMOD) interest(4) - extra("void *spvt") + extra("struct scan_element *spvt") } field(RSET,DBF_NOACCESS) { prompt("Address of RSET") special(SPC_NOMOD) interest(4) - extra("void *rset") + extra("struct rset *rset") } field(DSET,DBF_NOACCESS) { prompt("DSET address") @@ -195,13 +196,13 @@ prompt("Address of dbRecordType") special(SPC_NOMOD) interest(4) - extra("void *rdes") + extra("struct dbRecordType *rdes") } field(LSET,DBF_NOACCESS) { prompt("Lock Set") special(SPC_NOMOD) interest(4) - extra("void *lset") + extra("struct lockRecord *lset") } field(PRIO,DBF_MENU) { prompt("Scheduling Priority") diff --git a/src/db/dbLock.c b/src/db/dbLock.c index ea17cc60f..97b3e9f93 100644 --- a/src/db/dbLock.c +++ b/src/db/dbLock.c @@ -175,7 +175,7 @@ void dbLockSetGblUnlock(void) void dbLockSetRecordLock(dbCommon *precord) { - lockRecord *plockRecord = (lockRecord *)precord->lset; + lockRecord *plockRecord = precord->lset; lockSet *plockSet; STATUS status; @@ -212,7 +212,7 @@ void dbScanLock(dbCommon *precord) lockSet *plockSet; STATUS status; - if(!(plockRecord= (lockRecord *)precord->lset)) { + if(!(plockRecord= precord->lset)) { epicsPrintf("dbScanLock plockRecord is NULL record %s\n", precord->name); taskSuspend(0); @@ -235,7 +235,7 @@ void dbScanLock(dbCommon *precord) void dbScanUnlock(dbCommon *precord) { - lockRecord *plockRecord = (lockRecord *)precord->lset; + lockRecord *plockRecord = precord->lset; if(!plockRecord || !plockRecord->plockSet) { epicsPrintf("dbScanUnlock plockRecord or plockRecord->plockSet NULL\n"); @@ -247,7 +247,7 @@ void dbScanUnlock(dbCommon *precord) unsigned long dbLockGetLockId(dbCommon *precord) { - lockRecord *plockRecord = (lockRecord *)precord->lset; + lockRecord *plockRecord = precord->lset; lockSet *plockSet; if(!plockRecord) return(0); @@ -312,7 +312,7 @@ void dbLockInitRecords(dbBase *pdbbase) && pdbAddr->no_elements<=1) continue; dbLockSetMerge(precord,pdbAddr->precord); } - plockRecord = (lockRecord *)precord->lset; + plockRecord = precord->lset; if(!plockRecord->plockSet) allocLock(plockRecord); } } @@ -320,8 +320,8 @@ void dbLockInitRecords(dbBase *pdbbase) void dbLockSetMerge(dbCommon *pfirst,dbCommon *psecond) { - lockRecord *p1lockRecord = (lockRecord *)pfirst->lset; - lockRecord *p2lockRecord = (lockRecord *)psecond->lset; + lockRecord *p1lockRecord = pfirst->lset; + lockRecord *p2lockRecord = psecond->lset; lockSet *p1lockSet; lockSet *p2lockSet; @@ -368,7 +368,7 @@ void dbLockSetSplit(dbCommon *psource) int nrecordsInSet,i; dbCommon **paprecord; - plockRecord = (lockRecord *)psource->lset; + plockRecord = psource->lset; if(!plockRecord) { errMessage(-1,"dbLockSetSplit called before lockRecord allocated"); return; @@ -390,9 +390,9 @@ void dbLockSetSplit(dbCommon *psource) /*Now recompute lock sets */ for(i=0; ilset; + plockRecord = precord->lset; if(!(precord->name[0])) continue; - pdbRecordType = (dbRecordType *)precord->rdes; + pdbRecordType = precord->rdes; for(link=0; linkno_links; link++) { DBADDR *pdbAddr; @@ -442,7 +442,7 @@ long dblsr(char *recordname,int level) } precord = pdbentry->precnode->precord; dbFinishEntry(pdbentry); - plockRecord = (lockRecord *)precord->lset; + plockRecord = precord->lset; if(!plockRecord) return(0); plockSet = plockRecord->plockSet; } else { @@ -473,7 +473,7 @@ long dblsr(char *recordname,int level) for(plockRecord = (lockRecord *)ellFirst(&plockSet->recordList); plockRecord; plockRecord = (lockRecord *)ellNext(&plockRecord->node)) { precord = plockRecord->precord; - pdbRecordType = (dbRecordType *)precord->rdes; + pdbRecordType = precord->rdes; printf("%s\n",precord->name); if(level<=1) continue; for(link=0; (linkno_links) ; link++) { diff --git a/src/db/dbNotify.c b/src/db/dbNotify.c index dd30653b4..4687b92ce 100644 --- a/src/db/dbNotify.c +++ b/src/db/dbNotify.c @@ -53,7 +53,7 @@ #include "recGbl.h" /*NODE structure attached to ppnn field of each record in list*/ -typedef struct { +typedef struct pnWaitNode { ELLNODE node; struct dbCommon *precord; } PNWAITNODE; @@ -114,7 +114,7 @@ static void waitAdd(struct dbCommon *precord,PUTNOTIFY *ppn) PNWAITNODE *ppnnode; if(!precord->ppnn) precord->ppnn = dbCalloc(1,sizeof(PNWAITNODE)); - ppnnode = (PNWAITNODE *)precord->ppnn; + ppnnode = precord->ppnn; ppnnode->precord = precord; precord->ppn = ppn; ellAdd(&ppn->waitList,&ppnnode->node); @@ -206,7 +206,6 @@ static long putNotify(PUTNOTIFY *ppn) status=dbProcess(precord); if(status!=0) { ppn->status = status; - issueCallback(ppn); } ret_pending: return(S_db_Pending); @@ -303,8 +302,8 @@ static void notifyCancel(PUTNOTIFY *ppn) void dbNotifyCompletion(struct dbCommon *precord) { - PUTNOTIFY *ppn = (PUTNOTIFY *)precord->ppn; - PNWAITNODE *ppnnode = (PNWAITNODE *)precord->ppnn;; + PUTNOTIFY *ppn = precord->ppn; + PNWAITNODE *ppnnode = precord->ppnn;; ellDelete(&ppn->waitList,&ppnnode->node); precord->ppn = NULL; @@ -314,7 +313,7 @@ void dbNotifyCompletion(struct dbCommon *precord) void dbNotifyAdd(struct dbCommon *pfrom, struct dbCommon *pto) { - PUTNOTIFY *pfromppn = (PUTNOTIFY *)pfrom->ppn; + PUTNOTIFY *pfromppn = pfrom->ppn; PUTNOTIFY *ppn=NULL; if(pto->ppn == pfrom->ppn) return; /*Aready in same set*/ diff --git a/src/db/dbScan.c b/src/db/dbScan.c index a220e4e19..4628fb761 100644 --- a/src/db/dbScan.c +++ b/src/db/dbScan.c @@ -676,10 +676,10 @@ static void addToList(struct dbCommon *precord,scan_list *psl) scan_element *pse,*ptemp; FASTLOCK(&psl->lock); - pse = (scan_element *)(precord->spvt); + pse = precord->spvt; if(pse==NULL) { pse = dbCalloc(1,sizeof(scan_element)); - precord->spvt = (void *)pse; + precord->spvt = pse; pse->precord = precord; } pse ->pscan_list = psl; @@ -707,7 +707,7 @@ static void deleteFromList(struct dbCommon *precord,scan_list *psl) FASTUNLOCK(&psl->lock); return; } - pse = (scan_element *)(precord->spvt); + pse = precord->spvt; if(pse==NULL || pse->pscan_list!=psl) { FASTUNLOCK(&psl->lock); errMessage(-1,"deleteFromList failed"); diff --git a/src/db/dbTest.c b/src/db/dbTest.c index 261b430ed..6569cfd39 100644 --- a/src/db/dbTest.c +++ b/src/db/dbTest.c @@ -1175,11 +1175,13 @@ static int dbpr_report( char *ptemp_buf = &temp_buf[0]; short n = pdbFldDes->size; short i; + unsigned int value; strcpy(ptemp_buf,"0x"); ptemp_buf+=2; if(n>(sizeof(temp_buf)-2)/2) n = (sizeof(temp_buf)-2)/2; for (i=0; irecordname = dbRecordName(pdbentry); /* install record node in list in sorted postion */ - precnode = (dbRecordNode *)ellFirst(preclist); - while(precnode && strcmp(precordName,(char*)precnode->precord) > 0) - precnode = (dbRecordNode *)ellNext(&precnode->node); - if(precnode) + status = dbFirstRecord(pdbentry); + while(status==0) { + if(strcmp(precordName,dbGetRecordName(pdbentry)) < 0) break; + status = dbNextRecord(pdbentry); + } + if(status==0) { + precnode = pdbentry->precnode; ellInsert(preclist,ellPrevious(&precnode->node),&pNewRecNode->node); - else - ellAdd(preclist,&pNewRecNode->node); + } else { + ellAdd(preclist,&pNewRecNode->node); + } pdbentry->precnode = pNewRecNode; ppvd = dbPvdAdd(pdbentry->pdbbase,precordType,pNewRecNode); if(!ppvd) {errMessage(-1,"Logic Err: Could not add to PVD");return(-1);} - return(status); + return(0); } long epicsShareAPI dbDeleteRecord(DBENTRY *pdbentry) @@ -1940,9 +1945,14 @@ long epicsShareAPI dbPutString(DBENTRY *pdbentry,char *pstring) strncpy((char *)pfield, pstring,pflddes->size); if((pflddes->special == SPC_CALC) && !stringHasMacro) { char rpcl[RPCL_LEN]; + char *psCalcrpcl = 0; short error_number; status = postfix(pstring,rpcl,&error_number); + if(status) { + status = sCalcPostfix(pstring,&psCalcrpcl,&error_number); + free((void *)psCalcrpcl); + } if(status) status = S_dbLib_badField; } if((short)strlen(pstring) >= pflddes->size) status = S_dbLib_strLen; @@ -2310,10 +2320,15 @@ char * epicsShareAPI dbVerify(DBENTRY *pdbentry,char *pstring) } if((pflddes->special == SPC_CALC) && !stringHasMacro) { char rpcl[RPCL_LEN]; + char *psCalcrpcl = 0; short error_number; long status; status = postfix(pstring,rpcl,&error_number); + if(status) { + status = sCalcPostfix(pstring,&psCalcrpcl,&error_number); + free((void *)psCalcrpcl); + } if(status) { sprintf(message,"Illegal Calculation String"); return(message); diff --git a/src/dbStatic/dbStaticNoRun.c b/src/dbStatic/dbStaticNoRun.c index 34ace666c..5d01e293f 100644 --- a/src/dbStatic/dbStaticNoRun.c +++ b/src/dbStatic/dbStaticNoRun.c @@ -193,6 +193,7 @@ int epicsShareAPI dbIsDefaultValue(DBENTRY *pdbentry) void *pfield = pdbentry->pfield; if(!pflddes) return(FALSE); + if(pflddes->field_type==DBF_DEVICE) return(FALSE); if(!pfield) return(TRUE); switch (pflddes->field_type) { case DBF_STRING: @@ -231,7 +232,7 @@ int epicsShareAPI dbIsDefaultValue(DBENTRY *pdbentry) if(!pinitial) return(FALSE); return(strcmp(pinitial,pfield)==0); } - case DBF_DEVICE: + case DBF_DEVICE: /*Should never reach this state*/ return(FALSE); case DBF_INLINK: case DBF_OUTLINK: diff --git a/src/dev/apsDev/devApsEr.c b/src/dev/apsDev/devApsEr.c index 80ba6a59c..d7713b69c 100644 --- a/src/dev/apsDev/devApsEr.c +++ b/src/dev/apsDev/devApsEr.c @@ -219,13 +219,16 @@ long ErRegisterErrorHandler(int Card, ERROR_FUNC func) ******************************************************************************/ long ErGetTicks(int Card, unsigned long *Ticks) { + int key; if (ErHaveReceiver(Card) < 0) return(-1); /* BUG -- Do we read the HI first or the low? */ + key = intLock(); *Ticks = ErLink[Card].pEr->EventCounterLo; *Ticks += ErLink[Card].pEr->EventCounterHi << 16; + intUnlock(key); return(0); } diff --git a/src/dev/gpibDev/devCommonGpib.c b/src/dev/gpibDev/devCommonGpib.c index b47096cb2..f0dcf5013 100644 --- a/src/dev/gpibDev/devCommonGpib.c +++ b/src/dev/gpibDev/devCommonGpib.c @@ -3,6 +3,12 @@ /* * $Log$ + * Revision 1.2 1999/07/07 20:07:13 mrk + * sscanf response now checked to be equal to 1 rather than just not zero. + * + * Revision 1.1 1998/01/21 20:46:55 mrk + * restructure; new Symb support + * * Revision 1.36 1998/01/20 22:08:59 mrk * cleanup includes * @@ -1441,13 +1447,16 @@ struct gpibDpvt *pdpvt; else /* interpret msg with predefined format and write into .val */ { /* scan response string, return value will be 1 if successful */ - if(sscanf(pdpvt->msg,pCmd->format,&value)) + if(sscanf(pdpvt->msg,pCmd->format,&value)==1) { pai->val = value; pai->udf = FALSE; } else /* sscanf did not find or assign the parameter */ { + if(ibSrqDebug) + printf("error %s msg %s lenmsg %d\n", + pai->name,pdpvt->msg,strlen(pdpvt->msg)); devGpibLib_setPvSevr(pai,READ_ALARM,VALID_ALARM); } } @@ -1603,13 +1612,16 @@ struct gpibDpvt *pdpvt; else /* interpret msg with predefined format and write into .val */ { /* scan response string, return value will be 1 if successful */ - if(sscanf(pdpvt->msg,pCmd->format,&value)) + if(sscanf(pdpvt->msg,pCmd->format,&value)==1) { pli->val = value; pli->udf = FALSE; } else /* sscanf did not find or assign the parameter */ { + if(ibSrqDebug) + printf("error %s msg %s lenmsg %d\n", + pli->name,pdpvt->msg,strlen(pdpvt->msg)); devGpibLib_setPvSevr(pli,READ_ALARM,VALID_ALARM); } } @@ -1766,10 +1778,14 @@ struct gpibDpvt *pdpvt; } else { /* Scan response string, return value will be 1 if successful */ - if(sscanf(pdpvt->msg,pCmd->format, &value)) + if(sscanf(pdpvt->msg,pCmd->format, &value)==1) { pbi->rval = value; - else /* sscanf did not find or assign the parameter */ + } else { /* sscanf did not find or assign the parameter */ + if(ibSrqDebug) + printf("error %s msg %s lenmsg %d\n", + pbi->name,pdpvt->msg,strlen(pdpvt->msg)); devGpibLib_setPvSevr(pbi,READ_ALARM,VALID_ALARM); + } } } RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt); @@ -1927,10 +1943,14 @@ struct gpibDpvt *pdpvt; } else { /* Scan response string, return value will be 1 if successful */ - if(sscanf(pdpvt->msg, pCmd->format, &value)) + if(sscanf(pdpvt->msg,pCmd->format, &value)==1) { pmbbi->rval = value; - else /* sscanf did not find or assign the parameter */ + } else { /* sscanf did not find or assign the parameter */ + if(ibSrqDebug) + printf("error %s msg %s lenmsg %d\n", + pmbbi->name,pdpvt->msg,strlen(pdpvt->msg)); devGpibLib_setPvSevr(pmbbi,READ_ALARM,VALID_ALARM); + } } } RegisterProcessCallback(&pdpvt->head.callback, priorityLow, pdpvt); diff --git a/src/devOpt/Makefile.Vx b/src/devOpt/Makefile.Vx index 5f02ab1cb..b974d78ef 100644 --- a/src/devOpt/Makefile.Vx +++ b/src/devOpt/Makefile.Vx @@ -5,7 +5,7 @@ USR_INCLUDES = -I../../drv SRCS.c += ../devAnalytekGpib.c SRCS.c += ../devXxDg535Gpib.c -SRCS.c += ../devBBInteract.c +#SRCS.c += ../devBBInteract.c SRCS.c += ../devGpibInteract.c SRCS.c += ../devXxSr620Gpib.c SRCS.c += ../devK486Gpib.c diff --git a/src/devOpt/devAnalytekGpib.c b/src/devOpt/devAnalytekGpib.c index 9afcbbc7a..d4686ec87 100644 --- a/src/devOpt/devAnalytekGpib.c +++ b/src/devOpt/devAnalytekGpib.c @@ -553,34 +553,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &AnalytekDebug, /* debugging flag pointer */ - -1, /* set to -1 if the device does NOT respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxAnalytekGpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - NULL, /* pointer to SRQ handler function (NULL if none) */ - NULL /* pointer to secondary conversion routine */ -}; - /****************************************************************************** * * Initialization for device support @@ -594,8 +566,22 @@ static struct devGpibParmBlock devSupParms = { STATIC long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &AnalytekDebug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxAnalytekGpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); -} +}; + /****************************************************************************** * diff --git a/src/devOpt/devK486Gpib.c b/src/devOpt/devK486Gpib.c index ca1a84f2c..224d06730 100644 --- a/src/devOpt/devK486Gpib.c +++ b/src/devOpt/devK486Gpib.c @@ -265,35 +265,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = - { - &K486Debug, /* debugging flag pointer */ - -1, /* set to -1 if the device does NOT respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxK486Gpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - NULL, /* pointer to SRQ handler function (NULL if none) */ - NULL /* pointer to secondary conversion routine */ - }; - /****************************************************************************** * * Initialization for device support @@ -308,6 +279,19 @@ static long init_dev_sup(parm) int parm; { + if(parm==0) { + devSupParms.debugFlag = &K486Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxK486Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); } diff --git a/src/devOpt/devXxDc5009Gpib.c b/src/devOpt/devXxDc5009Gpib.c index 56e93054a..11cea20f4 100644 --- a/src/devOpt/devXxDc5009Gpib.c +++ b/src/devOpt/devXxDc5009Gpib.c @@ -266,38 +266,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - * In the future, the magic SRQ parm records will be processed as "I/O event - * scanned"... not passive. - * - ******************************************************************************/ -STATIC struct devGpibParmBlock devSupParms = { - &Dc5009Debug, /* debugging flag pointer */ - -1, /* device does not respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - 4, /* magic SRQ param number (-1 if none) */ - "devXxDc5009Gpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - srqHandler, /* SRQ handler function (NULL if none) */ - - NULL /* secondary conversion routine (NULL if none) */ -}; - /****************************************************************************** * * Initialization for device support @@ -309,6 +277,19 @@ STATIC struct devGpibParmBlock devSupParms = { STATIC long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &Dc5009Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = 4; + devSupParms.name = "devXxDc5009Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = srqHandler; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm,&DSET_AI)); } diff --git a/src/devOpt/devXxDg535Gpib.c b/src/devOpt/devXxDg535Gpib.c index dce336776..527d5ab96 100644 --- a/src/devOpt/devXxDg535Gpib.c +++ b/src/devOpt/devXxDg535Gpib.c @@ -664,34 +664,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &Dg535Debug, /* debugging flag pointer */ - -1, /* set to -1 if the device does NOT respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxDg535Gpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - NULL, /* pointer to SRQ handler function (NULL if none) */ - NULL /* pointer to secondary conversion routine */ -}; - /****************************************************************************** * * Initialization for device support @@ -703,6 +675,19 @@ static struct devGpibParmBlock devSupParms = { STATIC long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &Dg535Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxDg535Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); } diff --git a/src/devOpt/devXxK196Gpib.c b/src/devOpt/devXxK196Gpib.c index eeb10b11a..eb46b28cd 100644 --- a/src/devOpt/devXxK196Gpib.c +++ b/src/devOpt/devXxK196Gpib.c @@ -240,34 +240,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &K196Debug, /* debugging flag pointer */ - -1, /* set to -1 if the device does NOT respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxK196Gpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - NULL, /* pointer to SRQ handler function (NULL if none) */ - NULL /* pointer to secondary conversion routine */ -}; - /****************************************************************************** * * Initialization for device support @@ -281,6 +253,19 @@ static struct devGpibParmBlock devSupParms = { static long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &K196Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxK196Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); } diff --git a/src/devOpt/devXxK263Gpib.c b/src/devOpt/devXxK263Gpib.c index e1e5a284c..13050f7db 100644 --- a/src/devOpt/devXxK263Gpib.c +++ b/src/devOpt/devXxK263Gpib.c @@ -176,34 +176,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &K263Debug, /* debugging flag pointer */ - -1, /* set to -1 if the device does NOT respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxK263Gpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - - NULL, /* pointer to SRQ handler function (NULL if none) */ - NULL /* pointer to secondary conversion routine */ -}; - /****************************************************************************** * * Initialization for device support @@ -217,6 +189,19 @@ static struct devGpibParmBlock devSupParms = { static long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &K263Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxK263Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); } diff --git a/src/devOpt/devXxSkeletonGpib.c b/src/devOpt/devXxSkeletonGpib.c index c792eab07..92860b654 100644 --- a/src/devOpt/devXxSkeletonGpib.c +++ b/src/devOpt/devXxSkeletonGpib.c @@ -274,9 +274,13 @@ static struct gpibCmd gpibCmds[] = /****************************************************************************** * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. + * Initialization for device support + * This is called one time before any records are initialized with a parm + * value of 0. And then again AFTER all record-level init is complete + * with a param value of 1. * + *****************************************************************************/ +/****************************************************************************** * The magic SRQ parm is the parm number that, if specified on a passive * record, will cause the record to be processed automatically when an * unsolicited SRQ interrupt is detected from the device. @@ -287,32 +291,23 @@ static struct gpibCmd gpibCmds[] = * In the future, the magic SRQ parm records will be processed as "I/O event * scanned"... not passive. * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &SkeletonDebug, /* debugging flag pointer */ - -1, /* device does not respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number (-1 if none) */ - "devXxSkeletonGpib", /* device support module type name */ - DMA_TIME, /* # of clock ticks to wait for DMA completions */ - NULL, /* SRQ handler function (NULL if none) */ - NULL /* secondary conversion routine (NULL if none) */ -}; - -/****************************************************************************** - * - * Initialization for device support - * This is called one time before any records are initialized with a parm - * value of 0. And then again AFTER all record-level init is complete - * with a param value of 1. - * - ******************************************************************************/ + *****************************************************************************/ STATIC long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &SkeletonDebug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxSkeletonGpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = 0; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm,&DSET_AI)); } diff --git a/src/devOpt/devXxSr620Gpib.c b/src/devOpt/devXxSr620Gpib.c index e432a727b..31069fcc9 100644 --- a/src/devOpt/devXxSr620Gpib.c +++ b/src/devOpt/devXxSr620Gpib.c @@ -204,35 +204,6 @@ static struct gpibCmd gpibCmds[] = /* The following is the number of elements in the command array above. */ #define NUMPARAMS sizeof(gpibCmds)/sizeof(struct gpibCmd) -/****************************************************************************** - * - * Structure containing the user's functions and operating parameters needed - * by the gpib library functions. - * - * The magic SRQ parm is the parm number that, if specified on a passive - * record, will cause the record to be processed automatically when an - * unsolicited SRQ interrupt is detected from the device. - * - * If the parm is specified on a non-passive record, it will NOT be processed - * when an unsolicited SRQ is detected. - * - ******************************************************************************/ -static struct devGpibParmBlock devSupParms = { - &sr620Debug, /* debugging flag pointer */ - -1, /* device does not respond to writes */ - TIME_WINDOW, /* # of clock ticks to skip after a device times out */ - NULL, /* hwpvt list head */ - gpibCmds, /* GPIB command array */ - NUMPARAMS, /* number of supported parameters */ - -1, /* magic SRQ param number */ - "devXxSr620Gpib", /* device support module type name */ - DMA_TIME, - - srqHandler, /* pointer to SRQ handler function */ - - NULL /* pointer to secondary converstion routine */ -}; - /****************************************************************************** * * This is invoked by the linkTask when an SRQ is detected from a device @@ -308,6 +279,19 @@ STATIC int srqHandler(struct hwpvt *phwpvt, int srqStatus) STATIC long init_dev_sup(int parm) { + if(parm==0) { + devSupParms.debugFlag = &sr620Debug; + devSupParms.respond2Writes = -1; + devSupParms.timeWindow = TIME_WINDOW; + devSupParms.hwpvtHead = 0; + devSupParms.gpibCmds = gpibCmds; + devSupParms.numparams = NUMPARAMS; + devSupParms.magicSrq = -1; + devSupParms.name = "devXxSr620Gpib"; + devSupParms.dmaTimeout = DMA_TIME; + devSupParms.srqHandler = srqHandler; + devSupParms.wrConversion = 0; + } return(devGpibLib_initDevSup(parm, &DSET_AI)); } diff --git a/src/drv/old/Makefile.Vx b/src/drv/old/Makefile.Vx index 62aaccf44..c21aa3ab6 100644 --- a/src/drv/old/Makefile.Vx +++ b/src/drv/old/Makefile.Vx @@ -12,27 +12,34 @@ else USR_CFLAGS = -fshared-data -fvolatile endif -INC += drvBB232.h -INC += drvBitBus.h +#The following have been unbundled. DONT USE THESE +#INC += drvBB232.h +#INC += drvBitBus.h INC += drvBitBusErr.h +#INC += drvMsg.h +#drvBitBusInterface APPEARS HERE AND IN UNBUNDLED - BIG PROBLEM INC += drvBitBusInterface.h +#SRCS.c += ../drvBB232.c +#SRCS.c += ../drvBitBus.c +#SRCS.c += ../drvMsg.c +#SRCS.c += ../drvTranServ.c + +#The following have not been used +#INC += drvRs232.h +#INC += drvTy232.h + INC += drvGpib.h INC += drvGpibErr.h INC += drvGpibInterface.h INC += drvHiDEOSGpib.h INC += drvJgvtr1.h -INC += drvMsg.h INC += drvOms.h -INC += drvRs232.h -INC += drvTy232.h INC += steppermotor.h SRCS.c += ../module_types.c -SRCS.c += ../drvBB232.c SRCS.c += ../drvBb902.c SRCS.c += ../drvBb910.c -SRCS.c += ../drvBitBus.c SRCS.c += ../drvComet.c SRCS.c += ../drvCompuSm.c SRCS.c += ../drvDvx.c @@ -40,9 +47,7 @@ SRCS.c += ../drvFp.c SRCS.c += ../drvFpm.c SRCS.c += ../drvGpib.c SRCS.c += ../drvJgvtr1.c -SRCS.c += ../drvMsg.c SRCS.c += ../drvOms.c -#SRCS.c += ../drvTranServ.c SRCS.c += ../drvVmi4100.c SRCS.c += ../drvXy010.c SRCS.c += ../drvXy210.c diff --git a/src/libCom/errSymTbl.h b/src/libCom/errSymTbl.h index 8c219fe29..80d9f68b5 100644 --- a/src/libCom/errSymTbl.h +++ b/src/libCom/errSymTbl.h @@ -15,7 +15,7 @@ typedef struct /* ERRSYMBOL - entry in symbol table */ } ERRSYMBOL; typedef struct /* ERRSYMTAB - symbol table */ { - short nsymbols; /* current number of symbols in table */ + int nsymbols; /* current number of symbols in table */ ERRSYMBOL *symbols; /* ptr to array of symbol entries */ } ERRSYMTAB; typedef ERRSYMTAB *ERRSYMTAB_ID; diff --git a/src/libCom/sCalcPostfix.h b/src/libCom/sCalcPostfix.h index 3c3e6b14b..73ce109e8 100644 --- a/src/libCom/sCalcPostfix.h +++ b/src/libCom/sCalcPostfix.h @@ -29,8 +29,8 @@ * */ -#ifndef INCpostfixh -#define INCpostfixh +#ifndef INCsCalcPostfixH +#define INCsCalcPostfixH #include "shareLib.h" @@ -44,5 +44,5 @@ epicsShareFunc long epicsShareAPI char **psarg, int numSArgs, double *presult, char *psresult, int lenSresult, char *post); -#endif /* INCpostfixh */ +#endif /* INCsCalcPostfixH */ diff --git a/src/libCom/tsDefs.h b/src/libCom/tsDefs.h index 66b6ec11c..212aa6719 100644 --- a/src/libCom/tsDefs.h +++ b/src/libCom/tsDefs.h @@ -73,7 +73,7 @@ extern "C" { * *---------------------------------------------------------------------------- */ -typedef struct { +typedef struct TS_STAMP { epicsUInt32 secPastEpoch; /* seconds since 0000 Jan 1, 1990 */ epicsUInt32 nsec; /* nanoseconds within second */ } TS_STAMP; diff --git a/src/libCom/tsSubr.c b/src/libCom/tsSubr.c index 80524907f..fa0e2053e 100644 --- a/src/libCom/tsSubr.c +++ b/src/libCom/tsSubr.c @@ -119,6 +119,7 @@ #include #include #include +#include #define INC_tsDefs_h #if defined(vxWorks) diff --git a/src/makeBaseApp/top/config/makeIocCdCommands.pl b/src/makeBaseApp/top/config/makeIocCdCommands.pl index c8d74dd92..0c1962f02 100644 --- a/src/makeBaseApp/top/config/makeIocCdCommands.pl +++ b/src/makeBaseApp/top/config/makeIocCdCommands.pl @@ -11,23 +11,50 @@ $arch = $ARGV[0]; unlink("cdCommands"); open(OUT,">cdCommands") or die "$! opening cdCommands"; print OUT "startup = \"$cwd\"\n"; + +#appbin is kept for compatibility with 3.13.1 $appbin = $cwd; $appbin =~ s/iocBoot.*//; $appbin = $appbin . "/bin/${arch}"; print OUT "appbin = \"$appbin\"\n"; -#look for SHARE in /config/RELEASE -$release = $cwd; -$release =~ s/iocBoot.*//; -$release = $release . "config/RELEASE"; + +$top = $cwd; +$top =~ s/\/iocBoot.*//; +print OUT "top = \"$top\"\n"; +$topbin = "${top}/bin/${arch}"; +#skip check that top/bin/${arch} exists; src may not have been builT +print OUT "topbin = \"$topbin\"\n"; +$release = "$top/config/RELEASE"; if (-r "$release") { open(IN, "$release") or die "Cannot open $release\n"; - while () { - chomp; - s/^SHARE\s*=\s*// and $share = $_, break; + while ($line = ) { + next if ( $line =~ /\s*#/ ); + chomp($line); + $_ = $line; + #the following looks for + # prefix = $(macro)post + ($prefix,$macro,$post) = /(.*)\s*=\s*\$\((.*)\)(.*)/; + if ($macro eq "") { # true if no macro is present + # the following looks for + # prefix = post + ($prefix,$post) = /(.*)\s*=\s*(.*)/; + } else { + $base = $applications{$macro}; + if ($base eq "") { + print "error: $macro was not previously defined\n"; + } else { + $post = $base . $post; + } + } + $applications{$prefix} = $post; + $app = lc($prefix); + if ( -d "$post") { #check that directory exists + print OUT "$app = \"$post\"\n"; + } + if ( -d "$post/bin/$arch") { #check that directory exists + print OUT "${app}bin = \"$post/bin/$arch\"\n"; + } } close IN; } -if ( "$share" ) { - print OUT "share = \"$share\"\n"; -} close OUT; diff --git a/src/makeBaseApp/top/exampleApp/Db/dbExample2.template b/src/makeBaseApp/top/exampleApp/Db/dbExample2.template index b42f0032c..75852b657 100644 --- a/src/makeBaseApp/top/exampleApp/Db/dbExample2.template +++ b/src/makeBaseApp/top/exampleApp/Db/dbExample2.template @@ -4,7 +4,7 @@ record(calc, "$(USER):calcExample$(NO)") field(SCAN,"$(SCAN)") field(FLNK, "$(USER):aiExample$(NO)") field(CALC, "(Ainit=TRUE; + pai->eoff = pai->egul; if(!(pdset->special_linconv)) return(0); return((*pdset->special_linconv)(pai,after)); default: diff --git a/src/rec/aoRecord.c b/src/rec/aoRecord.c index ba9f14f96..34e6dd551 100644 --- a/src/rec/aoRecord.c +++ b/src/rec/aoRecord.c @@ -300,6 +300,7 @@ static long special(paddr,after) return(S_db_noMod); } pao->init=TRUE; + pao->eoff = pao->egul; if(!(pdset->special_linconv)) return(0); return((*pdset->special_linconv)(pao,after)); default: diff --git a/src/rec/compressRecord.c b/src/rec/compressRecord.c index 2db16190d..135439357 100644 --- a/src/rec/compressRecord.c +++ b/src/rec/compressRecord.c @@ -54,6 +54,9 @@ * .16 07-15-92 jba changed VALID_ALARM to INVALID alarm * .17 07-16-92 jba added invalid alarm fwd link test and chngd fwd lnk to macro * .18 05-09-94 jba Fixed the updating of pcompress->inx in array_average + * .19 03-16-99 wfl Added "N to 1 Median" algorithm (implemented + * only for array inputs; regular "Median" is not + * implemented) */ #include @@ -162,6 +165,17 @@ static void put_value(compressRecord *pcompress,double *psource, long n) return; } +/* qsort comparison function (for median calculation) */ +static int compare(const void *arg1, const void *arg2) +{ + double a = *(double *)arg1; + double b = *(double *)arg2; + + if ( a < b ) return -1; + else if ( a == b ) return 0; + else return 1; +} + static int compress_array(compressRecord *pcompress, double *psource,long no_elements) { @@ -219,7 +233,16 @@ static int compress_array(compressRecord *pcompress, put_value(pcompress,&value,1); } break; - } + case (compressALG_N_to_1_Median): + /* compress N to 1 keeping the median value */ + /* note: sorts source array (OK; it's a work pointer) */ + for (i = 0; i < nnew; i++, psource+=nnew){ + qsort(psource,n,sizeof(double),compare); + value=psource[n/2]; + put_value(pcompress,&value,1); + } + break; + } return(0); } @@ -285,7 +308,9 @@ static int compress_scalar(struct compressRecord *pcompress,double *psource) if ((value > *pdest) || (inx == 0)) *pdest = value; break; + /* for scalars, Median not implemented => use average */ case (compressALG_N_to_1_Average): + case (compressALG_N_to_1_Median): if (inx == 0) *pdest = value; else { diff --git a/src/rec/compressRecord.dbd b/src/rec/compressRecord.dbd index 2c2b82cba..8da8b542c 100644 --- a/src/rec/compressRecord.dbd +++ b/src/rec/compressRecord.dbd @@ -4,6 +4,7 @@ menu(compressALG) { choice(compressALG_N_to_1_Average,"N to 1 Average") choice(compressALG_Average,"Average") choice(compressALG_Circular_Buffer,"Circular Buffer") + choice(compressALG_N_to_1_Median,"N to 1 Median") } recordtype(compress) { include "dbCommon.dbd" diff --git a/src/rec/mbbiDirectRecord.c b/src/rec/mbbiDirectRecord.c index e42022863..8bfb909d6 100644 --- a/src/rec/mbbiDirectRecord.c +++ b/src/rec/mbbiDirectRecord.c @@ -108,27 +108,34 @@ static long readValue(); #define NUM_BITS 16 -/* refreshes all the bit fields based on a hardware value */ -static void refresh_bits(pmbbiDirect) +/* refreshes all the bit fields based on a hardware value + and sends monitors if the bit's value or the record's + severity/status have changed */ +static void refresh_bits(pmbbiDirect, monitor_mask) struct mbbiDirectRecord *pmbbiDirect; + unsigned short monitor_mask; { - int i, mask = 1; + unsigned short i; + unsigned short mask = 1; + unsigned short momask; unsigned char *bit; bit = &(pmbbiDirect->b0); for (i=0; ival & mask) { if (*bit == 0) { *bit = 1; - db_post_events(pmbbiDirect,bit,DBE_VALUE|DBE_LOG); + momask |= DBE_VALUE | DBE_LOG; } - } - else { + } else { if (*bit != 0) { *bit = 0; - db_post_events(pmbbiDirect,bit,DBE_VALUE|DBE_LOG); + momask |= DBE_VALUE | DBE_LOG; } } + if (momask) + db_post_events(pmbbiDirect,bit,momask); } } @@ -169,7 +176,7 @@ static long init_record(pmbbiDirect,pass) } if( pdset->init_record ) { if((status=(*pdset->init_record)(pmbbiDirect))) return(status); - refresh_bits(pmbbiDirect); + refresh_bits(pmbbiDirect, 0); } return(0); } @@ -204,9 +211,6 @@ static long process(pmbbiDirect) } else if(status == 2) status = 0; - /* Thomas Birke of BESSY suggested */ - refresh_bits(pmbbiDirect); - /* check event list */ monitor(pmbbiDirect); @@ -222,13 +226,11 @@ static void monitor(pmbbiDirect) { unsigned short monitor_mask; - /* - * Monitors for Bit Fields are done in the refresh_bits() - * routine. - */ - monitor_mask = recGblResetAlarms(pmbbiDirect); + /* send out bit field monitors (value change and sevr change) */ + refresh_bits(pmbbiDirect, monitor_mask); + /* check for value change */ if (pmbbiDirect->mlst != pmbbiDirect->val) { /* post events for value change and archive change */ @@ -256,7 +258,6 @@ static long readValue(pmbbiDirect) if (pmbbiDirect->pact == TRUE){ status=(*pdset->read_mbbi)(pmbbiDirect); - refresh_bits(pmbbiDirect); return(status); } @@ -267,23 +268,17 @@ static long readValue(pmbbiDirect) if (pmbbiDirect->simm == NO){ status=(*pdset->read_mbbi)(pmbbiDirect); - refresh_bits(pmbbiDirect); return(status); } - if (pmbbiDirect->simm == YES){ - status=dbGetLink(&(pmbbiDirect->siol), - DBR_USHORT,&(pmbbiDirect->sval),0,0); - if (status==0){ - pmbbiDirect->val=pmbbiDirect->sval; - pmbbiDirect->udf=FALSE; - refresh_bits(pmbbiDirect); - } - status=2; /* dont convert */ - } else { - status=-1; - recGblSetSevr(pmbbiDirect,SOFT_ALARM,INVALID_ALARM); - return(status); + + status=dbGetLink(&(pmbbiDirect->siol), + DBR_USHORT,&(pmbbiDirect->sval),0,0); + if (status==0){ + pmbbiDirect->val=pmbbiDirect->sval; + pmbbiDirect->udf=FALSE; } + status=2; /* don't convert */ + recGblSetSevr(pmbbiDirect,SIMM_ALARM,pmbbiDirect->sims); return(status); diff --git a/src/tools/mkdir.pl b/src/tools/mkdir.pl index e08d5a5cc..95efc0052 100644 --- a/src/tools/mkdir.pl +++ b/src/tools/mkdir.pl @@ -6,7 +6,7 @@ use File::Path; use Getopt::Std; -getopt(); +getopt ""; foreach $dir ( @ARGV ) { diff --git a/src/tools/rm.pl b/src/tools/rm.pl index 3d7085b69..83f54571a 100644 --- a/src/tools/rm.pl +++ b/src/tools/rm.pl @@ -6,7 +6,7 @@ use File::Path; use File::Find; use Getopt::Std; -getopt(); +getopt ""; foreach $arg ( @ARGV ) { diff --git a/src/util/rc2.logServer b/src/util/rc2.logServer index 7d148e222..016c70907 100644 --- a/src/util/rc2.logServer +++ b/src/util/rc2.logServer @@ -3,6 +3,12 @@ # Solaris rc2 script for EPICS IOC Log Server process. # # $Log$ +# Revision 1.2 1999/05/17 15:09:59 anj +# Moved export statements to the right place. +# +# Revision 1.1 1995/03/30 23:17:59 jba +# Added solaris scripts for starting caRepeater and iocLogServer - anj +# # INSTALL_BIN=:INSTALL_BIN: @@ -11,12 +17,9 @@ EPICS=:EPICS: # To change the default values for the EPICS Environment parameters, # uncomment and modify the relevant lines below. -# export EPICS_IOC_LOG_PORT -# export EPICS_IOC_LOG_FILE_NAME -# export EPICS_IOC_LOG_FILE_LIMIT -# EPICS_IOC_LOG_PORT="6500" -# EPICS_IOC_LOG_FILE_NAME="$EPICS/logs/iocLog" -# EPICS_IOC_LOG_FILE_LIMIT="1000000" +# EPICS_IOC_LOG_PORT="6500"; export EPICS_IOC_LOG_PORT +# EPICS_IOC_LOG_FILE_NAME="$EPICS/logs/iocLog"; export EPICS_IOC_LOG_FILE_NAME +# EPICS_IOC_LOG_FILE_LIMIT="1000000"; export EPICS_IOC_LOG_FILE_LIMIT if [ $1 = "start" ]; then if [ -x $INSTALL_BIN/iocLogServer ]; then