fix int64 in pva link

This commit is contained in:
Michael Davidsaver
2019-01-08 10:22:11 -08:00
parent 0ab4f937a7
commit 7bc5cbf957
5 changed files with 30 additions and 23 deletions

View File

@ -25,8 +25,10 @@ pvd::ScalarType DBR2PVD(short dbr)
switch(dbr) { switch(dbr) {
#define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE; #define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE;
#define CASE_SKIP_BOOL #define CASE_SKIP_BOOL
#define CASE_REAL_INT64
#include "pv/typemap.h" #include "pv/typemap.h"
#undef CASE_SKIP_BOOL #undef CASE_SKIP_BOOL
#undef CASE_REAL_INT64
#undef CASE #undef CASE
case DBF_ENUM: return pvd::pvUShort; case DBF_ENUM: return pvd::pvUShort;
case DBF_STRING: return pvd::pvString; case DBF_STRING: return pvd::pvString;

View File

@ -389,8 +389,10 @@ pvd::ScalarType DBR2PVD(short dbr)
switch(dbr) { switch(dbr) {
#define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE; #define CASE(BASETYPE, PVATYPE, DBFTYPE, PVACODE) case DBR_##DBFTYPE: return pvd::pv##PVACODE;
#define CASE_SKIP_BOOL #define CASE_SKIP_BOOL
#define CASE_REAL_INT64
#include "pv/typemap.h" #include "pv/typemap.h"
#undef CASE_SKIP_BOOL #undef CASE_SKIP_BOOL
#undef CASE_REAL_INT64
#undef CASE #undef CASE
case DBF_ENUM: return pvd::pvUShort; case DBF_ENUM: return pvd::pvUShort;
case DBF_STRING: return pvd::pvString; case DBF_STRING: return pvd::pvString;

View File

@ -230,7 +230,7 @@ void testDBR2PVD_array()
MAIN(testdbf_copy) MAIN(testdbf_copy)
{ {
testPlan(51); testPlan(53);
try{ try{
testPVD2DBR_scalar<pvd::pvDouble, double>(DBF_DOUBLE, 42.2, 42.2); testPVD2DBR_scalar<pvd::pvDouble, double>(DBF_DOUBLE, 42.2, 42.2);
testPVD2DBR_scalar<pvd::pvDouble, pvd::uint16>(DBF_USHORT, 42.2, 42u); testPVD2DBR_scalar<pvd::pvDouble, pvd::uint16>(DBF_USHORT, 42.2, 42u);
@ -238,6 +238,9 @@ MAIN(testdbf_copy)
testPVD2DBR_scalar<pvd::pvInt, pvd::int32>(DBF_LONG, 42, 42); testPVD2DBR_scalar<pvd::pvInt, pvd::int32>(DBF_LONG, 42, 42);
testPVD2DBR_scalar<pvd::pvInt, char[MAX_STRING_SIZE]>(DBF_STRING, 42, std::string("42")); testPVD2DBR_scalar<pvd::pvInt, char[MAX_STRING_SIZE]>(DBF_STRING, 42, std::string("42"));
testPVD2DBR_scalar<pvd::pvLong, pvd::int64>(DBF_INT64, 42, 42);
testPVD2DBR_scalar<pvd::pvLong, char[MAX_STRING_SIZE]>(DBF_STRING, 42, std::string("42"));
testPVD2DBR_scalar<pvd::pvUShort, pvd::uint16>(DBF_USHORT, 41u, 41); testPVD2DBR_scalar<pvd::pvUShort, pvd::uint16>(DBF_USHORT, 41u, 41);
testPVD2DBR_scalar<pvd::pvByte, pvd::int8>(DBF_CHAR, 41, 41); testPVD2DBR_scalar<pvd::pvByte, pvd::int8>(DBF_CHAR, 41, 41);

View File

@ -15,31 +15,31 @@ void testGet()
{ {
testDiag("==== testGet ===="); testDiag("==== testGet ====");
longinRecord *li1 = (longinRecord*)testdbRecordPtr("src:li1"); longinRecord *li1 = (longinRecord*)testdbRecordPtr("src:i1");
while(!dbIsLinkConnected(&li1->inp)) while(!dbIsLinkConnected(&li1->inp))
testqsrvWaitForLinkEvent(&li1->inp); testqsrvWaitForLinkEvent(&li1->inp);
testdbGetFieldEqual("target:li.VAL", DBF_LONG, 42); testdbGetFieldEqual("target:i.VAL", DBF_INT64, 42);
testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 0); // value before first process testdbGetFieldEqual("src:i1.VAL", DBF_INT64, 0); // value before first process
testdbGetFieldEqual("src:li1.INP", DBF_STRING, "{\"pva\":\"target:li\"}"); testdbGetFieldEqual("src:i1.INP", DBF_STRING, "{\"pva\":\"target:i\"}");
testdbPutFieldOk("src:li1.PROC", DBF_LONG, 1); testdbPutFieldOk("src:i1.PROC", DBF_INT64, 1);
testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 42); testdbGetFieldEqual("src:i1.VAL", DBF_INT64, 42);
testdbPutFieldOk("src:li1.INP", DBF_STRING, "{\"pva\":\"target:ai\"}"); testdbPutFieldOk("src:i1.INP", DBF_STRING, "{\"pva\":\"target:ai\"}");
while(!dbIsLinkConnected(&li1->inp)) while(!dbIsLinkConnected(&li1->inp))
testqsrvWaitForLinkEvent(&li1->inp); testqsrvWaitForLinkEvent(&li1->inp);
testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 42); // changing link doesn't automatically process testdbGetFieldEqual("src:i1.VAL", DBF_INT64, 42); // changing link doesn't automatically process
testdbPutFieldOk("src:li1.PROC", DBF_LONG, 1); testdbPutFieldOk("src:i1.PROC", DBF_INT64, 1);
testdbGetFieldEqual("src:li1.VAL", DBF_LONG, 4); // now it's changed testdbGetFieldEqual("src:i1.VAL", DBF_INT64, 4); // now it's changed
} }
void testPut() void testPut()
@ -51,14 +51,14 @@ void testPut()
while(!dbIsLinkConnected(&lo2->out)) while(!dbIsLinkConnected(&lo2->out))
testqsrvWaitForLinkEvent(&lo2->out); testqsrvWaitForLinkEvent(&lo2->out);
testdbGetFieldEqual("target:li2.VAL", DBF_LONG, 43); testdbGetFieldEqual("target:i2.VAL", DBF_INT64, 43);
testdbGetFieldEqual("src:lo2.VAL", DBF_LONG, 0); testdbGetFieldEqual("src:lo2.VAL", DBF_INT64, 0);
testdbGetFieldEqual("src:lo2.OUT", DBF_STRING, "{\"pva\":\"target:li2\"}"); testdbGetFieldEqual("src:lo2.OUT", DBF_STRING, "{\"pva\":\"target:i2\"}");
testdbPutFieldOk("src:lo2.VAL", DBF_LONG, 14); testdbPutFieldOk("src:lo2.VAL", DBF_INT64, 14);
testdbGetFieldEqual("target:li2.VAL", DBF_LONG, 14); testdbGetFieldEqual("target:i2.VAL", DBF_INT64, 14);
testdbGetFieldEqual("src:lo2.VAL", DBF_LONG, 14); testdbGetFieldEqual("src:lo2.VAL", DBF_INT64, 14);
} }
} // namespace } // namespace

View File

@ -1,21 +1,21 @@
# used by testGet() # used by testGet()
record(longin, "target:li") { record(int64in, "target:i") {
field(VAL, "42") field(VAL, "42")
} }
record(ai, "target:ai") { record(ai, "target:ai") {
field(VAL, "4.0") field(VAL, "4.0")
} }
record(longin, "src:li1") { record(int64in, "src:i1") {
field(INP, {pva:"target:li"}) field(INP, {pva:"target:i"})
} }
# used by testPut() # used by testPut()
record(longin, "target:li2") { record(int64in, "target:i2") {
field(VAL, "43") field(VAL, "43")
} }
record(longout, "src:lo2") { record(int64out, "src:lo2") {
field(OUT, {pva:"target:li2"}) field(OUT, {pva:"target:i2"})
} }