The folloing script looks proper but shows the error: undefined variable: ARG1.
Gnuplot 5.0 rc2 on Debian 7.
print 'ARGC=', ARGC
print 'ARG1=', ARG1
print 'ARG2=', ARG2
# ARG1,ARG2 become undefined after a nested code-block is executed.
if (1) {
if (1) {} # ==> undefined variable: ARG1
# do for[i=1:1] {} # ==> undefined variable: ARG1
# cond=1; while (cond) { cond=0; } # ==> undefined variable: ARG1
}
print 'ARGC=', ARGC
print 'ARG1=', ARG1
print 'ARG2=', ARG2
Running this script, argerror.gpi, shows:
$ gnuplot -c argerror.gpi 1 2
ARGC=2
ARG1=1
ARG2=2
ARGC=2
ARG1="argerror.gpi", line 14: undefined variable: ARG1
The following script works.
OPTC=ARGC
OPT1=ARG1
OPT2=ARG2
print 'OPTC=', OPTC
print 'OPT1=', OPT1
print 'OPT2=', OPT2
if (1) {
if (1) {}
do for[i=1:1] {}
cond=1; while (cond) { cond=0; }
}
print 'OPTC=', OPTC
print 'OPT1=', OPT1
print 'OPT2=', OPT2
Sorry if duplicate.
Thanks,
Takuma
Thanks for the bug report.
Now fixed in 5.0 and 5.1