.NA "The Christchurch Edit Facility - CHEF" "R.D. Eager"
.HD June 1981 DOC/REF/K2.7/3
.RV "May 1982 (4)"
.S1 Introduction
.PG
CHEF is a portable text editor written in BCPL. It is a
descendant of the UNIX system editor ED, but has a significantly
different command structure and a number of new features.
.PG
The primary field of application for CHEF is computer source
program editing. However, there are some simple word-processing
facilities in the form of text justification and centring which
make it usable for document and letter preparation.
.PG
The editor is 'safe' in the sense that the entire file is
copied into an internal workspace before any editing takes
place. The original file is undisturbed until you explicitly
request that it be updated.
.PG
.S1 "How to use CHEF"
.PG
The editor is started by entering the system command

.ti +5
CHEF\ \ \ \ \ or\ \ \ \ \ chef

under EMAS or UNIX. When loaded, the editor displays

.ti +5
Enter H for help (Q for quit)
.ti +5
>

and is then ready for the first command, entered on the same line
as the prompt character '>' and completed by depressing the
RETURN or ENTER key. Thereafter, the editor displays '>' whenever
it is ready for a new command.

On-line documentation is available. To obtain a general
introduction, enter 'H'. To obtain details of a particular
operator or special character, enter 'H' followed by the character.

.S1 "How to edit a file"
.PG
To edit the file XXX use the command

.ti +5
>EF XXX

which reads the file into the editor's workspace and closes the
disc file. Under EMAS or UNIX this may also be done when the
editor is started, as in

.ti +5
CHEF(xxx)\ \ \ \ \ or\ \ \ \ \ chef\ xxx

To write the file out again, use the command

.ti +5
>WF\ .\ \ \ \ \ \ \ (the dot stands for the 'current file')

which will write the contents of the workspace to the file whose
name was used in the last EF command. To write it to a different
file YYY use the command

.ti -5
     >WF YYY

Once a file has been read into the workspace, you can
examine any line of it or print any range of lines. To examine
line 56, for example, enter

.ti +5
>56

and to see lines 50 to 60, enter

.ti +5
>50,60

Often you might not know the exact line number. To print a
line that contains the pattern 'abc', use the command

.ti +5
>/abc/

and to print the range of lines starting with one containing 'abc' and
finishing with one containing 'def', enter

.ti +5
>/abc/,/def/

If you want to insert a new line
.BD after
line 3, enter

.ti +5
>3I

followed by the desired line, followed by a 'dot stop' line,
i.e., a line consisting of a '.' only. When you insert a line in
this way, of course, all succeeding line numbers are increased.
To delete line 7, use the command '7D'.
.PG
To replace part of line 10, use the R operator:-

.ti +5
>10R/abc/def/;P

which replaces the first occurrence of 'abc' in line 10 with the
string 'def'. The ';P' at the end causes the revised line to be
printed for verification. This demonstrates two things: first,
that CHEF commands can be concatenated using ';' as a separator
and, second,  that CHEF remembers the 'current line' and uses it
as the location for the P (print) command.
.PG
Note that commands begin with a location followed by an
operator. The full syntax of commands will be discussed below.
.PG
The above was a quick summary of the simplest basic commands, and
a more complete description can be found in the command summary
or in the CHEF on-line documentation.
.S1 "Text storage in CHEF"
.PG
A file being edited is stored in a workspace which can be of
arbitrary size (the maximum varies with the implementation) and
within this workspace the lines of the file are numbered from 1
to some 'last line'.
.PG
After each editing operation, CHEF remembers the 'current
line'. This can often be used to simplify the following command.
The position of the current line after each command is
specified in the command summary.
.PG
Workspaces may be stacked using the N (new) operator; two
or more workspaces may coexist, although only the most recent is
available for editing. When the most recently created workspace
is finished with, the previous one may be restored again with the
Q (quit) operator.
.PG
As well as the workspace, there are 27 one-line buffers
called 'controls' which are known by the letters A to Z and the
symbol +. These can be used to store text, strings of CHEF
commands, or parts of commands, and they may be edited in exactly
the same manner as the lines of the workspace. Text can be
transferred in either direction between the workspace and the
controls, and there is a macro substitution facility to enable the
content of a control to be included anywhere in a CHEF command
line. The controls are independent of the workspace and do not
disappear when the current workspace is stacked and superseded by
a new one.
.PG
If you give CHEF a single non concatenated command that
alters the workspace, the content of the special control + is
executed immediately afterwards. This provides an automatic
verification facility. The control + initially contains a P
(print) command, but you may change this to any other command
string, including the null string.
.PG
The term 'location' is used to mean the line or lines
where the action of a CHEF command is to occur. A location may
be:-

