Hi all,
I need to create an EPICS database for a soft IOC with 60 identical
devices. Each of these devices has a set of records that are identical
for multiple inputs. Having the DRY pattern in mind, I was wondering if
I could somehow use two levels of DB templates. Here is what I have in mind:
st.cmd:
dbLoadTemplate("myproject.substitutions")
myproject.substitutions:
global { SYS=...,SUBSYS=... }
file mydevice.db {
pattern { ... }
{ ... }
{ ... }
}
mydevice.db:
<some records here>
substitute "INPUT=1"
include "myinput.db"
substitute "INPUT=2"
include "myinput.db"
myinput.db:
<a couple of records needed for each input>
A manual run of MSI tool on mydevice.db handles both the "substitute"
and the "include" keyword correctly but by default macro expansion is
done at dbLoadTemplate time. This however results in
Error: syntax error
at or before "substitute" in file "mydevice.db" line 16
It seems like dbLoadTemplate doesn't support the "substitute" keyword. I
found a BNF definition of the substitution file format in chapter 6.12.1
of the Application Developer's Guide [1]. Unfortunately I did not find a
definition like this for DB files/templates. Can you please help me out
here?
I am aware that I could use 60 dbLoadTemplate lines instead (that would
clutter IOC boot output, though). I could also pull in both mydevice.db
and myinput.db from the substitutions file directly - but for that I
need to add N lines referring to myinput.db in the substitution file for
each line referring to mydevice.db (assuming a device with N inputs). Is
there a nicer way to do this?
Thanks a lot,
Martin
P.S.: BTW: Is there a difference between a DB file and a template? Are
their file names supposed to have different suffix (".template" vs. ".db"?
[1] http://www.aps.anl.gov/epics/base/R3-15/3-docs/AppDevGuide.pdf