Merged changes from 3.15 up to revno 12658
This commit is contained in:
@@ -38,9 +38,6 @@
|
||||
#include "recSup.h"
|
||||
#include "special.h"
|
||||
|
||||
/* The following is defined in db_convert.h */
|
||||
extern unsigned short dbDBRnewToDBRold[DBR_ENUM+1];
|
||||
|
||||
typedef struct parseContext {
|
||||
dbChannel *chan;
|
||||
chFilter *filter;
|
||||
@@ -618,7 +615,7 @@ long dbChannelOpen(dbChannel *chan)
|
||||
/* Set up type probe */
|
||||
probe.type = dbfl_type_val;
|
||||
probe.ctx = dbfl_context_read;
|
||||
probe.field_type = dbChannelFieldType(chan);
|
||||
probe.field_type = dbChannelExportType(chan);
|
||||
probe.no_elements = dbChannelElements(chan);
|
||||
probe.field_size = dbChannelFieldSize(chan);
|
||||
p = probe;
|
||||
@@ -660,7 +657,6 @@ long dbChannelOpen(dbChannel *chan)
|
||||
chan->final_no_elements = probe.no_elements;
|
||||
chan->final_field_size = probe.field_size;
|
||||
chan->final_type = probe.field_type;
|
||||
chan->final_dbr_type = dbDBRnewToDBRold[mapDBFToDBR[probe.field_type]];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -709,9 +705,9 @@ void dbChannelShow(dbChannel *chan, int level, const unsigned short indent)
|
||||
int post = ellCount(&chan->post_chain);
|
||||
|
||||
printf("%*schannel name: %s\n", indent, "", chan->name);
|
||||
/* FIXME: show field_type as text */
|
||||
printf("%*s field_type=%d (%dB), %ld element%s, %d filter%s", indent, "",
|
||||
chan->addr.field_type, chan->addr.field_size, elems, elems == 1 ? "" : "s",
|
||||
printf("%*s field_type=%s (%d bytes), dbr_type=%s, %ld element%s, %d filter%s", indent, "",
|
||||
dbGetFieldTypeString(chan->addr.field_type), chan->addr.field_size,
|
||||
dbGetFieldTypeString(chan->addr.dbr_field_type), elems, elems == 1 ? "" : "s",
|
||||
count, count == 1 ? "" : "s");
|
||||
if (count)
|
||||
printf(" (%d pre eventq, %d post eventq)\n", pre, post);
|
||||
@@ -720,9 +716,9 @@ void dbChannelShow(dbChannel *chan, int level, const unsigned short indent)
|
||||
if (level > 0)
|
||||
dbChannelFilterShow(chan, level - 1, indent + 2);
|
||||
if (count) {
|
||||
/* FIXME: show field_type as text */
|
||||
printf("%*s final field_type=%d (%dB), %ld element%s\n", indent, "",
|
||||
chan->final_type, chan->final_field_size, felems, felems == 1 ? "" : "s");
|
||||
printf("%*s final field_type=%s (%dB), %ld element%s\n", indent, "",
|
||||
dbGetFieldTypeString(chan->final_type), chan->final_field_size,
|
||||
felems, felems == 1 ? "" : "s");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ typedef struct dbChannel {
|
||||
long final_no_elements; /* final number of elements (arrays) */
|
||||
short final_field_size; /* final size of element */
|
||||
short final_type; /* final type of database field */
|
||||
short final_dbr_type; /* final field type as seen by database request */
|
||||
ELLLIST filters; /* list of filters as created from JSON */
|
||||
ELLLIST pre_chain; /* list of filters to be called pre-event-queue */
|
||||
ELLLIST post_chain; /* list of filters to be called post-event-queue */
|
||||
@@ -186,7 +185,7 @@ epicsShareFunc long dbChannelOpen(dbChannel *chan);
|
||||
#define dbChannelFinalFieldType(pChan) ((pChan)->final_type)
|
||||
|
||||
/* evaluates to short */
|
||||
#define dbChannelFinalExportType(pChan) ((pChan)->final_dbr_type)
|
||||
#define dbChannelFinalExportType(pChan) ((pChan)->final_type)
|
||||
|
||||
/* evaluates to short */
|
||||
#define dbChannelFinalFieldSize(pChan) ((pChan)->final_field_size)
|
||||
|
||||
@@ -119,13 +119,14 @@ struct dbChannel * dbChannel_create(const char *pname)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chan->addr.dbr_field_type = dbDBRnewToDBRold[ftype];
|
||||
|
||||
if (dbChannelOpen(chan)) {
|
||||
dbChannelDelete(chan);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Convert final_type to CA's type mapping */
|
||||
chan->final_type = dbDBRnewToDBRold[chan->final_type];
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
{
|
||||
dbChannel *pch;
|
||||
|
||||
testPlan(66);
|
||||
testPlan(76);
|
||||
|
||||
if (dbReadDatabase(&pdbbase, "dbTestIoc.dbd",
|
||||
"." OSI_PATH_LIST_SEPARATOR ".." OSI_PATH_LIST_SEPARATOR
|
||||
@@ -173,6 +173,7 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
r = e = 0;
|
||||
/* dbChannelTest() checks record and field names */
|
||||
testOk1(!dbChannelTest("x.NAME"));
|
||||
testOk1(!dbChannelTest("x.INP"));
|
||||
testOk1(!dbChannelTest("x.VAL"));
|
||||
testOk1(!dbChannelTest("x."));
|
||||
testOk1(!dbChannelTest("x"));
|
||||
@@ -188,12 +189,22 @@ MAIN(testDbChannel) /* dbChannelTest is an API routine... */
|
||||
testOk1(!!(pch = dbChannelCreate("x.{}")));
|
||||
if (pch) dbChannelDelete(pch);
|
||||
testOk1(!!(pch = dbChannelCreate("x.VAL{}")));
|
||||
testOk1(pch && dbChannelElements(pch) == 1);
|
||||
if (pch) dbChannelDelete(pch);
|
||||
testOk1(!!(pch = dbChannelCreate("x.NAME$")));
|
||||
testOk1(pch && pch->addr.no_elements > 1);
|
||||
testOk1(pch && dbChannelFieldType(pch) == DBF_CHAR);
|
||||
testOk1(pch && dbChannelExportType(pch) == DBR_CHAR);
|
||||
testOk1(pch && dbChannelElements(pch) == PVNAME_STRINGSZ);
|
||||
if (pch) dbChannelDelete(pch);
|
||||
testOk1(!!(pch = dbChannelCreate("x.INP$")));
|
||||
testOk1(pch && dbChannelFieldType(pch) == DBF_INLINK);
|
||||
testOk1(pch && dbChannelExportType(pch) == DBR_CHAR);
|
||||
testOk1(pch && dbChannelElements(pch) > PVNAME_STRINGSZ);
|
||||
if (pch) dbChannelDelete(pch);
|
||||
testOk1(!!(pch = dbChannelCreate("x.NAME${}")));
|
||||
testOk1(pch && pch->addr.no_elements > 1);
|
||||
testOk1(pch && dbChannelFieldType(pch) == DBF_CHAR);
|
||||
testOk1(pch && dbChannelExportType(pch) == DBR_CHAR);
|
||||
testOk1(pch && dbChannelElements(pch) == PVNAME_STRINGSZ);
|
||||
if (pch) dbChannelDelete(pch);
|
||||
|
||||
/* dbChannelCreate() rejects bad PVs */
|
||||
|
||||
@@ -488,13 +488,10 @@ static void dbRecordtypeFieldHead(char *name,char *type)
|
||||
pdbFldDes->as_level = ASL1;
|
||||
pdbFldDes->isDevLink = strcmp(pdbFldDes->name, "INP")==0 ||
|
||||
strcmp(pdbFldDes->name, "OUT")==0;
|
||||
for(i=0; i<DBF_NTYPES; i++) {
|
||||
if(strcmp(type,pamapdbfType[i].strvalue)==0) {
|
||||
pdbFldDes->field_type = pamapdbfType[i].value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
yyerrorAbort("Illegal Field Type");
|
||||
i = dbFindFieldType(type);
|
||||
if (i < 0)
|
||||
yyerrorAbort("Illegal Field Type");
|
||||
pdbFldDes->field_type = i;
|
||||
}
|
||||
|
||||
static void dbRecordtypeFieldItem(char *name,char *value)
|
||||
|
||||
@@ -801,15 +801,8 @@ long dbWriteRecordTypeFP(
|
||||
int j;
|
||||
|
||||
pdbFldDes = pdbRecordType->papFldDes[i];
|
||||
fprintf(fp,"\tfield(%s,",pdbFldDes->name);
|
||||
for(j=0; j<DBF_NTYPES; j++) {
|
||||
if(pamapdbfType[j].value == pdbFldDes->field_type) break;
|
||||
}
|
||||
if(j>=DBF_NTYPES)
|
||||
fprintf(stderr,"\t field_type: %d\n",
|
||||
pdbFldDes->field_type);
|
||||
else
|
||||
fprintf(fp,"%s) {\n",pamapdbfType[j].strvalue);
|
||||
fprintf(fp,"\tfield(%s,%s) {\n",pdbFldDes->name,
|
||||
dbGetFieldTypeString(pdbFldDes->field_type));
|
||||
if(pdbFldDes->prompt)
|
||||
fprintf(fp,"\t\tprompt(\"%s\")\n",pdbFldDes->prompt);
|
||||
if(pdbFldDes->initial)
|
||||
@@ -2654,6 +2647,30 @@ brkTable * dbFindBrkTable(dbBase *pdbbase,const char *name)
|
||||
return((brkTable *)pgph->userPvt);
|
||||
}
|
||||
|
||||
const char * dbGetFieldTypeString(int dbfType)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i < DBF_NTYPES; i++) {
|
||||
if (pamapdbfType[i].value == dbfType) {
|
||||
return pamapdbfType[i].strvalue;
|
||||
}
|
||||
}
|
||||
return "BAD_DBF_TYPE";
|
||||
}
|
||||
|
||||
int dbFindFieldType(const char *type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < DBF_NTYPES; i++) {
|
||||
if (strcmp(type, pamapdbfType[i].strvalue) == 0) {
|
||||
return pamapdbfType[i].value;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
dbMenu * dbFindMenu(dbBase *pdbbase,const char *name)
|
||||
{
|
||||
GPHENTRY *pgph;
|
||||
@@ -3042,13 +3059,8 @@ void dbDumpField(
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
for(j=0; j<DBF_NTYPES; j++) {
|
||||
if(pamapdbfType[j].value == pdbFldDes->field_type) break;
|
||||
}
|
||||
if(j>=DBF_NTYPES)
|
||||
printf("\t field_type: %d\n", pdbFldDes->field_type);
|
||||
else
|
||||
printf("\t field_type: %s\n", pamapdbfType[j].strvalue);
|
||||
printf("\t field_type: %s\n",
|
||||
dbGetFieldTypeString(pdbFldDes->field_type));
|
||||
printf("\tprocess_passive: %u\n",pdbFldDes->process_passive);
|
||||
printf("\t property: %u\n",pdbFldDes->prop);
|
||||
printf("\t base: %d\n",pdbFldDes->base);
|
||||
|
||||
@@ -190,6 +190,9 @@ epicsShareFunc long dbPutInfo(DBENTRY *pdbentry,
|
||||
epicsShareFunc brkTable * dbFindBrkTable(DBBASE *pdbbase,
|
||||
const char *name);
|
||||
|
||||
epicsShareFunc const char * dbGetFieldTypeString(int dbfType);
|
||||
epicsShareFunc int dbFindFieldType(const char *type);
|
||||
|
||||
epicsShareFunc dbMenu * dbFindMenu(DBBASE *pdbbase,
|
||||
const char *name);
|
||||
epicsShareFunc char ** dbGetMenuChoices(DBENTRY *pdbentry);
|
||||
|
||||
@@ -390,7 +390,7 @@ void currentTime::getCurrentTime ( epicsTimeStamp & dest )
|
||||
LONGLONG epicsTimeCurrent = this->epicsTimeLast + offset;
|
||||
if ( this->epicsTimeLast > epicsTimeCurrent ) {
|
||||
double diff = static_cast < double >
|
||||
( this->epicsTimeLast - epicsTimeCurrent );
|
||||
( this->epicsTimeLast - epicsTimeCurrent ) / EPICS_TIME_TICKS_PER_SEC;
|
||||
errlogPrintf (
|
||||
"currentTime::getCurrentTime(): %f sec "
|
||||
"time discontinuity detected\n",
|
||||
|
||||
Reference in New Issue
Block a user