Adjust record and device support for array constants

This commit is contained in:
Andrew Johnson
2016-08-10 12:53:39 -05:00
parent 519208833f
commit fb785e45c7
5 changed files with 25 additions and 15 deletions
+6 -2
View File
@@ -130,8 +130,12 @@ static long init_record(aSubRecord *prec, int pass)
struct link *plink = &(&prec->inpa)[i];
if (plink->type == CONSTANT) {
if ((&prec->noa)[i] < 2)
recGblInitConstantLink(plink, (&prec->fta)[i], (&prec->a)[i]);
short dbr = (&prec->fta)[i];
long n = (&prec->noa)[i];
dbLoadLinkArray(plink, dbr, (&prec->a)[i], &n);
if (n > 0)
(&prec->nea)[i] = n;
}
}
+6 -5
View File
@@ -8,6 +8,7 @@
#include <string.h>
#include "dbAccess.h"
#include "dbTest.h"
#include "dbUnitTest.h"
#include "errlog.h"
@@ -45,16 +46,16 @@ static void testGetPutArray(void)
testAbort("Failed to find record wfrec");
memcpy(&save, &addr, sizeof(save));
testDiag("Fetch initial value");
testDiag("Fetch initial value of %s", prec->name);
dbScanLock(addr.precord);
testOk1(prec->nord==0);
testOk(prec->nord==3, "prec->nord==3 (got %d)", prec->nord);
nreq = NELEMENTS(data);
if(dbGet(&addr, DBF_DOUBLE, &data, NULL, &nreq, NULL))
testFail("dbGet fails");
else {
testOk(nreq==0, "nreq==0 (got %ld)", nreq);
testOk(nreq==3, "nreq==3 (got %ld)", nreq);
}
dbScanUnlock(addr.precord);
@@ -101,10 +102,10 @@ static void testGetPutArray(void)
testAbort("Failed to find record wfrec1");
memcpy(&save, &addr, sizeof(save));
testDiag("Fetch initial value");
testDiag("Fetch initial value of %s", prec->name);
dbScanLock(addr.precord);
testOk1(prec->nord==0);
testOk(prec->nord==0, "prec->nord==0 (got %d)", prec->nord);
nreq = NELEMENTS(data);
if(dbGet(&addr, DBF_DOUBLE, &data, NULL, &nreq, NULL))
+1
View File
@@ -1,6 +1,7 @@
record(waveform, "wfrec") {
field(NELM, "10")
field(FTVL, "LONG")
field(INP, [1, 2, 3])
}
record(waveform, "wfrec1") {
field(NELM, "1")