EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Substitutions defaults and tricks
From: Andrew Johnson <[email protected]>
To: "Brown, Garth" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Fri, 15 Nov 2013 18:42:48 -0600
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.

--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock

Replies:
Re: Substitutions defaults and tricks Bruce Hill
Re: Substitutions defaults and tricks Michael Davidsaver
References:
Substitutions defaults and tricks Brown, Garth
Re: Substitutions defaults and tricks Pietryla, Anthony F.
RE: Substitutions defaults and tricks Brown, Garth

Navigate by Date:
Prev: RE: Substitutions defaults and tricks Brown, Garth
Next: Re: Substitutions defaults and tricks Bruce Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Substitutions defaults and tricks Brown, Garth
Next: Re: Substitutions defaults and tricks Bruce Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·