Back-ported dbLoadRecordsHook from the 3.15 branch

This commit is contained in:
Andrew Johnson
2015-02-17 14:29:20 -06:00
parent f16bdb0c83
commit 7e36a58f1e
3 changed files with 19 additions and 2 deletions

View File

@@ -13,6 +13,10 @@
<!-- Insert new items immediately below here ... -->
<h3>Back-ported dbLoadRecordsHook from the 3.15 branch</h3>
<p>See the Release Notes from the Base 3.15.1 release for details.</p>
<h3>Enhanced API for asTrapWrite listeners</h3>
<p>External software such as the CA Put Logging module that registers a listener

View File

@@ -61,6 +61,10 @@
epicsShareDef struct dbBase *pdbbase = 0;
epicsShareDef volatile int interruptAccept=FALSE;
/* Hook Routines */
epicsShareDef DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook = NULL;
static short mapDBFToDBR[DBF_NTYPES] = {
/* DBF_STRING => */ DBR_STRING,
/* DBF_CHAR => */ DBR_CHAR,
@@ -817,7 +821,11 @@ int epicsShareAPI dbLoadDatabase(const char *file, const char *path, const char
int epicsShareAPI dbLoadRecords(const char* file, const char* subs)
{
return dbReadDatabase(&pdbbase, file, 0, subs);
int status = dbReadDatabase(&pdbbase, file, 0, subs);
if (!status && dbLoadRecordsHook)
dbLoadRecordsHook(file, subs);
return status;
}

View File

@@ -276,9 +276,14 @@ epicsShareFunc long epicsShareAPI dbBufferSize(
short dbrType,long options,long nRequest);
epicsShareFunc long epicsShareAPI dbValueSize(short dbrType);
/* Hook Routine */
typedef void (*DB_LOAD_RECORDS_HOOK_ROUTINE)(const char* filename,
const char* substitutions);
epicsShareExtern DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook;
epicsShareFunc int epicsShareAPI dbLoadDatabase(
const char *filename, const char *path, const char *substitutions);
epicsShareFunc int epicsShareAPI dbLoadRecords(
const char* filename, const char* substitutions);