#
# This script exercises the ARG* variable-passing mechanism
# used by the "call" command.  Note that the only difference between
# "load" and "call" is that "load" has no parameters (ARGC = 0).
#
if (!exists("ARGC")) {
    print "This copy of gnuplot does not support the ARG call method"
    exit
}
print "\nEntering ", ARG0, " with ", ARGC, " parameters"
if (ARGC == 0) {
    undefine FOO
    BAZ = 5.67
    NOTAFUNCTION = "a string"
    print "Now exercise the call mechanism at line ", GPVAL_LINENO
    call ARG0 1.23e4 "string constant" FOO BAZ "3 + log(BAZ)" NOTAFUNCTION (1+3+4) pi
} else {
    FOO = 1
    print "\n\tTest whether this copy of gnuplot also supports deprecated"
    print "\tcall parameter syntax "."$"."0 "."$"."1 "."$"."2 "."etc: "
    print "\t\t", exists("$2") ? "yes" : "no"
    show variable ARG
    print "ARG1 (numerical constant) came through as ", ARG1
    print "     @ARG1 = ", @ARG1
    print "     (ARG1 == @ARG1) is ", (ARG1 == @ARG1) ? "TRUE" : "FALSE"
    print "ARG2 (string constant) came through as ", ARG2
    print "     words(ARG2) = ", words(ARG2)
    print "ARG3 (undefined variable FOO) came through as ", ARG3
    print "ARG4 (numerical variable BAZ=5.67) came through as ", ARG4
    print "     @ARG4 = ", @ARG4
    print "ARG5 (quoted expression) came through as ", ARG5
    print "     @ARG5 = ", @ARG5
    print "ARG6 (string variable) came through as ", ARG6
    print "     words(ARG6) = ", words(ARG6)
    print "ARG7 (expression) came through as ", ARG7
    print "ARG8 (pi) came through as ", ARG8
    if (exists("ARGV")) { print "ARGV = ", ARGV }
}
