Use new dbLink APIs instead of checking link.type

This commit is contained in:
Andrew Johnson
2016-08-27 16:30:48 -05:00
parent cca6a5d05a
commit 37b6cbb50c
43 changed files with 328 additions and 354 deletions

View File

@@ -78,16 +78,16 @@ static long init_record(aaiRecord *prec)
static long read_aai(aaiRecord *prec)
{
long nRequest = prec->nelm;
long status = dbGetLink(prec->simm == menuYesNoYES ? &prec->siol :
&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest);
dbGetLink(prec->simm == menuYesNoYES ? &prec->siol : &prec->inp,
prec->ftvl, prec->bptr, 0, &nRequest);
if (nRequest > 0) {
if (!status && nRequest > 0) {
prec->nord = nRequest;
prec->udf=FALSE;
if (prec->tsel.type == CONSTANT &&
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}
return 0;
return status;
}

View File

@@ -52,7 +52,7 @@ epicsExportAddress(dset,devAaoSoft);
static long init_record(aaoRecord *prec)
{
if (prec->out.type == CONSTANT) {
if (dbLinkIsConstant(&prec->out)) {
prec->nord = 0;
}
return 0;

View File

@@ -51,10 +51,9 @@ epicsExportAddress(dset, devAiSoft);
static long init_record(aiRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val))
prec->udf = FALSE;
return 0;
}
@@ -62,9 +61,6 @@ static long read_ai(aiRecord *prec)
{
double val;
if (prec->inp.type == CONSTANT)
return 2;
if (!dbGetLink(&prec->inp, DBR_DOUBLE, &val, 0, 0)) {
/* Apply smoothing algorithm */
@@ -76,7 +72,7 @@ static long read_ai(aiRecord *prec)
prec->udf = FALSE;
prec->dpvt = &devAiSoft; /* Any non-zero value */
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
} else {

View File

@@ -50,16 +50,15 @@ epicsExportAddress(dset, devAiSoftRaw);
static long init_record(aiRecord *prec)
{
if (prec->inp.type == CONSTANT) {
recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
}
recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval);
return 0;
}
static long read_ai(aiRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0) &&
prec->tsel.type == CONSTANT &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);

View File

@@ -66,7 +66,7 @@ static long read_bi(biRecord *prec)
prec->udf = FALSE;
}
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);

View File