.in +5
.LB 5
.LP i)
a line of the current workspace,

.LP ii)
a 'range', i.e., a group of contiguous lines of the current workspace,

.LP iii)
a control.
.LE
.in -5
.PG
Some CHEF commands admit all three possibilities as
locations; some are more restrictive. Consult the command
summary for details.
.S1 "Workspace line and range specification"
.PG
A line is specified by a 'finder', an arithmetic combination
(using + and - only) of 'terms' such as the following:-

.in +5
.LB 15
.LP 10
line number 10,

.LP \&.
the current line,

.LP $
the last line,

.LP /abc/
(a 'search pattern') the first line containing  the
pattern 'abc' found by a forward search from the
current line (the search 'wraps around' from the
last line to the first if necessary),

.LP \\abc\\
the first line containing the pattern 'abc' found
by a backward search from the current line,

.LP \&'A
(a 'tagger') the first line, found by a forward
search, that has been tagged with the character 'A',

.LP \&"A
the first line, found by a backward search, that has
been tagged with the character 'A',

.LP ~/abc/
the negated form of /abc/,

.LP ~\\abc\\
the negated form of \\abc\\,

.LP "~'A"
the negated form of 'A,

.LP '~"A'
the negated form of "A.
.LE
.in -5
.PG
The last four forms require the absence rather than the presence of a match.
.PG
Some examples of finders are:-

.ti +10
10\ \ .+1\ \ $-5\ \ /abc/+3\ \ 'X-1\ \ .

A 'range' is specified with two finders separated by a comma
or a colon. Thus, '1,5' specifies the range of lines 1 to 5
inclusive. The difference between the comma and the colon is
only significant when a search has to be carried out to evaluate
the finders. If the comma is used, both finders are evaluated
from the point of view of the current line. If the colon is
used, the current line is set to the value specified by the
finder preceding the colon before the next is evaluated. The
following are examples of ranges:-

.ti +10
\&.-5,.+5\ \ \ \\BEGIN\\,/END/\ \ \ \ \ /abc/+3:/def/
.PG
A range may be specified with three or more finders
separated by commas or colons. In this case the string of
finders is evaluated from left to right, and the current line is
set by each finder that is followed by a colon.  The final  value
of the range is determined by the last two finders. For
example:-

.ti +10
/END/:/BEGIN/:/END/
.sp 1
specifies the PASCAL compound statement following the one
containing the current line.
.PG
In the command summary, the term 'region' is used to mean
either a single workspace line or a range of lines.
.S2 "Default values in finders and ranges"
.PG
To reduce typing, various components of finders and ranges
may be elided. The rules are:-

.in +5
.LB 10
.LP i)
in a finder, if no term precedes a leading '+' or '-',
then an elided '.' is assumed,

.LP ii)
in a finder, if no term follows a '+' or '-', then a '1' is assumed,

.LP iii)
in a range, one or more finders may be elided,
leaving only ',' or ':'. The last finder, if
elided, defaults to '$', the last but one to '1',

.LP iv)
in a range, the comma or colon may be elided if no ambiguity results,

.LP v)
if a complete location specification is elided the current line '.' is assumed.
.LE
.in -5
.PG
Examples of the use of these rules are as follows:-
.CP 15 15

 Entered        Meaning         Rules
 -------        -------         -----

    +1            .+1            i
    +             .+1            i,ii
    ++           .+1+1           i,ii
   ,10            1,10           iii
   -,+          .-1,.+1          i,ii
   .,             .,$            iii
