Several macros or scripts can be defined within a single script file and these macros can be called by specifying the name of the macro in a script or the command line. To explicitly define a new macro the programmer can start the definition with BeginMacro macro_name, put the command lines of the macro after that, and end the definition with EndMacro.
To define an implicit block of command to be executed within a command, Begin macro_name ... EndBegin can be used ``within the command line''. Of course, the commands to be executed have to be specified on separate lines, but the original command line may continue after EndBegin. As an example we present a script that calculates the value of for and outputs the results in the form log(x) is n.
@echo -off expr -fout x -expr 1; while -expr 'x' <= 10; -cmd Begin evalLog expr -fout n -expr log('x'); echo log(${x}) is ${n} EndBegin: -loop expr -fout x -expr 'x' + 1;:
Or alternatively, the same execution could be obtained with:
@echo -off BeginMacro evalLog expr -fout n -expr log($1); echo log($1) is ${n} EndMacro expr -fout x -expr 1; while -expr 'x' <= 10; -cmd evalLog \${x}\: \ -loop expr -fout x -expr 'x' + 1;: