EPICS Controls 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  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: how can I prevent MSI from expanding just some macros?
From: Till Straumann <[email protected]>
To: [email protected]
Date: Fri, 02 Sep 2011 16:05:42 -0500
On 09/02/2011 03:42 PM, Ned Arnold wrote:
Maybe I misunderstand, but can't you simply replace the variable with
the same variable ... like this?

Cool - I didn't know that \ escaped a $. That's exactly what I
was looking for.

Thanks
-- T.


file dbAsyn_init.template
{
pattern
{P , R, GROUP, NAME, DLY }
{\$(P),\$(R), reg_data, IN0PD , "2" }
{\$(P),\$(R), reg_data, IN1PD , "2" }
{\$(P),\$(R), reg_data, IN2PD , "2" }
{\$(P),\$(R), reg_data, IN3PD , "2" }
{\$(P),\$(R), reg_data, IF_SLEEP , "2" }

"It works for me" ... as they say.

Ned


------------------------------------------------------------------------
*From: *"Andrew Johnson" <[email protected]>
*To: *[email protected]
*Sent: *Friday, September 2, 2011 3:01:45 PM
*Subject: *Re: how can I prevent MSI from expanding just some macros?

Hi Till,

On 2011-09-02 Till Straumann wrote:
 > I process a bunch of templates with MSI but would like the final
 > .db file to still contain macros which are to defined when the
 > .db file is loaded. Of course, this works for macros without
 > a definition but I'd like to prevent MSI from expanding a macro
 > that gives a default value:
 >
 > $(dont_expand=my_default)
 >
 > Is there a way to prevent MSI from expanding this?

The obvious way is to use something other than MSI to do this particular
expansion, but I expect it's possible to do it using MSI somehow.

Maybe instead of spelling them like you do above, you would spell those
macros
like this:

$(dont_expand$(equals)my_default)

When you run MSI it will convert that string to this:

$(dont_expand$(equals,undefined)my_default,undefined)

But that's Ok and still legal. When you're finally ready to expand the
dont_expand variable you also set equals='=' and you'll get this as a
partial
result:

$(dont_expand=my_default,undefined)

which should then properly expand the dont_expand variable and or set it to
my_default if it's not defined.

Not tested, and probably rather brittle...

- Andrew
--
Optimization is the process of taking something that works and
replacing it with something that almost works, but costs less.
-- Roger Needham


Replies:
Re: how can I prevent MSI from expanding just some macros? Ned Arnold
References:
Re: how can I prevent MSI from expanding just some macros? Ned Arnold

Navigate by Date:
Prev: Re: how can I prevent MSI from expanding just some macros? Ned Arnold
Next: Re: how can I prevent MSI from expanding just some macros? Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: how can I prevent MSI from expanding just some macros? Ned Arnold
Next: Re: how can I prevent MSI from expanding just some macros? Ned Arnold
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·