|
From: Ethan A M. <sf...@us...> - 2012-02-22 21:49:43
|
On Tuesday, February 21, 2012 11:17:07 pm pl...@pi... wrote:
> Hi,
>
> I just defined a few macros to shorten some lengthy plot commands, eg.
>
> in_lt_blue=' linecol rgb "light-blue" '
>
> It worked fine when I loaded the complete file using load command. No
> errors and I got the right results.
>
> Then I tested something else directly at the command prompt:
>
> gnuplot> in_red=' linecol rgb "red" '
> gnuplot> @in_red
> ^
> invalid character @
>
>
> I realised that this was in fact correct since I had not ' set macros'
>
> But in that case why did it work when I loaded this and similar lines
> with load ?
>
> It seems that there is an inconsistency here. The load command should
> equally have to parse the macros since there was no set macro command in
> the script.
>
> So there is an apparent bug: load command somehow circumvents the check
> on the state of set macros and expands them anyway.
You are correct.
The string_expand_macros() routine is called in two places.
One is inside a test for if (expand_macros) {}, but the one used by the
load command is not. I do not recall if this was intentional
or simply an oversight.
It would be a one-line change to misc.c, but let me think about possible
side effects.
|