Google
 

Trailing-Edge - PDP-10 Archives - BB-M836A-BM - tools/sed/sed.rnd
There are 16 other files named sed.rnd in the archive. Click here to see a list.
.ps 56 68 .autop
.VAR OLDTAB A B
.VAR TOPS20 A B
.FLAG MACRO {
.DEFINE DATE   February 1982
.DEFINE TERMNL VT52
.DEFINE ENTER  PAD-BLUE
.DEFINE CURLFT LEFT
.DEFINE CURRGT RIGHT
.DEFINE CURUP  UP
.DEFINE CURDWN DOWN
.DEFINE CURHOM PAD-BLK
.DEFINE CARRET _^M
.DEFINE ROLBKP _^Q
.DEFINE ROLBKL _^W
.DEFINE SRCBAK _^E
.DEFINE SRCFWD _^R
.DEFINE ROLFWL _^T
.DEFINE ROLFWP _^Y
.DEFINE INSSPS _^A
.DEFINE DELSPS _^S
.DEFINE INSLIN _^D
.DEFINE DELLIN _^F
.DEFINE PUT    _^G
.DEFINE SETFIL _^B
.DEFINE TAB    _^I
.DEFINE ENTCCH _^O
.DEFINE PERCGO _^P
.DEFINE CLRLIN (none)
.DEFINE EXECUT _^X
.DEFINE EXIT   _^Z
.DEFINE ABORT  _^C
.DEFINE RECALL PAD-RED
.DEFINE INSMOD PAD-ENT
.DEFINE DELCHR BKSP
.DEFINE RESET  DELETE
.DEFINE REALTB PAD-0
.DEFINE MARK   PAD-7
.DEFINE LINE   (none)
.DEFINE CASE   PAD-9
.DEFINE WINDOW PAD-1
.DEFINE ERSLIN _^J
.DEFINE UPTAB  PAD-8
.DEFINE DWNTAB PAD-2
.DEFINE REWRIT PAD-5
.DEFINE HELPER PAD-3
.DEFINE SAVER  (none)
.DEFINE BEGLIN PAD-4
.DEFINE ENDLIN PAD-6
.DEFINE ERASWD KEYPAD-.
.DEFINE SUBSTI ESC-S
.IFNOT OLDTAB
.DEFINE PICK   _^V
.DEFINE BAKTAB _^U
.DEFINE SWITCH _^N
.DEFINE SLDLFT _^K
.DEFINE SLDRGT _^L
.ELSE OLDTAB
.DEFINE PICK   _^K
.DEFINE BAKTAB _^N
.DEFINE SWITCH _^V
.DEFINE SLDLFT _^L
.DEFINE SLDRGT _^U
.ENDIF OLDTAB
.IF TOPS20
.DEFINE PUSHER _^_\
.ENDIF TOPS20
.NONUM

.C;SED: A CRT EDITOR FOR TOPS-10 AND TOPS-20
.C;WRITTEN AND DOCUMENTED BY A Christopher Hall
.C;{DATE
.S1
.IFNOT TOPS20
.C;(Operating system:  TOPS-10)
.ELSE TOPS20
.C;(Operating system:  TOPS-20)
.ENDIF TOPS20
.C;(Terminal described: {TERMNL)
.S2
.c;HISTORICAL NOTE AND COMMERCIAL

The first successful full-screen text editor was developed in 1967 at the
Institute for Defense Analyses by Edgar T. Irons and Franz M. Djorup for use
on the CDC-6600 computer. It was the first editor to use function keys as
editor commands.

The Yale editor "E" was designed in 1970 by Irons and Peter Weiner to be an
improvement on the IDA editor, running on the PDP-10. It demonstrated the
practicality of screen editors on terminals of speeds as low as 2400 baud.

The Rand editor "re" was conceived in 1974 by Peter Weiner, based on the Yale
editor. It was initially designed and written by Walter Bilofsky, and
modified by both Weiner and Bilofsky as it evolved. The Rand editor is used
on PDP-11 computers running the UNIX operating system. It is extremely
powerful, although limited to a small number of terminals.

The author has worked with the Yale editor and the Rand editor for the past
several years, and has made a number of modifications and improvements to a
version of the former. The editor described in this document was initially
developed by the author in 1978 to be a more tightly-written and better
documented program than the Yale editor, but it has evolved into an entity
in its own right. It incorporates useful features from both the Rand editor
and the Yale editor plus several new ideas. It runs on the PDP-10 under
either the TOPS-10 or TOPS-20 monitor (in native mode).

The new editor, SED, has a number of features which distinguish it from its
predecessors. It is the first full-screen editor which is easily adaptable to
a wide range of terminals. Also, it exploits more fully the capabilities of
the terminal by letting the terminal do the work whenever possible (and it
knows whether or not the terminal is equipped to do the job). The editor has
the usual set of commands: cursor movers, display window movers, inserts and
deletes, searches, and line copiers; all of which cause immediate changes on
the CRT screen when they are invoked. In addition, there are a number of
shortcuts by which the sophisticated user can save time and typing.

SED is documented with a tutorial, this user's manual, an installation
guide, copious comments within the program, and software history files and
suchlike for the serious hacker.

.PG .NUM 1
.HEADER BOTTOM

.C;INTRODUCTION TO SED

This document contains complete descriptions of all the SED commands.
It is a reference manual, good for finding out the details about things,
but confusing as a learning tool. If you are a new SED user, the tutorial
guide, DOC:SED.MAN would be a better introduction to the editor. But the
tutorial will only get you started; use this reference manual when you
feel comfortable with the basic SED commands.

Commands to SED are given by holding down the key labeled 'CNTR' or 'CTRL'
and typing a letter.  Also, some terminals have special keys which are SED
commands. In this manual editor commands are notated in capital letters and
brackets. For example, the command used to advance 1 page (one screenful) in
a file is given by holding the 'CONTROL' key and typing the letter 'Y'; it is
notated <ROLL-FORWARD-PAGES> or {ROLFWP. Think of the 'CONTROL' key as a
shift key.

.S3
.C;RUNNING SED

There are three ways of running the editor. At monitor level type

.IFNOT TOPS20
.S1 .LIT
        .R SED                  or
        .R SED;FILE.EXT         or
        .R SED;FILE.EXT=
.EL .S1
.ELSE TOPS20
.S1 .LIT
        @SED                    or
        @SED FILE.EXT           or
        @SED FILE.EXT=
.EL .S1
.ENDIF TOPS20

The first way will set up for editing the file (and alternate file*) which
were edited last time. SED will return you to the same position in the file
that you were last. If you are running SED for the first time a cheery
welcome message will appear. You can then use the <SET-FILE> command
(described below) to get a file to edit.

.FOOTNOTE 3
.LEFT MARGIN 0
* SED allows you to toggle between any two files. The alternate file is the
one which is not currently being edited. See the <SET-FILE> command.
!

If you type the second form SED will put you at the beginning of FILE.EXT (or
whatever file you give). The file you edited last time will be the alternate
file. If the file given in the run command does not exist SED will tell you
so and give you last time's file or the cheery message.

If you use the third form SED will do as above, except that if the file does
not exist the editor will create it.

.PG
.C;THE CURSOR

Run the editor and get the cheery message (don't give a file name). There
will be a blinking dash in the upper left-hand corner of the screen; that
dash is called the cursor, and it represents your position in the file.

You cannot do much with the cheery message, so why not create a new
file and play around with the editor? Type the following:

.S1 .NOFILL
        {ENTER A B C D = {SETFIL
.FILL .S1
one key after another (with no spaces in between). The editor will create
a file named ABCD containing the obvious message

.S1 .LIT
        ; This file is ABCD.
.EL .S1
Note that the cursor is still at the upper left of the screen.

If you type a character it will appear where the cursor is and the cursor
will move one space to the right. The character you type will replace the one
at the cursor position. If INSERT MODE is in effect (see the <INSERT-MODE>
command) the new character will be inserted in the line, and the rest of the
line moved one position to the right.

A carriage return will put the cursor at the start of the next line on the
screen, but will not affect the contents of the file. There are other keys
that simply move the cursor around: the key off to the right labeled HOME and
the four arrow keys near it (which move the cursor in the indicated
directions), <TAB> ({TAB) and <BACKTAB> ({BAKTAB). There's also a command
(<LINE>) to move to the beginning or the end of a line. Linefeed is NOT
merely a cursor mover, however (see the section on <CLEAR-LINE> or
<ERASE-LINE>).

Type something. If you make a mistake use the <CURSOR-LEFT> key to back up
over the bad character, and type the correct one on top of it. If you put in
one character too many, position the cursor to it and type <DELETE-SPACES>
({DELSPS). There is a whole spectrum of commands for inserting and deleting
characters and lines of text, moving around within the file, and other useful
things. Read on.

.PG
.C;FORMAT OF EDITOR COMMANDS

.INDEX ^^ENTER       ENTER PARAMETER                   {ENTER	#\\
.INDEX ^^PARAMETER   ENTER PARAMETER                   {ENTER	#\\

SED does not exist by cursor movements alone. There is a whole raft of
commands, which have the following form:

.S1 .LIT
           <COMMAND>
     or    <ENTER><parameter><COMMAND>
     or    <ENTER><COMMAND>                (TOKEN FORMAT)
     or    <ENTER><cursor movement><COMMAND>
.EL .S1

The <ENTER> key is {ENTER. A parameter is a piece of information that is used
by a command. For instance, if you want to insert blank lines in a file the
parameter is the number of lines you want to insert. Most commands have
default parameters; that is, if you simply issue the command without
specifying parameters, SED will use a pre-set value for each parameter.
<INSERT-LINES> ({INSLIN) will insert 1 line until you tell it otherwise,
which you do by using the second form of command. If you say

.S1 .LIT
        <ENTER>5<INSERT-LINES>
.EL .S1
SED will insert 5 lines. From that point on whenever you say

.S1 .LIT
        <INSERT-LINES>
.EL .S1
SED will insert 5 lines, until you change it again.

Certain pairs of commands share parameters. If you say

.S1 .LIT
        <ENTER>5<INSERT-LINES>
.EL .S1
and later say

.S1 .LIT
        <DELETE-LINES>
.EL .S1
SED will delete 5 lines because it shares its parameter with
<INSERT-LINES> (<DELETE-LINES> = {DELLIN).

There are two other command formats: tokens and cursor movement. Both are
shortcuts for the advanced user, so if you are just starting out don't worry
about them for now.

For the experienced or the curious, tokens work as follows: the format
<ENTER><COMMAND> tells the editor either to look for a "token" (see below)
or to do something special, the nature of which is dependent on the
command. For example, <ENTER><PERCENT> will move to the end of the file; it's
a shorthand way of saying <ENTER>100<PERCENT>. Also, <ENTER><PUT> will insert
text which has previously been deleted into the file; it is the only way of
recovering that information. The special functions of this command format
are described in detail with each command.

A token can be thought of as "the word at the cursor position." Actually the
formal definition is: the string of characters starting at the cursor
location and extending to the first nonalphabetic, nonnumeric character. Thus
the location of the cursor is important, and it need not be at the start of
an actual word. Sometimes SED is interested in the token itself, for instance
for the search command; sometimes it is only interested in the length of the
token, like for <DELETE-SPACES>.

Also, the token for the <SET-FILE> ({SETFIL) command is different. When doing
a <SET-FILE>, which sets up a new file for editing, the parameter is expected
to be a filespec. Since filespecs usually consist of at least a name and an
extension, the usual token will not work, since it will recognize only the
file name (and stop on the "."). So for the <SET-FILE> command a token is
defined as extending from the cursor position to the next space, tab, comma,
or control character. All other characters will be legal token characters.

Tokens, of course, don't give you anything you don't have already;
they just save some typing. If all the above is confusing, forget about
it for now.

The last command format is cursor movement. With this format you type
<ENTER>, move the cursor around using any of the cursor movement commands to
get to a different row and/or column on the terminal screen.  Then type a
non-cursor movement command. The command will take as its parameters the
difference in rows or columns (or both). Often both changes are useful; you
can delete three lines and the first 8 spaces of the  next line by typing

.S1 .LIT
        <ENTER><RETURN><RETURN><RETURN><TAB><DELETE-LINES>
.EL .S1
Cursor movement is not meaningful with every command, however, and
an error message will result from using it at the wrong time. But usually
it is used for what you think it ought to be, and illegal when you can't
see any reason for doing it.

Parameters can be edited: an entire parameter can be canceled by typing
<RESET> (which is invoked by {RESET). The latest character of the parameter
can be deleted by typing <CURSOR-LEFT> or <DELETE-CHARACTER> ({DELCHR).
The latest word of the parameter can be erased by <BACKTAB> ({BAKTAB) or
<ERASE-WORD> ({ERASWD), and the whole parameter erased by <ERASE-LINE>
({ERSLIN).

.PG
.C;COMMANDS TO THE EDITOR

This section describes all the commands to SED, telling what they are, how
they are (normally) invoked, what types of parameters they accept, and any
special attributes they have.

Each entry in this section describes one command, or two if they are related
and share a parameter value. The format of the entries in this sections is:

.S1 .LIT
COMMAND NAME(S)                 CONTROL CHAR(S) WHICH INVOKE

        STARTING NOMINAL
        TYPE OF PARAMETER EXPECTED
        CURSOR MOVEMENT DEFINED (NONE, CHANGE OF ROW, COLUMN, BOTH)
        TOKEN (NONE, TOKEN, OR SPECIAL)


DESCRIPTION OF THE ACTION TAKEN BY THE COMMAND

EXAMPLE: A LINE OR TWO BEFORE AND AFTER EDITING

.EL
.PG .LIT
***************************************************************************
.EL
The commands on this page and the next (through <LINE>) are the cursor
movement commands. They have no effect on the file; they are used to move the
cursor around on the terminal screen. These commands can be used in a
parameter to define a region of the screen, between where the cursor was
when you typed <ENTER> to where it was when you typed a non-cursor movement
command.

.S1 .LIT
***************************************************************************
.EL .NOFILL
<CURSOR-RIGHT> - <CURSOR-LEFT> - <CURSOR-UP> - <CURSOR-DOWN>
.FILL .S1

.INDEX ^^CURSOR      MOVE CURSOR UP                    {CURUP	#\\
.INDEX ^^UP          MOVE CURSOR UP                    {CURUP	#\\
.INDEX ^^MOVE        MOVE CURSOR UP                    {CURUP	#\\
.INDEX ^^CURSOR      MOVE CURSOR DOWN                  {CURDWN	#\\
.INDEX ^^DOWN        MOVE CURSOR DOWN                  {CURDWN	#\\
.INDEX ^^MOVE        MOVE CURSOR DOWN                  {CURDWN	#\\
.INDEX ^^CURSOR      MOVE CURSOR LEFT                  {CURLFT	#\\
.INDEX ^^LEFT        MOVE CURSOR LEFT                  {CURLFT	#\\
.INDEX ^^MOVE        MOVE CURSOR LEFT                  {CURLFT	#\\
.INDEX ^^CURSOR      MOVE CURSOR RIGHT                 {CURRGT	#\\
.INDEX ^^RIGHT       MOVE CURSOR RIGHT                 {CURRGT	#\\
.INDEX ^^MOVE        MOVE CURSOR RIGHT                 {CURRGT	#\\

Moves the cursor in the indicated direction. If the cursor goes off the
edge of the screen it will wrap around and appear at the other side.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<CURSOR-HOME>                                   {CURHOM
.FILL .S1

.INDEX ^^CURSOR      MOVE CURSOR HOME                  {CURHOM	#\\
.INDEX ^^HOME        MOVE CURSOR HOME                  {CURHOM	#\\
.INDEX ^^MOVE        MOVE CURSOR HOME                  {CURHOM	#\\

Moves the cursor to the upper left-hand corner of the screen.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<UP-TAB> - <DOWN-TAB>                           {UPTAB {DWNTAB
.FILL .S1

.INDEX ^^UP          MOVE CURSOR UP 6 LINES            {UPTAB	#\\
.INDEX ^^TAB         MOVE CURSOR UP 6 LINES            {UPTAB	#\\
.INDEX ^^DOWN        MOVE CURSOR DOWN 6 LINES          {DWNTAB	#\\
.INDEX ^^TAB         MOVE CURSOR DOWN 6 LINES          {DWNTAB	#\\

Moves the cursor up or down six lines. Exactly the same as typing six
<CURSOR-UP> or <CURSOR-DOWN>s.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<CARRIAGE-RETURN>                               {CARRET
.FILL .S1

.INDEX ^^RETURN      CARRIAGE RETURN                   {CARRET	#\\

Moves the cursor to the start of the next line (ie, does a CARRIAGE RETURN,
LINEFEED). If the cursor started on the bottom line of the screen the
screen will roll up one line, a new line will appear at the bottom of the
screen, and the cursor will be positioned at the start of it.

In INSERT mode (see the <INSERT-MODE> command) <CARRIAGE-RETURN> will
actually insert a <CRLF> at the cursor location.

Switches relevant to <CARRIAGE-RETURN>: /ROLL and /ICR. See the <SWITCH>
command.

.PG .LIT
***************************************************************************
.EL .NOFILL
<TAB> - <BACKTAB>                               {TAB {BAKTAB
.FILL .S1

.INDEX ^^MOVE        MOVE TO NEXT TAB STOP             {TAB	#\\
.INDEX ^^TAB         MOVE TO NEXT TAB STOP             {TAB	#\\
.INDEX ^^NEXT        MOVE TO NEXT TAB STOP             {TAB	#\\
.INDEX ^^MOVE        MOVE TO NEXT TAB STOP             TAB	#\\
.INDEX ^^TAB         MOVE TO NEXT TAB STOP             TAB	#\\
.INDEX ^^NEXT        MOVE TO NEXT TAB STOP             TAB	#\\
.INDEX ^^MOVE        MOVE TO PREVIOUS TAB STOP         {BAKTAB	#\\
.INDEX ^^TAB         MOVE TO PREVIOUS TAB STOP         {BAKTAB	#\\
.INDEX ^^PREVIOUS    MOVE TO PREVIOUS TAB STOP         {BAKTAB	#\\

Moves to the next tab stop in the forward or backward direction. Tab stops
are normally 8 spaces apart.

Tabs can be set to be any constant distance apart, using the <SWITCH> command.
For example, to set tabs every 6 columns, type

.S1 .LIT
        <ENTER>T:6<SWITCH>
.EL

If the /NOTABS switch has been set (see the <SWITCH> section),
then <TAB> and <BACKTAB> function in terms of words of text rather than
screen position. The table below explains what happens:

.S1 .LIT
CURSOR AT:           TAB MOVES TO:           BACKTAB MOVES TO:

within the line      start of next word      start of previous word
start of line        start of next word      end of previous line
last word of line    end of line             start of previous word
beyond end of line   next 8-space tab stop   start of last word of line
.EL

If you want a TAB command which actually inserts a TAB into the file you
are editing, see <REAL-TAB>.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<BEGIN-LINE> - <END-LINE>                       {BEGLIN {ENDLIN
.FILL .S1

.INDEX ^^BEGINNING   MOVE TO THE BEGINNING OF A LINE   {BEGLIN	#\\
.INDEX ^^LINE        MOVE TO THE BEGINNING OF A LINE   {BEGLIN	#\\
.INDEX ^^END         MOVE TO THE END OF A LINE         {ENDLIN	#\\
.INDEX ^^LINE        MOVE TO THE END OF A LINE         {ENDLIN	#\\

<BEGIN-LINE> moves the cursor to the beginning of the line it is on.
<END-LINE> moves the cursor to the end of the line it is on.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<LINE>                                          {LINE
.FILL .S1

.INDEX ^^LINE        MOVE TO BEGINNING OR END OF LINE  {LINE	#\\
.INDEX ^^BEGINNING   MOVE TO BEGINNING OR END OF LINE  {LINE	#\\
.INDEX ^^END         MOVE TO BEGINNING OR END OF LINE  {LINE	#\\

<LINE> does the functions of <BEGIN-LINE> and <END-LINE>: it moves the
cursor to the beginning or the end of the line. The cursor moves to the
beginning of the line, unless it was already there, in which case it moves
to the end of the line. Thus <LINE> will usually move to the beginning,
and <LINE><LINE> will usually move to the end. It's not as hard to do as
it is to describe.

If <LINE> is typed within a parameter it acts as cursor movement, moving
to the beginning or the end of the line as above.

.PG .LIT
***************************************************************************
.EL .NOFILL
<ROLL-BACK-PAGES> - <ROLL-FORWARD-PAGES>        {ROLBKP {ROLFWP
.FILL .S1 .LIT
        Starting nominal: 1 page
        Parameter: number (pages to roll)
        Cursor move: illegal
        Token: meaningless
.EL

.INDEX ^^ROLL        ROLL SCREEN BACKWARD PAGES        {ROLBKP	#\\
.INDEX ^^BACKWARD    ROLL SCREEN BACKWARD PAGES        {ROLBKP	#\\
.INDEX ^^PAGES       ROLL SCREEN BACKWARD PAGES        {ROLBKP	#\\
.INDEX ^^ROLL        ROLL SCREEN FORWARD PAGES         {ROLFWP	#\\
.INDEX ^^FORWARD     ROLL SCREEN FORWARD PAGES         {ROLFWP	#\\
.INDEX ^^PAGES       ROLL SCREEN FORWARD PAGES         {ROLFWP	#\\

Advances or backs up the given number of pages (screens-full) of the file.
Won't move before the start or beyond the end of the file: use <INSERT-LINES>
to extend file, not one of the rolls. Or just type on the last line on
the screen.

.S9 .LIT
***************************************************************************
.EL .NOFILL
<ROLL-BACK-LINES> - <ROLL-FORWARD-LINES>        {ROLBKL {ROLFWL
.FILL .S1 .LIT
        Starting nominal: 1/3 page
        Parameter: number (lines to roll)
        Cursor move: lines only; spaces ignored
        Token: causes scanning to begin
.EL

.INDEX ^^ROLL        ROLL SCREEN BACKWARD LINE         {ROLBKL	#\\
.INDEX ^^BACKWARD    ROLL SCREEN BACKWARD LINE         {ROLBKL	#\\
.INDEX ^^LINES       ROLL SCREEN BACKWARD LINE         {ROLBKL	#\\
.INDEX ^^ROLL        ROLL SCREEN FORWARD LINES         {ROLFWL	#\\
.INDEX ^^FORWARD     ROLL SCREEN FORWARD LINES         {ROLFWL	#\\
.INDEX ^^LINES       ROLL SCREEN FORWARD LINES         {ROLFWL	#\\
.INDEX ^^SCAN        SCAN THE FILE FORWARD             {ROLFWL	#\\
.INDEX ^^SCAN        SCAN THE FILE BACKWARD            {ROLBKL	#\\

Same as above, but movement is in terms of lines.

Scanning is started by typing <ENTER><ROLL-BACK-LINES> (or
<ENTER><ROLL-FORWARD-LINES>). A roll will occur (using the current nominal),
the editor will delay for a short time, then it will roll again. This
continues until the start or end of the file is reached, or until you type
any character. When scanning stops the cursor is left in the middle of the
screen to indicate that scanning is over.

.PG .LIT
***************************************************************************
.EL .NOFILL
<PERCENT-GOTO>                                  {PERCGO
.FILL .S1 .LIT
        Starting nominal: 0 percent
        Parameter: number between 0 and 100 (percent distance into file)
        Cursor move: illegal
        Token: acts same as 100 percent
.EL

.INDEX ^^GO TO       GO TO PERCENT IN FILE             {PERCGO	#\\
.INDEX ^^PERCENT     GO TO PERCENT IN FILE             {PERCGO	#\\

Displays the file starting the given percent into it. Typing
<ENTER>50<PERCENT-GOTO> will display the file starting mid-way through.
<ENTER>100<PERCENT-GOTO> (or just <ENTER><PERCENT-GOTO>) will display the
last several lines of the file, with the cursor at the end of the last line.

<PERCENT-GOTO> is very much faster than a <ROLL> command, since it does not
count lines of text. It can also be used to speed up searching, by <GOTO>ing
a place near where you expect a match and then doing the search.

.S5 .LIT
***************************************************************************
.EL .NOFILL
<SLIDE-LEFT> - <SLIDE-RIGHT>                    {SLDLFT {SLDRGT
.FILL .S1 .LIT
        Starting nominal: 8 spaces
        Parameter: number (spaces to slide)
        Cursor move: spaces only; lines ignored
        Token: takes length of token
.EL

.INDEX ^^SLIDE       SLIDE WINDOW LEFT                 {SLDLFT	#\\
.INDEX ^^WINDOW      SLIDE WINDOW LEFT                 {SLDLFT	#\\
.INDEX ^^LEFT        SLIDE WINDOW LEFT                 {SLDLFT	#\\
.INDEX ^^SLIDE       SLIDE WINDOW RIGHT                {SLDRGT	#\\
.INDEX ^^WINDOW      SLIDE WINDOW RIGHT                {SLDRGT	#\\
.INDEX ^^RIGHT       SLIDE WINDOW RIGHT                {SLDRGT	#\\

Moves screen window left or right within the file. For example, after a
nominal <SLIDE-RIGHT>, the first 8 characters of each line will not appear
on the screen (they will be off the left of the window), and each line
displayed will show character positions 9 through 88.

The window can be slid right an unlimited amount, but it cannot be slid
left past the left margin. The cursor will always stay on the line it is
on at the start of the slide; if the character it pointed to is out of the
window the cursor will point to the first character on that line that is
on the screen.

.PG .LIT
***************************************************************************
.EL .NOFILL
<INSERT-LINES> - <DELETE-LINES>               {INSLIN {DELLIN
.FILL .S1 .LIT
        Starting nominal: 1 line
        Parameter: number (lines to insert/delete)
        Cursor move: lines; spaces counted from left margin
        Token: takes size of token, plus 1
.EL

.INDEX ^^LINES       INSERT LINES IN FILE              {INSLIN	#\\
.INDEX ^^INSERT      INSERT LINES IN FILE              {INSLIN	#\\
.INDEX ^^LINES       DELETE LINES FROM FILE            {DELLIN	#\\
.INDEX ^^DELETE      DELETE LINES FROM FILE            {DELLIN	#\\

<INSERT-LINES> adds the given number of lines at the CURSOR POSITION (the
given number of spaces are also added, if they are asked for by a cursor
move. Thus if the cursor is on line 5 column 8, and you type
<ENTER><CURSOR-DOWN><INSERT-LINES>; then one line and 8 spaces will be added
to the file. The result will be to split line 5, moving everything after the
cursor one line down. If, in the same position, you type
<ENTER><CARRIAGE-RETURN><INSERT-LINES>; then one line (and no spaces) will be
added, and the result will be to split the line and put the stuff after the
cursor on the next line, starting at the left margin. That last command could
also be made by typing <ENTER>1<INSERT-LINES>.

<DELETE-LINES> removes lines (and spaces, using cursor movement) analogously.
The deleted material is not thrown away, but is stored in the DELETE BUFFER.
It can be replaced in the file using the <PUT> command. So if you
<DELETE-LINES> accidentally, type <ENTER><PUT> to get the lines back.

Deletes of any size are permitted. However, if more than about 50 lines are
deleted, the delete buffer will overflow and it will be written out on disk.
Everything will work normally, although perhaps a little more slowly.
However, there will be a new file, nnnCLS.TMP (where nnn is your job number)
sitting around in your area.

Overflowing the delete buffer has its advantages. nnnCLS.TMP is just another
file, and can be edited the same as any other file. It will stay around
until it is overwritten by another large delete. Thus suppose you do
a 100-line delete, then a 1-line delete, and then realize that part of those
100 lines should not have been deleted. You cannot type <ENTER><PUT> to
restore those lines, since what you will get is the single latestly-deleted
line. But you can get into the nnnCLS.TMP file (using the <SET-FILE> command),
<PICK> up the desired lines, return to your original file, and <PUT> the lines
back in.

Another use of the delete buffer is to split a file into two pieces (as long
as one piece is large enough to overflow the delete buffer). To create two
files, one containing the first 100 lines and the other the remainder, go to
the beginning of the file and type <ENTER>100<DELETE-LINES>. Then exit the
editor and rename nnnCLS.TMP to whatever you want; it contains the first 100
lines.

.PG .LIT
EXAMPLE: The cursor is on the word "and"; you type <ENTER>2<INSERT-LINES>

BEFORE: This is the thing of the gig
        and the gig is where it's at

AFTER:  This is the thing of the gig


        and the gig is where it's at
.EL .S1
If you then do a <DELETE-LINES> the two blank lines will be removed. Now say
the cursor is on the "f" and you type <INSERT-LINES>:
.S1 .LIT
BEFORE: Pack my box with five dozen liquor jugs.

AFTER:  Pack my box with

        five dozen liquor jugs.

Two blank lines have been inserted at the cursor position.
.EL

.S1 .LIT
***************************************************************************
.EL .NOFILL
<DELETE-CHARACTER>                              {DELCHR
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^DELETE      DELETE THE PREVIOUS CHARACTER     {DELCHR	#\\
.INDEX ^^CHARACTER   DELETE THE PREVIOUS CHARACTER     {DELCHR	#\\

Deletes the character to the left of the cursor. If that character is a
tab, <DELETE-CHARACTER> deletes the entire tab. At the beginning of a line
<DELETE-CHARACTER> has no effect.

If typed in a parameter, <DELETE-CHARACTER> will still delete the character
before the cursor. Thus, in a parameter, <DELETE-CHARACTER> and <CURSOR-LEFT>
have the same effect.

Deleted stuff can be gotten back by typing <ENTER><HELP>.

.S1 .LIT
***************************************************************************
.EL .NOFILL
<ERASE-WORD>                                    {ERASWD
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^DELETE      DELETE THE PREVIOUS WORD          {ERASWD	#\\
.INDEX ^^WORD        DELETE THE PREVIOUS WORD          {ERASWD	#\\

Deletes the word to the left of the cursor. <ERASE-WORD> at the beginning
of a line deletes the last word on the previous line.

A word is a string of alphanumerics or a single non-alphanumeric followed
by zero or more spaces or tabs.

<ERASE-WORD> deletes words in parameters, too. Thus, in a parameter,
<ERASE-WORD> and <BACKTAB> have the same effect.

Deleted stuff can be gotten back by typing <ENTER><HELP>.

.PG .LIT
***************************************************************************
.EL .NOFILL
<INSERT-SPACES> - <DELETE-SPACES>               {INSSPS {DELSPS
.FILL
.S1 .LIT
        Starting nominal: 1 space
        Parameter: number (spaces to insert/delete)
        Cursor move: spaces;
                     change in line causes rectangular insert/delete
        Token: uses size of token, plus 1
.EL

.INDEX ^^SPACES      INSERT SPACES IN FILE             {INSSPS	#\\
.INDEX ^^INSERT      INSERT SPACES IN FILE             {INSSPS	#\\
.INDEX ^^CHARACTERS  DELETE CHARACTERS FROM FILE       {DELSPS	#\\
.INDEX ^^DELETE      DELETE CHARACTERS FROM FILE       {DELSPS	#\\

Adds spaces (to add a string, see <PUT>) or deletes characters starting at
the cursor position. The deleted stuff can be gotten back by typing
<ENTER><HELP>.

.S1
EXAMPLE: The cursor is at "t" of the word "thing"; you type
<ENTER>4<INSERT-SPACES>:
.S1 .LIT
BEFORE: This is the thing of the gig

AFTER:  This is the     thing of the gig
.EL .S1
Then you move to the "o" of "of" and type <DELETE-SPACES>:
.S1 .LIT
AFTER:  This is the     thing he gig
.EL

A rectangular <INSERT-SPACES> works as follows: say you type
<ENTER><DOWN><DOWN><RIGHT><RIGHT><INSERT-SPACES>. Your cursor movement has
defined a rectangle whose opposite corners are the starting and ending
cursor positions (in this case, three rows by two columns). That rectangle
will be filled with spaces. For example, say the cursor starts at the "o"
of "of" and you type <ENTER><DOWN><DOWN><RIGHT><RIGHT><INSERT-SPACES>.
The cursor ends after the "f" of "five".

.S1 .LIT
BEFORE: This is the thing of the gig,
        and the gig is where it's at.
        Pack my box with five dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.

AFTER:  This is the thing   of the gig,
        and the gig is whe  re it's at.
        Pack my box with f  ive dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.

.EL

Rectangular <DELETE-SPACES> works in a similar manner, except that all
the characters within the rectangle are removed from the file.

If you just move the cursor up or down, with no change in column position,
you will work with a rectangle whose width is the same as last time
(which is useful if you can remember what last time's parameter was).

.PG .LIT
***************************************************************************
.EL .NOFILL
<SEARCH-FORWARD> - <SEARCH-BACK>                {SRCFWD {SRCBAK
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: string (search key)
        Cursor move: spaces (change of lines illegal)
        Token: uses token
.EL

.INDEX ^^SEARCH      SEARCH FORWARD                    {SRCFWD	#\\
.INDEX ^^FORWARD     SEARCH FORWARD                    {SRCFWD	#\\
.INDEX ^^SEARCH      SEARCH BACKWARD                   {SRCBAK	#\\
.INDEX ^^BACKWARD    SEARCH BACKWARD                   {SRCBAK	#\\

Searches for the given string, from the cursor position to the end of the
file, or from the cursor position to the beginning of the file. When the
key is found, a page from the file is displayed with the line containing
the match one-third of the way down the screen. If the match is on the
page displayed at the start of the search the cursor simply moves to the
first character of the match.

While the editor is searching the cursor lives at the upper left of the
screen, to show that it's still working.

A search can be aborted at any time by typing RUBOUT. This is useful, for
example, when your key was erroneously typed in lower case and the file is
entirely upper case. The screen will be restored to its pre-search status.

CONTROL-? and CONTROL-LEFT-ARROW are wild search characters; they will match
any single character in their position. Thus the command
.S1 .NOFILL
        <ENTER>THE{ENTCCH?E<SEARCH-FORWARD>
.FILL .S1
(see the section on <ENTER-CONTROL-CHARACTER> to find out why {ENTCCH ? sets up
a CONTROL-?) will match on THESE, THERE, THEME, or THE ERROR, among other
things.

A useful feature: <ENTER>{ENTCCH_JGIG<SEARCH-FORWARD> searches for the next
line that begins with GIG.

.S1 .I0
HINT: Searches will go faster if the first character of the key is uncommon.
Thus searching for "XECUTE" will be faster than searching for "EXECUTE", and
will accomplish the same thing.

If the /CASE switch is set searches are case-dependent; if /NOCASE they
are case-independent (ie, "t" will match "t" or "T").

You can use the <RECALL> command to get back your current or previous
search key. See the section on <RECALL>.

.PG .LIT
***************************************************************************
.EL .NOFILL
<SUBSTITUTE>                                    {SUBSTI
.FILL .S1 .LIT
        Starting nominals: none
        Parameters: Sstring, Rstring, or number
        Cursor move: illegal
        Token: illegal
.EL

.INDEX ^^SEARCH      SEARCH AND SUBSTITUTE STRINGS     {SUBSTI	#\\
.INDEX ^^SUBSTITUTE  SEARCH AND SUBSTITUTE STRINGS     {SUBSTI	#\\
.INDEX ^^STRINGS     SEARCH AND SUBSTITUTE STRINGS     {SUBSTI	#\\

<SUBSTITUTE> searches forward from the cursor position for a string (the
key) and substitutes another string (the substitute string) for it. You can
tell <SUBSTITUTE> how many times to repeat the process.

There are three types of parameters to <SUBSTITUTE>:

.S1 .LIT
        <ENTER>Sstring1
        <ENTER>Rstring2
        <ENTER>number
.EL

The first sets up string1 as the search key. The string must be preceded by
the letter "S" (or "s"). The search key is shared with the <SEARCH-FORWARD>
and <SEARCH-BACKWARD> commands.

The second parameter sets up string2 as the entity to replace occurrences
of string1. The string must be preceded by the letter "R" (or "r"). String2
may be null, meaning that string1 will be deleted wherever it is found.

The third parameter tells how many times to perform the search and substitute.

Searching is done the same as for the <SEARCH> commands, so wild characters,
case independence, and aborting the command with RUBOUT all work.

One, two, or all three of these parameters may be given at once, in any order.
The command

.S1 .LIT
        <ENTER>SFOO<ENTER>Rfoo<ENTER>1000<SUBSTITUTE>
.EL .S1
will change all occurrences of "FOO" to "foo" from the cursor to the end of
the file (well, 1000 times, anyway).

Following the above command with

.S1 .LIT
        <ENTER>SFUBAR<ENTER>1000<SUBSTITUTE>
.EL .S1
will change all occurrences of "FUBAR" to "foo". Note that the substitute key
was not given, so it defaulted to its latest setting.

Sometimes it is useful to set up the parameters, think about them, and
perform the substitute when everything looks right. If the numeric parameter
is omitted, them <SUBSTITUTE> will set up the key and substitute string,
but will not execute. Thus the commands

.S1 .LIT
        <ENTER>SGIG<ENTER>RTHING<SUBSTITUTE>
        <ENTER>1<SUBSTITUTE>
        <SUBSTITUTE>
        <ENTER>10<ENTER>STHIS<SUBSTITUTE>
        <SUBSTITUTE>

works as follows:

1) Only sets up the parameters.
2) Does one <SUBSTITUTE> since there was a numeric parameter.
3) Also does one <SUBSTITUTE>.
4) Changes the search key to "THIS" and does 10 iterations.
5) Also does 10 iterations.
.EL .S1
Note: <SUBSTITUTE> is the only command for which multiple <ENTER>s are
legal. For other commands, all <ENTER>s except the first one are ignored.

.PG .LIT
***************************************************************************
.EL .NOFILL
<PICK>                                          {PICK
.FILL .S1 .LIT
        Starting nominal: 1 line
        Parameter: number of lines
        Cursor move: lines; spaces counted from left margin
        Token: uses token
.EL

.INDEX ^^PICK        PICK UP LINES OF FILE             {PICK	#\\
.INDEX ^^LINES       PICK UP LINES OF FILE             {PICK	#\\
.INDEX ^^APPEND      APPENDING LINES TO PICK BUFFER    {PICK	#\\

Copies lines and/or partial lines from the file into the pick buffer. The
file is not changed. Words (instead of lines) can be <PICK>ed using cursor
movement or token picks.

If a pick of more than 100 lines is done, the pick buffer will overflow and
be written out on disk. Everything will work normally, though. Picks of
any size are permitted. However, there will be a new file, nnnPIK.TMP, sitting
around on disk.

The same discussion about overflow of the delete buffer applies to overflow
of the pick buffer.

.S1 .I0
EXAMPLES: Say the cursor is at the start of the first line of:

.S1 .LIT
        Pack my box with five dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.
        Now is the time for all good people to
        come to the aid of their party.
.EL .S1
If you type <ENTER>2<PICK> you will load the pick buffer with

.S1 .LIT
        Pack my box with five dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.
.EL .S1
There's a carriage return at the end of each line. You can avoid picking the
last carriage return by using cursor movement: typing <ENTER><END-LINE><PICK>
will load

.S1 .LIT
        Pack my box with five dozen liquor jugs.
.EL .S1
into the pick buffer, without the trailing carriage return.

.S1 .LIT
     If  you  type <ENTER><RIGHT><RIGHT><RIGHT><RIGHT><RIGHT><RIGHT>
<PICK> (6 RIGHTs) you will load

        Pack m
.EL .S1
And if you type <ENTER><DOWN><RIGHT><RIGHT><RIGHT><PICK> you will pick up

.S1 .LIT
        Pack my box with five dozen liquor jugs.
        Qui
.EL

Normally, <PICK> clears the pick buffer each time before writing it.
However, there is a switch, /APPND, which causes <PICK> to append to the
buffer. It works as follows: Type <ENTER>/APPND<SWITCH> to tell SED to
append to the pick buffer. When you do your first <PICK> after setting the
/APPND switch the pick buffer will be cleared and the text put into it. The
second <PICK> will be added at the end of the first, and so on. You can <PUT>
the buffer and then continue appending to it if you want. To stop appending
type the /NOAPPND switch. To clear the buffer and keep appending type the
/APPND switch again.

.S1 .I0
EXAMPLE: Suppose the text is (again):

.S1 .LIT
        Pack my box with five dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.
        Now is the time for all good people to
        come to the aid of their party.
.EL .S1
If you type <ENTER>/AP<SWITCH> and then <PICK> the 4th line, then the 3rd, 1st,
and 2nd lines, then <PUT>, you get:

.S1 .LIT
        come to the aid of their party.
        Now is the time for all good people to
        Pack my box with five dozen liquor jugs.
        Quick brown fox jumped over the lazy dog.
.EL .S1
inserted into the file. The lines are sorted, for reason unknown.

Typing more <PICKS> will continue to append. If you then type
<ENTER>/AP<SWITCH> and do two <PICK>s, just the text from those last two
<PICK>s will be in the buffer.

You can append any kind of <PICK> to the buffer; full lines, partial lines,
single words, or a <PICK> using a <MARK> will all work.

The /APPND and /NOAPPND switches do not affect the contents of the pick
buffer directly; they just tell the following <PICK>s what to do.

.PG .LIT
***************************************************************************
.EL .NOFILL
<PUT>                                           {PUT
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: string (read into pick buffer)
        Cursor move: spaces (change of lines illegal)
        Token: causes DELETE buffer to be PUT
.EL

.INDEX ^^LINES       RESTORE DELETED LINES             {PUT	#\\
.INDEX ^^DELETED     RESTORE DELETED LINES             {PUT	#\\
.INDEX ^^RESTORE     RESTORE DELETED LINES             {PUT	#\\
.INDEX ^^INSERT      INSERT TEXT IN FILE               {PUT	#\\
.INDEX ^^TEXT        INSERT TEXT IN FILE               {PUT	#\\

<PUT> writes text from either the pick buffer or the delete buffer into
the file, at the cursor location. The contents of the buffer is not changed.
The normal use of this command is to <PICK> something, move to a new
location, and <PUT> it by simply typing <PUT>. Or <DELETE-LINES> something,
move, and insert it by typing <ENTER><PUT>.

PUT is also used to insert a string directly at the cursor position. The
string is given as the parameter. If you type
.S1 .LIT
        <ENTER><string><PUT>
.EL .S1
then <string> will be inserted at the cursor location. The string will also
be stored in the pick buffer, so it can be inserted somewhere else by
simply typing <PUT>.

.S1
EXAMPLE: The cursor is at the "t" of the word "thing"; you type
<ENTER><RIGHT><RIGHT><RIGHT><RIGHT><RIGHT><RIGHT><PICK>, thus loading
"thing#" into the pick buffer using cursor movement. The cursor is still at
"thing". Now type <PUT>:

.S1 .LIT
BEFORE: This is the thing of the gig
        and the gig is where it's at

AFTER:  This is the thing thing of the gig
        and the gig is where it's at
.EL .S1
Now do a <LINE> to get to the beginning of that line and type <DELETE-LINES>
(with the starting nominal of 1 already set up):
.S1 .LIT
AFTER:  and the gig is where it's at
.EL .S1
The deleted line has been loaded into the delete buffer. Typing
<DOWN><ENTER><PUT> restores that line beneath the other one:
.S1 .LIT
AFTER:  and the gig is where it's at
        This is the thing thing of the gig
.EL .S1
Now position the cursor to the "w" of "where" and type
<ENTER>NOT<PUT>:
.S1 .LIT
AFTER:  and the gig is NOT where it's at
        This is the thing thing of the gig
.EL
.PG .LIT
***************************************************************************
.EL .NOFILL
<MARK>                                          {MARK
.FILL .S1 .LIT
        No Parameters
        Token: cancels mark
.EL

.INDEX ^^MARK        MARK POSITION FOR PICK OR DELETE  {MARK	#\\
.INDEX ^^POSITION    MARK POSITION FOR PICK OR DELETE  {MARK	#\\
.INDEX ^^PICK        MARK POSITION FOR PICK OR DELETE  {MARK	#\\
.INDEX ^^DELETE      MARK POSITION FOR PICK OR DELETE  {MARK	#\\

This command extends the <PICK> and <DELETE-LINES> commands using cursor
movement to work with arbitrarily large sections of text. When MARK is typed
SED stores the current cursor position. You can then move to any other part
of the file and type <PICK> (or <DELETE-LINES>), and all the text between the
mark and the ending cursor position will be picked up (or deleted). It
doesn't matter whether the ending cursor position is before or after the mark.

Thus the <MARK> command temporarily changes the effect of a <PICK> or
<DELETE-LINES> without a parameter. When the <PICK> or <DELETE> has been
done, the mark is forgotten and those commands perform normally again.

Typing <ENTER><MARK> will cancel the mark and restore the screen to the way
it was when you typed <MARK> (so <MARK> can also be used as a place-holder:
<MARK>, move around (but don't <PICK>), then <ENTER><MARK> to return to
the marked position).

The mark is also forgotten if you type any command which alters the file
(including typing a character). Every other command retains the mark. You can
get to the ending position any way you want: <ROLLS>, <PERCENT-GOTO>, and
<SEARCHES> are probably the most useful ways.

Say the nominal number of lines to pick is 1. If you type:
.S1 .LIT
        <MARK>
        <ENTER>10<ROLL-FORWARD-PAGES>
        <PICK>
.EL .S1
then 10 screens-full (say around 240 lines) of text will be <PICK>ed. Those
lines can be PUT in the normal way. If you now type another <PICK> you will
pick up 1 line.

.PG .LIT
***************************************************************************
.EL .NOFILL
<INSERT-MODE>                                   {INSMOD
.FILL .S1 .LIT
        No Parameters
.EL

.INDEX ^^INSERT      INSERT/REPLACE TOGGLE             {INSMOD	#\\
.INDEX ^^REPLACE     INSERT/REPLACE TOGGLE             {INSMOD	#\\

This command toggles the editor between normal type-in mode and insert mode.
In normal mode when you type a character it replaces the one at the cursor
position. In insert mode the new character is placed before the one at the
cursor and the rest of the line is moved one position to the right.

If the editor is in normal mode, typing <INSERT-MODE> will put it in insert
mode. Then typing <INSERT-MODE> will put the editor back in normal mode.

If you type the wrong character you can delete it using the <DELETE-CHARACTER>
command (see below).

Character strings can also be inserted in the file using the PUT command,
by typing <ENTER>string<PUT>.

Switches relevant to <INSERT-MODE>: /BEEP, /ICR, and /IMODE.
See the <SWITCH> command.

.S4 .LIT
***************************************************************************
.EL .NOFILL
<SAVE-FILE>                                     {SAVER
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^SAVE        SAVE THE CURRENT FILE             {SAVER	#\\
.INDEX ^^FILE        SAVE THE CURRENT FILE             {SAVER	#\\

Saves the current file without exiting.

BEWARE: <SAVE-FILE> is designed to work quickly, so it does not eliminate
nulls or trailing spaces from the file. So <SAVE-FILE><ABORT> is not
the same as <EXIT>. If you have changed the file be sure to end the session
with an <EXIT>.
.PG .LIT
***************************************************************************
.EL .NOFILL
<SET-FILE>                                      {SETFIL
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: string (filespecs)
        Cursor move: spaces (change of lines illegal)
        Token: uses filespec token
.EL

.INDEX ^^EDIT        EDIT A NEW FILE                   {SETFIL	#\\
.INDEX ^^FILE        EDIT A NEW FILE                   {SETFIL	#\\
.INDEX ^^NEW         EDIT A NEW FILE                   {SETFIL	#\\

Looks up and displays the given file. Saves previous file on disk. Saves
position in previous file. If new file is not found, returns to the previous
file. A backup file is made if /BACK is set, else not.

The filespec parameter is in the usual form:
.IFNOT TOPS20
DEV:FILE.EXT[P,PN]. DEV: defaults to DSK:, [P,PN] defaults to your own.
.ELSE TOPS20
DEV:<DIR>FILE.EXT. DEV: can be a real or defined device. <DIR>
defaults to your connected directory.
.ENDIF TOPS20
If EXT is missing SED will try some extensions until one succeeds: none,
.IFNOT TOPS20
device (if you typed HLP:FILE, SED will look for HLP:FILE.HLP),
.ENDIF TOPS20
the extension of the previous file, MAC, TXT, RNO, FOR, CBL, DAT.

All of the switches described for the <SWITCH> command can be given along
with the file specs (for example, DSKD:FOO.BAR/NOTABS). Particulatly
relevant are /AGAIN:, /GOTO:, and /RCUR.

<SET-FILE> with no parameter will return to the previous file, to the same
page and cursor position as was last set up. The current file will then
become the new previous file. Thus you can toggle back and forth between two
files, after setting them up, simply by typing <SET-FILE>s.

To create a file, end the filespec parameter with an "=". If the file exists
it will be looked up as usual, but if it does not exist a file with a clever
message will be materialized and set up for editing. SED will not overwrite
an existing file.

Exception: if you <SET-FILE> to your current file (so you can look at two
different places in the same file), the editor will not save the file.
This is so the change of file pointers can take place as quickly as
possible. The file will be saved when you <SET-FILE> to a different file
or <EXIT> the editor.

The file is only saved on a <SET-FILE> or an <EXIT>; otherwise changes
are made only to the in-core image of the file. During the save all nulls
are removed from the file (they are added in abundance during editing),
and trailing spaces are removed from each line.

To abort the editor and forget all changes, use the <ABORT> command.
The file will be the way it was before you edited it.

Appendix#B tells how to move back and forth through a list of files.

.PG .LIT
***************************************************************************
.EL .NOFILL
<EXIT> - <ABORT>                                {EXIT {ABORT
.FILL .S1 .LIT
        Parameters or token causes Exit and Go (EXIT only)
.EL

.INDEX ^^EXIT        EXIT AND SAVE CHANGES             {EXIT	#\\
.INDEX ^^SAVE        EXIT AND SAVE CHANGES             {EXIT	#\\
.INDEX ^^CHANGES     EXIT AND SAVE CHANGES             {EXIT	#\\
.INDEX ^^EXIT        EXIT AND FORGET CHANGES           {ABORT	#\\
.INDEX ^^FORGET      EXIT AND FORGET CHANGES           {ABORT	#\\
.INDEX ^^CHANGES     EXIT AND FORGET CHANGES           {ABORT	#\\
.INDEX ^^ABORT       EXIT AND FORGET CHANGES           {ABORT	#\\

Saves the current file and exits to the monitor.

The editor writes the file nnnSED.TMP (where nnn is your job number)
containing the names and status of the last two files edited. The next
time you run the editor the latest of these files will be automatically
set up, with display and cursor position the same as they were upon exit.

If any parameter is typed (or a token, ie, just <ENTER><EXIT>) the editor
will exit as above and run COMPIL. COMPIL will execute the last compile-class
command.

Unless told otherwise (see the <SWITCH> command) the editor creates a backup
file, with extension .BAK, containing the file the way it was before editing.

<ABORT> does not save the file - the file is as it was before the editing
session.

The editor can be re-entered after a mistaken <EXIT> or <ABORT> by typing
REENTER.

.S2 .LIT
***************************************************************************
.EL .NOFILL
<RESET>                                         {RESET
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: ^ (up arrow) is the only meaningful parameter
        Cursor move: undefined
        Token: causes rewrite of single line
.EL

.INDEX ^^RESET       RESET PARAMETER OR DISPLAY        {RESET	#\\
.INDEX ^^PARAMETER   RESET PARAMETER OR DISPLAY        {RESET	#\\
.INDEX ^^DISPLAY     RESET PARAMETER OR DISPLAY        {RESET	#\\

This command is used to cancel an entered parameter, reset the cursor
position, rewrite a single line, or re-do the entire screen. It is useful if
you don't trust what you see. If you ever get a "Timesharing ends" message
while you're editing, you'll appreciate being able to <RESET>.

Also, it's useful to be able to cancel a parameter you really don't want.

.S1 .LIT
To:                                     Type:

  Cancel a parameter                     <RESET>
  Re-position the cursor                 <RESET>
  Rewrite the line the cursor is on      <ENTER><RESET>
  Re-do the entire screen                <ENTER>^<RESET>
.EL .PG .LIT
***************************************************************************
.EL .NOFILL
<REWRITE>                                       {REWRIT
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^REWRITE     REWRITE THE SCREEN                {REWRIT	#\\

Rewrites the entire terminal screen without changing anything. <REWRITE>
does the same thing as <ENTER>_^<RESET>, above. <REWRITE> is commonly used
to repair a screen which has been messed up by a system message or
something.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<ENTER-CONTROL-CHARACTER>                       {ENTCCH
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^CONTROL     ENTER CONTROL CHARACTER           {ENTCCH	#\\
.INDEX ^^CHARACTER   ENTER CONTROL CHARACTER           {ENTCCH	#\\
.INDEX ^^ENTER       ENTER CONTROL CHARACTER           {ENTCCH	#\\

Causes the next character typed to be a  control  character  (a character,
now, not a command). Has no effect on commands. Thus if you type in your file

.S1 .LIT
                ABC<ENTER-C-C>D
.EL .S1
the characters A, B, C, and CONTROL-D will be placed in the file.

<ENTER-C-C> also works within parameters, so

.S1 .LIT
        <ENTER>ABC<ENTER-C-C>D<PUT>
.EL .S1
will put A, B, C, CONTROL-D into the file.

Note: this command is the way to get a TAB or a FORMFEED (page mark) into a
file. For a TAB type <ENTER-C-C>I, and for a formfeed type <ENTER-C-C>L.

.S3 .LIT
***************************************************************************
.EL .NOFILL
<REAL-TAB>                                      {REALTB
.FILL .S1 .LIT
        No Parameters
.EL

.INDEX ^^TAB         PUT A REAL TAB IN THE FILE        {REALTB	#\\

The <REAL-TAB> command is identical to typing <ENTER-CONTROL-CHARACTER>I.
It replaces the character at the cursor with a tab character (or inserts
it, if the editor is in insert mode). <REAL-TAB> also can be used to put a
tab in a parameter.

See also the <TAB> command, which just moves the cursor around but does
not change the file you are editing.

.PG .LIT
***************************************************************************
.EL .NOFILL
<ERASE-LINE>                                    {ERSLIN
.FILL .S1 .LIT
        No Parameters
        If typed in a parameter, erases entire parameter
.EL

.INDEX ^^ERASE       ERASE FROM CURSOR TO END OF LINE  {ERSLIN	#\\
.INDEX ^^LINE        ERASE FROM CURSOR TO END OF LINE  {ERSLIN	#\\

The <ERASE-LINE> command deletes all characters from the cursor position
to the end of the line. It is also used to erase an entire parameter.

Deleted stuff can be gotten back by typing <ENTER><HELP>.

.S1 .LIT
EXAMPLES: The cursor is on the "h" of "the" and you type <ERASE-LINE>:

BEFORE: This is the thing of the gig
        and the gig is where it's at

AFTER:  This is t
        and the gig is where it's at
.EL .S1
You type <ENTER>THING and wanted to type <ENTER>12. <ERASE-LINE> will
erase the parameter "THING" and let you start again:
.S1 .LIT
BEFORE: >THING
AFTER:  >
.EL
.S2 .LIT
***************************************************************************
.EL .NOFILL
<CLEAR-LINE>                                    {CLRLIN
.FILL .S1 .LIT
        No Parameters
.EL

.INDEX ^^CLEAR       CLEAR LINE BELOW CURSOR           {CLRLIN	#\\
.INDEX ^^LINE        CLEAR LINE BELOW CURSOR           {CLRLIN	#\\
.INDEX ^^CURSOR      CLEAR LINE BELOW CURSOR           {CLRLIN	#\\

Clears out the entire line which the cursor moves onto. The contents of the
line is not saved. <CLEAR-LINE> won't work if the cursor starts on the last
line of the screen. This is a dangerous command, but useful for cleaning
out a lot of garbage and leaving blank lines behind.

Note: <CLEAR-LINE> is almost the same as <ERASE-LINE> but not as useful.
It is included for compatibility, but is obsolete.

.S1 .LIT
EXAMPLE: The cursor is on the word "thing"; you type <CLEAR-LINE>

BEFORE: This is the thing of the gig
        and the gig is where its at
        This is another thing of the gig

AFTER:  This is the thing of the gig

        This is another thing of the gig

Now the cursor is where the "is" used to be on the second line.

.EL .PG
.LIT
***************************************************************************
.EL .NOFILL
<SWITCH>                                        {SWITCH
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: string (switch name or names)
        Cursor move: undefined
        Token: query of nominal parameter settings
        No Parameter: query of position and file status
.EL

.INDEX ^^SWITCHES    SET SWITCHES OR QUERY STATUS      {SWITCH	#\\
.INDEX ^^QUERY       SET SWITCHES OR QUERY STATUS      {SWITCH	#\\
.INDEX ^^STATUS      SET SWITCHES OR QUERY STATUS      {SWITCH	#\\

This command is used to tailor the operation of the editor to the user and to
get status information. The default setting of each switch is denoted as on
(+) or off (-) where it is meaningful. To turn a switch off type "NONAME"
("NOCASE", "NOUPPER", etc.) as the parameter. You only have to type enough of
the switch name to make it unique ("T" is good enough for TABS).

You can set more than one switch in one command by separating them with
slashes, for example <ENTER>TABS:6/CASE/BACK<SWITCH>.

.LM 8
.P-8
-APPND##causes <PICK>s to append to the PICK buffer, not overwrite it, until
/NOAPPND or another /APPND is typed. See the <PICK> command.

+BACKUP#causes a backup file to be made on exit. The file has the
extension .BAK. /NOBACKUP causes no backup file to be made.

-BEEP###causes the terminal to beep once when entering INSERT mode and twice
when entering replace mode, instead of displaying a message on the screen.

+CASE###make searches case-dependent, ie, the key "THE" is different from
the key "the". The opposite switch, /NOCASE, will cause the key "THE" to
match the first occurrence of "THE", "the", "tHe", _&c.

-DTABS##causes tabs to identify themselves. With /DTABS set, each tab displays
as a highlighted "I" followed by one fewer space than usual. Thus the
columns on the screen are still aligned properly.

+HELP###Enables on-line help when <ENTER><ENTER> is typed.

+ICR####Causes a carriage return typed in insert mode to insert a carriage
return. /NOICR just positions the cursor.

+INVRT##tells the <CASE> command to invert case. /NOINVRT tells <CASE> to
use the setting of the /RAISE switch.

-ISAVE:n#Causes an incremental save of your file every n commands. Default
is n=0 (ie, no incremental saves) (_#).

+ITABS###If you type something beyond the end of a line SED will insert spaces
so the character is properly positioned. If /ITABS is set SED will try to
use as many tabs as possible instead of spaces. /NOITABS causes SED to use
only spaces.
.IF TOPS20

-JOURN##Starts a journal. See Appendix#D for information on journaling.
.ENDIF TOPS20

#LENG:n#causes SED to think your terminal is n lines long. Good for limiting
the amount of information written on a slow terminal.

+LINEFD#enables the <LINEFEED> command, as distinct from the cursor down
command. If this switch is off <LINEFEED> will perform a cursor down.

#LMAR:n#Sets the left margin to be column n. Default is 1. See Appendix#C
to find out about margins.

-PAGE###causes <SWITCH> to output your position as PAGE-LINE, rather than LINES
from start of file. Pages are delimited by formfeeds (_^L).
.IFNOT TOPS20

#PROG:FILE#sets up the name of the system program to be run when you type
<ENTER><EXIT>. The default is COMPIL. The switch /PROG:RUNOFF will cause RUNOFF
to be run instead.
.ELSE TOPS20

#PROG:FILE#sets up the name of the program to be run when you type
<ENTER><EXIT>. The default is the latest compile-class command.
The switch /PROG:SYS:RUNOFF.EXE will cause RUNOFF to be run instead.
.ENDIF TOPS20

+RAISE##is used by the <CASE> command if /NOINVRT is set. /RAISE tells <CASE>
to change lower case to upper. /NORAISE tells <CASE> to change upper case
to lower.

-READ###makes the file read-only. /READ is the opposite of /WRITE.

-RESET##causes the starting nominal parameters to be reset after each
command. When set, <ENTER>5<INSERT-LINE><INSERT-LINE> will insert 6 lines.
Under /NORESET those commands will insert 10 lines.

#RMAR:n#Sets the right margin to be column n. Default is the width of the
screen. See Appendix#C to find out about margins.

+ROLL###causes the screen to roll one line if the cursor is at the bottom
of the screen and you type <CARRIAGE-RETURN.> If /NOROLL is set, the cursor
will move to the top of the screen and there is no roll.

-SAVE:n##Causes an incremental save of your file every n characters of typein.
Default is n=0 (ie, no incremental saves) (_#).

-SHOW###causes <EXECUTE> to display as it is working. /NOSHOW updates the screen
only when the <EXECUTE> is done.

-STRIP##causes
.IFNOT TOPS20
SOS
.ELSE TOPS20
EDIT
.ENDIF TOPS20
line numbers to be stripped from the file when it is read in. /NOSTRIP just
marks the file read-only.

#TABS###makes <TAB> and <BACKTAB> use the usual tab positions. /NOTABS sets up
word-wise TABS. See the TAB/BACKTAB section (*).

-UPPER##causes all alphabetic characters to be converted to upper case.
Useful for a terminal whose shift lock shifts all characters.

#WIDTH:n#causes SED to think the terminal is n characters wide. Good for
terminals which can change their widths, like the VT100.

+WRITE##allows the current file to be altered. If turned off, commands which
change the file become illegal, so the file cannot be modified accidentally.
.LM 0 .S1
(_#) /ISAVE and /SAVE should be used together. When either becomes zero the
file is saved and both counters are reset.
.S1 .I0
(*) You can also type TABS:n to set up tab stops every n positions. Default
is TABS:8.

.P5
There are three other places you can use these switches: as part of the
monitor-level RUN command, in the <SET-FILE> command, and in your
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
file. You can do things like

.IFNOT TOPS20
.S1 .LIT
        .R SED;FILE.EXT/NOCASE/TABS:5
.EL
.ELSE TOPS20
.S1 .LIT
        @SED FILE.EXT/NOCASE/TABS:5
.EL
.ENDIF TOPS20
.LIT
or
        <ENTER>FILE.EXT/GOTO:50<SET-FILE>
.EL .S1
.IFNOT TOPS20
and if your SWITCH.INI contained the line

.S1 .LIT
        SED/NOC/UP
.EL .S1
.ELSE TOPS20
and if your SED.INIT contained the line

.S1 .LIT
        /NOC/UP
.EL .S1
.ENDIF TOPS20
SED will set switches for searching independent of case and for upper case
characters each time it is run.

There are a couple of switches which are not meaningful in the <SWITCH> command
but can be used with the other three methods:

.LM 8
.P-8
#AGAIN##used in a <SET-FILE> command. If you are editing FILE.FOO, typing
<ENTER>/AG<SET-FILE> acts the same as if the parameter were "FILE.FOO". Also,
/AG:nn acts the same as /AG/G:nn - the numeric argument is a percentage of
the way into the file. Do not use explicit filespecs with /AGAIN.

#ALT####used when running SED. Swaps the current and alternate files you
were editing last time. Also, /AL:nn acts the same as /AL/G:nn.

#GOTO:PERC#used when running SED or doing a <SET-FILE>. The file will
be displayed starting PERC percent of the way through. If /GOTO, no argument,
is used SED will use the current percent value.

-IMODE##puts SED in insert mode. /NOIMODE puts it in replace mode. This
switch can also be used in execute buffers ($IM_^SW).

-QUICK##causes the file not to display after the <SET-FILE>. This is useful
on a slow terminal when you are not interested in what is on the first page
of display.

#RCUR###used with <SET-FILE>; causes the current filespecs, rather than the
alternate specs, to be replaced by the given ones. Useful for "keeping your
finger" in one file (the alternate) while looking at several others.
.IF TOPS20

#RECOV##typing SED/REC at monitor level tells SED to recover the previous
session using the journal. See Appendix#D for information on journaling.
.ENDIF TOPS20

#X:NAME:txt##used in
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
to set up an execute buffer named NAME with
contents txt. See the <EXECUTE> command for details.
.LM .S1
.P5
There are two other functions of the <SWITCH> command: to get information
about the file you are editing and to find out the settings of the
nominal parameter values. You get the former by typing just <SWITCH>,
the latter by typing <ENTER><SWITCH>.

The file information consists of the current file name, the line and position
the cursor is on (that's the line and position in the file, not the row and
column on the screen), the percent through the file, the name of the
alternate file (if any), and the current search key (if any). For example,

.IFNOT TOPS20
.S1 .LIT
FILE: SED.RNO[401,127]  LINE: 534(67%) POS: 1 ALT: FOO.BAR[10,15]
.EL .S1
.ELSE TOPS20
.S1 .LIT
FILE: SED.RNO  LINE: 534(67%) POS: 1 ALT: <CHALL>FOO.BAR
.EL .S1
.ENDIF TOPS20
says that the current file is SED.RNO, the cursor is at the start of the
534th line, which is 67% through the file, and the alternate file is FOO.BAR.

To find out how many lines lie between a given line and the beginning of the
file, position the cursor to the desired line and type <SWITCH>. This
function may not occur immediately, since the editor has to go back to the
beginning of the file and count every line.

.PG

Typing <ENTER><SWITCH> will give you the settings of the nominal parameter
values. The bottom line of the screen will look something like:

.S1 .LIT
RL:8, RP:1, PC:2, SL:8, IL:1, IS:3, PK:3,8, TB:8; KEY:th SUB:FOO
.EL

This somewhat cryptic message tells you that the following values are set:

.S1 .LIT
        LINES TO ROLL:         8
        PAGES TO ROLL:         1
        PERCENT-GOTO:          2
        SLIDE:                 8
        INSERT/DELETE LINES:   1 LINE AND 0 SPACES
        INSERT/DELETE SPACES:  3
        PICK:                  3 LINES AND 8 SPACES
        TAB SIZE:              8
        SEARCH KEY:            th
        SUBSTITUTE STRING:     FOO
.EL

So if you type a <PERCENT-GOTO> command with no parameter you will go to the
2% point, a <DELETE-LINES> will delete 1 line (and <INSERT-LINES> will insert
1 line), and a PICK will pick up 3 lines.

Remember that you can use cursor movement to tell <PICK> and
<INSERT/DELETE-LINES> to work with both a number of lines and a number of
spaces; thus they have two nominal values above.

Tab size is not really a parameter but is controlled by the /TABS switch.
If word-wise tabs are in effect the tab size in the above list will show
up as the number "W".

.IF TOPS20
.S4 .LIT
***************************************************************************
.EL .NOFILL
<PUSH>                                          {PUSHER
.FILL .S1 .LIT
        No parameters
.EL

.INDEX ^^PUSH        PUSH TO EXEC CONTEXT              {PUSHER	#\\
.INDEX ^^EXEC        PUSH TO EXEC CONTEXT              {PUSHER	#\\

Creates an inferior fork and runs the EXEC. Popping from the EXEC continues
the editing session where it left off.
.ENDIF TOPS20
.PG .LIT
***************************************************************************
.EL .NOFILL
<RECALL>                                        {RECALL
.FILL .S1 .LIT
        Starting nominal: none
        Parameter: type of thing to recall
        Cursor move: ignored
        Token: ignored
.EL

.INDEX ^^RECALL      RECALL PARAMETER                  {RECALL	#\\
.INDEX ^^PARAMETER   RECALL PARAMETER                  {RECALL	#\\
.INDEX ^^SEARCH      RECALL CURRENT/FORMER SEARCH KEY  {RECALL	#\\
.INDEX ^^FILESPECS   RECALL CURRENT FILESPECS          {RECALL	#\\

Simulates an <ENTER> with the latest parameter typed. When <RECALL> is typed
the latest parameter appears at the bottom of the screen and the editor is
placed in <ENTER> mode. You can add to or delete from the parameter and then
pass that parameter to a command by typing that command.

The <RECALL> command is useful in three instances: when you have typed the
wrong parameter to a command and want to correct it with a minimum of
typing, when you have given the right parameter to the wrong command (in
which case you can just type <RECALL><RIGHT-COMMAND>), and when you just
want to see what the latest parameter was.

<RECALL> uses the first character of its parameter to recall some
specific information. Type <ENTER><char><RECALL> to get the following:

.S1 .LIT
        char    THING RECALLED

         F      Current Filespecs
         A      Alternate Filespecs
         S      Current Search Key
         O      Previous (Old) Search Key
         R      Substitute String
.EL .S1
After you recall one of these things you can use it as if you typed it in:
you can edit it and fire it off to any command. For example,
<ENTER>F<RECALL><PUT> will put the current filespecs into the file.

.S1 .LIT
***************************************************************************
.EL .NOFILL
<HELP>                                          {HELPER
.FILL .S1 .LIT
        No explicit parameters
        Token: Recovers from a delete command
.EL

.INDEX ^^HELP        GIVE ON-LINE HELP                 {HELPER	#\\

Asks for on-line help. When <HELP> is typed SED asks for the command to
give help for and waits for you to type any command. SED then tells you
something about the command and asks for another. Typing "G" or "g" instead
of a command will return you to the file. Try it.

Typing <ENTER><HELP> will put back the text deleted by the latest
<DELETE-CHARACTER>, <ERASE-WORD>, <DELETE-SPACES> or <ERASE-LINE>
command.

.PG .LIT
***************************************************************************
.EL .NOFILL
<CASE>                                          {CASE
.FILL .S1 .LIT
        Starting nominal: 1 character
        Parameter: number of characters
        Cursor move: characters and/or lines
        Token: uses token
.EL

.INDEX ^^CASE        CHANGE CASE OF LETTERS            {CASE	#\\

The <CASE> command changes the case of the letters starting where the cursor
is. Two switches control way <CASE> works: /INVRT and /RAISE.
If /INVRT is set (default) then the case of all the letters is inverted:
upper is changed to lower and lower to upper.

If /NOINVRT is set then the setting of /RAISE is used.
Lower case letters will be changed to upper case if the /RAISE switch
is set; if /NORAISE, upper case letters will be changed to lower case.

Cursor movement can be used to make <CASE> work across more than one line.

.S1 .LIT
EXAMPLE: The cursor is at the start of "BOX" and you type
         <ENTER><RIGHT><RIGHT><RIGHT><CASE>:

BEFORE: PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.
        QUICK BROWN FOX JUMPED OVER THE LAZY DOG.

AFTER:  PACK MY box WITH FIVE DOZEN LIQUOR JUGS.
        QUICK BROWN FOX JUMPED OVER THE LAZY DOG.

You then type <ENTER><RETURN><CASE>:

AFTER:  PACK MY box with five dozen liquor jugs.
        QUICK BROWN FOX JUMPED OVER THE LAZY DOG.


***************************************************************************
.EL .NOFILL
<WINDOW>                                        {WINDOW
.FILL .S1 .LIT
        No Parameters
.EL

.INDEX ^^WINDOW      SET OR CLEAR SPLIT-SCREEN WINDOW  {WINDOW	#\\
.INDEX ^^SPLIT       SET OR CLEAR SPLIT-SCREEN WINDOW  {WINDOW	#\\

The <WINDOW> command allows two files to appear on the terminal screen at
the same time. The files each occupy half of the screen, one on top of the
other.

Type <WINDOW> to divide the screen. The file you are currently editing will
be displayed in the top window. If you then do a SET-FILE, the new file
will appear in the bottom window. Another SET-FILE will get you back to the
top window, and so on.

To get back to normal, non-windowing operations, type <WINDOW> again. The
split screen will go away and the file you are currently editing will
occupy the entire screen.

.PG .LIT
***************************************************************************
.EL .NOFILL
<EXECUTE>                                       {EXECUT
.FILL .S1 .LIT
        Starting nominal: 0
        Parameter: number (iterations)
        No Parameter: closes execute buffer, if open
                      does nominal iterations, if buffer closed
        Cursor move: spaces (change of lines illegal)
        Token: opens execute buffer
.EL

.INDEX ^^EXECUTE     EXECUTE COMMAND SEQUENCE          {EXECUT	#\\
.INDEX ^^COMMAND     EXECUTE COMMAND SEQUENCE          {EXECUT	#\\

This command allows you to store a sequence of commands in a command buffer,
and later execute that sequence as many times as desired.
.IFNOT TOPS20
SOS-like
.ELSE TOPS20
EDIT-like
.ENDIF TOPS20
things like changing all occurrences of XYZ to ABCD can be handled with this
command; but it is more powerful than that: ANY sequence of commands can be
set up to be executed. It is easy to do things like removing the first 16
spaces from every line of the file, or causing each occurrence of JU_&$ to be
at the start of a new line.

<EXECUTE> is a complicated command. This section explains the basics of how
to use one <EXECUTE> buffer. The next two sections deal with advanced
<EXECUTE> features.

The procedure for using the <EXECUTE> command is as follows: first open the
execute buffer by typing <ENTER><EXECUTE>. From now until the buffer is closed
everything that you type will have its effect on the file and the screen,
and also be saved in the execute buffer. Do one iteration of the sequence.
Close the execute buffer by typing only <EXECUTE>.

When you want to execute that command sequence, figure out how many times
you want to do it (a large number, if you want as many as possible; it will
stop on an error like "Search failure"). For 10 iterations type

.S1 .LIT
        <ENTER>10<EXECUTE>
.EL .S1
The command sequence in the execute buffer will be issued 10 times, just as
if you had typed the commands yourself. Except for one thing: the display
screen will not change until the execute is done. This saves time. However,
every 8 times the entire buffer has been executed, the terminal will beep so
you can tell it is still working. So there should be 2 beeps from the command
above.

When the execute is done the screen will be re-displayed to show what
it looks like after the last iteration.

An <EXECUTE> can be aborted early by typing RUBOUT. The command will stop
immediately and return control to you. The file will have been changed by the
commands which have been issued before you aborted the <EXECUTE>.

Some helpful suggestions: set up your nominals before you open the command
buffer. For example, you might type

.S1 .LIT
        <ENTER><EXECUTE>
        <ENTER>XYZ<SEARCH-FORWARD>
        ABC
        <EXECUTE>
.EL .S1
which will set up to change XYZ's to ABC's. Instead type

.S1 .LIT
        <ENTER>XYZ<SEARCH-FORWARD>
        <CURSOR-UP>
        <ENTER><EXECUTE>
        <SEARCH-FORWARD>
        ABC
        <EXECUTE>
.EL .S1
This does the same thing, although it requires more typing. But the benefit
is that the work of setting up the search key is not done every time the
command is iterated. The time savings from this gambit can be enormous for a
complicated sequence or a lot of iterations (and you'll be just twiddling
your thumbs and listening to beeps while all this happens). There is another
advantage: the nominals can be changed, resulting in a similar but different
command sequence at minimum setup cost. For example, suppose the lower
sequence above had been typed. Now change all XYZ's to ABC's:

.S1 .LIT
        <ENTER>0<PERCENT>
        <ENTER>10000<EXECUTE>
.EL .S1
Fine. But it so happens that all xyz's want to be changed to ABC's, too. Just
type:

.S1 .LIT
        <PERCENT>
        <ENTER>xyz<SEARCH-FORWARD>
        <CURSOR-UP>
        <EXECUTE>
.EL

This will search for all occurrences (or the first 10000, whichever comes
first) of xyz and change them to ABC. It iterates 10000 times because that
is the nominal set up by the previous <EXECUTE>. The <CURSOR-UP> is so the
first match will be found by the first iteration; if the cursor were pointing
at it, it would be skipped.

Note: if xyz were wanted to be changed to abc (instead of ABC), you would need
to reload the execute buffer, since the ABC is not a command nominal. For the
record, an absolutely arbitrary "change all occurrences of ?? to ??" command
can be set up by the following:

.PG .LIT
        <ENTER><STRING><SEARCH-FORWARD>
        <ENTER><length of above string><DELETE-SPACES>
        <ENTER><STRING1><PUT>

        <ENTER><EXECUTE>
        <SEARCH-FORWARD>
        <DELETE-SPACES>
        <PUT>
        <EXECUTE>
.EL .S1

This sets up <EXECUTE> to change all occurrences of STRING to STRING1 (except
the first two, which you have done yourself by hand. The first sets up the
command parameters and the second saves the commands in the execute buffer).
To change all STRING2's to STRING3's, type

.S1 .LIT
        <ENTER><STRING2><SEARCH-FORWARD>
        <ENTER><length of above string><DELETE-SPACES>
        <ENTER><STRING3><PUT>
.EL .S1
and then execute; the rest has already been set up.

Another use of the <EXECUTE> command is to do something to the same part of
every line in the file. For example, suppose you had a batch output file and
you wanted to pretty it up by removing all the time tags - the first 16
characters of every line. Move to the start of the first line of the file and
type

.S1 .LIT
        <ENTER>16<DELETE-SPACES>
        <ENTER>1<ROLL-FORWARD-LINES>
.EL .S1
That sets up the nominal parameter values. Now load the execute buffer:
.S1 .LIT
        <ENTER><EXECUTE>
        <DELETE-SPACES>
        <CURSOR-DOWN>
        <ROLL-FORWARD-LINES>
        <EXECUTE>
.EL .S1
Then execute the sequence by typing <ENTER>10000<EXECUTE>. Note that the
<ROLL> is necessary because without it, when the execute got to last line on
the screen the <DOWN> would position the cursor back at the first line on the
screen. Note also that the <DOWN> is not really needed for this particular
sequence since the <ROLL> will kick the cursor down a line (since the cursor
is at the top of the screen). But if you were working with lines in the
middle of the screen, or deleting characters from the middle of a line, you
would want the <CURSOR-DOWN>.

.PG
.C;MORE INFORMATION ABOUT <EXECUTE>
.S1 .LIT
Sections:
        SETTING UP A BUFFER
        WRITING A BUFFER
        TWO WAYS OF READING THE CONTENTS OF A BUFFER
        FINDING OUT WHAT THE NAMES OF THE BUFFERS ARE
        KILLING A BUFFER
.EL
.IFNOT TOPS20
.LIT
        SETTING UP EXECUTE BUFFERS IN SWITCH.INI
.EL
.ELSE TOPS20
.LIT
        SETTING UP EXECUTE BUFFERS IN SED.INIT
.EL
.ENDIF TOPS20
.LIT
        EXAMPLES OF EXECUTE SEQUENCES
.EL

.INDEX ^^EXECUTE     MORE INFORMATION ABOUT EXECUTE    {EXECUT	#\\

There are a number of execute buffers (normally 32), so a variety of different
command sequences can be set up and iterated. Each buffer can be given a name
up to five characters long. Names can be defined or deleted as desired.
Buffers can be written either by opening them and allowing commands to be
stored, as described in the previous section, or directly using the
WRITE-BUFFER format described below. One buffer has a default name:
null (it's the buffer that was described in the basic <EXECUTE> section
above).

There are also conditional execute commands (such as IF and DO WHILE), and a
way to connect an execute buffer to a command key or sequence, so that
pressing the key will execute the buffer once (thus creating your own
meta-command). Also, execute buffer definitions can be stored in a disk file
and read in when needed. All these things will be taken up in the next
section.

The <EXECUTE> command can be in one of the following formats:

.S1 .LIT
        <ENTER>S<name><EXECUTE>     set up buffer with given name
        <ENTER>W<sequence><EXECUTE> write sequence into active buffer
        <ENTER>R<name><EXECUTE>     read name & contents of buffer
        <ENTER>R<EXECUTE>           read active buffer
        <ENTER>L<name><EXECUTE>     list contents of buffer
        <ENTER>L<EXECUTE>           list active buffer
        <ENTER>N<EXECUTE>           get list of buffer names
        <ENTER>K<name><EXECUTE>     kill buffer with given name
        <ENTER><EXECUTE>            open active buffer
        <ENTER><number><EXECUTE>    execute active buffer n times
        <EXECUTE>                   close or execute active buffer
.EL

Note that the WRITE format (and READ and LIST with no argument) works with
the active execute buffer, meaning the one that was most recently set up
(using the S format). Originally the active buffer is the null buffer.

All characters typed in these formats are meaningful. So don't put in
any spaces unless you really want them.

.PG .LIT
***************************************************************************
SETTING UP A BUFFER
.EL

The general procedure for working with an execute buffer is to set it
up, write it, then execute it.

To define and write a new buffer: choose a name, say "FOO", and set up
the buffer by typing

.S1 .LIT
        <ENTER>SFOO<EXECUTE>
.EL

Names can be up to five characters long and can consist of any
printing characters.

The S format is also used to set to a buffer which has already been
created. A buffer must be set before it is written (the W format), read
(R), listed (L), or executed. The S format will look for a buffer of the
given name and make it and its contents active if it exists; if no buffer
by that name exists, it will create one (which is empty). To set to the
null buffer type <ENTER>S<EXECUTE>.

.S1 .LIT
***************************************************************************
WRITING A BUFFER
.EL

After creating the buffer named FOO you can write a command sequence into
it in the usual way, by typing <ENTER><EXECUTE> to open the buffer, the
desired sequence of commands, and <EXECUTE> to close it. Note that setting
up the buffer name with the S format does NOT open the buffer.

The execute buffer can also be written directly, without having the commands
take effect on the screen (using the W WRITE format). The WRITE format works
with the active buffer. For example, following the above set command with

.S1 .LIT
        <ENTER>W$THING^SF$5^DS$HACK^PT<EXECUTE>
.EL .S1
will load the buffer names FOO with a sequence of commands which searches for
an occurrence of "THING", deletes it, and inserts "HACK". The buffer is
loaded with the following command sequence:

.S1 .LIT
        <ENTER>THING<SEARCH-FORWARD>
        <ENTER>5<DELETE-SPACES>
        <ENTER>HACK<PUT>
.EL

Writing into the execute buffer requires a language to describe the editor
commands, since typing them directly will cause them to take effect.
Appendix#E is a list of the editor commands and the sequences that <EXECUTE>
uses to describe them. In general they are "_^" followed by two or three
letters which describe the command. <ENTER-PARAMETER> is a dollar sign.

For another example, to load the active buffer with a sequence to put an "X"
at the cursor position, move to the position underneath, and roll the screen
one line, type

.S1 .LIT
        <ENTER>WX^CL^CD$1^RFL<EXECUTE>
.EL .S1
This sets up the buffer with the following command sequences:

.S1 .LIT
        X
        <CURSOR-LEFT>
        <CURSOR-DOWN>
        <ENTER>1<ROLL-FORWARD-LINES>
.EL

Of course, the execute will run faster if the parameters are set up in
advance, not in the sequence itself.

The execute buffer does not have to be opened in order to write it using
the W format, nor does it have to be closed afterward. Those two formats
apply only when you want to save commands as they are issued, as described
in the previous section.

After the buffer has been written it can be executed in the normal
fashion, by typing <ENTER><number><EXECUTE>.

If you want to do the same series of commands several times in a row, you
can give a repeat count. For example, _^4(_^CR) is the same as
_^CR_^CR_^CR_^CR. Any series of commands can be repeated up to 2000 times.

To put a real up-arrow in a buffer type "_^_^" (two up-arrows). To put in a
real dollar sign type "_^$". Within a repeat, a real close parenthesis must
be given as "_^)".

You can use cursor movement to read a buffer definition from the file you
are editing, so a useful way of experimenting with execute buffers is to
put the buffer definition in your file, preceded by the "W" for the WRITE
format. Position to the "W", move the cursor to the end of the line,
and type <EXECUTE>. If the command sequence is not quite right, change it
in the file and use cursor movement to pick it up again.

.S1 .LIT
***************************************************************************
TWO WAYS OF READING THE CONTENTS OF A BUFFER
.EL

There are two formats for seeing what is in a buffer: LISTing and READing.
LIST presents the buffer in a manner compatible with the WRITE format;
READ presents it in a style that can be <PUT> into execute files or
.IFNOT TOPS20
SWITCH.INI.
.ELSE TOPS20
SED.INIT.
.ENDIF TOPS20

You can see what is in a buffer by typing <ENTER>L<name><EXECUTE>. The active
buffer can be read by typing <ENTER>L<EXECUTE>. The null buffer must be made
active before it is read (using the S format). Typing this command will
cause a line like

.S1 .LIT
        W$THING^SF$5^DS$HACK^PT
.EL .S1
to be put into the parameter buffer and displayed on the screen. This line
can be treated just like a parameter that you have typed: you can edit it
and type <EXECUTE> again to load the edited version into the buffer, or
use <PUT> to insert it into the file (where it can be copied or modified
at will and reloaded using <ENTER><END-LINE>(EXECUTE>.

Similarly, you can type <ENTER>R<name><EXECUTE> (or <ENTER>R<EXECUTE> to
read the active buffer). This format gives you a little more information:
READing the FOO buffer will cause the line

.S1 .LIT
        /X:FOO:$THING^SF$5^DS$HACK^PT
.EL .S1
to be put into the parameter buffer and displayed on the screen. Again, you
can treat this line like a parameter that you have typed. In particular,
it's useful to be able to store the command string in
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
or some other file by doing a READ and a <PUT>. More on these switch files
later (in the section on reading execute files from disk).

.S1 .LIT
***************************************************************************
FINDING OUT WHAT THE NAMES OF THE BUFFERS ARE
.EL

Typing <ENTER>N<EXECUTE> will fill the bottom line of the screen with the
names of the buffers.

.S1 .LIT
***************************************************************************
KILLING A BUFFER
.EL

If all the execute buffers are set up and you try to SET another one, SED
will inform you that all the buffers are in use and suggest you kill one of
them. You do that using the K format: to kill the buffer FOO type

.S1 .LIT
        <ENTER>KFOO<EXECUTE>
.EL .S1
That name will go away and the buffer will be cleared, and it will be
available to be set to something new.

The null buffer can be killed by typing <ENTER>K<EXECUTE>.

.S1 .LIT
***************************************************************************
.EL
.IFNOT TOPS20
.LIT
SETTING UP EXECUTE BUFFERS IN SWITCH.INI
.EL
.ELSE TOPS20
.LIT
SETTING UP EXECUTE BUFFERS IN SED.INIT
.EL
.ENDIF TOPS20

Frequently-used command sequences can be put in
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
so they will be set up automatically when SED is run. An example of an
execute switch is:

.S1 .LIT
        /X:NAME:$gig^PT^RT
.EL .S1
which sets up execute buffer "NAME" with the command sequence to do a <PUT> and
a carriage return.

You can copy an execute buffer into
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
(or any file) by typing <ENTER>R<name><EXECUTE> and then <PUT>.

.S1 .LIT
***************************************************************************
EXAMPLES OF EXECUTE SEQUENCES
.EL

.S1 .LIT
        ^8($5^DS^CD)^RFL
.EL .S1
(where the <ROLL-LINES> parameter is set to 8). This deletes 5 characters from
the same column of each of 8 lines, then rolls the screen 8 lines.

.S1 .LIT
        $^ECJ^EC?^EC?^EC?^ECM^SF^DL
.EL .S1
This will delete all lines which are exactly three characters long. It
looks for lines which have exactly three characters between a linefeed
(the end of the previous line) and a carriage return.

.S1 .LIT
        ^SF^LN^PK^RT^FL^PT^RT^FL
.EL .S1
(where some search key has been set up, the <PICK> parameter is 1, and the
alternate file is the end of the current file). This copies all lines which
contain a match of the search key to the end of the file. It searches for a
match, gets to the start of the line, <PICK>s the line, sets to the alternate
file (which is the end of the current file), <PUT>s the line, and <SET-FILE>s
back. Note that there will never be a search failure. The alternate file
could be a separate file, but then the two files will have to be read and
written on disk for each <SET-FILE>, which will slow the sequence down
considerably. The set of matching lines can easily be transferred from the
end of the file to any other file when the execute has completed.

.PG
.C;ADVANCED EXECUTE BUFFER FEATURES
.S1 .LIT
Sections:
        WRITING AND EXECUTING IN ONE COMMAND
        SETTING INITIAL PARAMETERS FOR AN EXECUTE
        CONNECTING EXECUTE BUFFERS TO TERMINAL KEYS
        READING EXECUTE BUFFERS FROM DISK
        CONDITIONAL EXECUTE STATEMENTS
        THE EXECUTE COUNTER
.EL

.INDEX ^^EXECUTE     EXECUTE FEATURES - ADVANCED       {EXECUT	#\\

The story of <EXECUTE> is not over yet.

.S2
.C;WRITING AND EXECUTING IN ONE COMMAND

You can write a sequence of commands into the active buffer and immediately
execute the buffer a given number of times by using the X format:

.S1 .LIT
        <ENTER>Xn:<sequence><EXECUTE> write buffer & execute n times
.EL .S1
The X format is useful for doing a one-shot series of commands.

.S2
.C;SETTING INITIAL PARAMETERS FOR AN EXECUTE

The START-UP construct allows you to define parameters and switches
at the beginning of an execute. The format of START-UP is:

.S1 .LIT
START-UP  . . . . . . . . . . . ^ST( ... )
.EL

The contents of the START-UP block is executed only once, at the start of
the execute. The parameters of commands in the START-UP block are set up
but the commands themselves are not executed. Thus the START-UP block is
used to initialize command parameters. Switches can also be set in the
block using the <SWITCH> command.

For example the construct _^ST($1_^IS$gig_^SF) will set the <INSERT-SPACES>
parameter and the search key, but will not perform either command.

Initializing can speed up an execute buffer a lot. For example

.S1 .LIT
        ^ST($THING^SF$2^DS)^SFGIG^DS

acts the same as

        $THING^SFGIG$2^DS
.EL .S1
but is much more efficient since the parameters are set up once in the
first case and once per iteration in the second. Parsing those parameters
takes time.

The START-UP block can also be used to set switches which will be in effect
during the execute:

.S1 .LIT
        ^ST($NC/T:8/NIM^SW)     or
        ^ST($NC+T:8+NIM^SW)
.EL .S1
initializes for case-independent searches, tab length of 8, and no INSERT
mode during the execute. The second form above must be used in
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
or an indirect (.XCT) execute file, since a "/" marks the start of a new
buffer definition or switch.

.S1 .LIT
***************************************************************************
.EL
.C;CONNECTING EXECUTE BUFFERS TO TERMINAL KEYS

You can set up any command sequence to call one iteration of an execute
buffer. A command sequence is a string of characters which begins with a
control character. The action of the commands in the buffer will be displayed
on the screen as it happens. You can use this capability, in effect, to
define new commands to SED.

There is one more EXECUTE format:

.S1 .LIT
        <ENTER>B<EXECUTE>          connect active buffer to button
.EL .S1
After you type this format SED will ask you to press any key followed by the
letter "G" (or "g"). SED will take the sequence output by that key as the
invocation of the currently active buffer. Making some other buffer active
has no effect on this relationship. Changing the contents of the buffer also
has no effect, but remember that if you change the buffer something new will
happen when you press the key.

After you have typed <ENTER>B<EXECUTE> you can type any command sequence you
want. The sequence can be a control character, a special key, or any string
of characters which begins with a control character. If you type

.S1 .LIT
        <ENTER>B<EXECUTE>
        <ESCAPE>XG
.EL .S1
then the buffer would be executed once when you typed <ESCAPE>X (there is a
way to make <ENTER>n<ESCAPE>X cause the buffer to be executed n times; see
the section about the execute counter, below).

The sequence of characters can even be one which already invokes an editor
command, so you can replace commands you don't use with new ones of your
own design.

You can undefine a key by making its buffer active and typing
<ENTER>B<EXECUTE>G (ie, re-defining its key to nothing).

.IFNOT TOPS20
The key definition can be set up with the buffer in SWITCH.INI. The expanded
format of the SWITCH.INI line is:
.ELSE TOPS20
The key definition can be set up with the buffer in SED.INIT. The expanded
format of the SED.INIT line is:
.ENDIF TOPS20

.S1 .LIT
        /X:NAME,^[X:$gig^PT^RT
.EL .S1
which sets up a buffer named NAME with <ENTER>gig<PUT><RETURN>, and assigns
it to the sequence <ESCAPE>X. ("_^[" == CONTROL-[ == <ESCAPE>. All the
stuff between the comma and the colon is taken as the key definition. The
key definition can be omitted.

Note: RUBOUT (or DELETE) can be part of the command sequence. If you read
the execute buffer the RUBOUT will appear as "_^?".

.S1 .LIT
***************************************************************************
.EL
.C;READING EXECUTE BUFFERS FROM DISK

There is yet another <EXECUTE> format:

.S1 .LIT
        <ENTER>@FILE.EXT<EXECUTE>  read from the given file
.EL .S1
This causes the buffer definitions and switches in FILE.EXT to be set up.
The previous definitions are erased. Thus the disk file can contain the
definition of an entire special user environment.

The disk file looks like a list of switches. SED will skip characters until
it finds a "/", so the first several lines can be used for comments. But be
sure there's not a "/" in the comments.

The default extension of this file is "XCT".

You can set up and write execute buffers, and then when they are working
properly you can put them in this file by Setting each one up, doing a
READ, and then a <PUT>.

Here is an example of an execute file. It sets up four special keys on
the VT52 terminal to do useful things for an assembly language programmer:

.S1 .LIT
        MACRO PROGRAMMER'S EXECUTES:
        BUTTON 4: TAB TO 4TH STOP AND ";"
        BUTTON 5: <CR> AND TAB
        BUTTON 6: ":" AND TAB
        BUTTON 9: DELETE PREVIOUS WORD

        /X:B4CM,^[?t:^3(^FCL32(^TA));
        /X:B5RT,^[?u:^RT^TA
        /X:B6RC,^[?v::^TA
        /X:B9DW,^[?y:^BT$^TB^DS

.EL .PG .LIT
***************************************************************************
.EL
.C;CONDITIONAL EXECUTE STATEMENTS

In addition to the editor commands, the following are defined:

.S1 .LIT
ITERATED-DO . . . . . . . . . . ^n ( ... )
DO-WHILE  . . . . . . . . . . . ^DW condition ( ... )

IF-CHARACTER  . . . . . . . . . ^IF condition ( ... )
IF-ROW  . . . . . . . . . . . . ^FR comparison ( ... )
IF-COLUMN . . . . . . . . . . . ^FC comparison ( ... )
IF-COUNTER  . . . . . . . . . . ^F. comparison ( ... )

EXIT-BLOCK  . . . . . . . . . . ^XB
CONTINUE-BLOCK. . . . . . . . . ^CB
EXIT-BUFFER . . . . . . . . . . ^XX
.EL

The ITERATED-DO construct has already been described: it was called a
"repeat block" in a previous section. It causes the stuff following in
()'s to be repeated the given number of times (up to 2000).

DO-WHILE and IF-CHARACTER perform or skip the stuff in ()'s depending on
the nature of the character at the cursor position.

IF-ROW and IF-COLUMN perform or skip the stuff in ()'s depending on the row
or column position of the cursor on the screen. IF-COUNTER does likewise
depending on the value of the Execute counter (use of the counter is
described below).

EXIT-BLOCK causes control to leave the interior of a conditional.
CONTINUE-BLOCK causes the rest of the conditional to be skipped. These two
behave the same inside an IF block; in a DO block EXIT stops iterating and
CONTINUE ends the current iteration. EXIT-BUFFER ends the current iteration
of the execute buffer.

Now for details. DO-WHILE and IF-CHARACTER can check to see if the character
at the cursor is

.S1 .LIT
            Some given character
        ^L  ALPHABETIC (A-Z, a-z)
        ^U  UPPER CASE (A-Z)
        ^N  NUMERIC (0-9)
        ^A  ALPHA-NUMERIC
        ^C  ANY CHARACTER
        ^S  SPACE OR TAB
        ^E  END OF LINE OR BEYOND
.EL .S1
or .NOT. any of those things (by preceding them by "_^X"). Any character is
anything but space or TAB (same as "_^X_^S).

You can say "if character is a space, move cursor right" by "_^IF_^S(_^CR)".
"Do while character is not the letter 'A', cursor right" is "_^DW_^XA(_^CR)".

IF-ROW, IF-COLUMN and IF-COUNTER check if the current row or column or the
Execute counter is:

.S1 .LIT
        En  EQUAL TO n
        Gn  GREATER THAN n
        Ln  LESS THAN n
        Nn  NOT EQUAL TO n
.EL .S1
For example, you can say "If column is less than 64, cursor right"
by "_^FCL64(_^CR)", and "If it's not row 12, cursor down" by "_^FRN12(_^CD)".

These constructs can be nested to a depth of about 10, and intermingled as
much as desired.

.S1 .LIT
Examples:

    ^DW (^CR)       while character at cursor is " ", cursor right
    ^DW^X5(^CR)     while character is not a "5" move right
                    a.k.a. DO-UNTIL character is "5" ...
    ^DW^X^N(^CR)    until character is numeric move right
    ^FCE64(^RT)     if at column 64 do a RETURN
    ^FRG10(^CH)     if beyond row 10 go HOME
    ^IF^E(^RT)      if at or beyond end of line do a RETURN
    ^IF^X^E(^CR)    if not end of line move right
    ^1000(^PT)      PUT 1000 times
.EL

EXIT- and CONTINUE-BLOCK are usually used inside a conditional, along with an
IF statement. For example

.S1 .LIT
        ^DW^X^E(^CR^FCG40(^XB))
.EL .S1
will stop DOing when the end of the line is reached or when the column is
greater than 40.

.S1 .LIT
        ^1(^IF^S(^DS^PT^XB)^TB)
.EL .S1
is an IF-THEN-ELSE statement. If the character is a space or TAB SED deletes
it, does a <PUT>, and skips the rest of the conditional; else it TABs over.

.PG .LIT
***************************************************************************
.EL
.C;THE EXECUTE COUNTER

You can keep a count of something and use that count as a command parameter
or the number of iterations of a DO. The counter constructs are:

.S1 .LIT
CLEAR-COUNTER . . . . . . . . . ^C=
INCREMENT-COUNTER . . . . . . . ^C+
DECREMENT-COUNTER . . . . . . . ^C-
USE-COUNTER . . . . . . . . . . ^CT
ITERATE-COUNTER . . . . . . . . ^C.( ... )
IF-COUNTER  . . . . . . . . . . ^F.( ... )
SET-COUNTER . . . . . . . . . . ^SC
.EL

The counter can be cleared, incremented, and decremented anywhere in the
execute buffer.

You can use the counter as a parameter: if the counter contains 12, then
"$_^CT_^DS" will delete 12 spaces. Or "$_^CT_^PT" will <PUT> the characters
"12" into the file. The counter must appear alone in a parameter; you can't
say "$123_^CT45_^PT". Also, the _^CT construct can appear only in a parameter.

To loop <counter> times on a set of commands, type "_^C.(#...#)". For example
if the counter contains 5, "_^C.(_^PT)" will do 5 <PUT>s.

The value of the counter can be used for conditional branching:
"_^F.E10(_^PT)" will do a <PUT> only if the counter contains 10.

SET-COUNTER (_^SC) sets the execute counter to the (numeric) parameter the
user typed. It is intended for execute buffers which are assigned to keys on
the terminal. If _^SC appears at the beginning of the buffer and the user
types <ENTER>17<KEY>, then 17 will be stored in the counter. If the user
does not type a parameter, the same value as last time is used (the default
is 1). Non-numeric parameters cause an error.

.I0
For example the buffer

.S1 .LIT
        ^SC^C-^ND$^ECL^C.(^SF)^RT
.EL .S1
sets up a command to put the user at the start of some page of the file
(where pages are marked by formfeeds - CONTROL-L's). Suppose the user types
<ENTER>4<KEY>. The counter is set to 3, and CONTROL-L is searched for 3
times [the construct _$_^ECL_^C.(_^SF) is used rather than _^C.($_^ECL_^SF)
because it is faster - the parameter is only processed once). After the last
search a carriage return is done. NO-DISPLAY (_^ND - see next section) is
set, so the action is displayed only after the buffer is done executing.
Without _^ND all the search targets would appear on the screen one by one.

.S3 .LIT
***************************************************************************
.EL
.C;DEFERRING THE DISPLAY OF A BUFFER ATTACHED TO A TERMINAL KEY

.S1 .LIT
NO-DISPLAY  . . . . . . . . . . ^ND
.EL

Normally, the action taken by an execute buffer which is connected to a
terminal key is displayed step by step as the buffer is processed. If the
NO-DISPLAY construct appears in a buffer, the screen will not be updated
until the buffer has completed. Then the entire screen will be re-written.
This feature is useful if the buffer will display a lot of parts of the file
but you only care about where it ends up.

A buffer with _^ND in it acts the same as a buffer invoked by
<ENTER>n<EXECUTE> with /NOSHOW set.

.S3 .LIT
***************************************************************************
.EL
.C;OUTPUTTING IMAGE CHARACTERS

.S1 .LIT
OUTPUT  . . . . . . . . . . . . ^OU( ... )
.EL

The OUTPUT construct is used to output an image string of characters. SED
will send to the terminal the ASCII argument to _^OU. This construct can
be used to cause things to happen to the terminal that SED does not know
about (for example, changing colors on a graphics terminal).

NOTE: The text is output to the terminal screen. It is not put in the file.

Control characters are denoted by "_^K". <ESCAPE> is "_$". "_^_$", "_^_^",
and "_^)" denote "_$", "_^", and ")".

.I0
EXAMPLE: _^OU(_$H_$J(Running_^)) outputs "<ESCAPE>H<ESCAPE>J(Running)".

.PG
As an overall example, here is an execute buffer which lines up every comment
line at the 4th tab position, or if the comment starts after the 4th tab, it
puts one space between the instruction and the comment. Also, comments which
start before column 16 are assumed to be subroutine headers, and are left
alone.

Note that if the search key were "'" the buffer would work with BASIC
programs; if it were "!" it would work with FORTRAN, etc.

One comment is handled by every iteration of this buffer.

.S1 .LIT
        ^ST($;^SF$1^IS$IM^SW)
        ^SF
        ^FCG16(
                ^CL^C=
                ^DW^S(^CL^C+)
                ^CR
                $^CT^DS
                ^4(^FCL32(^TA))
                ^CL
                ^IF^X^S(^CR )
                )
        ^RT
.EL .S1
The buffer first sets the search key to be ";", the parameter for
<DELETE-SPACES> to be 1, and INSERT MODE to be in effect.

SED finds a match. If the match is not beyond the 16th column, SED does
a carriage return (one comment per line!) and stops the iteration.
Else SED moves to the left of the comment symbol. It counts up all spaces
to the left of the comment, and then deletes them. Then SED puts in tabs
until the comment starts at column 32.

Then SED looks at the character to the left of the comment symbol. If it is
not a space or tab (meaning that the comment started beyond column 32, thus
no tabs were inserted in the loop above) SED separates the comment from the
instruction with a space. SED then does a <RETURN> to end the iteration.

Other sample execute buffers can be found in SED.XCT and other .XCT files.

Incidentally, the multi-line format above can be used in
.IFNOT TOPS20
SWITCH.INI
.ELSE TOPS20
SED.INIT
.ENDIF TOPS20
or .XCT
files. The indentation characters must be TABs. When SED is reading a
buffer definition all control characters are ignored, so CARRIAGE RETURNs,
LINEFEEDs, and TABs can be put in wherever you want.

.PG
.C;APPENDICES
.S1
.IFNOT TOPS20
.C;Appendix A. DEFAULT FILESPECS AND SFDS

.INDEX ^^SFDS        DEFAULT FILESPECS AND SFDS        Appendix	#\\
.INDEX ^^FILESPECS   DEFAULT FILESPECS AND SFDS        Appendix	#\\

When SFD's are in effect SED's default filespecs behave a little
differently than when they are not. Without SFD's, if you do not give a
PPN the default is the number you logged in under. Thus if you are
[100,150],

.S1 .LIT
        <ENTER>FILE.EXT[200,25]<SET-FILE>
        <ENTER>NEWFIL.MAC<SET-FILE>
.EL .S1
will find NEWFIL.MAC on [100,150].

However, with SFD's in effect the default is the path which SED is following
at the moment. The above commands would find NEWFIL.MAC on [200,25]. Here's
how the defaults work when you have SFD's:

.S1 .LIT
<ENTER>FILE.EXT[200,25]<SET-FILE>       gets things started
<ENTER>FOO.MAC[,,THING]<SET-FILE>       looks on [200,25,THING]
<ENTER>FOO.FOR<SET-FILE>                on [200,25,THING]
<ENTER>FOO.BAR[,]<SET-FILE>             on [200,25]
<ENTER>NEWFIL.MAC[100,150]<SET-FILE>    only way to get [100,150]
.EL
.PG
.ELSE TOPS20
.C;Appendix A. DEFAULT FILESPECS

.INDEX ^^FILESPECS   DEFAULT FILESPECS                 Appendix	#\\

Files are always looked for on your connected directory unless you
give an explicit device and/or directory name.

.S1 .LIT
***************************************************************************
.EL
.ENDIF TOPS20
.C;Appendix B. LOOKING THROUGH A LIST OF FILES

.INDEX ^^INDIRECT    LOOKING THROUGH A LIST OF FILES   Appendix	#\\
.INDEX ^^LIST        LOOKING THROUGH A LIST OF FILES   Appendix	#\\

You can create a file containing a list of files and then look at them
one by one, moving one file forward or backward along the list. The
easiest way to create this list of files is using the DIRECT program
(or command). For example, type

.IFNOT TOPS20
.S1 .LIT
        .DIR/F LIST=*.MAC
.EL .S1
.ELSE TOPS20
.S1 .LIT
        @DIR *.MAC,
        @@OUTPUT (TO FILE) LIST
.EL .S1
.ENDIF TOPS20
This creates LIST.DIR with a list of the MACRO files in your area.
.IF TOPS20
It will probably need a little editing since the full filespec (in particular
the file name) must appear on each line.
.ENDIF TOPS20
Any method which sets up a list of files, one to a line, will do.

If you then run SED and say <ENTER>@LIST.DIR<SET-FILE> (or run with
.IFNOT TOPS20
".R#SED;@LIST.DIR")
.ELSE TOPS20
"@SED#@LIST.DIR")
.ENDIF TOPS20
(the default extension is "DIR") you will be
looking at the first file on the list. Then a lone <SET-FILE> command will
get the next file on the list, and <ENTER><SET-FILE> will get the previous
one. When you reach the beginning or end of the list SED will toggle between
the last two files it found.

You can return to normal by typing <ENTER>filespecs<SET-FILE>.

.S1 .I0
NOTE: The indirect file must reside in
.IFNOT TOPS20
the top level of your logged-in directory.
.ELSE TOPS20
your connected directory.
.ENDIF TOPS20

The indirect file (such as LIST.DIR above) can contain comments (which start
with "!" or ";"). Spaces and tabs are ignored, so they can be put in anywhere.
Entirely blank lines can appear before the first filespec, but not between
specs (use a lone comment symbol).

Here is an example of an indirect <SET-FILE> file:

.S1 .LIT
        ;LIST OF EXPERIMENTAL FILES

        EXP1.MAC        !FILE TO CHANGE ALL THE WORLD
        EXP2.MAC        ;FILE TO CHANGE ALL THE REST
        !
        EXP3A.MAC
        ;
        ;THE FOLLOWING ARE NOT VERY USEFUL:
        ;
        EXP8.MAC
        EXP15.MAC
.EL
.PG
.C;Appendix C. USING MARGINS AND SCREEN LIMITS

.INDEX ^^MARGINS     USING MARGINS AND SCREEN LIMITS   Appendix	#\\

.s1
This appendix discusses the action of four switches: /LENGTH:, /WIDTH:,
/LMAR:, and /RMAR:.

/LENGTH: and /WIDTH: set up the dimensions of the terminal display. You can
use them to limit the amount of output. For example, for a lot of searching
on a slow terminal, set /LENGTH:10 and only a few lines around the search
match will be displayed. Also, SED can be adjusted for terminals which change
widths, like the VT100, using the /WIDTH: switch.

/LMAR: and /RMAR: control how typed-in characters are entered on the screen
and in the file. If you set, say, /LMAR:8, then a <CARRIAGE-RETURN> or
<BEGIN-LINE> command will move the cursor, on the screen and in the file, to
the eighth column. The line in the file will begin with eight spaces. /LMAR:
is initially 1.

You can move into that indented region using <CURSOR-LEFT> or
<DELETE-CHARACTER>.

/RMAR: sets up the right margin. If you are typing in text and exceed the
right margin then the word you are typing will be moved to the next line. SED
will put in the carriage returns for you. /RMAR: starts as the width of the
entire screen.

/RMAR: can be disabled by setting it larger than the screen width (like
/RMAR:1000).

.PG
.IFNOT TOPS20
.C;Appendix D. INCREMENTAL FILE SAVES

.INDEX ^^SAVES       INCREMENTAL FILE SAVES            Appendix	#\\
.ELSE TOPS20
.C;Appendix D. INCREMENTAL FILE SAVES AND JOURNALING

.INDEX ^^JOURNAL     INCREMENTAL SAVES AND JOURNALING  Appendix	#\\
.INDEX ^^SAVES       INCREMENTAL SAVES AND JOURNALING  Appendix	#\\
.ENDIF TOPS20

.s1
There are a number of ways to recover editing sessions in SED. You can save
the file you are editing automatically by setting the /ISAVE: and /SAVE:
switches. Say you set /ISAVE:30/SAVE:150. Then after 30 commands or 150
characters of type-in, whichever comes first, the file will be saved. Then
both counters are reset.

/ISAVE: and /SAVE: both start off at zero, meaning no incremental saves
(which is what these saves are called). You can tune SED's saving
characteristics to your editing style.

Of course, you can also save the file by simply exiting SED and rerunning it,
since SED will put you back where you were in the file. This scheme is good
if you want to save only at specific times (and can remember that it needs
to be done). There's also the <SAVE-FILE> command, which saves the file
without exiting SED.

One thing to beware: incremental saves and the <SAVE-FILE> command do not
clean up the file. SED puts a lot of nulls and trailing spaces into the file;
they are eliminated when the file is saved by an <EXIT> or <SET-FILE> command.
But the other saves are designed to take as little time as possible, so the
nulls and spaces are left in. However, some programs will break if there are
nulls in the file. So end your editing sessions by typing <EXIT>, not
<SAVE-FILE><ABORT>.

.IF TOPS20
Incremental saves can take a long time for large files. So there is another
recovery mechanism: journaling. The journal is the file SEDJRN.TMP, which
holds the stream of commands which you typed during your editing session. If
the computer crashes you can recover your session by telling SED to read its
commands from the journal and apply them to the unchanged file (it is
unchanged because the system crashed before you exited). A few commands at
the end of the session will be lost, but you will get most of your work back.

.S1 .I0
NOTE: Journaling works only under TOPS-20 at this time.

.S1 .I0
ALERT: Journaling does not work correctly under all conditions now.
It fails by just stopping part way through recovery, which, at least, isn't
fatal. I find that it still works often enough to be useful, and I am
gradually correcting the deficiencies. However, the journaling code is
turned off in the distributed version of SED. If you have journaling
enabled, please be aware that it fails sometimes.

Start journaling by typing the /JOURN switch (in the <SWITCH> command, in the
monitor-level RUN command, or as part of a <SET-FILE>. The journal will be
started immediately, and SED will remember what file you are editing and
where you are in it. The journal is restarted every time the file is saved
(on a <SET-FILE> or incremental save).

You don't have to worry about the journal unless the computer crashes. When
the system comes up, type "SED/RECOV" at monitor level. SED will take its
commands from the journal, update the file, and tell you when it's done.

If you want to see your own commands being performed at super-speed, type
"SED/RECOV/SHOW". Watching your two-hour session whiz by in a couple of
minutes is very humbling, and has the same entertainment value as watching
two shirts fight in a clothes dryer.

Also, if you recover by typing "SED/REC/JOURN" (or "SED/REC/SHOW/JOURN") then
the journal will be appended to after the recovery is finished. This also
happens if /JOURN is in SED.INIT. Note: if, after recovery, you type
<ENTER>JOURN<SWITCH> then the journal file will be STARTED, not appended to.
When in doubt save the file (by exiting, for example), and start with a fresh
journal.

If you put the /JOURN switch in your SED.INIT file then journaling will be
done automatically. You can turn it off for an editing session by typing
<ENTER>NOJOURN<SWITCH> (as you might expect).
.ENDIF TOPS20
.PG
.PS 60 68
.C;Appendix E. TABLE OF EXECUTE COMMAND NAMES
.S1 .LIT
        COMMAND             NAME    OTHER COMMANDS          NAME
        -------             ----    ----- ----------        ----
        ENTER-PARAMETER . . $       SET-FILE  . . . . . . . ^FL
                                    SWITCH  . . . . . . . . ^SW
CURSOR  CURSOR-UP . . . . . ^CU     WINDOW  . . . . . . . . ^WI
.EL
.IFNOT TOPS20
.LIT
        CURSOR-DOWN . . . . ^CD
.EL
.ELSE TOPS20
.LIT
        CURSOR-DOWN . . . . ^CD     PUSH  . . . . . . . . . ^PU
.EL
.ENDIF TOPS20
.LIT
        CURSOR-LEFT   . . . ^CL
        CURSOR-RIGHT  . . . ^CR     OTHER CONSTRUCTS        FORMAT
        CURSOR-HOME   . . . ^CH     ----- ----------        ------
        CARRIAGE-RETURN . . ^RT     START-UP  . . . . . . . ^ST( ... )
        TAB . . . . . . . . ^TB     IMAGE-OUTPUT  . . . . . ^OU( ... )
        BACKTAB . . . . . . ^BT     NO-DISPLAY  . . . . . . ^ND
        UP-TAB  . . . . . . ^UT
        DOWN-TAB  . . . . . ^DT     ITERATED-DO . . . . . . ^n( ... )
        BEGIN-LINE  . . . . ^LB     DO-WHILE  . . . . . . . ^DWc( ... )
        END-LINE  . . . . . ^LE     IF-CHARACTER  . . . . . ^IFc( ... )
        LINE  . . . . . . . ^LN     IF-ROW  . . . . . . . . ^FRc( ... )
                                    IF-COLUMN . . . . . . . ^FCc( ... )
ROLLS   ROLL-BACK-PAGES . . ^RBP    EXIT-BLOCK  . . . . . . ^XB
        ROLL-FORWARD-PAGES. ^RFP    CONTINUE-BLOCK. . . . . ^CB
        ROLL-BACK-LINES . . ^RBL    EXIT-BUFFER . . . . . . ^XX
        ROLL-FORWARD-LINES. ^RFL
        PERCENT-GOTO  . . . ^GO     CLEAR-COUNTER . . . . . ^C=
        SLIDE-LEFT. . . . . ^SL     INCREMENT-COUNTER . . . ^C+
        SLIDE-RIGHT . . . . ^SR     DECREMENT-COUNTER . . . ^C-
                                    SET-COUNTER . . . . . . ^SC
SEARCH  SEARCH-FORWARD  . . ^SF     USE-COUNTER . . . . . . ^CT
        SEARCH-BACKWARD . . ^SB     ITERATE-COUNTER . . . . ^C.( ... )
                                    IF-COUNTER  . . . . . . ^F.c( ... )
TEXT    INSERT-SPACES . . . ^IS
        DELETE-SPACES . . . ^DS     For DO-WHILE or IF-CHARACTER:
        INSERT-LINES  . . . ^IL
        DELETE-LINES  . . . ^DL           SOME GIVEN CHARACTER
        PICK  . . . . . . . ^PK       ^L  ALPHABETIC (A-Z, a-z)
        PUT   . . . . . . . ^PT       ^U  UPPER CASE (A-Z)
        INSERT-MODE . . . . ^IN       ^N  NUMERIC (0-9)
        DELETE-CHARACTER. . ^DC       ^A  ALPHA-NUMERIC
        CLEAR-LINE  . . . . ^LF       ^S  SPACE OR TAB
        ERASE-LINE  . . . . ^EL       ^E  END OF LINE OR BEYOND
        ERASE-WORD  . . . . ^EW
                                      ^X  .NOT. ONE OF THE ABOVE
OTHERS  ABORT . . . . . . . ^AB
        CASE  . . . . . . . ^CS     For IF-ROW, -COLUMN, -COUNTER:
        ENTER-CTRL-CHAR . . ^EC
        EXECUTE . . . . . . ^EX        En  EQUAL TO n
        EXIT  . . . . . . . ^XT        Gn  GREATER THAN n
        HELP  . . . . . . . ^HL        Ln  LESS THAN n
        MARK  . . . . . . . ^MK        Nn  NOT EQUAL TO n
        REAL-TAB  . . . . . ^TA
        RECALL  . . . . . . ^RC
        REWRITE . . . . . . ^RW
        SAVE-FILE . . . . . ^SV
.EL
.PG
.PS 56 68
.C;EXAMPLE I
.C;TERMINAL DEPENDENCIES OF THE VT52

The VT52 has a numeric keypad to the right of the normal keyboard. Four
cursor movement keys are at the right of that keypad and there are three
unidentified buttons above the pad. The leftmost (blue) unidentified button
is the <ENTER> command, the rightmost one (BLACK) is <HOME>, and the center one
(RED) is <RECALL>. The number keys in the pad can be used to invoke commands
which are not defined as control characters. Do not use the red ESC (SEL)
key at the upper left of the keyboard.

.IFNOT OLDTAB
.S2 .LIT
VT52 EDITOR KEYBOARD

       Q    W    E    R    T    Y    U    I    O    P
.____.____.____.____.____.____.____.____.____.____.____.   .____.____.
!    !ROLL!ROLL!SRCH!SRCH!ROLL!ROLL!BACK!    !ENTR!PERC!   !ERAS!RE- !
!TAB !BK P!BK L!BACK!FORW!FW L!FW P!TAB !TAB !CCH !GOTO!...!LINE!SET !
!____!____!____!____!____!____!____!____!____!____!____!   !____!____!
       !INS !DEL !INS !DEL !    !ERAS!ERAS!SLID!SLID!      !         !
       !SPAC!SPAC!LINE!LINE!PUT !CHAR!LINE!LEFT!RGHT!   ...! RETURN  !
   .___!____!____!____!____!____!____!____!____!____!_.    !_________!
   !     !    !    !    !    !SET !    !RE- ! <  ! >  !    !RE- !
   !SHIFT!EXIT!EXCT!ABRT!PICK!FILE!SWCH!TURN! ,  ! .  ! ...!PEAT!
   !_____!____!____!____!____!____!____!____!____!____!    !____!
           Z    X    C    V    B    N    M
.EL
.ELSE OLDTAB
.S2 .LIT
VT52 EDITOR KEYBOARD

       Q    W    E    R    T    Y    U    I    O    P
.____.____.____.____.____.____.____.____.____.____.____.   .____.____.
!    !ROLL!ROLL!SRCH!SRCH!ROLL!ROLL!SLID!    !ENTR!PERC!   !ERAS!RE- !
!TAB !BK P!BK L!BACK!FORW!FW L!FW P!RGHT!TAB !CCH !GOTO!...!LINE!SET !
!____!____!____!____!____!____!____!____!____!____!____!   !____!____!
       !INS !DEL !INS !DEL !    !ERAS!ERAS!    !SLID!      !         !
       !SPAC!SPAC!LINE!LINE!PUT !CHAR!LINE!PICK!LEFT!   ...! RETURN  !
   .___!____!____!____!____!____!____!____!____!____!_.    !_________!
   !     !    !    !    !    !SET !BACK!RE- ! <  ! >  !    !RE- !
   !SHIFT!EXIT!EXCT!ABRT!SWCH!FILE!TAB !TURN! ,  ! .  ! ...!PEAT!
   !_____!____!____!____!____!____!____!____!____!____!    !____!
           Z    X    C    V    B    N    M
.EL
.ENDIF OLDTAB
.LIT

        NUMERIC PAD AT RIGHT     .____.____.____.____.
        OF NORMAL KEYBOARD:      !ENTR!RE- !    !CUR !
                                 !ARGS!CALL!HOME! UP !
                                 !____!____!____!____!
                                 !    !UP- !    !CUR !
                               7 !MARK!TAB !CASE!DOWN! 9
                                 !____!____!____!____!
                                 !BEG-!RE- !END-!CUR !
                               4 !LINE!WRIT!LINE!RIGT! 6
                                 !____!____!____!____!
                                 !WIN-!DOWN!    !CUR !
                               1 !DOW !TAB !HELP!LEFT! 3
                                 !____!____!____!____!
                                 !   REAL  !ERAS!INS !
                                 !   TAB   !WORD!MODE!
                                 !_________!____!____!

.EL
.PG
.C;EXAMPLE II
.C;TERMINAL DEPENDENCIES OF THE ADM2

The ADM2 has a row of buttons above the normal keyboard. They send the
sequences "_^A LETTER RETURN", with a different LETTER for each key. If SED
uses those keys, _^A cannot be the <INSERT-SPACES> command, since when SED
receives a _^A it will wait for two more characters before it decides what
to do. Also, the ADM2 uses _^K and _^L for cursor movement, so the slide
commands must be moved. So the leftmost 4 special keys stand for <INSERT->
and <DELETE-SPACES> and <SLIDE-LEFT> and <-RIGHT>. <ENTER> and the commands
which are not invoked by control characters are set up on the right side
of the extra keys.

.S1 .LIT
ADM2 EDITOR KEYBOARD
.____.____.____.____.____.____/        \____.____.____.____.____.____.
!INS !DEL !SLID!SLID!    !    /        \    !    !ERAS!INS !RE- !ENTR!
!SPAC!SPAC!LEFT!RGHT! F5 ! F6 /  ...   \ F11!MARK!CHAR!MODE!CALL!ARGS!
!____!____!____!____.____.____/        \____!____!____!____!____!____!

       Q    W    E    R    T    Y    U    I    O    P
.____.____.____.____.____.____.____.____.____.____.____.   .____.____.
!    !ROLL!ROLL!SRCH!SRCH!ROLL!ROLL!BACK!    !ENTR!PERC!   !         !
!CTRL!BK P!BK L!BACK!FORW!FW L!FW P!TAB !TAB !CCH !GOTO!...!   TAB   !
!____!____!____!____!____!____!____!____!____!____!____!   !_________!
       !    !DEL !INS !DEL !    !CUR !CUR !    !    !           !CUR !
       ! XX !SPAC!LINE!LINE!PUT !LEFT!DOWN! XX ! XX !   ...     !DOWN!
.______!____!____!____!____!____!____!____!____!____!_.    .____!____!
!        !    !    !    !    !SET !    !RE- ! <  ! >  !    !         !
! SHIFT  !EXIT!EXCT!ABRT!PICK!FILE!SWCH!TURN! ,  ! .  ! ...! RETURN  !
!________!____!____!____!____!____!____!____!____!____!    !_________!
           Z    X    C    V    B    N    M
                                .____.____.____.
        PAD AT RIGHT            !    !CUR !    !
        OF NORMAL KEYBOARD:     !    ! UP !    !
                                !____!____!____!
                                !CUR !    !CUR !
                                !LEFT!HOME!RIGT!
                                !____!____!____!
                                !    !CUR !    !
                                !    !DOWN!    !
                                !____!____!____!
.EL
.PG
.C;INDEX OF EDITOR COMMANDS, BY COMMAND
.PS 56 100

.S1 .NOFILL .I0
PAGE  COMMAND    NAME                 EXPLANATION
.S1
 12     {INSSPS	INSERT-SPACES        INSERT SPACES TO FILE
 16     {SETFIL	SET-FILE             SET UP A FILE FOR EDITING
 22     {ABORT	ABORT                EXIT AND FORGET CHANGES
 10     {INSLIN	INSERT-LINES         INSERT BLANK LINES IN FILE
 13     {SRCBAK	SEARCH-BACKWARD      SEARCH FROM CURSOR TO START OF FILE
 10     {DELLIN	DELETE-LINES         DELETE LINES FROM FILE
 18     {PUT	PUT                  PUT TEXT INTO FILE
  6     {CURLFT	CURSOR-LEFT          MOVE CURSOR LEFT
  7     {TAB	TAB                  MOVE TO NEXT TAB STOP
 24     {CLRLIN	CLEAR-LINE           CLEAR LINE BELOW CURSOR
 24     {ERSLIN	ERASE-LINE           ERASE FROM CURSOR TO END OF LINE
.IFNOT OLDTAB
  9     {SLDLFT	SLIDE-LEFT           SLIDE VIEWING WINDOW LEFT
  9     {SLDRGT	SLIDE-RIGHT          SLIDE VIEWING WINDOW RIGHT
.ELSE OLDTAB
 16     {PICK	PICK                 PICK TEXT FROM FILE
  9     {SLDLFT	SLIDE-LEFT           SLIDE VIEWING WINDOW LEFT
.ENDIF OLDTAB
  6     _^M	CARRIAGE-RETURN      GOOD OL' ASCII CARRIAGE RETURN
.IFNOT OLDTAB
 25     {SWITCH	SWITCH               SET SWITCHES OR QUERY STATUS
.ELSE OLDTAB
  7     {BAKTAB	BACKTAB              MOVE TO PREVIOUS TAB STOP
.ENDIF OLDTAB
 23     {ENTCCH	ENTER-CTRL-CHAR      MAKE NEXT CHARACTER A CONTROL CHAR.
  9     {PERCGO	PERCENT-GOTO         GO TO SOME PERCENT THROUGH THE FILE
  8     {ROLBKP	ROLL-BACK-PAGES      MOVE VIEWING WINDOW BACK PAGES
 13     {SRCFWD	SEARCH-FORWARD       SEARCH FROM CURSOR TO END
 12     {DELSPS	DELETE-SPACES        DELETE CHARACTERS FROM FILE
  8     {ROLFWL	ROLL-FORWARD-LINES   MOVE VIEWING WINDOW FORWARD LINES
.IFNOT OLDTAB
  7     {BAKTAB	BACKTAB              MOVE TO PREVIOUS TAB STOP
 16     {PICK	PICK                 PICK TEXT FROM FILE
.ELSE OLDTAB
  9     {SLDRGT	SLIDE-RIGHT          SLIDE VIEWING WINDOW RIGHT
 25     {SWITCH	SWITCH               SET SWITCHES OR QUERY STATUS
.ENDIF OLDTAB
  8     {ROLBKL	ROLL-BACKWARD-LINES  MOVE VIEWING WINDOW BACK LINES
 32     {EXECUT	EXECUTE              PERFORM SEQUENCE OF EDITOR COMMANDS
  8     {ROLFWP	ROLL-FORWARD-PAGES   MOVE VIEWING WINDOW FORWARD PAGES
 22     {EXIT	EXIT                 EXIT AND SAVE CHANGES
  3     {ENTER	ENTER                PASS A PARAMETER TO A COMMAND
 22     {RESET	RESET                RESET SCREEN OR PARAMETER
 30     {RECALL	RECALL               RECALL PREVIOUS PARAMETER
 20     {INSMOD	INSERT-MODE          CHARACTER INSERT/REPLACE TOGGLE
 11     {DELCHR	DELETE-CHARACTER     ERASE CHARACTER TO LEFT OF CURSOR
 23     {REALTB	REAL-TAB             TYPE A REAL TAB IN THE FILE
 19     {MARK  	MARK                 MARK POSITION FOR PICK OR DELETE
 31     {CASE  	CASE                 CHANGE CASE OF LETTER AT CURSOR
 31     {WINDOW	WINDOW               SET OR CLEAR SPLIT-SCREEN WINDOWING
  6     {UPTAB	UP-TAB               MOVE THE CURSOR UP 6 LINES
  6     {DWNTAB	DOWN-TAB             MOVE THE CURSOR DOWN 6 LINES
 23     {REWRIT	RE-WRITE             REWRITE THE SCREEN
 20     {SAVER	SAVE-FILE            SAVE THE CURRENT FILE
 30     {HELPER	HELP                 GIVE ON-LINE HELP
  7     {BEGLIN	BEGIN-LINE           MOVE THE THE BEGINNING OF THE LINE
  7     {ENDLIN	END-LINE             MOVE THE THE END OF THE LINE
 11     {ERASWD	ERASE-WORD           ERASE THE WORD AT THE CURSOR
.IF TOPS20
 29     {PUSHER	PUSH                 PUSH TO EXEC CONTEXT
.ENDIF TOPS20
 14     {SUBSTI	SUBSTITUTE           SEARCH AND SUBSTITUTE

.PS 56 68 .PG .FILL
.C;ARTICULATED INDEX OF EDITOR COMMANDS

The COMMAND column refers to the control character which invokes the desired
command. UP, DOWN, LEFT, RIGHT, and HOME are the five cursor movement keys,
usually denoted by arrows on the key caps (but see the terminal dependent
section to make sure). RUB is the RUBOUT key, sometimes yclept DEL, for
DELETE. ESC is the ESCAPE or ALTMODE key. "PAD" means that the key is on
a keypad which is separate from the normal typewriter keyboard.

.NOAUTOP .NOFIL
.S1 .LIT
KEY         EXPLANATION                     COMMAND       PAGE
.EL
.TITLE KEY         EXPLANATION                     COMMAND       PAGE
.PRINT INDEX