I've been struggling to update the "call" syntax to something more compatible with current gnuplot capabilities. The original syntax performs macro-like expansion triggered by the character sequences $0 ... $9, with the count of parameters substituted for $#.
Problems with the original syntax:
1) Consumes quote marks on input, ignores quotes during macro expansion
2) Because of (1) it handles string variables and string constants poorly
3) The $# expansion has been broken for years because it looks like a comment
4) This use of $N conflicts with the use of $N as shorthand for column(N)
5) The use of $ and the peculiar handling of quotes makes it very hard to generate or pass through lines from a unix-like shell script
This patch introduces an alternative syntax for the "call" arguments. They are loaded into ordinary gnuplot variables that are saved/restored across the call.
ARG0 = name of the script being executed
ARGC = count of parameters passed to the script
ARG1..ARG9 = the arguments stored as strings
- Because the arguments are constructed and accessed as regular string variables, you have the choice of using them directly (e.g. set title ARG3) or expanding them as macros (e.g. plot @ARG3). The former is usually appropriate for strings, the latter is usually appropriate for numerical values or expressions.
- ARG0 holds the name of the script being executed during "load" also, as well as during execution of files named on the gnuplot command line.
The patch contains a simple demo "calltest.dem" that illustrates this.