@@ -48,19 +48,16 @@ epicsExportAddress(dset, devBiSoft);
static long init_record(biRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
return 0;
}
static long read_bi(biRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
if (prec->inp.type != CONSTANT)
prec->udf = FALSE;
if (prec->tsel.type == CONSTANT &&
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -48,16 +48,14 @@ epicsExportAddress(dset, devBiSoftRaw);
static long init_record(biRecord *prec)
{
if (prec->inp.type == CONSTANT) {
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
}
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
return 0;
}
static long read_bi(biRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_ULONG, &prec->rval, 0, 0) &&
prec->tsel.type == CONSTANT &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);

View File

@@ -48,10 +48,8 @@ epicsExportAddress(dset, devEventSoft);
static long init_record(eventRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val))
prec->udf = FALSE;
return 0;
}
@@ -60,7 +58,7 @@ static long read_event(eventRecord *prec)
long status;
char newEvent[MAX_STRING_SIZE];
if (prec->inp.type != CONSTANT) {
if (!dbLinkIsConstant(&prec->inp)) {
status = dbGetLink(&prec->inp, DBR_STRING, newEvent, 0, 0);
if (status) return status;
if (strcmp(newEvent, prec->val) != 0) {
@@ -69,7 +67,7 @@ static long read_event(eventRecord *prec)
}
}
prec->udf = FALSE;
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
return 0;

View File

@@ -52,10 +52,9 @@ epicsExportAddress(dset,devHistogramSoft);
static long init_record(histogramRecord *prec)
{
if (prec->svl.type == CONSTANT) {
if(recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl))
prec->udf = FALSE;
return 0;
}

View File

@@ -48,10 +48,9 @@ epicsExportAddress(dset, devLiSoft);
static long init_record(longinRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val))
prec->udf = FALSE;
return 0;
}
@@ -61,7 +60,7 @@ static long read_longin(longinRecord *prec)
status = dbGetLink(&prec->inp, DBR_LONG, &prec->val, 0, 0);
if (!status &&
prec->tsel.type == CONSTANT &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
return status;

View File

@@ -29,7 +29,7 @@ static long read_string(lsiRecord *prec)
long status = dbGetLinkLS(&prec->inp, prec->val, prec->sizv, &prec->len);
if (!status &&
prec->tsel.type == CONSTANT &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);

View File

@@ -48,19 +48,17 @@ epicsExportAddress(dset, devMbbiDirectSoft);
static long init_record(mbbiDirectRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
return 0;
}
static long read_mbbi(mbbiDirectRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
if (prec->inp.type != CONSTANT)
prec->udf = FALSE;
if (prec->tsel.type == CONSTANT &&
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -48,11 +48,12 @@ epicsExportAddress(dset, devMbbiDirectSoftRaw);
static long init_record(mbbiDirectRecord *prec)
{
if (prec->inp.type == CONSTANT) {
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
}
/*to preserve old functionality*/
if (prec->nobt == 0) prec->mask = 0xffffffff;
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
/* Preserve old functionality */
if (prec->nobt == 0)
prec->mask = 0xffffffff;
prec->mask <<= prec->shft;
return 0;
}
@@ -61,7 +62,7 @@ static long read_mbbi(mbbiDirectRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) {
prec->rval &= prec->mask;
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -48,19 +48,18 @@ epicsExportAddress(dset, devMbbiSoft);
static long init_record(mbbiRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val))
prec->udf = FALSE;
return 0;
}
static long read_mbbi(mbbiRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_USHORT, &prec->val, 0, 0)) {
if (prec->inp.type != CONSTANT)
prec->udf = FALSE;
if (prec->tsel.type == CONSTANT &&
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -48,11 +48,12 @@ epicsExportAddress(dset, devMbbiSoftRaw);
static long init_record(mbbiRecord *prec)
{
if (prec->inp.type == CONSTANT) {
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
}
/*to preserve old functionality*/
if (prec->nobt == 0) prec->mask = 0xffffffff;
recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval);
/* Preserve old functionality*/
if (prec->nobt == 0)
prec->mask = 0xffffffff;
prec->mask <<= prec->shft;
return 0;
}
@@ -61,7 +62,7 @@ static long read_mbbi(mbbiRecord *prec)
{
if (!dbGetLink(&prec->inp, DBR_LONG, &prec->rval, 0, 0)) {
prec->rval &= prec->mask;
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -48,10 +48,16 @@ epicsExportAddress(dset, devSASoft);
static long init_record(subArrayRecord *prec)
{
if (prec->inp.type == CONSTANT) {
prec->nord = 0;
long nelm = prec->nelm;
long status = dbLoadLinkArray(&prec->inp, prec->ftvl, prec->bptr, &nelm);
if (!status && nelm > 0) {
prec->nord = nelm;
prec->udf = FALSE;
}
return 0;
else
prec->nord = 0;
return status;
}
static long read_sa(subArrayRecord *prec)
@@ -62,7 +68,7 @@ static long read_sa(subArrayRecord *prec)
if (nRequest > prec->malm)
nRequest = prec->malm;
if (prec->inp.type == CONSTANT)
if (dbLinkIsConstant(&prec->inp))
nRequest = prec->nord;
else
dbGetLink(&prec->inp, prec->ftvl, prec->bptr, 0, &nRequest);
@@ -81,7 +87,7 @@ static long read_sa(subArrayRecord *prec)
prec->nord = ecount;
if (nRequest > 0 &&
prec->tsel.type == CONSTANT &&
dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);

View File

@@ -50,10 +50,8 @@ epicsExportAddress(dset, devSiSoft);
static long init_record(stringinRecord *prec)
{
if (prec->inp.type == CONSTANT) {
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
prec->udf = FALSE;
}
if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val))
prec->udf = FALSE;
return 0;
}
@@ -63,9 +61,9 @@ static long read_stringin(stringinRecord *prec)
status = dbGetLink(&prec->inp, DBR_STRING, prec->val, 0, 0);
if (!status) {
if (prec->inp.type != CONSTANT)
if (!dbLinkIsConstant(&prec->inp))
prec->udf = FALSE;
if (prec->tsel.type == CONSTANT &&
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}

View File

@@ -68,7 +68,9 @@ static long read_wf(waveformRecord *prec)
if (!status && nRequest > 0) {
prec->nord = nRequest;
if (prec->tsel.type == CONSTANT &&
prec->udf = FALSE;
if (dbLinkIsConstant(&prec->tsel) &&
prec->tse == epicsTimeEventDeviceTime)
dbGetTimeStamp(&prec->inp, &prec->time);
}