EPICS Home

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  2021  2022  2023  2024  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  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: comment a field with a macro
From: "Kasemir, Kay via Tech-talk" <[email protected]>
To: Alfio Rizzo <[email protected]>, "'[email protected]'" <[email protected]>
Date: Wed, 7 Aug 2019 15:28:17 +0000
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: [email protected] <[email protected]> on behalf of Alfio Rizzo via Tech-talk <[email protected]>
 Sent: Wednesday, August 7, 2019 11:17 AM
 To: [email protected] <[email protected]>
 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 ?

Replies:
Re: comment a field with a macro Jemian, Pete R. via Tech-talk
References:
comment a field with a macro Alfio Rizzo via Tech-talk

Navigate by Date:
Prev: comment a field with a macro Alfio Rizzo via Tech-talk
Next: Re: comment a field with a macro Jemian, Pete R. 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  2021  2022  2023  2024 
Navigate by Thread:
Prev: comment a field with a macro Alfio Rizzo via Tech-talk
Next: Re: comment a field with a macro Jemian, Pete R. 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  2021  2022  2023  2024