handle new 64 bit data types

This commit is contained in:
2018-03-19 17:12:57 +01:00
parent f0a1839548
commit 8000f41de8
4 changed files with 74 additions and 9 deletions

View File

@ -967,10 +967,11 @@ getFieldAddress(const char* fieldname, StreamBuffer& address)
}
static const unsigned char dbfMapping[] =
#ifdef DBF_INT64
{0, DBF_UINT64, DBF_INT64, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
#else
{0, DBF_ULONG, DBF_LONG, DBF_ENUM, DBF_DOUBLE, DBF_STRING};
static const short typeSize[] =
{0, sizeof(epicsUInt32), sizeof(epicsInt32), sizeof(epicsUInt16),
sizeof(epicsFloat64), MAX_STRING_SIZE};
#endif
bool Stream::
formatValue(const StreamFormat& format, const void* fieldaddress)
@ -1018,7 +1019,7 @@ formatValue(const StreamFormat& format, const void* fieldaddress)
/* convert type to LONG, ENUM, DOUBLE, or STRING */
long nelem = pdbaddr->no_elements;
size_t size = nelem * typeSize[format.type];
size_t size = nelem * dbValueSize(fmt.type);
/* print (U)CHAR arrays as string */
if (format.type == string_format &&
@ -1137,7 +1138,7 @@ matchValue(const StreamFormat& format, const void* fieldaddress)
DBADDR* pdbaddr = (DBADDR*)fieldaddress;
long nord;
long nelem = pdbaddr->no_elements;
size_t size = nelem * typeSize[format.type];
size_t size = nelem * dbValueSize(fmt.type);
buffer = fieldBuffer.clear().reserve(size);
for (nord = 0; nord < nelem; nord++)
{

View File

@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
case DBF_FLOAT:
((epicsFloat32 *)aai->bptr)[aai->nord] = (epicsFloat32)lval;
break;
#ifdef DBF_INT64
case DBF_INT64:
case DBF_UINT64:
((epicsInt64 *)aai->bptr)[aai->nord] = (epicsInt64)lval;
break;
#endif
case DBF_LONG:
case DBF_ULONG:
((epicsInt32 *)aai->bptr)[aai->nord] = (epicsInt32)lval;
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
case DBF_FLOAT:
dval = ((epicsFloat32 *)aai->bptr)[nowd];
break;
#ifdef DBF_INT64
case DBF_INT64:
dval = ((epicsInt64 *)aai->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)aai->bptr)[nowd];
break;
#endif
case DBF_LONG:
dval = ((epicsInt32 *)aai->bptr)[nowd];
break;
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
{
switch (aai->ftvl)
{
#ifdef DBF_INT64
case DBF_INT64:
lval = ((epicsInt64 *)aao->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)aao->bptr)[nowd];
break;
#endif
case DBF_LONG:
lval = ((epicsInt32 *)aai->bptr)[nowd];
break;
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
static long initRecord (dbCommon *record)
{
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
aaiRecord *aai = (aaiRecord *) record;
aai->bptr = calloc(aai->nelm, typesize[aai->ftvl]);
aai->bptr = calloc(aai->nelm, dbValueSize(aai->ftvl));
if (aai->bptr == NULL)
{
errlogSevPrintf (errlogFatal,

View File

@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
case DBF_FLOAT:
((epicsFloat32 *)aao->bptr)[aao->nord] = (epicsFloat32)lval;
break;
#ifdef DBF_INT64
case DBF_INT64:
case DBF_UINT64:
((epicsInt64 *)aao->bptr)[aao->nord] = (epicsInt64)lval;
break;
#endif
case DBF_LONG:
case DBF_ULONG:
((epicsInt32 *)aao->bptr)[aao->nord] = (epicsInt32)lval;
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
case DBF_FLOAT:
dval = ((epicsFloat32 *)aao->bptr)[nowd];
break;
#ifdef DBF_INT64
case DBF_INT64:
dval = ((epicsInt64 *)aao->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)aao->bptr)[nowd];
break;
#endif
case DBF_LONG:
dval = ((epicsInt32 *)aao->bptr)[nowd];
break;
@ -198,6 +212,14 @@ static long writeData (dbCommon *record, format_t *format)
{
switch (aao->ftvl)
{
#ifdef DBF_INT64
case DBF_INT64:
lval = ((epicsInt64 *)aao->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)aao->bptr)[nowd];
break;
#endif
case DBF_LONG:
lval = ((epicsInt32 *)aao->bptr)[nowd];
break;
@ -274,10 +296,9 @@ static long writeData (dbCommon *record, format_t *format)
static long initRecord (dbCommon *record)
{
static const int typesize[] = {MAX_STRING_SIZE,1,1,2,2,4,4,4,8,2};
aaoRecord *aao = (aaoRecord *) record;
aao->bptr = calloc(aao->nelm, typesize[aao->ftvl]);
aao->bptr = calloc(aao->nelm, dbValueSize(aao->ftvl));
if (aao->bptr == NULL)
{
errlogSevPrintf (errlogFatal,

View File

@ -73,6 +73,12 @@ static long readData (dbCommon *record, format_t *format)
case DBF_FLOAT:
((epicsFloat32 *)wf->bptr)[wf->nord] = (epicsFloat32)lval;
break;
#ifdef DBF_INT64
case DBF_INT64:
case DBF_UINT64:
((epicsInt64 *)wf->bptr)[aao->nord] = (epicsInt64)lval;
break;
#endif
case DBF_LONG:
case DBF_ULONG:
((epicsInt32 *)wf->bptr)[wf->nord] = (epicsInt32)lval;
@ -163,6 +169,14 @@ static long writeData (dbCommon *record, format_t *format)
case DBF_FLOAT:
dval = ((epicsFloat32 *)wf->bptr)[nowd];
break;
#ifdef DBF_INT64
case DBF_INT64:
dval = ((epicsInt64 *)wf->bptr)[nowd];
break;
case DBF_UINT64:
dval = ((epicsUInt64 *)wf->bptr)[nowd];
break;
#endif
case DBF_LONG:
dval = ((epicsInt32 *)wf->bptr)[nowd];
break;
@ -197,6 +211,14 @@ static long writeData (dbCommon *record, format_t *format)
{
switch (wf->ftvl)
{
#ifdef DBF_INT64
case DBF_INT64:
lval = ((epicsInt64 *)wf->bptr)[nowd];
break;
case DBF_UINT64:
lval = ((epicsUInt64 *)wf->bptr)[nowd];
break;
#endif
case DBF_LONG:
lval = ((epicsInt32 *)wf->bptr)[nowd];
break;