From 7627454f6301de5879a33ef3942afc37d86533e9 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 2 Jun 2016 22:02:54 -0500 Subject: [PATCH] Simplify link-type checks in soft device supports --- src/std/dev/devAaiSoft.c | 13 +------------ src/std/dev/devAaoSoft.c | 13 +------------ src/std/dev/devAiSoft.c | 13 +------------ src/std/dev/devAiSoftRaw.c | 13 +------------ src/std/dev/devBiSoft.c | 13 +------------ src/std/dev/devBiSoftRaw.c | 13 +------------ src/std/dev/devEventSoft.c | 13 +------------ src/std/dev/devHistogramSoft.c | 13 +------------ src/std/dev/devLiSoft.c | 13 +------------ src/std/dev/devMbbiDirectSoft.c | 13 +------------ src/std/dev/devMbbiDirectSoftRaw.c | 13 +------------ src/std/dev/devMbbiSoft.c | 13 +------------ src/std/dev/devMbbiSoftRaw.c | 13 +------------ src/std/dev/devSASoft.c | 13 +------------ src/std/dev/devSiSoft.c | 13 +------------ src/std/dev/devWfSoft.c | 13 +------------ 16 files changed, 16 insertions(+), 192 deletions(-) diff --git a/src/std/dev/devAaiSoft.c b/src/std/dev/devAaiSoft.c index caaaa50ff..ff985b088 100644 --- a/src/std/dev/devAaiSoft.c +++ b/src/std/dev/devAaiSoft.c @@ -52,19 +52,8 @@ epicsExportAddress(dset,devAaiSoft); static long init_record(aaiRecord *prec) { - /* INP must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { prec->nord = 0; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default : - recGblRecordError(S_db_badField, (void *)prec, - "devAaiSoft (init_record) Illegal INP field"); - return(S_db_badField); } return 0; } diff --git a/src/std/dev/devAaoSoft.c b/src/std/dev/devAaoSoft.c index 61eeb9cdd..a88d61140 100644 --- a/src/std/dev/devAaoSoft.c +++ b/src/std/dev/devAaoSoft.c @@ -52,19 +52,8 @@ epicsExportAddress(dset,devAaoSoft); static long init_record(aaoRecord *prec) { - /* OUT must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (prec->out.type) { - case CONSTANT: + if (prec->out.type == CONSTANT) { prec->nord = 0; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default : - recGblRecordError(S_db_badField, prec, - "devAaoSoft (init_record) Illegal OUT field"); - return(S_db_badField); } return 0; } diff --git a/src/std/dev/devAiSoft.c b/src/std/dev/devAiSoft.c index 77ee6dbed..ccd713d75 100644 --- a/src/std/dev/devAiSoft.c +++ b/src/std/dev/devAiSoft.c @@ -51,20 +51,9 @@ epicsExportAddress(dset, devAiSoft); static long init_record(aiRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_DOUBLE, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devAiSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devAiSoftRaw.c b/src/std/dev/devAiSoftRaw.c index 0cf5e40f0..fa9d869ed 100644 --- a/src/std/dev/devAiSoftRaw.c +++ b/src/std/dev/devAiSoftRaw.c @@ -50,19 +50,8 @@ epicsExportAddress(dset, devAiSoftRaw); static long init_record(aiRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->rval); - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devAiSoftRaw (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devBiSoft.c b/src/std/dev/devBiSoft.c index 6c2740693..4b0ee854a 100644 --- a/src/std/dev/devBiSoft.c +++ b/src/std/dev/devBiSoft.c @@ -48,20 +48,9 @@ epicsExportAddress(dset, devBiSoft); static long init_record(biRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devBiSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devBiSoftRaw.c b/src/std/dev/devBiSoftRaw.c index 2afef6356..3f40bade8 100644 --- a/src/std/dev/devBiSoftRaw.c +++ b/src/std/dev/devBiSoftRaw.c @@ -48,19 +48,8 @@ epicsExportAddress(dset, devBiSoftRaw); static long init_record(biRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devBiSoftRaw (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devEventSoft.c b/src/std/dev/devEventSoft.c index 418da5658..09987cb5b 100644 --- a/src/std/dev/devEventSoft.c +++ b/src/std/dev/devEventSoft.c @@ -48,20 +48,9 @@ epicsExportAddress(dset, devEventSoft); static long init_record(eventRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_STRING, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devEventSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devHistogramSoft.c b/src/std/dev/devHistogramSoft.c index cdb4add1e..21a09b52e 100644 --- a/src/std/dev/devHistogramSoft.c +++ b/src/std/dev/devHistogramSoft.c @@ -52,20 +52,9 @@ epicsExportAddress(dset,devHistogramSoft); static long init_record(histogramRecord *prec) { - /* histogram.svl must be a CONSTANT or a PV_LINK or a DB_LINK or a CA_LINK*/ - switch (prec->svl.type) { - case (CONSTANT) : + if (prec->svl.type == CONSTANT) { if(recGblInitConstantLink(&prec->svl,DBF_DOUBLE,&prec->sgnl)) prec->udf = FALSE; - break; - case (PV_LINK) : - case (DB_LINK) : - case (CA_LINK) : - break; - default : - recGblRecordError(S_db_badField,(void *)prec, - "devHistogramSoft (init_record) Illegal SVL field"); - return(S_db_badField); } return 0; } diff --git a/src/std/dev/devLiSoft.c b/src/std/dev/devLiSoft.c index 11dbedc3f..3deea8493 100644 --- a/src/std/dev/devLiSoft.c +++ b/src/std/dev/devLiSoft.c @@ -48,20 +48,9 @@ epicsExportAddress(dset, devLiSoft); static long init_record(longinRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_LONG, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devLiSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devMbbiDirectSoft.c b/src/std/dev/devMbbiDirectSoft.c index 8b7816b65..ccbc7efe7 100644 --- a/src/std/dev/devMbbiDirectSoft.c +++ b/src/std/dev/devMbbiDirectSoft.c @@ -48,20 +48,9 @@ epicsExportAddress(dset, devMbbiDirectSoft); static long init_record(mbbiDirectRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devMbbiDirectSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devMbbiDirectSoftRaw.c b/src/std/dev/devMbbiDirectSoftRaw.c index df8c08f52..3824cdc14 100644 --- a/src/std/dev/devMbbiDirectSoftRaw.c +++ b/src/std/dev/devMbbiDirectSoftRaw.c @@ -48,19 +48,8 @@ epicsExportAddress(dset, devMbbiDirectSoftRaw); static long init_record(mbbiDirectRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devMbbiDirectSoftRaw (init_record) Illegal INP field"); - return S_db_badField; } /*to preserve old functionality*/ if (prec->nobt == 0) prec->mask = 0xffffffff; diff --git a/src/std/dev/devMbbiSoft.c b/src/std/dev/devMbbiSoft.c index c3b0d28f1..210699fa6 100644 --- a/src/std/dev/devMbbiSoft.c +++ b/src/std/dev/devMbbiSoft.c @@ -48,20 +48,9 @@ epicsExportAddress(dset, devMbbiSoft); static long init_record(mbbiRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_ENUM, &prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devMbbiSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devMbbiSoftRaw.c b/src/std/dev/devMbbiSoftRaw.c index 997201cdb..4d5b57cb9 100644 --- a/src/std/dev/devMbbiSoftRaw.c +++ b/src/std/dev/devMbbiSoftRaw.c @@ -48,19 +48,8 @@ epicsExportAddress(dset, devMbbiSoftRaw); static long init_record(mbbiRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { recGblInitConstantLink(&prec->inp, DBF_ULONG, &prec->rval); - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devMbbiSoftRaw (init_record) Illegal INP field"); - return S_db_badField; } /*to preserve old functionality*/ if (prec->nobt == 0) prec->mask = 0xffffffff; diff --git a/src/std/dev/devSASoft.c b/src/std/dev/devSASoft.c index 6178b6ce7..049fa644e 100644 --- a/src/std/dev/devSASoft.c +++ b/src/std/dev/devSASoft.c @@ -48,19 +48,8 @@ epicsExportAddress(dset, devSASoft); static long init_record(subArrayRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { prec->nord = 0; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devSASoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devSiSoft.c b/src/std/dev/devSiSoft.c index 1a64674cf..044a41afb 100644 --- a/src/std/dev/devSiSoft.c +++ b/src/std/dev/devSiSoft.c @@ -50,20 +50,9 @@ epicsExportAddress(dset, devSiSoft); static long init_record(stringinRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { if (recGblInitConstantLink(&prec->inp, DBF_STRING, prec->val)) prec->udf = FALSE; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devSiSoft (init_record) Illegal INP field"); - return S_db_badField; } return 0; } diff --git a/src/std/dev/devWfSoft.c b/src/std/dev/devWfSoft.c index 0ea0ce771..c18b9007c 100644 --- a/src/std/dev/devWfSoft.c +++ b/src/std/dev/devWfSoft.c @@ -49,19 +49,8 @@ epicsExportAddress(dset, devWfSoft); static long init_record(waveformRecord *prec) { - /* INP must be CONSTANT, PV_LINK, DB_LINK or CA_LINK*/ - switch (prec->inp.type) { - case CONSTANT: + if (prec->inp.type == CONSTANT) { prec->nord = 0; - break; - case PV_LINK: - case DB_LINK: - case CA_LINK: - break; - default: - recGblRecordError(S_db_badField, (void *)prec, - "devWfSoft (init_record) Illegal INP field"); - return(S_db_badField); } return 0; }