diff --git a/src/ioc/db/dbBkpt.c b/src/ioc/db/dbBkpt.c index 347e28cd4..5a24822cb 100644 --- a/src/ioc/db/dbBkpt.c +++ b/src/ioc/db/dbBkpt.c @@ -410,7 +410,7 @@ long dbd(const char *record_name) precord = addr.precord; - if (! precord->bkpt & BKPT_ON_MASK) { + if (! (precord->bkpt & BKPT_ON_MASK)) { printf(" BKPT> No breakpoint set in this record\n"); return(S_db_bkptNotSet); } diff --git a/src/ioc/db/dbChannel.c b/src/ioc/db/dbChannel.c index 5ce1be4ef..92be08c77 100644 --- a/src/ioc/db/dbChannel.c +++ b/src/ioc/db/dbChannel.c @@ -107,7 +107,7 @@ static int chf_boolean(void * ctx, int boolVal) return result; } -static int chf_integer(void * ctx, long integerVal) +static int chf_integer(void * ctx, long long integerVal) { parseContext *parser = (parseContext *) ctx; chFilter *filter = parser->filter; @@ -132,7 +132,7 @@ static int chf_double(void * ctx, double doubleVal) } static int chf_string(void * ctx, const unsigned char * stringVal, - unsigned int stringLen) + size_t stringLen) { parseContext *parser = (parseContext *) ctx; chFilter *filter = parser->filter; @@ -159,7 +159,7 @@ static int chf_start_map(void * ctx) } static int chf_map_key(void * ctx, const unsigned char * key, - unsigned int stringLen) + size_t stringLen) { parseContext *parser = (parseContext *) ctx; chFilter *filter = parser->filter; @@ -243,15 +243,12 @@ static const yajl_callbacks chf_callbacks = { chf_null, chf_boolean, chf_integer, chf_double, NULL, chf_string, chf_start_map, chf_map_key, chf_end_map, chf_start_array, chf_end_array }; -static const yajl_parser_config chf_config = - { 0, 1 }; /* allowComments = NO , checkUTF8 = YES */ - -static void * chf_malloc(void *ctx, unsigned int sz) +static void * chf_malloc(void *ctx, size_t sz) { return malloc(sz); } -static void * chf_realloc(void *ctx, void *ptr, unsigned int sz) +static void * chf_realloc(void *ctx, void *ptr, size_t sz) { return realloc(ptr, sz); } @@ -261,36 +258,38 @@ static void chf_free(void *ctx, void *ptr) free(ptr); } -static const yajl_alloc_funcs chf_alloc = +static yajl_alloc_funcs chf_alloc = { chf_malloc, chf_realloc, chf_free }; static long chf_parse(dbChannel *chan, const char **pjson) { parseContext parser = { chan, NULL, 0 }; - yajl_handle yh = yajl_alloc(&chf_callbacks, &chf_config, &chf_alloc, &parser); + yajl_handle yh = yajl_alloc(&chf_callbacks, &chf_alloc, &parser); const char *json = *pjson; - size_t jlen = strlen(json); + size_t jlen = strlen(json), ylen; yajl_status ys; long status; if (!yh) return S_db_noMemory; - ys = yajl_parse(yh, (const unsigned char *) json, (unsigned int) jlen); - if (ys == yajl_status_insufficient_data) - ys = yajl_parse_complete(yh); + ys = yajl_parse(yh, (const unsigned char *) json, jlen); + ylen = yajl_get_bytes_consumed(yh); + + if (ys == yajl_status_ok) + ys = yajl_complete_parse(yh); switch (ys) { case yajl_status_ok: + *pjson += ylen; status = 0; - *pjson += yajl_get_bytes_consumed(yh); break; case yajl_status_error: { unsigned char *err; - err = yajl_get_error(yh, 1, (const unsigned char *) json, (unsigned int) jlen); + err = yajl_get_error(yh, 1, (const unsigned char *) json, jlen); printf("dbChannelCreate: %s\n", err); yajl_free_error(yh, err); } /* fall through */ diff --git a/src/ioc/db/dbConvertJSON.c b/src/ioc/db/dbConvertJSON.c index e2a453549..eb697eeda 100644 --- a/src/ioc/db/dbConvertJSON.c +++ b/src/ioc/db/dbConvertJSON.c @@ -37,20 +37,20 @@ static int dbcj_boolean(void *ctx, int val) { return 0; /* Illegal */ } -static int dbcj_integer(void *ctx, long num) { +static int dbcj_integer(void *ctx, long long num) { parseContext *parser = (parseContext *) ctx; - epicsInt32 val32 = num; - FASTCONVERT conv = dbFastPutConvertRoutine[DBF_LONG][parser->dbrType]; + epicsInt64 val64 = num; + FASTCONVERT conv = dbFastPutConvertRoutine[DBF_INT64][parser->dbrType]; if (parser->elems > 0) { - conv(&val32, parser->pdest, NULL); + conv(&val64, parser->pdest, NULL); parser->pdest += parser->dbrSize; parser->elems--; } return 1; } -static int dblsj_integer(void *ctx, long num) { +static int dblsj_integer(void *ctx, long long num) { return 0; /* Illegal */ } @@ -70,7 +70,7 @@ static int dblsj_double(void *ctx, double num) { return 0; /* Illegal */ } -static int dbcj_string(void *ctx, const unsigned char *val, unsigned int len) { +static int dbcj_string(void *ctx, const unsigned char *val, size_t len) { parseContext *parser = (parseContext *) ctx; char *pdest = parser->pdest; @@ -93,7 +93,7 @@ static int dbcj_string(void *ctx, const unsigned char *val, unsigned int len) { return 1; } -static int dblsj_string(void *ctx, const unsigned char *val, unsigned int len) { +static int dblsj_string(void *ctx, const unsigned char *val, size_t len) { parseContext *parser = (parseContext *) ctx; char *pdest = parser->pdest; @@ -118,7 +118,7 @@ static int dbcj_start_map(void *ctx) { return 0; /* Illegal */ } -static int dbcj_map_key(void *ctx, const unsigned char *key, unsigned int len) { +static int dbcj_map_key(void *ctx, const unsigned char *key, size_t len) { return 0; /* Illegal */ } @@ -149,9 +149,6 @@ static yajl_callbacks dbcj_callbacks = { dbcj_start_array, dbcj_end_array }; -static const yajl_parser_config dbcj_config = - { 0, 0 }; /* allowComments = NO, checkUTF8 = NO */ - long dbPutConvertJSON(const char *json, short dbrType, void *pdest, long *pnRequest) { @@ -169,13 +166,13 @@ long dbPutConvertJSON(const char *json, short dbrType, parser->elems = *pnRequest; yajl_set_default_alloc_funcs(&dbcj_alloc); - yh = yajl_alloc(&dbcj_callbacks, &dbcj_config, &dbcj_alloc, parser); + yh = yajl_alloc(&dbcj_callbacks, &dbcj_alloc, parser); if (!yh) return S_db_noMemory; - ys = yajl_parse(yh, (const unsigned char *) json, (unsigned int) jlen); - if (ys == yajl_status_insufficient_data) - ys = yajl_parse_complete(yh); + ys = yajl_parse(yh, (const unsigned char *) json, jlen); + if (ys == yajl_status_ok) + ys = yajl_complete_parse(yh); switch (ys) { case yajl_status_ok: @@ -185,7 +182,7 @@ long dbPutConvertJSON(const char *json, short dbrType, case yajl_status_error: { unsigned char *err = yajl_get_error(yh, 1, - (const unsigned char *) json, (unsigned int) jlen); + (const unsigned char *) json, jlen); fprintf(stderr, "dbConvertJSON: %s\n", err); yajl_free_error(yh, err); } @@ -227,13 +224,11 @@ long dbLSConvertJSON(const char *json, char *pdest, epicsUInt32 size, parser->elems = 1; yajl_set_default_alloc_funcs(&dbcj_alloc); - yh = yajl_alloc(&dblsj_callbacks, &dbcj_config, &dbcj_alloc, parser); + yh = yajl_alloc(&dblsj_callbacks, &dbcj_alloc, parser); if (!yh) return S_db_noMemory; - ys = yajl_parse(yh, (const unsigned char *) json, (unsigned int) jlen); - if (ys == yajl_status_insufficient_data) - ys = yajl_parse_complete(yh); + ys = yajl_parse(yh, (const unsigned char *) json, jlen); switch (ys) { case yajl_status_ok: @@ -243,7 +238,7 @@ long dbLSConvertJSON(const char *json, char *pdest, epicsUInt32 size, case yajl_status_error: { unsigned char *err = yajl_get_error(yh, 1, - (const unsigned char *) json, (unsigned int) jlen); + (const unsigned char *) json, jlen); fprintf(stderr, "dbLoadLS_JSON: %s\n", err); yajl_free_error(yh, err); } diff --git a/src/ioc/db/dbFastLinkConv.c b/src/ioc/db/dbFastLinkConv.c index 00a37f710..1d94bc95e 100644 --- a/src/ioc/db/dbFastLinkConv.c +++ b/src/ioc/db/dbFastLinkConv.c @@ -920,18 +920,14 @@ static long cvt_q_q( epicsInt64 *from, epicsInt64 *to, const dbAddr *paddr) - { - - *to=*from; return(0); } + { *to=*from; return(0); } /* Convert Int64 to UInt64 */ static long cvt_q_uq( epicsInt64 *from, epicsUInt64 *to, const dbAddr *paddr) - { - - *to=*from; return(0); } + { *to=*from; return(0); } /* Convert Int64 to Float */ static long cvt_q_f( @@ -949,7 +945,7 @@ static long cvt_q_d( /* Convert Int64 to Enumerated */ static long cvt_q_e( - epicsInt32 *from, + epicsInt64 *from, epicsEnum16 *to, const dbAddr *paddr) { *to=*from; return(0); } diff --git a/src/ioc/db/dbJLink.c b/src/ioc/db/dbJLink.c index b68432f6e..ea054eee9 100644 --- a/src/ioc/db/dbJLink.c +++ b/src/ioc/db/dbJLink.c @@ -112,12 +112,12 @@ static int dbjl_boolean(void *ctx, int val) { CALL_OR_STOP(pjlink->pif->parse_boolean)(pjlink, val)); } -static int dbjl_integer(void *ctx, long num) { +static int dbjl_integer(void *ctx, long long num) { parseContext *parser = (parseContext *) ctx; jlink *pjlink = parser->pjlink; IFDEBUG(10) - printf("dbjl_integer(%s@%p, %ld)\n", + printf("dbjl_integer(%s@%p, %lld)\n", pjlink->pif->name, pjlink, num); assert(pjlink); @@ -138,13 +138,13 @@ static int dbjl_double(void *ctx, double num) { CALL_OR_STOP(pjlink->pif->parse_double)(pjlink, num)); } -static int dbjl_string(void *ctx, const unsigned char *val, unsigned len) { +static int dbjl_string(void *ctx, const unsigned char *val, size_t len) { parseContext *parser = (parseContext *) ctx; jlink *pjlink = parser->pjlink; IFDEBUG(10) printf("dbjl_string(%s@%p, \"%.*s\")\n", - pjlink->pif->name, pjlink, len, val); + pjlink->pif->name, pjlink, (int) len, val); assert(pjlink); return dbjl_value(parser, @@ -190,7 +190,7 @@ static int dbjl_start_map(void *ctx) { return dbjl_return(parser, result); } -static int dbjl_map_key(void *ctx, const unsigned char *key, unsigned len) { +static int dbjl_map_key(void *ctx, const unsigned char *key, size_t len) { parseContext *parser = (parseContext *) ctx; jlink *pjlink = parser->pjlink; char *link_name; @@ -200,13 +200,13 @@ static int dbjl_map_key(void *ctx, const unsigned char *key, unsigned len) { if (!parser->key_is_link) { if (!pjlink) { errlogPrintf("dbJLinkInit: Illegal second link key '%.*s'\n", - len, key); + (int) len, key); return dbjl_return(parser, jlif_stop); } IFDEBUG(10) { printf("dbjl_map_key(%s@%p, \"%.*s\")\t", - pjlink->pif->name, pjlink, len, key); + pjlink->pif->name, pjlink, (int) len, key); printf(" jsonDepth=%d, parseDepth=%d, key_is_link=%d\n", parser->jsonDepth, pjlink ? pjlink->parseDepth : 0, parser->key_is_link); } @@ -218,7 +218,7 @@ static int dbjl_map_key(void *ctx, const unsigned char *key, unsigned len) { } IFDEBUG(10) { - printf("dbjl_map_key(NULL, \"%.*s\")\t", len, key); + printf("dbjl_map_key(NULL, \"%.*s\")\t", (int) len, key); printf(" jsonDepth=%d, parseDepth=00, key_is_link=%d\n", parser->jsonDepth, parser->key_is_link); } @@ -334,9 +334,6 @@ static yajl_callbacks dbjl_callbacks = { dbjl_start_map, dbjl_map_key, dbjl_end_map, dbjl_start_array, dbjl_end_array }; -static const yajl_parser_config dbjl_config = - { 0, 0 }; /* allowComments = NO, checkUTF8 = NO */ - long dbJLinkParse(const char *json, size_t jlen, short dbfType, jlink **ppjlink, unsigned opts) { @@ -363,13 +360,13 @@ long dbJLinkParse(const char *json, size_t jlen, short dbfType, parser->jsonDepth, parser->key_is_link); yajl_set_default_alloc_funcs(&dbjl_allocs); - yh = yajl_alloc(&dbjl_callbacks, &dbjl_config, &dbjl_allocs, parser); + yh = yajl_alloc(&dbjl_callbacks, &dbjl_allocs, parser); if (!yh) return S_db_noMemory; - ys = yajl_parse(yh, (const unsigned char *) json, (unsigned) jlen); - if (ys == yajl_status_insufficient_data) - ys = yajl_parse_complete(yh); + ys = yajl_parse(yh, (const unsigned char *) json, jlen); + if (ys == yajl_status_ok) + ys = yajl_complete_parse(yh); switch (ys) { unsigned char *err; @@ -381,10 +378,11 @@ long dbJLinkParse(const char *json, size_t jlen, short dbfType, break; case yajl_status_error: - err = yajl_get_error(yh, 1, (const unsigned char *) json, (unsigned) jlen); + err = yajl_get_error(yh, 1, (const unsigned char *) json, jlen); errlogPrintf("dbJLinkInit: %s\n", err); yajl_free_error(yh, err); dbJLinkFree(parser->pjlink); + dbJLinkFree(parser->product); /* fall through */ default: status = S_db_badField; diff --git a/src/ioc/db/dbLink.c b/src/ioc/db/dbLink.c index 9279b91fb..c90dcb3df 100644 --- a/src/ioc/db/dbLink.c +++ b/src/ioc/db/dbLink.c @@ -66,6 +66,26 @@ static const char * link_field_name(const struct link *plink) return "????"; } +/* Special TSEL handler for PV links */ +/* FIXME: Generalize for new link types... */ +static void TSEL_modified(struct link *plink) +{ + struct pv_link *ppv_link; + char *pfieldname; + + if (plink->type != PV_LINK) { + errlogPrintf("dbLink::TSEL_modified called for non PV_LINK\n"); + return; + } + /* If pvname contains .TIME truncate it to point to VAL instead */ + ppv_link = &plink->value.pv_link; + pfieldname = strstr(ppv_link->pvname, ".TIME"); + if (pfieldname) { + *pfieldname = 0; + plink->flags |= DBLINK_FLAG_TSELisTIME; + } +} + /***************************** Generic Link API *****************************/ @@ -93,7 +113,7 @@ void dbInitLink(struct link *plink, short dbfType) return; if (plink == &precord->tsel) - recGblTSELwasModified(plink); + TSEL_modified(plink); if (!(plink->value.pv_link.pvlMask & (pvlOptCA | pvlOptCP | pvlOptCPP))) { /* Make it a DB link if possible */ @@ -127,6 +147,9 @@ void dbAddLink(struct dbLocker *locker, struct link *plink, short dbfType, { struct dbCommon *precord = plink->precord; + /* Clear old TSELisTIME flag */ + plink->flags &= ~DBLINK_FLAG_TSELisTIME; + if (plink->type == CONSTANT) { dbConstAddLink(plink); return; @@ -145,7 +168,7 @@ void dbAddLink(struct dbLocker *locker, struct link *plink, short dbfType, return; if (plink == &precord->tsel) - recGblTSELwasModified(plink); + TSEL_modified(plink); if (ptarget) { /* It's a DB link */ @@ -470,4 +493,3 @@ long dbPutLinkLS(struct link *plink, char *pbuffer, epicsUInt32 len) return dbPutLink(plink, DBR_STRING, pbuffer, 1); } - diff --git a/src/ioc/db/dbUnitTest.c b/src/ioc/db/dbUnitTest.c index 3fac2a756..39b551987 100644 --- a/src/ioc/db/dbUnitTest.c +++ b/src/ioc/db/dbUnitTest.c @@ -150,7 +150,7 @@ long testdbVPutField(const char* pv, short dbrType, va_list ap) return dbPutField(&addr, dbrType, pod.bytes, 1); } -void testdbPutFieldOk(const char* pv, short dbrType, ...) +void testdbPutFieldOk(const char* pv, int dbrType, ...) { long ret; va_list ap; @@ -162,7 +162,7 @@ void testdbPutFieldOk(const char* pv, short dbrType, ...) testOk(ret==0, "dbPutField(\"%s\", %d, ...) -> %#lx (%s)", pv, dbrType, ret, errSymMsg(ret)); } -void testdbPutFieldFail(long status, const char* pv, short dbrType, ...) +void testdbPutFieldFail(long status, const char* pv, int dbrType, ...) { long ret; va_list ap; @@ -175,7 +175,7 @@ void testdbPutFieldFail(long status, const char* pv, short dbrType, ...) pv, dbrType, status, errSymMsg(status), ret, errSymMsg(ret)); } -void testdbGetFieldEqual(const char* pv, short dbrType, ...) +void testdbGetFieldEqual(const char* pv, int dbrType, ...) { va_list ap; diff --git a/src/ioc/db/dbUnitTest.h b/src/ioc/db/dbUnitTest.h index 8fe8011af..897e5c67d 100644 --- a/src/ioc/db/dbUnitTest.h +++ b/src/ioc/db/dbUnitTest.h @@ -48,13 +48,13 @@ epicsShareFunc void testdbCleanup(void); * testdbPutFieldOk("pvname", DBF_FLOAT, (double)4.1); * testdbPutFieldOk("pvname", DBF_STRING, "hello world"); */ -epicsShareFunc void testdbPutFieldOk(const char* pv, short dbrType, ...); +epicsShareFunc void testdbPutFieldOk(const char* pv, int dbrType, ...); /* Tests for put failure */ -epicsShareFunc void testdbPutFieldFail(long status, const char* pv, short dbrType, ...); +epicsShareFunc void testdbPutFieldFail(long status, const char* pv, int dbrType, ...); epicsShareFunc long testdbVPutField(const char* pv, short dbrType, va_list ap); -epicsShareFunc void testdbGetFieldEqual(const char* pv, short dbrType, ...); +epicsShareFunc void testdbGetFieldEqual(const char* pv, int dbrType, ...); epicsShareFunc void testdbVGetFieldEqual(const char* pv, short dbrType, va_list ap); epicsShareFunc void testdbPutArrFieldOk(const char* pv, short dbrType, unsigned long count, const void *pbuf); diff --git a/src/ioc/db/recGbl.c b/src/ioc/db/recGbl.c index a614b5268..337ed7875 100644 --- a/src/ioc/db/recGbl.c +++ b/src/ioc/db/recGbl.c @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recGbl.c */ /* @@ -259,15 +259,13 @@ void recGblGetTimeStamp(void *pvoid) struct link *plink = &prec->tsel; if (!dbLinkIsConstant(plink)) { - struct pv_link *ppv_link = &plink->value.pv_link; - - if (ppv_link->pvlMask & pvlOptTSELisTime) { + if (plink->flags & DBLINK_FLAG_TSELisTIME) { if (dbGetTimeStamp(plink, &prec->time)) - errlogPrintf("recGblGetTimeStamp: dbGetTimeStamp failed, %s.TSEL = %s\n", - prec->name, ppv_link->pvname); + errlogPrintf("recGblGetTimeStamp: dbGetTimeStamp failed for %s.TSEL", + prec->name); return; } - dbGetLink(&prec->tsel, DBR_SHORT, &prec->tse, 0, 0); + dbGetLink(plink, DBR_SHORT, &prec->tse, 0, 0); } if (prec->tse != epicsTimeEventDeviceTime) { if (epicsTimeGetEvent(&prec->time, prec->tse)) @@ -276,24 +274,6 @@ void recGblGetTimeStamp(void *pvoid) } } -void recGblTSELwasModified(struct link *plink) -{ - struct pv_link *ppv_link = &plink->value.pv_link; - char *pfieldname; - - if (plink->type != PV_LINK) { - errlogPrintf("recGblTSELwasModified called for non PV_LINK\n"); - return; - } - /*If pvname ends in .TIME then just ask for VAL*/ - /*Note that the VAL value will not be used*/ - pfieldname = strstr(ppv_link->pvname, ".TIME"); - if (pfieldname) { - *pfieldname = 0; - ppv_link->pvlMask |= pvlOptTSELisTime; - } -} - void recGblCheckDeadband(epicsFloat64 *poldval, const epicsFloat64 newval, const epicsFloat64 deadband, unsigned *monitor_mask, const unsigned add_mask) { diff --git a/src/ioc/db/recGbl.h b/src/ioc/db/recGbl.h index 8eb589450..171c00964 100644 --- a/src/ioc/db/recGbl.h +++ b/src/ioc/db/recGbl.h @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ /* recGbl.h */ /* Record Global @@ -63,7 +63,6 @@ epicsShareFunc void recGblInheritSevr(int msMode, void *precord, epicsEnum16 sta epicsEnum16 sevr); epicsShareFunc void recGblFwdLink(void *precord); epicsShareFunc void recGblGetTimeStamp(void *precord); -epicsShareFunc void recGblTSELwasModified(struct link *plink); epicsShareFunc void recGblCheckDeadband(epicsFloat64 *poldval, const epicsFloat64 newval, const epicsFloat64 deadband, unsigned *monitor_mask, const unsigned add_mask); diff --git a/src/ioc/dbStatic/dbStaticLib.c b/src/ioc/dbStatic/dbStaticLib.c index d647f787d..bcfa93727 100644 --- a/src/ioc/dbStatic/dbStaticLib.c +++ b/src/ioc/dbStatic/dbStaticLib.c @@ -1940,7 +1940,7 @@ char * dbGetString(DBENTRY *pdbentry) else ppind=0; dbMsgPrint(pdbentry, "%s%s%s%s", plink->value.pv_link.pvname ? plink->value.pv_link.pvname : "", - (pvlMask & pvlOptTSELisTime) ? ".TIME" : "", + (plink->flags & DBLINK_FLAG_TSELisTIME) ? ".TIME" : "", ppstring[ppind], msstring[plink->value.pv_link.pvlMask&pvlOptMsMode]); break; diff --git a/src/ioc/dbStatic/dbYacc.y b/src/ioc/dbStatic/dbYacc.y index e61ce58b0..9dc8c5081 100644 --- a/src/ioc/dbStatic/dbYacc.y +++ b/src/ioc/dbStatic/dbYacc.y @@ -4,7 +4,7 @@ * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. * EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* in file LICENSE that is included with this distribution. \*************************************************************************/ %{ static int yyerror(); @@ -97,7 +97,7 @@ choice: tokenCHOICE '(' tokenSTRING ',' tokenSTRING ')' { if(dbStaticDebug>2) printf("choice %s %s\n",$3,$5); dbMenuChoice($3,$5); dbmfFree($3); dbmfFree($5); -} +} | include; recordtype_head: '(' tokenSTRING ')' @@ -139,12 +139,12 @@ recordtype_field_body: '{' recordtype_field_item_list '}' ; recordtype_field_item_list: recordtype_field_item_list recordtype_field_item | recordtype_field_item; -recordtype_field_item: tokenSTRING '(' tokenSTRING ')' +recordtype_field_item: tokenSTRING '(' tokenSTRING ')' { if(dbStaticDebug>2) printf("recordtype_field_item %s %s\n",$1,$3); dbRecordtypeFieldItem($1,$3); dbmfFree($1); dbmfFree($3); } - | tokenMENU '(' tokenSTRING ')' + | tokenMENU '(' tokenSTRING ')' { if(dbStaticDebug>2) printf("recordtype_field_item %s (%s)\n","menu",$3); @@ -154,7 +154,7 @@ recordtype_field_item: tokenSTRING '(' tokenSTRING ')' device: tokenDEVICE '(' tokenSTRING ',' tokenSTRING ',' tokenSTRING ',' tokenSTRING ')' -{ +{ if(dbStaticDebug>2) printf("device %s %s %s %s\n",$3,$5,$7,$9); dbDevice($3,$5,$7,$9); dbmfFree($3); dbmfFree($5); @@ -290,6 +290,7 @@ json_object: '{' '}' }; json_members: json_pair + | json_pair ',' | json_pair ',' json_members { $$ = dbmfStrcat3($1, ",", $3); @@ -325,6 +326,14 @@ json_array: '[' ']' }; json_elements: json_value + | json_value ',' +{ /* Retain the trailing ',' so link parser can distinguish a + * 1-element const list from a PV name (commas are illegal) + */ + $$ = dbmfStrcat3($1, ",", ""); + dbmfFree($1); + if (dbStaticDebug>2) printf("json %s\n", $$); +}; | json_value ',' json_elements { $$ = dbmfStrcat3($1, ",", $3); @@ -342,7 +351,7 @@ json_value: jsonNULL { $$ = dbmfStrdup("null"); } %% - + #include "dbLex.c" @@ -363,7 +372,7 @@ static long pvt_yy_parse(void) { static int FirstFlag = 1; long rtnval; - + if (!FirstFlag) { yyAbort = FALSE; yyFailed = FALSE; diff --git a/src/ioc/dbStatic/link.h b/src/ioc/dbStatic/link.h index f2b426308..2e3c77820 100644 --- a/src/ioc/dbStatic/link.h +++ b/src/ioc/dbStatic/link.h @@ -67,10 +67,10 @@ epicsShareExtern maplinkType pamaplinkType[]; #define pvlOptInpString 0x100 /*Input as string*/ #define pvlOptOutNative 0x200 /*Output native*/ #define pvlOptOutString 0x400 /*Output as string*/ -#define pvlOptTSELisTime 0x800 /*Field TSEL is getting timeStamp*/ /* DBLINK Flag bits */ #define DBLINK_FLAG_INITIALIZED 1 /* dbInitLink() called */ +#define DBLINK_FLAG_TSELisTIME 2 /* Use TSEL to get timeStamp */ struct macro_link { char *macroStr; diff --git a/src/ioc/rsrv/camsgtask.c b/src/ioc/rsrv/camsgtask.c index e2a0d3e18..04a7e780e 100644 --- a/src/ioc/rsrv/camsgtask.c +++ b/src/ioc/rsrv/camsgtask.c @@ -59,7 +59,7 @@ void camsgtask ( void *pParm ) epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf("CAS: ioctl error - %s\n", + errlogPrintf("CAS: FIONREAD error: %s\n", sockErrBuf); cas_send_bs_msg(client, TRUE); } diff --git a/src/ioc/rsrv/caserverio.c b/src/ioc/rsrv/caserverio.c index 7250ae6db..20a1c1c5b 100644 --- a/src/ioc/rsrv/caserverio.c +++ b/src/ioc/rsrv/caserverio.c @@ -114,7 +114,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAS: TCP send to %s failed - %s\n", + errlogPrintf ( "CAS: TCP send to %s failed: %s\n", buf, sockErrBuf); } pclient->disconnect = TRUE; @@ -140,7 +140,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ("CAS: Socket shutdown error - %s\n", + errlogPrintf ("CAS: Socket shutdown error: %s\n", sockErrBuf ); } } @@ -218,7 +218,7 @@ void cas_send_dg_msg ( struct client * pclient ) epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) ); - errlogPrintf( "CAS: UDP send to %s failed - %s\n", + errlogPrintf( "CAS: UDP send to %s failed: %s\n", buf, sockErrBuf); } diff --git a/src/ioc/rsrv/caservertask.c b/src/ioc/rsrv/caservertask.c index 9a032d25e..3a493e7f1 100644 --- a/src/ioc/rsrv/caservertask.c +++ b/src/ioc/rsrv/caservertask.c @@ -73,7 +73,7 @@ static void req_server (void *pParm) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAS: Listen error %s\n", + errlogPrintf ( "CAS: Listen error: %s\n", sockErrBuf ); epicsSocketDestroy (IOC_sock); epicsThreadSuspendSelf (); @@ -95,7 +95,7 @@ static void req_server (void *pParm) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf("CAS: Client accept error was \"%s\"\n", + errlogPrintf("CAS: Client accept error: %s\n", sockErrBuf ); epicsThreadSleep(15.0); continue; @@ -140,7 +140,7 @@ int tryBind(SOCKET sock, const osiSockAddr* addr, const char *name) { epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAS: %s bind error: \"%s\"\n", + errlogPrintf ( "CAS: %s bind error: %s\n", name, sockErrBuf ); epicsThreadSuspendSelf (); } @@ -205,7 +205,7 @@ SOCKET* rsrv_grab_tcp(unsigned short *port) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( "CAS: getsockname error was \"%s\"\n", + errlogPrintf ( "CAS: getsockname error: %s\n", sockErrBuf ); epicsThreadSuspendSelf (); ok = 0; @@ -244,7 +244,7 @@ SOCKET* rsrv_grab_tcp(unsigned short *port) epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP(&scratch.ia, name, sizeof(name)); - cantProceed( "CAS: Socket bind %s error was %s\n", + cantProceed( "CAS: Socket bind %s error: %s\n", name, sockErrBuf ); } ok = 0; @@ -310,13 +310,14 @@ void rsrv_build_addr_lists(void) } #ifdef IP_ADD_MEMBERSHIP { - int flag = 1; + osiSockOptMcastLoop_t flag = 1; if (setsockopt(beaconSocket, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&flag, sizeof(flag))<0) { char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf("rsrv: failed to set mcast loopback\n"); + errlogPrintf("CAS: failed to set mcast loopback: %s\n", + sockErrBuf); } } #endif @@ -665,7 +666,7 @@ int rsrv_init (void) epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP (&temp, name, sizeof(name)); - fprintf(stderr, "CAS: Socket mcast join %s to %s failed with \"%s\"\n", + errlogPrintf("CAS: Socket mcast join %s to %s failed: %s\n", ifaceName, name, sockErrBuf ); } } diff --git a/src/ioc/rsrv/cast_server.c b/src/ioc/rsrv/cast_server.c index be5ec15c6..4039d0f6f 100644 --- a/src/ioc/rsrv/cast_server.c +++ b/src/ioc/rsrv/cast_server.c @@ -176,7 +176,7 @@ void cast_server(void *pParm) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - epicsPrintf ("CAS: UDP recv error (errno=%s)\n", + epicsPrintf ("CAS: UDP recv error: %s\n", sockErrBuf); epicsThreadSleep(1.0); } diff --git a/src/ioc/rsrv/online_notify.c b/src/ioc/rsrv/online_notify.c index d1d557943..b2547c464 100644 --- a/src/ioc/rsrv/online_notify.c +++ b/src/ioc/rsrv/online_notify.c @@ -87,8 +87,8 @@ void rsrv_online_notify_task(void *pParm) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP (&pAddr->addr.ia, buf, sizeof(buf)); - errlogPrintf ( "%s: CA beacon (send to \"%s\") error was \"%s\"\n", - __FILE__, buf, sockErrBuf); + errlogPrintf ( "CAS: CA beacon send to %s error: %s\n", + buf, sockErrBuf); } else { assert (status == sizeof(msg)); diff --git a/src/std/link/links.dbd.pod b/src/std/link/links.dbd.pod index ceb6ced77..d94e9e8f0 100644 --- a/src/std/link/links.dbd.pod +++ b/src/std/link/links.dbd.pod @@ -114,6 +114,14 @@ expression. Equivalent to the C field of a record. An optional integer specifying the numeric precision with which the calculation result should be displayed. Equivalent to the C field of a record. +=item time + +An optional string containing a single upper or lower-case letter C ... C +which must correspond to an input provided in the c parameter. When the +record containing such a link has C set to -2 (epicsTimeEventDeviceTime) +the record's timestamp field C