File: callargs.dem

package info (click to toggle)
gnuplot 6.0.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,940 kB
  • sloc: ansic: 95,319; cpp: 7,590; makefile: 2,470; javascript: 2,328; sh: 1,531; lisp: 664; perl: 304; pascal: 191; tcl: 88; python: 46
file content (49 lines) | stat: -rw-r--r-- 1,805 bytes parent folder | download | duplicates (3)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
# 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
}
$DATA << EOD
1 2
3 4
EOD
set table $OUT

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
    plot $DATA using ($1):($2) title "Does $1 clobber using spec?"
    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 }
    plot $DATA using ($1):($2) title "Does $1 clobber using spec?"
}

unset table
reset