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  2013  2014  2015  2016  2017  2018  <20192020  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  <20192020 
<== Date ==> <== Thread ==>

Subject: Re: comment a field with a macro
From: "Jemian, Pete R. via Tech-talk" <tech-talk@aps.anl.gov>
To: "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Wed, 7 Aug 2019 15:44:20 +0000
Seems like a use case for a default value.  Check my syntax (following 
the docs here: https://epics.anl.gov/base/R7-0/2-docs/msi.html) since I 
don't often use defaults:

 >     #field(SIML, "$(test=test):SimulationMode")

Almost any value would work since the code is in a comment.


On 2019-08-07 10:28 AM, Kasemir, Kay via Tech-talk wrote:
> Hi:
> 
> I think the reason is simply that macros are replaced way early, before the parser looks at the meaning of anything on a line.
> Macros can be anywhere within the database text.
> Macros can even include '#' for comments.
> 
> record(calc, ramp)
> {
> $(C) field(SCAN, "1 second")
>           field(CALC, "A+1")
>           field(INPA, "ramp")
> }
> 
> Running it like this "works", $(C) is replaced by <nothing>:
> softIoc -m "C=" -d test.db
> 
> Running it like this comments the SCAN field line, and the record doesn't get scanned:
> softIoc -m "C=#" -d test.db
> 
> Might consider it a feature, not a bug.
> 
> -Kay
> 
> 
> 
> 
>    
> From: tech-talk-bounces@aps.anl.gov <tech-talk-bounces@aps.anl.gov> on behalf of Alfio Rizzo via Tech-talk <tech-talk@aps.anl.gov>
>   Sent: Wednesday, August 7, 2019 11:17 AM
>   To: tech-talk@aps.anl.gov <tech-talk@aps.anl.gov>
>   Subject: [EXTERNAL] comment a field with a macro
>      
>   
>   Hi,
>   I see some strange behavior when I want to comment
>   a field in a record if there there are different macros in it
>   E.g.
>    
>   record(ai, "$(user):PiraniGauge") {
>     field(DESC, "Readback form Pirani Gauge")
>     field(EGU,  "Torr")
>     field(VAL, 4e-07)
>     #field(SIML, "$(test):SimulationMode")
>   }
>    
>    
>   When then I load the db,
>   I must defined also the macro $test even if I don’t use it (its commented),
>   Otherwise I will get this warning from the iocsh
>    
>   …………
>   macLib: macro test is undefined (expanding string #  field(SIML, "$(test):SimulationMode")
>   ………..
>    
>   i.e. I have to write
>    
>   dbLoadRecords("piranig.db","user=me, test=mytest")
>    
>   Is this normal ? why it does not skip the entire commented line ?
> 

-- 
----------------------------------------------------------
Pete R. Jemian, Ph.D.                 <jemian@anl.gov>
Beam line Controls and Data Acquisition (BC, aka BCDA)
Advanced Photon Source,    Argonne National Laboratory
Argonne, IL  60439                    630 - 252 - 3189
-----------------------------------------------------------
       Education is the one thing for which people
          are willing to pay yet not receive.
-----------------------------------------------------------



References:
comment a field with a macro Alfio Rizzo via Tech-talk
Re: comment a field with a macro Kasemir, Kay via Tech-talk

Navigate by Date:
Prev: Re: comment a field with a macro Kasemir, Kay via Tech-talk
Next: EPICS 'isegHAL' module Fulcher, Ethan via Tech-talk
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  <20192020 
Navigate by Thread:
Prev: Re: comment a field with a macro Kasemir, Kay via Tech-talk
Next: EPICS 'isegHAL' module Fulcher, Ethan via Tech-talk
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  <20192020 
ANJ, 07 Aug 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·