From c49ade6ad7c5c6cf01298f9a2bec21adf0c8758d Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Tue, 21 Apr 1992 11:54:26 +0000 Subject: [PATCH] jba added pass test to init_record and changed cvt_dbaddr --- src/rec/recAi.c | 5 ++++- src/rec/recAo.c | 5 ++++- src/rec/recBi.c | 5 ++++- src/rec/recBo.c | 5 ++++- src/rec/recCalc.c | 5 ++++- src/rec/recCompress.c | 10 ++++------ src/rec/recEvent.c | 5 ++++- src/rec/recFanout.c | 10 ++++++---- src/rec/recHistogram.c | 11 +++++++---- src/rec/recLongin.c | 5 ++++- src/rec/recLongout.c | 5 ++++- src/rec/recMbbi.c | 5 ++++- src/rec/recMbbo.c | 5 ++++- src/rec/recPid.c | 11 +++++++---- src/rec/recPulseCounter.c | 7 +++++-- src/rec/recPulseDelay.c | 7 +++++-- src/rec/recPulseTrain.c | 7 +++++-- src/rec/recSel.c | 7 +++++-- src/rec/recSteppermotor.c | 4 +++- src/rec/recStringin.c | 5 ++++- src/rec/recStringout.c | 5 ++++- src/rec/recSub.c | 5 ++++- src/rec/recTimer.c | 8 +++++--- src/rec/recWaveform.c | 34 ++++++++++++++++------------------ 24 files changed, 120 insertions(+), 61 deletions(-) diff --git a/src/rec/recAi.c b/src/rec/recAi.c index 608d6004c..c58eeeffa 100644 --- a/src/rec/recAi.c +++ b/src/rec/recAi.c @@ -141,12 +141,15 @@ void convert(); long cvtRawToEngBpt(); void monitor(); -static long init_record(pai) +static long init_record(pai,pass) struct aiRecord *pai; + int pass; { struct aidset *pdset; long status; + if (pass!=0) return(0); + if(!(pdset = (struct aidset *)(pai->dset))) { recGblRecordError(S_dev_noDSET,pai,"ai: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recAo.c b/src/rec/recAo.c index 0c10e2d02..e63c00e27 100644 --- a/src/rec/recAo.c +++ b/src/rec/recAo.c @@ -136,13 +136,16 @@ long cvtEngToRawBpt(); void monitor(); -static long init_record(pao) +static long init_record(pao,pass) struct aoRecord *pao; + int pass; { struct aodset *pdset; long status=0; double value; + if (pass!=0) return(0); + if(!(pdset = (struct aodset *)(pao->dset))) { recGblRecordError(S_dev_noDSET,pao,"ao: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recBi.c b/src/rec/recBi.c index 2ce261510..ccd867dce 100644 --- a/src/rec/recBi.c +++ b/src/rec/recBi.c @@ -116,12 +116,15 @@ struct bidset { /* binary input dset */ void alarm(); void monitor(); -static long init_record(pbi) +static long init_record(pbi,pass) struct biRecord *pbi; + int pass; { struct bidset *pdset; long status; + if (pass!=0) return(0); + if(!(pdset = (struct bidset *)(pbi->dset))) { recGblRecordError(S_dev_noDSET,pbi,"bi: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recBo.c b/src/rec/recBo.c index 4e7716c5c..1ea6ec537 100644 --- a/src/rec/recBo.c +++ b/src/rec/recBo.c @@ -154,13 +154,16 @@ static void myCallback(pcallback) dbScanUnlock((struct dbCommon *)pbo); } -static long init_record(pbo) +static long init_record(pbo,pass) struct boRecord *pbo; + int pass; { struct bodset *pdset; long status=0; struct callback *pcallback; + if (pass!=0) return(0); + if(!(pdset = (struct bodset *)(pbo->dset))) { recGblRecordError(S_dev_noDSET,pbo,"bo: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recCalc.c b/src/rec/recCalc.c index 971e65db6..351f3db98 100644 --- a/src/rec/recCalc.c +++ b/src/rec/recCalc.c @@ -133,8 +133,9 @@ long dbCaGetLink(); {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; -static long init_record(pcalc) +static long init_record(pcalc,pass) struct calcRecord *pcalc; + int pass; { long status; struct link *plink; @@ -143,6 +144,8 @@ static long init_record(pcalc) short error_number; char rpbuf[80]; + if (pass!=0) return(0); + plink = &pcalc->inpa; pvalue = &pcalc->a; for(i=0; ibptr==NULL) { + if (pass==0){ pcompress->bptr = (double *)calloc(pcompress->nsam,sizeof(double)); /* allocate memory for the summing buffer for conversions requiring it */ if (pcompress->alg == AVERAGE){ pcompress->sptr = (double *)calloc(pcompress->nsam,sizeof(double)); } + return(0); } if(pcompress->wptr==NULL && pcompress->inp.type==DB_LINK) { struct dbAddr *pdbAddr = (struct dbAddr *)(pcompress->inp.value.db_link.pdbAddr); @@ -231,9 +232,6 @@ static long cvt_dbaddr(paddr) { struct compressRecord *pcompress=(struct compressRecord *)paddr->precord; - /* This may get called before init_record. If so just call it*/ - if(pcompress->bptr==NULL) (void)init_record(pcompress); - paddr->pfield = (void *)(pcompress->bptr); paddr->no_elements = pcompress->nsam; paddr->field_type = DBF_DOUBLE; diff --git a/src/rec/recEvent.c b/src/rec/recEvent.c index 13c49b613..ca60ced76 100644 --- a/src/rec/recEvent.c +++ b/src/rec/recEvent.c @@ -99,12 +99,15 @@ struct eventdset { /* event input dset */ }; void monitor(); -static long init_record(pevent) +static long init_record(pevent,pass) struct eventRecord *pevent; + int pass; { struct eventdset *pdset; long status=0; + if (pass!=0) return(0); + if( (pdset=(struct eventdset *)(pevent->dset)) && (pdset->init_record) ) status=(*pdset->init_record)(pevent); return(status); diff --git a/src/rec/recFanout.c b/src/rec/recFanout.c index 9bf95600b..56557d2b2 100644 --- a/src/rec/recFanout.c +++ b/src/rec/recFanout.c @@ -104,12 +104,14 @@ long dbCaAddInlink(); long dbCaGetLink(); -static long init_record(pfanout) - struct fanoutRecord *pfanout; +static long init_record(pfanout,pass) + struct fanoutRecord *pfanout; + int pass; { - /* Added for Channel Access Links */ -long status; + long status; + + if (pass!=0) return(0); /* get link selection if sell is a constant and nonzero*/ if (pfanout->sell.type==CONSTANT && pfanout->sell.value.value!=0 ){ diff --git a/src/rec/recHistogram.c b/src/rec/recHistogram.c index 3ca32b967..1c52781d6 100644 --- a/src/rec/recHistogram.c +++ b/src/rec/recHistogram.c @@ -147,8 +147,9 @@ static void wdCallback(pcallback) return; } -static long init_record(phistogram) - struct histogramRecord *phistogram; +static long init_record(phistogram,pass) + struct histogramRecord *phistogram; + int pass; { struct histogramdset *pdset; long status; @@ -156,6 +157,8 @@ static long init_record(phistogram) float wait_time; void (*process)(); + if (pass==0){ + /* This routine may get called twice. Once by cvt_dbaddr. Once by iocInit*/ pcallback->process = process; @@ -194,6 +197,8 @@ static long init_record(phistogram) recGblRecordError(S_dev_missingSup,phistogram,"histogram: init_record"); return(S_dev_missingSup); } + return(0); + } /* call device support init_record */ if( pdset->init_record ) { @@ -328,8 +333,6 @@ static long cvt_dbaddr(paddr) { struct histogramRecord *phistogram=(struct histogramRecord *)paddr->precord; - /* This may get called before init_record. If so just call it*/ - if(phistogram->bptr==NULL) init_record(phistogram); paddr->pfield = (void *)(phistogram->bptr); paddr->no_elements = phistogram->nelm; paddr->field_type = DBF_ULONG; diff --git a/src/rec/recLongin.c b/src/rec/recLongin.c index 31292c729..075871897 100644 --- a/src/rec/recLongin.c +++ b/src/rec/recLongin.c @@ -104,12 +104,15 @@ struct longindset { /* longin input dset */ void alarm(); void monitor(); -static long init_record(plongin) +static long init_record(plongin,pass) struct longinRecord *plongin; + int pass; { struct longindset *pdset; long status; + if (pass!=0) return(0); + if(!(pdset = (struct longindset *)(plongin->dset))) { recGblRecordError(S_dev_noDSET,plongin,"longin: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recLongout.c b/src/rec/recLongout.c index f3d3824d3..ffcd6ed84 100644 --- a/src/rec/recLongout.c +++ b/src/rec/recLongout.c @@ -104,12 +104,15 @@ void alarm(); int convert(); void monitor(); -static long init_record(plongout) +static long init_record(plongout,pass) struct longoutRecord *plongout; + int pass; { struct longoutdset *pdset; long status=0; + if (pass!=0) return(0); + if(!(pdset = (struct longoutdset *)(plongout->dset))) { recGblRecordError(S_dev_noDSET,plongout,"longout: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recMbbi.c b/src/rec/recMbbi.c index 1031b444c..ca6d32b99 100644 --- a/src/rec/recMbbi.c +++ b/src/rec/recMbbi.c @@ -136,13 +136,16 @@ static void init_common(pmbbi) return; } -static long init_record(pmbbi) +static long init_record(pmbbi,pass) struct mbbiRecord *pmbbi; + int pass; { struct mbbidset *pdset; long status; int i; + if (pass!=0) return(0); + if(!(pdset = (struct mbbidset *)(pmbbi->dset))) { recGblRecordError(S_dev_noDSET,pmbbi,"mbbi: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recMbbo.c b/src/rec/recMbbo.c index 9a2262ebe..64feb6d89 100644 --- a/src/rec/recMbbo.c +++ b/src/rec/recMbbo.c @@ -143,13 +143,16 @@ static void init_common(pmbbo) return; } -static long init_record(pmbbo) +static long init_record(pmbbo,pass) struct mbboRecord *pmbbo; + int pass; { struct mbbodset *pdset; long status; int i; + if (pass!=0) return(0); + if(!(pdset = (struct mbbodset *)(pmbbo->dset))) { recGblRecordError(S_dev_noDSET,pmbbo,"mbbo: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recPid.c b/src/rec/recPid.c index 1568dc66a..d7229cf3f 100644 --- a/src/rec/recPid.c +++ b/src/rec/recPid.c @@ -101,11 +101,14 @@ long dbCaAddInlink(); long dbCaGetLink(); -static long init_record(ppid) - struct pidRecord *ppid; +static long init_record(ppid,pass) + struct pidRecord *ppid; + int pass; { -/* Added for Channel Access Links */ -long status; + /* Added for Channel Access Links */ + long status; + + if (pass!=0) return(0); /* initialize the setpoint for constant setpoint */ if (ppid->stpl.type == CONSTANT){ diff --git a/src/rec/recPulseCounter.c b/src/rec/recPulseCounter.c index bfcc00351..d038de482 100644 --- a/src/rec/recPulseCounter.c +++ b/src/rec/recPulseCounter.c @@ -112,12 +112,15 @@ struct pcdset { /* pulseCounter input dset */ void monitor(); -static long init_record(ppc) - struct pulseCounterRecord *ppc; +static long init_record(ppc,pass) + struct pulseCounterRecord *ppc; + int pass; { struct pcdset *pdset; long status=0; + if (pass!=0) return(0); + /* must have device support */ if(!(pdset = (struct pcdset *)(ppc->dset))) { recGblRecordError(S_dev_noDSET,ppc,"pc: init_record"); diff --git a/src/rec/recPulseDelay.c b/src/rec/recPulseDelay.c index 1357ab1ea..5b79321d4 100644 --- a/src/rec/recPulseDelay.c +++ b/src/rec/recPulseDelay.c @@ -102,12 +102,15 @@ struct pddset { /* pulseDelay input dset */ }; void monitor(); -static long init_record(ppd) - struct pulseDelayRecord *ppd; +static long init_record(ppd,pass) + struct pulseDelayRecord *ppd; + int pass; { struct pddset *pdset; long status=0; + if (pass!=0) return(0); + /* must have device support */ if(!(pdset = (struct pddset *)(ppd->dset))) { recGblRecordError(S_dev_noDSET,ppd,"pd: init_record"); diff --git a/src/rec/recPulseTrain.c b/src/rec/recPulseTrain.c index b5f51ba32..6d61dba88 100644 --- a/src/rec/recPulseTrain.c +++ b/src/rec/recPulseTrain.c @@ -114,12 +114,15 @@ struct ptdset { /* pulseTrain input dset */ void monitor(); -static long init_record(ppt) - struct pulseTrainRecord *ppt; +static long init_record(ppt,pass) + struct pulseTrainRecord *ppt; + int pass; { struct ptdset *pdset; long status=0; + if (pass!=0) return(0); + /* must have device support */ if(!(pdset = (struct ptdset *)(ppt->dset))) { recGblRecordError(S_dev_noDSET,ppt,"pt: init_record"); diff --git a/src/rec/recSel.c b/src/rec/recSel.c index b3a7473ff..7802a7bb1 100644 --- a/src/rec/recSel.c +++ b/src/rec/recSel.c @@ -111,8 +111,9 @@ long dbCaGetLink(); {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"}; -static long init_record(psel) - struct selRecord *psel; +static long init_record(psel,pass) + struct selRecord *psel; + int pass; { struct link *plink; int i; @@ -120,6 +121,8 @@ static long init_record(psel) /* Added for Channel Access Links */ long status; + if (pass!=0) return(0); + /* get seln initial value if nvl is a constant*/ if (psel->nvl.type == CONSTANT ) psel->seln = psel->nvl.value.value; if (psel->nvl.type == PV_LINK) diff --git a/src/rec/recSteppermotor.c b/src/rec/recSteppermotor.c index 31c8d2910..c54f49c59 100644 --- a/src/rec/recSteppermotor.c +++ b/src/rec/recSteppermotor.c @@ -172,12 +172,14 @@ long dbCaGetLink(); -static long init_record(psm) +static long init_record(psm,pass) struct steppermotorRecord *psm; + int pass; { struct smdset *pdset; long status; + if (pass!=0) return(0); if(!(pdset = (struct smdset *)(psm->dset))) { recGblRecordError(S_dev_noDSET,psm,"sm: init_record"); diff --git a/src/rec/recStringin.c b/src/rec/recStringin.c index 2b497853c..eb556463c 100644 --- a/src/rec/recStringin.c +++ b/src/rec/recStringin.c @@ -101,12 +101,15 @@ struct stringindset { /* stringin input dset */ }; void monitor(); -static long init_record(pstringin) +static long init_record(pstringin,pass) struct stringinRecord *pstringin; + int pass; { struct stringindset *pdset; long status; + if (pass!=0) return(0); + if(!(pdset = (struct stringindset *)(pstringin->dset))) { recGblRecordError(S_dev_noDSET,pstringin,"stringin: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recStringout.c b/src/rec/recStringout.c index e44018cd6..d72c20ea6 100644 --- a/src/rec/recStringout.c +++ b/src/rec/recStringout.c @@ -102,12 +102,15 @@ struct stringoutdset { /* stringout input dset */ }; void monitor(); -static long init_record(pstringout) +static long init_record(pstringout,pass) struct stringoutRecord *pstringout; + int pass; { struct stringoutdset *pdset; long status=0; + if (pass!=0) return(0); + if(!(pdset = (struct stringoutdset *)(pstringout->dset))) { recGblRecordError(S_dev_noDSET,pstringout,"stringout: init_record"); return(S_dev_noDSET); diff --git a/src/rec/recSub.c b/src/rec/recSub.c index 0c6bbc38b..5b0ba00ef 100644 --- a/src/rec/recSub.c +++ b/src/rec/recSub.c @@ -101,8 +101,9 @@ void monitor(); long do_sub(); long fetch_values(); -static long init_record(psub) +static long init_record(psub,pass) struct subRecord *psub; + int pass; { FUNCPTR psubroutine; char sub_type; @@ -113,6 +114,8 @@ static long init_record(psub) int i; double *pvalue; + if (pass!=0) return(0); + plink = &psub->inpa; pvalue = &psub->a; for(i=0; itorg.type == CONSTANT ){ diff --git a/src/rec/recWaveform.c b/src/rec/recWaveform.c index 1029a75dd..14e0fa072 100644 --- a/src/rec/recWaveform.c +++ b/src/rec/recWaveform.c @@ -131,15 +131,14 @@ void monitor(); extern unsigned int gts_trigger_counter; -static long init_record(pwf) +static long init_record(pwf,pass) struct waveformRecord *pwf; + int pass; { struct wfdset *pdset; long status; - - /* This routine may get called twice. Once by cvt_dbaddr. Once by iocInit*/ - if(pwf->bptr==NULL) { + if (pass==0){ if(pwf->nelm<=0) pwf->nelm=1; if(pwf->ftvl == 0) { pwf->bptr = (char *)calloc(pwf->nelm,MAX_STRING_SIZE); @@ -148,18 +147,19 @@ static long init_record(pwf) pwf->bptr = (char *)calloc(pwf->nelm,sizeofTypes[pwf->ftvl]); } pwf->nord = 0; - /* must have read_wf function defined */ - if(!(pdset = (struct wfdset *)(pwf->dset))) { - recGblRecordError(S_dev_noDSET,pwf,"wf: init_record"); - return(S_dev_noDSET); - } - if( (pdset->number < 5) || (pdset->read_wf == NULL) ) { - recGblRecordError(S_dev_missingSup,pwf,"wf: init_record"); - return(S_dev_missingSup); - } - if( pdset->init_record ) { - if((status=(*pdset->init_record)(pwf))) return(status); - } + return(0); + } + /* must have read_wf function defined */ + if(!(pdset = (struct wfdset *)(pwf->dset))) { + recGblRecordError(S_dev_noDSET,pwf,"wf: init_record"); + return(S_dev_noDSET); + } + if( (pdset->number < 5) || (pdset->read_wf == NULL) ) { + recGblRecordError(S_dev_missingSup,pwf,"wf: init_record"); + return(S_dev_missingSup); + } + if( pdset->init_record ) { + if((status=(*pdset->init_record)(pwf))) return(status); } return(0); } @@ -220,8 +220,6 @@ static long cvt_dbaddr(paddr) { struct waveformRecord *pwf=(struct waveformRecord *)paddr->precord; - /* This may get called before init_record. If so just call it*/ - if(pwf->bptr==NULL) init_record(pwf); paddr->pfield = (void *)(pwf->bptr); paddr->no_elements = pwf->nelm; paddr->field_type = pwf->ftvl;