Allow appended .db files to omit record type

This .db file syntax is now legal, provided the
named record already exists:

  record("*", "named") {
    field(VAL, 10)
  }
This commit is contained in:
Andrew Johnson
2014-06-12 14:47:42 -05:00
parent 41bd895cd5
commit 3cf2d9057f
2 changed files with 41 additions and 3 deletions

View File

@@ -15,6 +15,25 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.</p>
<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
<!-- Insert new items immediately below here ... -->
<h3>Database field setting updates</h3>
<p>A database (.db) file loaded by an IOC does not have to repeat the record
type of a record that has already been loaded. It may replace the first
parameter of the <tt>record(type, name)</tt> statement with an asterisk
character inside double-quotes, <tt>"*"</tt> instead. Thus the following is a
legal database file:</p>
<blockquote><pre>record(ao, "ao1") {}
record("*", "ao1") {
field(VAL, 10)
}</pre></blockquote>
<p>Note that database configuration tools will not be expected to have to
understand this syntax, which is provided for scripted and hand-coded database
and template instantiation only. Setting the IOC's <tt>dbRecordsOnceOnly</tt>
flag also makes this syntax illegal, since its purpose is to prevent
multiply-defined records from being collapsed into a single instance.</p>
<h3>Added echo command to iocsh</h3>
<p>The single argument string may contain escaped characters, which will be

View File

@@ -927,10 +927,26 @@ static void dbRecordHead(char *recordType, char *name, int visible)
epicsPrintf("Bad character '%c' in record name \"%s\"\n",
*badch, name);
}
pdbentry = dbAllocEntry(pdbbase);
if (ellCount(&tempList))
yyerrorAbort("dbRecordHead: tempList not empty");
allocTemp(pdbentry);
if (recordType[0] == '*' && recordType[1] == 0) {
if (dbRecordsOnceOnly)
epicsPrintf("Record-type \"*\" not valid with dbRecordsOnceOnly\n");
else {
status = dbFindRecord(pdbentry, name);
if (status == 0)
return; /* done */
epicsPrintf("Record \"%s\" not found\n", name);
}
yyerror(NULL);
duplicate = TRUE;
return;
}
status = dbFindRecordType(pdbentry, recordType);
if (status) {
epicsPrintf("Record \"%s\" is of unknown type \"%s\"\n",
@@ -938,10 +954,12 @@ static void dbRecordHead(char *recordType, char *name, int visible)
yyerrorAbort(NULL);
return;
}
/*Duplicate records ok if the same type */
/*Duplicate records are ok if the same type */
status = dbCreateRecord(pdbentry,name);
if (status==S_dbLib_recExists) {
if (strcmp(recordType, dbGetRecordTypeName(pdbentry))!=0) {
if (status == S_dbLib_recExists) {
if (strcmp(recordType, dbGetRecordTypeName(pdbentry)) != 0) {
epicsPrintf("Record \"%s\" of type \"%s\" redefined with new type "
"\"%s\"\n", name, dbGetRecordTypeName(pdbentry), recordType);
yyerror(NULL);
@@ -960,6 +978,7 @@ static void dbRecordHead(char *recordType, char *name, int visible)
name, recordType);
yyerrorAbort(NULL);
}
if (visible)
dbVisibleRecord(pdbentry);
}