From f6c4099634a314ba5d695202ed99758aa151c5d3 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 23 May 2016 12:00:11 +0200 Subject: [PATCH] Make info tags also JSON objects --- src/ioc/dbStatic/dbLexRoutines.c | 6 ++++++ src/ioc/dbStatic/dbYacc.y | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ioc/dbStatic/dbLexRoutines.c b/src/ioc/dbStatic/dbLexRoutines.c index ff9f04db1..380844dec 100644 --- a/src/ioc/dbStatic/dbLexRoutines.c +++ b/src/ioc/dbStatic/dbLexRoutines.c @@ -1072,6 +1072,12 @@ static void dbRecordInfo(char *name, char *value) if(duplicate) return; ptempListNode = (tempListNode *)ellFirst(&tempList); pdbentry = ptempListNode->item; + if (*value == '"') { + /* jsonSTRING values still have their quotes */ + value++; + value[strlen(value) - 1] = 0; + } + dbTranslateEscape(value, value); /* yuck: in-place, but safe */ status = dbPutInfo(pdbentry,name,value); if(status) { epicsPrintf("Can't set \"%s\" info \"%s\" to \"%s\"\n", diff --git a/src/ioc/dbStatic/dbYacc.y b/src/ioc/dbStatic/dbYacc.y index 25df127ed..e61ce58b0 100644 --- a/src/ioc/dbStatic/dbYacc.y +++ b/src/ioc/dbStatic/dbYacc.y @@ -258,10 +258,11 @@ record_field: tokenFIELD '(' tokenSTRING ',' if(dbStaticDebug>2) printf("record_field %s %s\n",$3,$6); dbRecordField($3,$6); dbmfFree($3); dbmfFree($6); } - | tokenINFO '(' tokenSTRING ',' tokenSTRING ')' + | tokenINFO '(' tokenSTRING ',' + { BEGIN JSON; } json_value { BEGIN INITIAL; } ')' { - if(dbStaticDebug>2) printf("record_info %s %s\n",$3,$5); - dbRecordInfo($3,$5); dbmfFree($3); dbmfFree($5); + if(dbStaticDebug>2) printf("record_info %s %s\n",$3,$6); + dbRecordInfo($3,$6); dbmfFree($3); dbmfFree($6); } | tokenALIAS '(' tokenSTRING ')' {