/abc//def/     /abc/,/def/       iv
    ,             1,$            iii
                   .             v
.EC
.S2 "Controls as locations"
.PG
A control may be specified as a location in many, but not
all, situations where a line can be specified. To specify the
control 'A' in the context of a location, the form '@A' is used.
For example, to change the contents of control J, use the
command '@JC', and to delete its contents (i.e. make them null) use the
command '@JD'.
.PG
There is no concept of a range of controls, so the form '@A,@G' is not permitted.
.S2 "Patterns"
.PG
A pattern is a sequence of elements enclosed by delimiters.
In a search pattern the delimiters must be '/' (for forward
search) or '\\' (for backward search), and the pattern may be
preceded by '~' if you wish it to match by exclusion.  This type
of pattern is used in finders and as the operand of X (execute).
.PG
Patterns are also used by the R (replace)  and  S  (segment)
operators to specify a substring of a line. In these cases the
delimiter may be any character except ';'.
They are used in a similar way by the F (fold) and M (merge) operators,
and by the PM (print matches) command.
.PG
CHEF attempts to match the pattern against all substrings of
a line starting with the 'left margin' (initially column 1) and
finishing at the 'right margin' (initially the last column). You
may alter these margin settings with the L (load) operator to
force the search to take place within restricted column limits.
.PG
The following are examples of elements that can be used in
constructing patterns:-

.in +5
.LB 15
.LP A
matches the character 'A',

.LP \&.
matches any character at all,

.LP [A-Z]
matches any character in the range 'A'-'Z',

.LP [Z-A]
is equivalent to [A-Z]

.LP [A-Z0-9+)]
matches any character in the ranges 'A'-'Z', '0'-'9', or the characters '+' or ')',

.LP ~[0-9]
matches any character that is not in the range '0'-'9',

.LP ~A
matches any character except 'A'.
.LE
.in -5
.PG
Any of these elements may be followed by a '*' to signify
that the element may be present zero or more times. Thus the
pattern '[A-Z][a-z]*' matches any word having an initial capital letter
followed by zero or more lower case letters.
.PG
The following special elements may be used:-

.in +5
.LB 15
.LP ^
matches the start of the line,

.LP "$"
matches the end of the line.
.LE
.in -5
.PG
The forms '//' and '\\\\' are used to signify a pattern that
is the same as the one last specified.
They may be abbreviated to '/' and '\\' if they are the only component
of a command.
.S3 "Patterns in replacements"
.PG
In the command 'R/abc/def/', the 'def' is the replacement.
The characters '^', '$' and so on have no special significance in
a replacement, but the character '&' specifies the matched
string. For example, the command

.ti +5
,RA/Pago/&-&/

will replace all occurrences of 'Pago' by 'Pago-Pago'.
.PG
Note that the command 'R/abc//' will replace 'abc' with the null string; in other words, 'abc' is deleted
from the line.
.S3 "The escape character"
.PG
The escape character is '#'. The most common use for it is
when you want the special characters used in pattern or
replacement strings to have their ordinary meanings. This
applies to characters such as '^', '$', '&', '/' and so on. To escape
the special meaning, precede the character with '#'. Thus '#*'
is equivalent to an ordinary '*' in a pattern. The character '#'
can itself be escaped. Thus to express the pattern element 'any
number of #', use the combination '##*'.
.PG
In most cases, special characters used in situations where
their special meaning does not apply do not have to be escaped.
Thus a '$' at the beginning of a pattern is not treated as the
end-of-line symbol (unless it is the only pattern character).
.PG
A second use for '#' is to express a character in a pattern
or replacement string by means of its hexadecimal code. Thus '#0A' is
equivalent to the ASCII character 'linefeed' or 'newline'. There must always
be exactly two hexadecimal digits (except that, for convenience, #N or #n
is taken as the code for 'newline').
Substitution of 'newline' into a line is useful for splitting lines,
although the Fold operator (F) is sometimes more convenient.
.S3 "Patterns in upper and lower case"
.PG
Normally, upper and lower case letters are treated as distinct characters
for the purposes of pattern matching.  The command 'LC' causes CHEF to
treat upper and lower case letters as equivalent,
and if this is repeated, a
return is made to the normal rules for pattern matching.
.PG
Special replacement commands are available for converting from lower case
to upper case and vice versa.  The command

