Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: macLib/msi changes with 3.14.10
From: Andrew Johnson <anj@aps.anl.gov>
To: tech-talk@aps.anl.gov
Date: Fri, 23 Oct 2009 14:00:30 -0500
Hi Till,

On Thursday 22 October 2009 18:41:05 Till Straumann wrote:
> I'm not a macLib MSI expert but just used
> the MSI tool to do db expansions. One thing
> I used to do a lot is use MSI for 'partial'
> expansions where I leave some macros unexpanded.

This is still supported (as long as you're feeding the resulting files back 
into macLib), although you need a new version of msi and you will still get a 
warning message from it.

> I noticed that with 3.14.10 the behavior
> of macExpandString() changed drastically
> which breaks things for me.

The change occurred when I added support for scoped macros in 3.14.10, but I 
obviously forgot to list them in the release notes.  However, read on...

> Under 3.14.8.2
>
>   echo 'unexpanded=${XXX}' | msi
>
> produces
>
>   unexpanded=${XXX}
>
> on stdout and msi terminates without error.
>
> Under 3.14.10 however, the same pipeline
> produces
>
>   on stdout:    unexpanded=$(XXX,undefined)
>
> and
>
>   on stderr:    input: unexpanded=${XXX}
>                   which is in line 1 of file stdin
> and terminates with an error.

A new version of msi was released on 2008-11-10, so using msi release 1-5 
(with R3.14.11, but 3.14.10 is identical) I get this:

tux% echo 'unexpanded=${XXX}' | msi
unexpanded=$(XXX,undefined)
Warning: unexpanded macros in ouput
tux% echo $status
0

The Warning: line comes out on stderr and the main text on stdout just as 
before; the new version does not terminate with an error status however.  You 
can add a -V flag to msi to get a more verbose warning message on stderr.

However, when it subsequently expands them again the macLib code will 
completely ignore the ",undefined" part of the modified macro names, so you 
can still feed the msi output straight into dbLoadRecords without any 
problems.

> Couldn't find anything in the release notes documenting
> this rather drastic change.

Mea culpa, but it's not as drastic as you think as long as you upgrade msi and 
aren't using some other code to expand the output files.

> How can I convince macLib/MSI that I want undefined
> macros to be copied verbatim?

You can't disable the addition of the ",undefined" flag in the current 
version, or prevent the braces from being replaced by parentheses.

Scoped macros now allow you to define other macro values within the scope of 
the one being expanded.  If we define these:
    X   = $(Y_$(n))
    Y_1 = A
    Y_2 = B
then expanding $(X,n=1) temporarily defines n=1 so will return "A" and 
$(X,n=2) will return "B", but in both cases the macro $(n) will never be 
visible outside of the scope of the expansion of $(X).  You can even 
temporarily redefine other macros, so that expanding $(X,n=1,Y_1=C) $(X,n=1) 
returns "C A".  Demo:

    tux% msi -M 'X=$(Y_$(n)),Y_1=A,Y_2=B'
    $(X,n=1)
    A
    $(X,n=2)
    B
    $(X,n=1,Y_1=C) $(X,n=1)
    C A

Default values have been available since R3.14.6, using the syntax $(X=def) 
which will return "def" is X is not defined.

HTH,

- Andrew
-- 
The best FOSS code is written to be read by other humans -- Harald Welte


Replies:
Re: macLib/msi changes with 3.14.10 Till Straumann
References:
macLib/msi changes with 3.14.10 Till Straumann

Navigate by Date:
Prev: RE: devLibOSD.c for Linux Davidsaver, Michael
Next: Re: devLibOSD.c for Linux Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: macLib/msi changes with 3.14.10 Till Straumann
Next: Re: macLib/msi changes with 3.14.10 Till Straumann
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·