Robot Control Meta Language (RCML)

9.1 Passing parameters to the RCML program

The data from the OS may be passed to the RCML program via the command line. However, at this stage of language development only real data types may be passed. In order to have access to the parameters in the RCML code passed via the command line, add necessary parameters to the main function.

The values are passed to these parameters of the main function by adding the parameter value to the invocation command of the RCML interpreter after specifying the file with the PC code. Passing a parameter with a value will be as follows:

-Pparameter_name=parameter value

For example, let there be a test.rcml file with the following content:

function main(foo, bar) {
	sum = foo + bar;
	system.echo(“foo + bar = ”, sum, “\n”);

The command for compiling the RCML file:

rcml_compiler test.rcml test.pc

The command for executing the RCML program with passing value 1 to parameter foo, and bar equal to 3.5:

rcml_interpreter test –Pfoo=1 –Pbar=3.5

The result of program execution will be:

foo + bar = 4.5

Here, the order of passing the parameters values is not important, since they are passed by their names. The parameters whose values have not been passed will be equal to 0.0. 

In the next example:

rcml_interpreter test –Pfoo=1

The result will be:

foo + bar = 1

If the value has been passed for a non-existing parameter, an error will be thrown at the attempt to run the RCML program.

The following example contains an error, since the err parameter does not exist:

rcml_interpreter test –Pfoo=1 –Perr=2.35

9.2 passing values from the RCML program to the OS

Data may be passed from RCML to the OS in two ways:

9.3 Passing exceptions (errors) from the program to the OS

It occurs by throwing an exception without catching it up to the top level, i.e., before and including the main function. In this case the RCML program will terminate with code 1, and the value of the exception will not be passed. The mechanism of processing and passing exceptions is discussed in more details in Section "Exceptions".


12, Monastyrskaya St., lit. A,
Office 600, Perm, Russia


+7 (342) 214 01 84