File: callargs.dem

package info (click to toggle)
gnuplot5 5.0.0~rc%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,548 kB
  • ctags: 8,104
  • sloc: ansic: 77,108; cpp: 6,848; makefile: 1,932; sh: 1,343; lisp: 657; perl: 302; awk: 235; pascal: 194; tcl: 88; python: 46
file content (35 lines) | stat: -rw-r--r-- 1,501 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#
# 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)
} else {
    print "\n\tTest whether this copy of gnuplot also supports deprecated"
    print "\tcall parameter syntax "."$"."0 "."$"."1 "."$"."2 "."etc: "
    print "\t\t", exists("$3") ? "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
}