Make info tags also JSON objects

This commit is contained in:
Andrew Johnson
2016-05-23 12:00:11 +02:00
parent c76041b14c
commit f6c4099634
2 changed files with 10 additions and 3 deletions

View File

@@ -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",

View File

@@ -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 ')'
{