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 2025 | 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 2025 |
<== 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