next up previous contents index
Next: Clear Up: Commands Previous: Cd   Contents   Index


Call

The call command is identical to the load command with one exception: you can have up to ten additional parameters to the command (delimited according to the standard parser rules) which can be substituted into the lines read from the file. As each line is read from the called input file, it is scanned for the sequence $ (dollar-sign) followed by a digit (0-9). If found, the sequence is replaced by the corresponding parameter from the call command line. If the parameter was specified as a string in the call line, it is substituted without its enclosing quotes. Sequence $# is replaced by the number of passed parameters. $ followed by any character will be that character; e.g. use $$ to get a single $. Providing more than ten parameters on the call command line will cause an error. A parameter that was not provided substitutes as nothing. Files being called may themselves contain call or load commands.

The call command must be the last command on a multi-command line.

Syntax:

     call "<input-file>" <parameter-0> <parm-1> ... <parm-9>

The name of the input file must be enclosed in quotes, and it is recommended that parameters are similarly enclosed in quotes (future versions of gnuplot may treat quoted and unquoted arguments differently).

Example:

If the file 'calltest.gp' contains the line:

     print "argc=$# p0=$0 p1=$1 p2=$2 p3=$3 p4=$4 p5=$5 p6=$6 p7=x$7x"

entering the command:

     call 'calltest.gp' "abcd" 1.2 + "'quoted'" -- "$2"

will display:

     argc=7 p0=abcd p1=1.2 p2=+ p3='quoted' p4=- p5=- p6=$2 p7=xx

NOTE: there is a clash in syntax with the datafile using callback operator. Use $$n or column(n) to access column n from a datafile inside a called datafile plot.


next up previous contents index
Next: Clear Up: Commands Previous: Cd   Contents   Index
Ethan Merritt 2007-03-03