.ti +5
RL/ABC/

converts 'ABC' to 'abc', and the command

.ti +5
RU/abc/

converts 'abc' to 'ABC'.  Any pattern may be used after RL or RU; its
.ul
first
occurrence, on each line of the location, is converted.
.S1 "CHEF command syntax"
.PG
A CHEF command consists of some or all of the following
elements, in the order given:-

.in +5
.LB 10
.LP i)
a location, specifying the scope of action of the command,

.LP ii)
an operator specifying what action is required,

.LP iii)
a modifier for that action,

.LP iv)
an appropriate operand.
.LE
.in -5
.PG
The location preceding the operator indicates where a text
modification is to be made, or the source of text to be printed
or copied to a file. Some commands restrict the type of location
that may be specified. For instance, the I (insert) operator
requires that its location be a workspace line; one cannot
insert new text after a control. The E (edit) operator, and a
number of others, permit no location at all.
.PG
The operator is a single upper or lower case letter, except
for the query operator which is '?'. The modifier, permissible
for some operators, is a single letter or other character that
modifies the action of the operator.
.PG
A  variety  of possible operands may follow the operator and
its modifier.  These include  locations,  file  names,  integers,
text patterns and so on.
.PG
Extra spaces may be used to separate the above four elements
of a command, but may not be used within each element.
.PG
Several commands may be concatenated on one line, if
desired, separated by the character ';'.
.PG
.S2 "Default commands"
.PG
A command consisting simply of a location, with nothing
following it, is treated as a P (print) command. This is useful
as a quick means of specifying a line or range to be printed.
If the location is elided as well, i.e., only a null line is
entered, the command is treated as

.ti +5
>.+1P

