As in DCL, it is possible to define symbols which will be translated by the command parser. For an example, you may repeatedly want to change the plot device to a different one, make a new plot, and change it back. In this case we could just define a symbol, MAKE-LNO3-PLOT say, that would execute this simple ``command line macro''. The syntax is similar to that of DCL:
>> MAKE-LN03-PLOT := 'set-plot-device H;new-plot;set-plot-device T;'
The symbol name is minimum matched in the same way as any other command. This makes it possible (and sensible) to give your symbol some fairly explicit name so that you don't forget what it was for -- the command ``SHOW-COMMANDS plot" will now list your new symbol as well as all the built-in commands that include the word ``PLOT'' in their name. The equivalence string may be up to 64 characters long at present.
It is also possible to allow for the possibility of a more general command,
whereby one or more parameters is unknown at the time the symbol is
defined. Say that instead of always
plotting to the hardcopy device in the above example we wanted to choose, at
the time, which device we meant. There are two ways of passing the parameter to
the new command. The first is to declare a string parameter -- DEVICE
say -- that you can set using the `=' command, and to use this parameter in
the symbol:
>> declare device c1
>> make-plot := 'set-plot-device device;new-plot;set-plot-device T;'
:
>> device = 'H'
>> make-plot
When you type MAKE-PLOT the equivalence string is substituted in the command
buffer, and when the variable DEVICE is found as input to the prompt from
SET-PLOT-DEVICE it is assigned its current value (`H').
Alternatively, you can use the ``immediate mode'' prompt discussed in the previous section:
>> make-plot := set-plot-device ?;new-plot;set-plot-device T;
:
>> make-plot
Immediate> Terminal / Hardcopy / Null (T/H/N) [H] H <CR>
..
Note that you can not put the response to the expected prompt on the
same command line as ``make-plot'' in this case: the fact that the command
is being input in immediate mode means that the prompt will always
appear, and will expect input from the terminal at that point. This is in
contrast to command files, where the `?' character causes the parser to
look for input at the calling level and will accept arguments that
follow the command file name (e.g.
>> @command-file p1 p2 ).
Currently defined command symbols can be inspected using the command SHOW-SYMBOLS.