Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: if-then-else in iocsh
From: Eric Norum <norume@aps.anl.gov>
To: Emmanuel Mayssat <emmanuel_mayssat@lynceantech.com>
Cc: Maren Purves <m.purves@jach.hawaii.edu>, tech-talk@aps.anl.gov
Date: Fri, 28 Jan 2005 14:23:48 -0600
Emmanuel Mayssat wrote:
I use "dbLoad" files such as this one:

#----------------------------------------------------------------------
# HPS937A - LOAD RECORD INSTANCES
#----------------------------------------------------------------------
# Serial Port Number    =       ${SPN}
# Serial Configuration  =       9600 8N1
#----------------------------------------------------------------------

dbLoadRecords("${DB_DIR}/HPS937A.db","deviceName=${IOCNAME}:HPS937A:${SPN}:${PAD},

serialPortNumber=${SPN},primaryAddress=${PAD},
baudRate=${BR},numberOfDataBits=8,parity=0,numberOfStopBits=1");



those can be considered as template for intanciation.

In the stcmd file ( iocsh script ), I source those template files with a command as follow:

< /DBL_DIR/HPS937A.dbl

Now, before I source this file, I need to epicsSetEnv all the variables such as ${SPN} and ${PAD} and ${IOCNAME}. ( or they need to be defined in the linux shell )

Now, I would like to include in my dbl files a command that says:
If this variable is not set, then set it to this value.

This would enable me to just set the vars that are meaningful.
For example, baudRate could default to 9600. But if I really want to change it I can do so with epicsSetEnv(BR,19200).

Why not just source a script which sets the default values of all the environment varaibles before sourcing any of the other scripts which then optionally override the values and use them.
--
Eric Norum norume@aps.anl.gov
Advanced Photon Source Phone: (630) 252-4793
Argonne National Laboratory



Replies:
Re: if-then-else in iocsh Emmanuel Mayssat
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

Navigate by Date:
Prev: Re: if-then-else in iocsh Emmanuel Mayssat
Next: Re: if-then-else in iocsh Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
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  <20052006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·