Hi Garth,
Another way to solve this would be to have separate substitutions
files for each system. For example,
evrSys0.substitutions
evrSys1.substitutions
evrSys2.substitutions
...
Each file would handle the values that vary between sys0, sys1, etc,
generating evrSys0.db, evrSys1.db, etc.
It's not quite as clean as having one db file that you load with a SYS
macro, but should work.
Regards,
- Bruce
On 11/15/2013 04:42 PM, Andrew Johnson wrote:
Hi Garth,
There have been some significant modifications made to the version of
msi which is found in Base 3.15. I'm not sure if they will completely
solve your problem, but you might want to check the documentation at
http://www.aps.anl.gov/epics/base/R3-15/0-docs/msi.html which shows the
new global syntax in the substitutions file. There are more docs
including an EBNF grammar in the Application Developers Guide at
http://www.aps.anl.gov/epics/base/R3-15/0-docs/AppDevGuide/node7.html#SECTION007220000000000000000
-- the same syntax works in both msi and dbLoadTemplate(). If you want
to try out the new msi it should be possible to extract just the
src/ioc/dbtemplate/msi.c file and build it against a 3.14.12 version of
Base.
You can also of course use any templating language you like to write
substitutions. We provide msi which shares the dbLoadTemplate syntax,
but other sites have written their own tools when they had specific
needs which msi can't meet. You could modify msi as well, but I would
suggest starting from the 3.15 version if you think you might want to
offer your changes back to us.
HTH,
- Andrew
On 11/15/2013 06:15 PM, Brown, Garth wrote:
I'll add a few tangentially related thoughts on how msi/macLib might
be modified. It would be nice if there was a way to keep a macro with
a default value in a template unexpanded. That is, if sample.template
contains the line
field(X, "$(MYX=3)" )
then sample.substitutions could have a way to indicate that MYX
shouldn't be expanded and should retain the default value part, so
that sample.db still had exactly that line. As it is, you can leave
MYX undefined, which expands to
field(X, "3" )
Or you can have in the substitutions { MYX='$(MYX)' }, which expands
to
field(X, "$(MYX)" ) # default value is lost
The macro with default can't survive msi unchanged.
If there were a way to leave the macro undefined with the default
value intact, I could solve my problem with two levels of
substitutions files: a general substitutions file that contained
macros with defaults for everywhere, and environment specific
substitutions files that used the output of the general one as a
template.
Getting more technical about how that might work, you could interpret
{ MYX=$(MYX) } recursive definition as not wanting the macro
substituted, rather than as an error condition. Right now, macLib
will turn this into $(MYX, recursive), indicating an error and losing
the default value.
I had a look in macCore.c where this case is handled, and didn't
immediately see how to implement that. The recursive definition is
detected one call stack level below where the default value is
specified.
--
Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 10
Menlo Park, CA 94025
- References:
- Substitutions defaults and tricks Brown, Garth
- Re: Substitutions defaults and tricks Pietryla, Anthony F.
- RE: Substitutions defaults and tricks Brown, Garth
- Re: Substitutions defaults and tricks Andrew Johnson
- Navigate by Date:
- Prev:
Re: Substitutions defaults and tricks Andrew Johnson
- Next:
Re: Substitutions defaults and tricks Michael Davidsaver
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Substitutions defaults and tricks Andrew Johnson
- Next:
Re: Substitutions defaults and tricks Michael Davidsaver
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|