Mark Rivers wrote:
Bernhard Kuner wrote:
[...]
something like this:
file test.template {
pattern{ NAME, HOPR="9", LOPR="1", MDEL="0.1"}
I really like this suggestion.
One problem with template files now is that it is real hassle if one
wants to add an additional subsitution parameter. Suppose test.template
above does not currently support the MDEL parameter, but I want to add
it. At present, if I add it, then I have to find every substitution
file that references test.template and update it to add MDEL.
With Bernhard's suggestion, this would not be necessary. I could define
a default value for that new parameter, which would be the same as the
previous default value for that field in test.template, or if it was not
defined there, then the default value in the record. Existing
substitution files will work as they always did, but new ones can now
use the MDEL parameter.
Mark Rivers
If you specify default values in the "pattern" line, then you still have
to change all substitution files that use your extended template. Although
it becomes easier, because you just need to change the "pattern" lines.
To keep an extended template backward compatible, you would need to
specify the default values in the template file.
Two possibilities to specify default values would be:
a) where you use a substitution variable: "$(MDEL=0.1)"
b) in a comment line with a new keyword: #default{MDEL="0.1"}
+ example.subs:
file test.template {
{NAME=X, MDEL=1}
{NAME=Y}
}
+ test.template of type a):
record(ai,"$(NAME)") {
field(MDEL,"$(MDEL=0.1)")
}
+ test.template of type b):
#default{MDEL="0.1"}
record(ai,"$(NAME)") {
field(MDEL,"$(MDEL)")
}
+ dbLoadTemplate example.subs (in both cases)
record(ai,"X") {
field(MDEL,"1")
}
record(ai,"Y") {
field(MDEL,"0.1")
}
Andreas
--
Dr. Andreas Luedeke, SLS Operations Manager, Tel:+41-56-3104002
mailto:[email protected], http://people.web.psi.ch/luedeke
- References:
- RE: found a bug in 3.13.9 dbLoadTemplate - after all that time Mark Rivers
- Navigate by Date:
- Prev:
RE: found a bug in 3.13.9 dbLoadTemplate - after all that time Ralph Lange
- Next:
bug and fix in iocCore Dirk Zimoch
- 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: found a bug in 3.13.9 dbLoadTemplate - after all that time Mark Rivers
- Next:
RE: found a bug in 3.13.9 dbLoadTemplate - after all that time Mark Rivers
- 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
|