next up previous contents index
Next: Numeric evaluation of expressions Up: Programming with the interpreter Previous: Introduction   Contents   Index


Parameters

Command files and programs accept arguments. Inside a command file or a program, the first argument is represented by the expression #1, the second by #2, etc. It is also possible to use parentheses, to avoid ambiguities. For instance, #(11) will mean the parameter 11 and #(1)1 the parameter 1 followed by 1. The maximal number of arguments that a command file or program can accept is fixed in the initialization file (cf. 3.1).


Example : Suppose that the command file x.cmd contains the following lines

Xcom1 #1 xx#2yy
Xcom2
Xcom3 #2
Xcom3 x#(1)2y

Then the command

<x.cmd A B

will produce the execution of

Xcom1 A xxByy
Xcom2
Xcom3 B
Xcom3 xA2y

(provided that the commands Xcom1, Xcom2, Xcom3 mean something).

It is possible to put a numerical expression inside #(). For instance #(x+y) will mean the parameter whose number is the biggest integer smaller than or equal to x+y (see 4.3.2, 7).

The substitution of parameters is a particular case of the way to make substitutions in the command interpreter (cf. 4.5).


In a command line, in expressions of type {1, {2, ..., a substitution of # to { is made. This is a way to send parameters containing the character # .



next up previous contents index
Next: Numeric evaluation of expressions Up: Programming with the interpreter Previous: Introduction   Contents   Index
2009-11-12