COMMAND FORMATS
When the Editor is called, it positions its file pointer at the start
of the first line in the file to be edited and presents the initial
display. At the outset, it is in command mode and expects command input
to be typed on the command line. The response may take one of three
forms:
typing a command line followed by RETURN
typing a Special command followed by RETURN
pressing a control key (including plain RETURN)
A command line consists of one or more editing commands, optionally
separated by spaces. A command line is terminated by RETURN and errors
noticed while typing it may be cancelled by means of the DEL key.
Special commands
Special commands are distinguished by starting with the prefix "%"
(percent-sign) followed by a letter. They are used to select options
and set modes which modify the effect of subsequent editing commands.
The most essential Special command is the Close command "%C" which is
used to close off the edit. The Special command "%H" (for Help)
provides general Help information on the Editor and its use, and the
Special command "%Q" (for Query) allows the user to explore the
significance of individual keys. Details of the Special commands are
given in the major sections SPECIAL COMMANDS and MACROS.
Control keys
Where a control key has been defined as a command, the effect of
pressing the key is effectively the same as if the command sequence for
which the key stands had been typed in followed by RETURN. Note,
however, the important difference mentioned under 'repetition'. RETURN
by itself counts as a control key with the fixed significance of M
(Move).
One control key has the effect of switching between command mode and
data-entry mode. In data-entry mode, only control keys (including
RETURN) can be interpreted as commands, since any printing characters
and spaces typed in this mode are treated as data to go into the file,
overwriting any text already present at the current position.
Command types
There are just two formats for individual editing commands, one for
those commands which are accompanied by a text string as parameter and
one for those which are not.
A command which has no text parameter takes the form of a single
character or a single character followed by a minus sign. For most
commands the single character is a letter, which is mnemonic for an
imperative verb. For example, the Move command is denoted simply by "M"
(or "m") and the Move back command by "M-" (or "m-").
A command with a text parameter takes the form of a single letter (or
letter followed by minus) followed by whatever string of characters the
user wants to specify, enclosed within delimiter characters. For
example, "F/cat/" is an instance of the Find command with "cat" as its
parameter, and "S.dog." is an instance of the Substitute command with
"dog" as its parameter.
The user has a choice of several characters for use as delimiters; the
oblique stroke and the period illustrated above are popular because of
typing convenience, but any character which has no defined significance
to the Editor may be used. The opening and closing delimiter for any
one parameter must be the same, and the delimiter must be chosen to be
distinct from any of the characters which require to be included in the
text string. Strings may include any printing characters and spaces,
but not line-breaks.
The commands which take a text parameter fall into two groups:
text-matching commands and text-insertion commands. There is some
relaxation of the format rules for the parameters for the latter
(Insert, Overwrite, Substitute and Get); details are given in the
description of the Insert command.
There are a number of alternative ways of specifying a text parameter:
by one of the six text parameter macro letters (X,Y,Z,x,y,z);
by the ditto symbol(");
by the exclamation-mark (!).
The first of these is described in the section on Command and Text
Macros.
The ditto symbol indicates that the text string to be used is the same
as the last string used in a command of the same group (matching or
insertion).
Using an exclamation-mark in place of a text string indicates that the
actual text to be used is not provided within the command, but is to be
requested at the time the command is executed. In this case, when the
text is requested, it should be typed without delimiters and terminated
by RETURN. (For the interpretation of exclamation-mark within command
macro sequences, see MACROS).
Case distinctions
In commands, the upper-case letters 'A' to 'W' have a fixed
significance as basic editing commands. Initially the lower-case
letters 'a' to 'w' have the same meaning as their upper-case
counterparts, but this is not fixed and may be changed by re-definition
as command macros. The letters 'X' to 'Z' and 'x' to 'z' have no fixed
significance to the Editor and are available for definition as text or
command macros.
Within text strings, case distinctions are always significant for
insertions, but are normally ignored for text matching purposes, so
that, for example, the string "the" would be considered to match "The"
as well as "the" (not to mention "tHe" and so on). However, there is an
Option (NOMATCH) which may be selected to prevent this indiscriminate
matching.
Multiple commands
When more than one command is typed on a line, they may be, but need
not be, separated by spaces. The commands are executed in order from
left to right. One point of putting several commands on one line is to
control the frequency of feedback. Another is to produce a useful unit
for repetition.
Syntactic errors
Before proceeding to execute a command line, the Editor checks that
the format of each command in it is correct, for example, that a text
matching command is accompanied by a text parameter. If not, an error
report is made indicating the nature of the error and no attempt is made
to execute any of the commands making up the line. Note the contrast
between the treatment of this kind of error and the effect of failures
in executing well-formed commands.
Failure conditions
The specification of the individual commands defines not only what
happens when the command is carried out but the condition under which
the command cannot be carried out -- the failure condition. In the
simple case, a failure in command execution counts as an error and a
report is made. Any subsequent commands in a command sequence are not
executed, but the effect of any earlier commands in a command sequence
is not undone, nor that of successfully completed cases of a repeated
command. There may also be partial execution of the failing command
itself, as defined in the individual descriptions which follow. Failure
conditions can be utilised to control command execution in a number of
ways, of which the most important is mentioned in the next paragraph.
For a few commands, mainly those represented by a character other
than a letter, there is no failure condition.
Repetition numbers
Any command may be followed by a repetition number (a decimal
integer) indicating that the command is to be repeated the number of
times specified. For example, "M5" means Move five times, and "I/ /20"
means Insert a space twenty times, that is, in effect, insert twenty
spaces. An asterisk may be used in place of a repetition number with
the significance: repeat the command until it fails. For typing
convenience, the digit zero may be employed in place of an asterisk.
For example, the command "E*" (or "E0") means Erase repeatedly until the
failure condition for Erase is met, that is, Erase up to the end of the
line.
Repetition of last command
Instead of typing in a new command at any point, the user may instead
type simply a repetition number. This causes the last genuine command
line to be executed again the number of times specified. The whole
command line, which may consist of a sequence of several commands, is
repeated. In this context, neither Special commands nor control key
commands count as genuine command lines, nor do they cause the last
genuine command to be lost (although some Special commands may cause the
record of it to be erased from the screen).
The control key Linefeed is generally defined to have the
significance of repeating the last command once.