On Apr 14, 2021, at 12:32 PM, Ralph Lange via Core-talk <core-talk at aps.anl.gov> wrote:
>
>> Do we need some syntax in macros to prevent them from escaping back-slashes when expanding values? I’m not sure how easy it would be to implement that, but it might be possible. Any other suggestions on what might be changed?
>
> Looking at the macLib code, I was getting the expression that the original intention might have been to do it right.
> /* discard quotes and escapes if level is > 0 (i.e. if these aren't
> the user's quotes and escapes) */
>
> Or not? (Shouldn't quotes and escapes only be discarded when they are the user's, and kept through replacements?)
> Well, at least there was an intention.
Read the macLibNOTES file in the libCom/macLib directory. Unfortunately it’s a bit self-referential in places as it was originally meant to be run on itself so not always immediately obvious.
> What if using a variable wouldn't change its content? After the second line, I would expect PP and QQ to be the same.
> epics> epicsEnvSet PP a\\b\\c
> epics> epicsEnvSet QQ $(PP)
> epics> epicsEnvShow
> [...]
> PP=a\b\c
> QQ=abc
>
> We could maybe add another bracket character pair for verbatim usage.
> epics> echo $[eeed]
>
> I am afraid that changing the current behaviour - even if it was "correcting" it - would add a pretty high risk of breaking things for users.
I agree, I wouldn’t do that; I was thinking of something more on the lines of ${\PP} or ${'PP'} which both currently return the same as ${PP}. I’d rather not add more start/end character pairs to the macro syntax. What would be simplest depends on whether I can detect the modifiers in the right place inside the code, the leading back-slash might be simplest to implement. We'd have to be careful about how to expand things like ${\${PP}=${Q}} though.
- Andrew
--
Complexity comes for free, simplicity you have to work for.
- Replies:
- Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- References:
- Windows paths inside iocShell Ralph Lange via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Kasemir, Kay via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Johnson, Andrew N. via Core-talk
- Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Navigate by Date:
- Prev:
Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Next:
failing tests on github.com Zimoch Dirk (PSI) via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Next:
Re: [EXTERNAL] Windows paths inside iocShell Ralph Lange via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|