and the line that follows the current line is printed. This can
be used to step quickly through a region of the workspace,
printing one line at a time.
.PG
If CHEF commands are concatenated, these default
interpretations do not apply when the location specifies a region
of the workspace. Thus the effect of '..;10;..' is merely to set
the current line to 10. However the form '..;@A;..' causes
control A to be printed.
.S2 "File names"
.PG
File names may be used as operands for many commands. They
are always preceded by the F modifier.
.PG
Each workspace has a current file name. When an E (edit) or
N (new) command is used to copy a file into the workspace, the
current file name is set. To refer to the current file name, use
the symbol '.'. Thus the command 'WF.' copies the workspace to
the current file.
.PG
The current file name may also be set with the L (load)
operator (including the null value) and it may be interrogated
with '?F'.
.S2 "Console input"
.PG
CHEF displays the character '>' to request command input. A
number of commands, separated by ';', may now be entered and
execution starts when the line is terminated by RETURN (or
ENTER).
.PG
The commands C (change) and I (insert), without modifier,
cause CHEF to enter input mode. When input is to a control line,
a single line of text will be accepted (terminated by RETURN or
ENTER). When input is to the workspace, you may type as many
lines as you wish, but the input must finish with a line whose
only non blank character is a '.' in the first position (a 'dot
stop' line).
.PG
CHEF signals errors by printing '?'. With experience, you
will find this sufficient in most cases, but you can obtain a
more informative message by replying with '?'.
.S1 "Macro substitution"
.PG
A control line may be copied into the command line using the
special character '%'. For example, if control A contains the
string 'abc', this string will be substituted for each occurrence
of the combination '%A' in the command line.
.PG
Text from the console may be included in like manner, using
the combination '%%'. Each occurrence of '%%' in the command
line calls for one line of text from the console, terminated by
RETURN (or ENTER). No prompt character is printed.
.PG
As an example of the use of the macro substitution facility,
the command 'R/%A/%%/' fetches the pattern to be matched from
control A and the string to be substituted from the console.
.PG
The substitution mechanism is quite general: macro
expansion takes place incrementally as the commands are
interpreted, and you may nest macro calls to an arbitrary depth.
.PG
\&'Programs' of commands may be constructed with macro
substitution: the string of commands stored in control A, for
example, may invoke further commands in control B with the macro
call '%B'. You may even create an indefinite loop by invoking
the commands recursively with '%A'. The K operator is available
for terminating such loops, as demonstrated by the following
example. This program prints the contents of selected controls
and is started by the command '%C':-

.CP 15 6
control content
------- -------
   A    Enter list of controls (form GHI...)
   B    @DK; @DS/[A-Z]/-ED; @FC@%E; @FR/^/%E - /; @F; %B
   C    @A; @DC; %B
 D,E,F  (working space)
.EC
.PG
If the location on a K command refers to a line that is empty, all subsequent
concatenated commands are abandoned, and the commands of any operand
are executed instead.
.S1 "Additional commands"
.PG
CHEF contains many other useful facilities;
some of these will now be described.
See the command summary in Section 10,
or the on-line documentation, for further information.
.S2 "The Alter operator (A)"
.PG
This operator allows editing of a line or range of lines where the edits are
specified by a 'template' line.  Characters may be overprinted, changed to
blanks, or deleted, and arbitrary strings may be inserted at any point.
.PG
When there is no modifier, each line of the range may be edited repeatedly.
CHEF displays each line in turn, starting with the first, and waits for an
editing line to be typed underneath.  The edit is carried out, and the line
is displayed again for verification and/or re-editing.  A simple ENTER or RETURN
will cause CHEF to move on to the next line in the range, and a line
consisting of a '.' only will terminate the command without altering
any more lines of the range after the current line.
.PG
When the modifier is A (All), a single control or workspace line may be specified
as an operand.   If there is such a line specified, its content is used to edit
all lines of the range. If there is no operand, CHEF displays the first line of the
range and waits for an editing line to be supplied from the console; this is then applied
to all lines of the range.
.PG
When the editing line is derived from the console, the text line being edited
is displayed with the text itself displaced to column 2, and a margin symbol
in column 1.
.PG
The editing line makes use of the following special characters (in upper or lower case):
.sp
.LB 5
.LP "B"
The corresponding character of the text line is overprinted with a blank.
.LP "D"
The corresponding character of the text line is deleted.
.LP "I"
The string between the 'I' and the end of the line is inserted into the text
line.  The first character of the insert will be at the position of the 'I'.
.LP "O"
All non-blanks between the 'O' and the end of the editing line overprint
the corresponding characters of the text line.
.LP "%"
If followed by a letter (or a '%'), this causes the content of the corresponding
control line
(or a line from the console) to replace the rest of the
.ul
editing
line, starting at the position of the '%'.
.LP "U"
This only has an effect in column 1 of the editing line; it causes the
action of the preceding editing line to be 'undone'.
.LE
.S2 "The Fold operator (F)"
.PG
This operator is used to 'fold' a single line into two lines; it complements
the M operator (see below).
.PG
First, the workspace line is displayed.  Set the cursor so that it is underneath
the character which is to start the new line, then press ENTER or RETURN.
The line is folded, and the two resulting lines replace the original.
.PG
If the modifier is C, then all leading blanks are cleared from the second new line.
If the operand is a string within arbitrary delimiters, then that string is
prefixed to the second new line.  The current line is set to the second of the
two new lines.
.S2 "The justification operator (J)"
.PG
This operator justifies the lines of the given range within
columns which are the 'left verge' (initially 1) and the 'right
verge' (initially 65). It takes its source text from the left
margin (initially column 1) or the first non-blank character
if this occurs earlier in the line, to the right margin (initially the
last column). Text justification assumes the following simple
rules:-

.in +5
.LB 10
.LP i)
an indented line remains indented,

.LP ii)
a blank line remains blank,

.LP iii)
a line indented beyond the threshold (initially column 6) is frozen,

.LP iv)
a line indented beyond the threshold and having the
centring symbol (initially ':') in column one is centred (deleting the ':'),

.LP v)
a sentence ending in '.', '!', ':' or '?' and followed
by an extra blank has that extra blank preserved,

.LP vi)
otherwise the text of the current line together
with that of the preceding line is justified.
.LE
.in -5
.PG
As an example, the commands

                   /^ *$/;/^   *~ /://-J

justify the following paragraph.
.S2 "The merge operator (M)"
.PG
This operator merges the lines of the given range into a single line. If
the modifier is C (Clear), any intervening spaces and tabs are removed.
.PG
There may be an operand, which must be a string enclosed in arbitrary
delimiters. If present, this string is included at each point of join.
.S2 "The segment operator (S)"
.PG
This operator copies segments of the specified line to
controls. If there is no modifier, these segments are the head,
match, and tail substrings defined with respect to the first
occurrence of the pattern that forms part of the operand. If the
modifier is A then the segments are defined by all occurrences of
the matched pattern. If you do not wish to save all the
segments, you may replace any of the controls with an invalid
control character such as '-' or '.'. For example, if the
current line is 'axbcxdefxghi':-

.in +5
.LB 15
.LP >S/x/ABC 
causes controls A, B and C to contain 'a', 'x' and 'bcxdefxghi' respectively and

.LP >SA/x/A.B.C
causes controls A, B and C to contain 'a', 'bc' and 'def' respectively.

.LE
.in -5
.S2 "The undoing operator (U)"
.PG
You can recover from certain editing mistakes with the U
operator. The action of U, which takes no location or operands,
is to restore the workspace to the state it had before the last
command that altered it. Only certain 'willing' operators (A, C, D, F,
I, J, M, R, T) can be undone and you must not have used
any 'unwilling' operators (E, K, N, Q, QQ, U, X) in the intervening
time. CHEF acknowledges your U command, in favourable cases, by
printing the command string it uses to restore the workspace.
.S2 "The execute operator (X)"
.PG
If there is no modifier, and the operand is a search pattern
or tagger, the effect of the command is to execute the remainder
of the command string for all lines of the location that match
the specified pattern or tagger (or which do not match, if the
pattern or tagger is negated). Thus the following will print the
line numbers of all lines containing the word BEGIN:-

      >,X/BEGIN/;PN

and the following will print all lines of the workspace having no
leading blanks:-

      >,X~/^ /;P
.PG
Normally, the commands are applied to the lines of the region in order of
increasing line number. However,
use of \\ instead of / to specify the search pattern (or " instead of ' to specify
a tagger) causes the commands to be applied to the lines of the region
in
.ul
reverse order.
Thus to print all lines of the workspace containing the word INTEGER, starting
from the end of the file, the following could be used:-

      >,X\\INTEGER\\;P
.PG
If you use an F modifier after X, CHEF opens the file whose name follows
F,  and  executes  the  commands  in  it. Nested  XF  commands  are  not
permitted.   During  an  XF command, character counts are not printed on
file input or output.
.PG
If the modifier is C, the last command given (with certain limitations) is
re-executed without modification.  If the modifier is A, you are given an
opportunity to modify the stored command before execution; this is done in the
style of the CHEF operator A (Alter).  The command is displayed, and you may
edit it any number of times before executing it with a simple ENTER or
RETURN, or aborting it with a line consisting of a single '.' only.
.PG
Since a common reason for re-submitting a command is because it had undesirable
effects the first time, the operators H, L, U, ? and the null operator are not
saved and may be used without disturbing the saved command.  Commands given
within the scope of X or XF are also not saved, though command lines
beginning with
X or XF are saved.  When several commands are concatenated on one line, it
is the whole line that is saved when first submitted.
.S1 "Acknowledgement"
.PG
The version of CHEF described herein is based on the original one
written
by M.A. Maclean (of the University of Canterbury, New Zealand) and 
J.E.L. Peck (of the University of British Columbia, Canada).
.PG
This document is based on an interim user document also written by them.
.bp
.S1 "Command summary"
.PG
The following abbreviations are used (examples in brackets).

.CP 0
            c   = control                  ( @A )
            ch  = character
            f   = finder                   ( 10 or /abc/+1 )
            f0  = finder or 0
          i1 i2 = integers
            n   = file name
            oc  = occurrence               ( 3 )
            p   = pattern                  ( /abc/ or \\def\\ )
            pcl = pattern and control list ( /abc/PQR or /abc/P-R )
            pn  = pattern and new string   ( /abc/def/ )
            r   = region                   ( 10 or 10,15 )
            s   = string                   ( /abc/ )
            sp  = search pattern           ( /abc/ or ~\\def\\ )
            t   = tagger                   ( 'A or ~"B )
           (.)  = the default location is the current line
           (6)  = default value for a CHEF parameter.

            Locn.   Op./Mod  Opnd.     Action
      --------------------------------------------------------------
      Alter line(s) using a template (A)
            c r (.) | A - |   -     | alter range interactively
                    |   A | c f     | alter range with operand line
                    |   A |   -     | alter range with line from console
            (. is set to the last line altered)
      --------------------------------------------------------------
      Change existing lines (C)
            c r (.) | C F |    n    | lines from a file
                    |   D | c r (.) | lines from workspace (deleted)
                    |   - | c r     | lines from workspace
                    |   - |   -     | lines from console
            (. is set to the last line entered)
      --------------------------------------------------------------
      Delete lines (D)
            c r (.) | D - |    -    | delete lines (empty control)
            (. is set at next line, or end of workspace)
      --------------------------------------------------------------
      Edit (E)
            -       | E F |    n    | edit file n, set current name
                    |   - |    -    | empty workspace, cur. name null
            (. is set at end of workspace)
      --------------------------------------------------------------
      Fold line (F)
            f       | F - |    -    | fold to make two lines
                    | F C |    -    | fold and clear leading blanks
                    | F - |    s    | fold and prefix with string s
                    | F C |    s    | fold, clear and prefix with s
            (. is set to the second new line)
      --------------------------------------------------------------
.EC
.CP 0
            Locn.   Op./Mod  Opnd.     Action
      --------------------------------------------------------------
      Help (H)
            -       | H - |    ch   | help message for that character
                    |     |    -    | general help message
            (. is not changed)
      --------------------------------------------------------------
      Insert lines after a specified line (I)
            f0 (.)  | I F |    n    | lines from a file
                    |   D | c r (.) | lines from workspace (deleted)
                    |   - | c r     | lines from workspace
                    |   - |    -    | lines from console
            (. is set to the last line entered)
      --------------------------------------------------------------
      Justify text to within specified verges (J)
            r (.)   | J - |  i1,i2  | left verge, right verge
                    |     |    i2   | right verge
                    |     |    -    | current verges (1,65)
            (. is set to the last line justified)
      --------------------------------------------------------------
      Kill current command line if location specifies empty line (K)
            c f (.) | K - |   c f   | take new commands from operand
                    |     |    -    | no new commands
      --------------------------------------------------------------
      Load a parameter (L)
            -       | L F |    n    | current file name (may be null)
                    |   L |    i1   | left verge (1)
                    |   R |    i1   | right verge (65)
                    |   T |    i1   | indentation threshold (6)
                    |   V |    -    | verification toggle (On)
                    |   P |    -    | prompt toggle (On)
                    |   C |    -    | upper/lower case search toggle (Off)
                    |   : |    ch   | centring symbol (:)
                    |   ^ |    i1   | left margin (1)
                    |   $ |    i1   | right margin (248)
            (. is not changed)
      --------------------------------------------------------------
      Merge specified lines (M)
            r (.)   | M - |    -    | merge lines
                    |   C |    -    | merge and clear blanks
                    |   - |    s    | merge with string
                    |   C |    s    | merge and clear with string
            (. is set to the merged line)
      --------------------------------------------------------------
      New work space (N)
            -       | N F |    n    | load file, set current name
                    |   - |    -    | new empty workspace
            (. is set at end of workspace)
      --------------------------------------------------------------
.EC
.bp
.CP 0
            Locn.   Op./Mod  Opnd.     Action
      --------------------------------------------------------------
      Print to the console, or a file (P)
            c r (.) | P A |    -    | text with line numbers and tags
                    |   C |    -    | byte count only
                    |   F |    n    | copy to the file n
                    |   L |    -    | print in lucid mode
                    |   M |    p    | positions of pattern matches
                    |   N |    -    | line numbers of region limits
                    |   - |    -    | print to the console
            (. is set to the last line printed)
      --------------------------------------------------------------
      Quit (Q)
            -       | Q - |    -    | quit this workspace
                    |   Q |    -    | quit all workspaces
                    |   S | command | execute the system command
                    |   S |    -    | temporary exit to the system
      --------------------------------------------------------------
      Replace a string in one or more lines (R)
            c r (.) | R - |    pn   | replace first match in all lines
                    |   A |    pn   | replace all matches in all lines
                    |   I |    pn   | interactively replace all matches
                    |     |         |  read line from console for each
                    |     |         |  match and perform replacement
                    |     |         |  only if line is 'Y' or 'y'
                    |  oc |    pn   | replace specified match
                    |   L |    p    | convert first match to lower case
                    |   U |    p    | convert first match to upper case
            (. is set to last line in which replacement could occur)
      --------------------------------------------------------------
      Save segments in control lines (S)
            c f (.) | S - |   pcl   | head, matched, and tail segments
                    |     |         |  to the control lines in order
                    |   A |   pcl   | save all segments w.r.t. pattern
            (. is set to the line being segmented)
      --------------------------------------------------------------
      Tag line with a character (T)
            r (.)   | T - |    ch   | set tag to specified character
                    |   - |    -    | reset the tag
            (. is set to the last line tagged)
      --------------------------------------------------------------
      Undo a willing operator (U)
            -       | U - |    -    | willing - A C D F I J M R T
                    |     |         | neutral - H L P QS S V W ?
                    |     |         | unwilling - E K N Q QQ U X
      --------------------------------------------------------------
      View a region of the workspace (V)
            f (.)   | V - |    i1   | window is .-i1,.+i1
                    |   - |    -    | window as previously set
                    |   P |    i1   | (Previous) window is .-2*i1,.
                    |   P |    -    | window as previously set
                    |   N |    i1   | (Next) window is .+1,.+2*i1+1
                    |   N |    -    | window as previously set
            (. unchanged by V and VP, else set to last line displayed)
      --------------------------------------------------------------
.EC
.bp
.CP 0
            Locn.   Op./Mod  Opnd.     Action
      --------------------------------------------------------------
      Write the workspace to a file (W)
            -       | W F |    n    | copies workspace to file n
            (. is not changed)      |
      --------------------------------------------------------------
      eXecute CHEF commands (X)
            r (.)   | X - |  sp t - | executes remainder of command
                    |     |         |  line repeatedly for matching
                    |     |         |  lines
                    |     |         |  (/ = forwards, \\ = backwards)
                    |     |         |  (' = forwards, " = backwards)
            (. set by last command executed)
            -       | X A |    -    | alters and re-executes command
            -       | X C |    -    | re-executes command
            -       | X F |    n    | executes commands in file n
      --------------------------------------------------------------
      Query a parameter (?)
            -       | ? F |    -    | current file name
                    |   L |    -    | current left verge
                    |   R |    -    | current right verge
                    |   T |    -    | current indentation threshold
                    |   : |    -    | current centring symbol
                    |   V |    -    | state of verification toggle
                    |   P |    -    | state of prompt toggle
                    |   C |    -    | upper/lower case search toggle
                    |   ^ |    -    | current left margin
                    |   $ |    -    | current right margin
                    |   //|    -    | current pattern
                    |   / |    -    | current pattern
                    |   \\\\|    -    | current pattern
                    |   \\ |    -    | current pattern
                    |   - |    -    | current error message
            (. is not changed)
      --------------------------------------------------------------
.EC

