Experimental Physics and
| |||||||||||||||
|
In the interest of full disclosure, I saw that trick in databases we received from LBL ... it's likely Eric had something to do with it :)
Just wanted to give credit where it was due ... Ned From: "Till Straumann" <[email protected]> To: [email protected] Sent: Friday, September 2, 2011 4:05:42 PM Subject: Re: how can I prevent MSI from expanding just some macros? 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
| ||||||||||||||
ANJ, 18 Nov 2013 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |