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