Treat ENUM as signed to allow things like %#{A=-1|B=0|C=1}

This commit is contained in:
2018-08-20 15:05:55 +02:00
parent eb4e4b08ff
commit 1b0e890ddd
9 changed files with 13 additions and 10 deletions

View File

@ -188,10 +188,10 @@ static long writeData(dbCommon *record, format_t *format)
dval = ((epicsUInt32 *)aai->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
dval = ((epicsInt16 *)aai->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
dval = ((epicsUInt16 *)aai->bptr)[nowd];
break;
case DBF_CHAR:
@ -231,10 +231,10 @@ static long writeData(dbCommon *record, format_t *format)
lval = ((epicsUInt32 *)aai->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
lval = ((epicsInt16 *)aai->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
lval = ((epicsUInt16 *)aai->bptr)[nowd];
break;
case DBF_CHAR:

View File

@ -217,10 +217,10 @@ static long writeData(dbCommon *record, format_t *format)
dval = ((epicsUInt32 *)aao->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
dval = ((epicsInt16 *)aao->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
dval = ((epicsUInt16 *)aao->bptr)[nowd];
break;
case DBF_CHAR:
@ -260,10 +260,10 @@ static long writeData(dbCommon *record, format_t *format)
lval = ((epicsUInt32 *)aao->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
lval = ((epicsInt16 *)aao->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
lval = ((epicsUInt16 *)aao->bptr)[nowd];
break;
case DBF_CHAR:

View File

@ -78,11 +78,11 @@ static long writeData(dbCommon *record, format_t *format)
return streamPrintf(record, format, co->oval);
}
case DBF_ULONG:
case DBF_ENUM:
{
return streamPrintf(record, format, (unsigned long)co->oval);
}
case DBF_LONG:
case DBF_ENUM:
{
return streamPrintf(record, format, (long)co->oval);
}

View File

@ -47,9 +47,9 @@ static long writeData(dbCommon *record, format_t *format)
switch (format->type)
{
case DBF_ULONG:
case DBF_ENUM:
return streamPrintf(record, format, (unsigned long)li->val);
case DBF_LONG:
case DBF_ENUM:
return streamPrintf(record, format, (long)li->val);
}
return ERROR;

View File

@ -68,9 +68,9 @@ static long writeData(dbCommon *record, format_t *format)
switch (format->type)
{
case DBF_ULONG:
case DBF_ENUM:
return streamPrintf(record, format, lo->val);
case DBF_LONG:
case DBF_ENUM:
return streamPrintf(record, format, (long)lo->val);
}
return ERROR;

View File

@ -80,6 +80,7 @@ static long writeData(dbCommon *record, format_t *format)
switch (format->type)
{
case DBF_LONG:
case DBF_ULONG:
{
/* print VAL or RVAL ? Look if any value is defined */
val = mbbi->val;

View File

@ -86,11 +86,11 @@ static long writeData(dbCommon *record, format_t *format)
switch (format->type)
{
case DBF_ULONG:
case DBF_ENUM:
val = mbboD->rval;
if (mbboD->mask) val &= mbboD->mask;
break;
case DBF_LONG:
case DBF_ENUM:
val = (epicsInt32)mbboD->rval;
if (mbboD->mask) val &= (epicsInt32)mbboD->mask;
break;

View File

@ -42,6 +42,7 @@ static long readData(dbCommon *record, format_t *format)
return OK;
}
case DBF_LONG:
case DBF_UONG:
case DBF_ENUM:
{
long lval;
@ -71,6 +72,7 @@ static long writeData(dbCommon *record, format_t *format)
return streamPrintf(record, format, sco->oval);
}
case DBF_LONG:
case DBF_UONG:
case DBF_ENUM:
{
return streamPrintf(record, format, (long)sco->oval);

View File

@ -189,10 +189,10 @@ static long writeData(dbCommon *record, format_t *format)
dval = ((epicsUInt32 *)wf->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
dval = ((epicsInt16 *)wf->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
dval = ((epicsUInt16 *)wf->bptr)[nowd];
break;
case DBF_CHAR:
@ -232,10 +232,10 @@ static long writeData(dbCommon *record, format_t *format)
lval = ((epicsUInt32 *)wf->bptr)[nowd];
break;
case DBF_SHORT:
case DBF_ENUM:
lval = ((epicsInt16 *)wf->bptr)[nowd];
break;
case DBF_USHORT:
case DBF_ENUM:
lval = ((epicsUInt16 *)wf->bptr)[nowd];
break;
case DBF_CHAR: