Experimental Physics and Industrial Control System
Emmanuel Mayssat wrote:
I was thinking about using a registar function as follow:
default("${BR}",9600)
that would check the value or $BR and if not set, then put 9600.
(and so far nobody mentioned that solution!! )
Actually that was one of my earlier suggestions.
but what I really want to do is an if then else in iocsh
You're welcome to try to add an if-then-else command to your own version
of iocsh, since EPICS is Open Source. However we're not likely to
accept any patches that implement this into the official release because
we don't want the iocsh to become Yet Another Programming Language.
Eric Norum has in the past linked the tcl language up to EPICS so you
can write startup scripts in tcl if you want to do intelligent
processing in them, although his code was never published.
My point was that setting a default in the way you're suggesting could
very easily cause you problems, whether you add an if-then-else
construct to iocsh or write a defaultEnv(variable, value) command.
Imagine two dbload files with this pseudocode:
a.dbl:
if unset(X) then X=1
dbLoadRecords a.db, X=${X}
b.dbl:
if unset(X) then X=2
dbLoadRecords b.db, X=${X}
If we execute these in this order with X unset:
< a.dbl
< b.dbl
the dbLoadRecords commands will expand out to this:
dbLoadRecords a.db, X=1
dbLoadRecords b.db, X=1
whereas if we execute them in the reverse order:
< b.dbl
< a.dbl
they will expand out to this:
dbLoadRecords b.db, X=2
dbLoadRecords a.db, X=2
I'm just warning you to be prepared for this to happen.
- Andrew
--
Dear God, I didn't think orange went with purple until I saw
the sunset you made last night. That was really cool. - Caro
- References:
- if-then-else in iocsh Emmanuel Mayssat
- Re: if-then-else in iocsh Andrew Johnson
- Re: if-then-else in iocsh Maren Purves
- Re: if-then-else in iocsh Emmanuel Mayssat
- Re: if-then-else in iocsh Andrew Johnson
- Re: if-then-else in iocsh Emmanuel Mayssat
- Navigate by Date:
- Prev:
Re: if-then-else in iocsh Emmanuel Mayssat
- Next:
Re: if-then-else in iocsh Emmanuel Mayssat
- 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: if-then-else in iocsh Emmanuel Mayssat
- Next:
mbbo strings linked to mbbo commands Emmanuel Mayssat
- 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