1#
2# This script exercises the ARG* variable-passing mechanism
3# used by the "call" command.  Note that the only difference between
4# "load" and "call" is that "load" has no parameters (ARGC = 0).
5#
6if (!exists("ARGC")) {
7    print "This copy of gnuplot does not support the ARG call method"
8    exit
9}
10$DATA << EOD
111 2
123 4
13EOD
14set table
15
16print "\nEntering ", ARG0, " with ", ARGC, " parameters"
17if (ARGC == 0) {
18    undefine FOO
19    BAZ = 5.67
20    NOTAFUNCTION = "a string"
21    print "Now exercise the call mechanism at line ", GPVAL_LINENO
22    plot $DATA using ($1):($2) title "Does $1 clobber using spec?"
23    call ARG0 1.23e4 "string constant" FOO BAZ "3 + log(BAZ)" NOTAFUNCTION (1+3+4) pi
24} else {
25    FOO = 1
26    print "\n\tTest whether this copy of gnuplot also supports deprecated"
27    print "\tcall parameter syntax "."$"."0 "."$"."1 "."$"."2 "."etc: "
28    print "\t\t", exists("$2") ? "yes" : "no"
29    show variable ARG
30    print "ARG1 (numerical constant) came through as ", ARG1
31    print "     @ARG1 = ", @ARG1
32    print "     (ARG1 == @ARG1) is ", (ARG1 == @ARG1) ? "TRUE" : "FALSE"
33    print "ARG2 (string constant) came through as ", ARG2
34    print "     words(ARG2) = ", words(ARG2)
35    print "ARG3 (undefined variable FOO) came through as ", ARG3
36    print "ARG4 (numerical variable BAZ=5.67) came through as ", ARG4
37    print "     @ARG4 = ", @ARG4
38    print "ARG5 (quoted expression) came through as ", ARG5
39    print "     @ARG5 = ", @ARG5
40    print "ARG6 (string variable) came through as ", ARG6
41    print "     words(ARG6) = ", words(ARG6)
42    print "ARG7 (expression) came through as ", ARG7
43    print "ARG8 (pi) came through as ", ARG8
44    if (exists("ARGV")) { print "ARGV = ", ARGV }
45    plot $DATA using ($1):($2) title "Does $1 clobber using spec?"
46}
47
48unset table
49reset
50