dbStatic: Allow empty recordtype bodies in DBD files

A record type with an empty body is a declaration. The IOC will
accept one of these in a DBD file as long as it has already
loaded the full record type definition.
This will allow device support to provide a DBD file that declares
each record type it uses before giving the related device() entry.
Later commits will explain why.
This commit is contained in:
Andrew Johnson
2014-07-27 23:26:01 -05:00
parent c710a3a898
commit ee40ee789c
2 changed files with 26 additions and 3 deletions

View File

@@ -62,6 +62,7 @@ static void dbMenuChoice(char *name,char *value);
static void dbMenuBody(void);
static void dbRecordtypeHead(char *name);
static void dbRecordtypeEmpty(void);
static void dbRecordtypeBody(void);
static void dbRecordtypeFieldHead(char *name,char *type);
static void dbRecordtypeFieldItem(char *name,char *value);
@@ -607,6 +608,23 @@ static void dbRecordtypeCdef(char *text) {
return;
}
static void dbRecordtypeEmpty(void)
{
tempListNode *ptempListNode;
dbRecordType *pdbRecordType;
if (duplicate) {
duplicate = FALSE;
return;
}
ptempListNode = (tempListNode *)ellFirst(&tempList);
pdbRecordType = ptempListNode->item;
epicsPrintf("Declaration of recordtype(%s) preceeded full definition.\n",
pdbRecordType->name);
yyerrorAbort(NULL);
}
static void dbRecordtypeBody(void)
{
dbRecordType *pdbRecordType;

View File

@@ -100,7 +100,12 @@ recordtype_head: '(' tokenSTRING ')'
dbRecordtypeHead($2); dbmfFree($2);
};
recordtype_body: '{' recordtype_field_list '}'
recordtype_body: '{' '}'
{
if(dbStaticDebug>2) printf("empty recordtype_body\n");
dbRecordtypeEmpty();
}
| '{' recordtype_field_list '}'
{
if(dbStaticDebug>2) printf("recordtype_body\n");
dbRecordtypeBody();
@@ -215,14 +220,14 @@ record_head: '(' tokenSTRING ',' tokenSTRING ')'
dbRecordHead($2,$4,0); dbmfFree($2); dbmfFree($4);
};
record_body: /*Null*/
record_body: /* empty */
{
if(dbStaticDebug>2) printf("null record_body\n");
dbRecordBody();
}
| '{' '}'
{
if(dbStaticDebug>2) printf("record_body - no fields\n");
if(dbStaticDebug>2) printf("empty record_body\n");
dbRecordBody();
}
| '{' record_field_list '}'