October 1, 1979 COMMAND MACROS CREATION
MACROS -- $R
11.2.1.2 &READ ______________
This function can be used to prompt the user for required
parameters which are not specified initially and for which no
standard default can be used. An &R function inside a macro will
cause the character string enclosed in apostrophes to be printed
and a read to be done at the user's terminal (i.e., the terminal
will wait for a response). The string typed by the user will
replace the &R function in the macro expansion.


&R[<n>]['<prompt>']

or

&R<n>


<n>........A number from 1 to 9. If <prompt> is specified, the
line read in will substitute the &R function in the
command line.
Any &R<n> may be redefined at any time by another
&R<n>'<prompt>'.
If <prompt> is not specified, the last line read by
&R<n>'<prompt>' will substitute &R<n> in the command
line.
<prompt>...A line typed at the terminal before the read is done.
If null ________, or if both <n> and <prompt> are not
a read will specified, no line will be typed, but ___________
still be done _____________.
Notes _____
If the &R<n>'<prompt>' occurs as part of a default the &R<n> is
not defined unless the default is used. A null prompt may be
specified, for example, by &R1''.
The definitions do not have to proceed in numerical order, that
is, &R2 may be defined and used even if &R1 is undefined.
Both the <text string> and the input from the user are
considered literal text; no parameter substitution is done.
&R<n> must be defined before An _______________________________ it is used or an expansion
error will occur and macro execution will terminate.
&R<n> cannot itself take a default, but it can be included in a
default for a symbolic parameter (&<n>).
FRESS Resource Manual Release 9.1 FRESS RSection 7.2 -- 251
October 1, 1979 COMMAND MACROS CREATION
MACROS -- $R
Example _______
(1) l/&R1'What to change:'
(2) s/&R1/&R2'Change to:'
(3) l/&R2
This macro locates a pattern, changes it to a new pattern, and
then makes the pattern the first text in the buffer.
(1) The macro first prompts for the LOCATE pattern.
(2) In SUBSTITUTE the same pattern is then used as the <scope>
parameter and the macro prompts for the text string.
(3) The text string is used again as a LOCATE pattern.
Example _______
(1) mc off> &C'turn macro comments off'
(2) g/&1&R1'filename?'
(3) l/&1&R1> &C'to find end of macros'
(4) ib/&1&R1/&R2'new macro?'
(5) s/&1&R1/&R1'new end of macro delimiter?'
(6) g/macfile> &C'GET universal macro file'
(7) l/&R1> &C'Find end of macro delimiter'
(8) ib/&R1/&R2> &C'put new macro in universal'
(9) mc on> &C'turn macro comments back on'
This macro enables the user to insert a new macro in both the
file specified and in a special file that holds all his macros.
The comments (&C) are just internal documentation so they are
turned off at the top (1) and back on at the bottom (9) [mc off,
mc on]. Note the use of the Command Separator (">") so comments
can be be put on the same line (see Section 7.2.1.3).
if the first symbolic (2) &R1 is defined to be the filename _____________________
parameter is omitted or left null ____________________________________. This same line will
then get the file.
(3) The filename is LOCATEd. It was used as a delimiter to
denote the end of the format code macro definitions in the
file.
(4) &R2 is defined to be a new format code macro and it is
inserted before the filename. Note that if the user typed
a null line in response to "new macro?" this would define
&R2 as null and the command would put the user into Input
Mode. The subsequent input would not be saved as &R2.
(5) The saved filename is used in place of &R1 in its first
instance and then &R1 is redefined to be the new end of
macros delimiter. The old delimiter (the filename) is then
replaced with the new delimiter.
252 -- Section 7 Release 9.1 FRESS Resource Manual
Previous Page Next Page