Dallwitz, M.J., Paine, T.A. and Zurcher, E.J. 1986 onwards. User’s guide to the text editor Ted. http://delta-intkey.com DELTA Home

User’s guide to the text editor TED

9 July 2006

M.J. Dallwitz, T.A. Paine and E.J. Zurcher

Contents

1. INTRODUCTION [">1]
1.1 Files [">1]
1.2 Switching On [">1]
1.3 Connecting the Terminal to the Computer and Logging In [">2]
1.4 Using Control Characters to Edit Input [">3]
1.5 Running a Program [">3]

2. TED [">4]
2.1 Commands and Text [">4]
2.2 Modes of Display [">4]
2.3 Safety Checks [">4]
2.4 Copying Files [">5]
2.5 Input Mode [">5]
2.6 Saving and Deleting Files [">5]
2.7 The Pointer [">6]
2.8 Removing and Inserting Text [">7]
2.9 Displaying the Workspace [">7]
2.10 Indefinite Repetition [">8]
2.11 Windowing of the Display [">8]
2.12 Searching [">8]
2.13 Tabs [">9]
2.14 Re-entering Input Mode [">10]
2.15 Joining Files [">10]
2.16 The Journal File [">11]
2.17 Cut and Paste [">11]

ACKNOWLEDGEMENTS [">12]

A1. DIFFERENCES BETWEEN TED AND ED [">13]
A1.1 Interaction between the Editor and its Environment [">13]
A1.2 Discrepancies [">13]
A1.3 Extensions [">14]

A2. SUMMARY OF TED COMMANDS [">16]

1. Introduction

This is an introduction to using the text editor, TED, to prepare and alter data, manuscripts, and programs. A complete list of TED commands is given in an Appendix. A few basic features of the VAX/VMS operating system are also described. (Further information can be obtained from various Digital Equipment Corporation manuals.) The system is described with particular reference to the VAX/VMS installation at the CSIRO Division of Entomology.

Each point is illustrated with examples. You should try each example as you come to it. Always keep in mind that the purpose of the examples is to help you understand the system, not to check that the system is giving the correct responses. If you don't understand why the system has responded in a certain way, don't go on in the hope that it will become clear later. First reread the section. If things are still not clear, ask another user for help.

Before beginning, you will need a password and a user identification, which are obtained from the system manager.

1.1 Files

Information is stored in the computer system in units called files. A file is identified by a name, a type, and a version number. A file name is an arbitrary group of characters, chosen by the file's owner. It consists of alphanumeric characters (that is, letters and numbers), and may optionally be followed by a full stop and a further group of characters called the type, which is usually used to indicate the kind of material in the file (for example: TEM010980.DAT — a data file; GUIDE.TPS — a typesetting file). A version is a number which may be used to distinguish files having the same name. If present, it must be preceded by a semicolon. Usually, it is not necessary to explicitly specify the version number — an appropriate one is selected by the computer system.

A file may be put into the computer system by typing it on a terminal. Alternatively, a file may be input from a floppy disc, magnetic tape, a microcomputer, or from the CSIRONET network.

1.2 Switching On

Before you can use the terminal, the power must be switched on, and the terminal must be `on line', that is, connected to the line which takes signals to and from the terminal. The power on/off switch may be on the keyboard, on the front edge of the keyboard, underneath the keyboard, or on the back of the terminal. Switching between on-line and off-line (also called line and local) may be carried out by a switch or by a key on the keyboard. Terminals which display information on a screen (rather than print it on paper) may take about half a minute to warm up.

1.3 Connecting the Terminal to the Computer and Logging In

The terminal keyboard is similar to that of a typewriter. However, there are about 30 extra characters called control characters. We shall denote control characters by small capitals, thus: [9F[1.7HCR]]. The control characters [9F[1.7HCR]] (carriage return), [9F[1.7HDEL]] (delete), and [9F[1.7HESC]] (escape) are produced by special keys. The rest are usually produced from the ordinary keys with the aid of a special shift key marked CONTROL or CTRL.

Most terminals can produce both upper-case and lower-case letters, but a few produce upper case only. Our examples will be written as upper case, but the effect will be the same if you type them in lower case. Most terminals have a CAPS LOCK key, which produces the upper-case versions of the alphabetic characters, but does not affect numeric and special characters.

There is also a special key marked BREAK, which is used to initiate connection and disconnection of the terminal with a computer. On some terminals, this key must be held down for at least half a second to take effect.

Connecting the terminal with a computer is similar to connecting one telephone with another. The correspondence between the parts of these operations is as follows.

Telephone to telephone Terminal to computer


Lift receiver Press [9F[1.7HBREAK]] and [9F[1.7HCR]]
Dial number of required telephone Enter code for required computer
Converse Work with computer
Hang up receiver Press [9F[1.7HBREAK]]

Now connect yourself to the Entomology VAX computer (VX) as follows. Press
[9F[1.7HBREAK]]
Wait at least two seconds, then type
[9F[1.7HCR]]
The response should be
[Q[2.2Henter class]]
(If there is no response, retry the same sequence, making sure to hold down the [9F[1.7HBREAK]] key for at least half a second, and to wait at least two seconds between the [9F[1.7HBREAK]] and [9F[1.7HCR]]. If there is still no response, consult computing staff.) Type
[Q[2.2HVX ][9F[1.7HCR]]]
The response should be
[Q[2.2Hclass vx start]]
Type
[Q[9F[1.7HCR]]]
The response should be
[Q[2.2HENTOMOLOGY VAX-11/750 VMS system]]
[Q[2.2HUsername:]]
Now enter your user identification. The system responds with
[Q[2.2HPassword:]]
Enter your password. You are now logged in to the VAX computer.

Type in the characters [Q[2.2HASD123]] . The characters [Q[2.2Hasd123]] or [Q[2.2HASD123]] should appear on the paper or screen. Now hold down the shift key, and strike the same six keys. The letters will now be in upper case, and instead of the numerals, the upper characters marked on the key tops will be displayed: [Q[2.2HASD!"#]] . Now release the shift key, hold down the CTRL key, and strike the U key ( [.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]] U). This produces a control character, and [Q[2.2H^U]] is displayed.

When you are finished working with the computer, you must press [9F[1.7HBREAK]] to disconnect your terminal. (This makes the line available for other users.) For the moment, leave your terminal connected for the next exercises.

1.4 Using Control Characters to Edit Input

As characters are typed in, they are stored in the computer, but they are (usually) not interpreted until you type [9F[1.7HCR]] . At any time before you type [9F[1.7HCR]] , you can correct mistakes by using control characters. [.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]] U deletes the whole line, so that you can retype it. [9F[1.7HDEL]] deletes the last character of the line; more than one character can be deleted by repeated use of [9F[1.7HDEL]] . [.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]] R displays the corrected line.

Type in
[.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HU]] [Q[2.2HREST]] [ ][.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HU]] [Q[2.2HTEST LINE]] [ ][.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HR]]
The response will be
[Q[2.2HTEST LINE]]
Note that after [.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HU]] you are automatically given a new line when you start retyping the line. Now type in
[.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HU]][ ] [Q[2.2HSECOND TEDT]] [9F[1.7HDEL  DEL]] [Q[2.2HST LINE]] [ ][.15f[o[0,0_]\[0,1.3_]\[1.3d] [.3b[.7HCTRL]] [1.3d]]][ ] [Q[2.2HR]]
The response will be
[Q[2.2HSECOND TEST LINE]]
Finally, type [9F[1.7HCR]] . The response will be
[Q[2.2H%DCL-W-IVVERB, unrecognized command verb]]
[Q[2.2H \SECOND\]]
[Q[2.2H$]]
As the line is not a valid command, it has been rejected. The $ on the next line indicates that the computer is ready to accept more input from the keyboard.

1.5 Running a Program

You may now run the computer program which you want to use. We shall be using the editing program, TED, which can be used to create files and to alter existing files. TED is started by typing
[Q[2.2HTED] [9F[1.7HCR]]]
The response will be
[Q[2.2HTED ]]revision date
[Q[2.2H:]]
The colon indicates that TED is ready to accept input from the keyboard. For the moment, just type
[Q[2.2HQ] [9F[1.7HCR]]]
You have now terminated TED (`quit'), and are back to the stage where you can select a program. Instead, type
[Q[2.2HLO] [9F[1.7HCR]]]
and the terminal will be `logged out'. Now press
[Q[9F[1.7HBREAK]]]
to disconnect the terminal.

2. Ted

2.1 Commands and Text

To give instructions to TED, the user types in commands, each of which is represented by a single character. Several commands may be typed in on each line (that is, before typing [9F[1.7HCR]] ).

Some commands must be followed by a group of characters (text) on which the command is to operate; for example, the command might insert the characters in a file. To separate the commands from the characters upon which they operate, the latter are enclosed between a pair of characters, called delimiters. The delimiters are the semicolon ( ; ) , the slash ( / ) , and the exclamation mark ( ! ) . Both members of a pair of delimiters must be the same, and the chosen delimiter must not be the same as any of the characters being enclosed.

Most commands may be preceded by a number, whose meaning depends on the command. Usually, it signifies the number of times the command is to be repeated. Some commands may also be preceded by symbols called command modifiers, which alter the effect of the command.

For example, in the line
[Q[2.2H^J2RI;GO TO 30;F]]
[Q[2.2HJ]], [Q[2.2HR]], [Q[2.2HI]], and [Q[2.2HF]] are commands, the [Q[2.2H2]] indicates that the command [Q[2.2HR]] is to be repeated two times, and the [Q[2.2H^]] modifies the command [Q[2.2HJ]]. [Q[2.2HGO TO 30]] is the group of characters which is operated on by the command [Q[2.2HI]], and the two semicolons are the delimiters which separate this group of characters from the commands.

2.2 Modes of Display

TED can operate in either screen mode, where the whole screen is used to display your file, or in line mode, where only one line is displayed at a time. In general, you will find screen mode easier to use, though it does require that your terminal be VT100- or VT220-compatible. In addition, the operating system must be notified of your terminal type before running TED — e.g. [Q[2.2HSET TERMINAL /VT100]]. (If you usually use the same terminal, the SET TERMINAL command should be put in your login command file.)

To change to screen mode, type WP after logging into TED. To revert to line mode, type NP.

2.3 Safety Checks

Before executing each command, TED checks whether it is ‘dangerous’. A command is dangerous if it could potentially destroy large amounts of information — for example, a whole file or several lines of a file. If a command is dangerous, TED asks for confirmation by displaying a question mark under the command and waiting for a response from the user. A response of [Q[2.2HY]] confirms the command, and execution continues. Any other response ([Q[2.2HN]] or just [9F[1.7HCR]] is suggested) aborts the command and any subsequent commands in the line. It is most important to type [Q[2.2HN]] or [9F[1.7HCR]] in response to a request for confirmation, unless the consequences of confirming the command are fully understood.

2.4 Copying Files

TED does not directly alter a file. Instead, a temporary copy of the file is made. The required changes are made on this copy, then a new file is made from the revised copy. The area of computer memory occupied by the copy is called the workspace. The command to copy a file into the workspace (‘copy the file’) takes the form
[Q[2.2HC;[2.6Hname];]]
where name is the file name. (By default, the highest-numbered version is copied. Other versions may be copied by including the version number with the file name. If you specify a version number, be careful to use one of the alternative text delimiters — see Section 2.1.)

2.5 Input Mode

If you want to start an entirely new file, rather than alter an existing file, give the command
[Q[2.2HC;?;]]
TED then enters input mode, and transfers the subsequent lines directly to the workspace, instead of interpreting them as commands. The normal editing or command mode of operation is restored by typing a line containing only [9F[1.7HCR]] .

Let us now prepare and edit a small file. Connect and log in, and enter TED. If your terminal is suitable for screen-editing, type [Q[2.2HWP]] to go into screen mode. Then type [Q[2.2HC;?;]] . The response is [Q[2.2HENTER TEXT]] . Type in the following lines: [Q][2.2H]
TERMINALS
THE FOUR MAIN TYPES OF TERMINAL
IN THE CSIRONET SYSTEM ARE:
TELETYPE
CONTROL DATA 713
SILENT 700
TEKTRONIX
[9F[1.7HCR]] [2.6H]
In screen mode, note that the request to ENTER TEXT remains displayed until you enter the final [9F[1.7HCR]]. The colon prompt then reappears, indicating that TED is ready to accept further editing commands. In line mode, note that the only response after each line except the last is the character >, indicating that TED is ready for another input line. After the last line, the response is [Q[2.2HTEKTRONIX]] , that is, the last line of the workspace, and the prompt reverts to a colon.

2.6 Saving and Deleting Files

The command to save the workspace as a file (‘make’ the file) is
[Q[2.2HM;[2.6Hname];]]
where name is the name chosen for the file, or
[Q[2.2HM;*;]]
where * indicates the name used in the last successful copy or make command. If files with the specified or implied name already exist, the version number of the new file will be one greater than the highest of the old version numbers. Otherwise, the version number of the new file will be 1. It is preferable to use the second form of the command unless you want to change the name of a file. If the file name is not yet known to TED (for example, after a C ;?; command), you will be asked to enter the name.

The workspace is not altered by the M command.

Let us call our file TERM. Type in [Q[2.2HM;*;]] . The response will be [Q[2.2HENTER FILE NAME]] . Type in [Q[2.2HTERM]] . The response will be [Q[2.2HTERM MADE]] .

It is advisable to make the file occasionally during input or editing. TED displays a reminder to make the file after every 50 changes. If you have changed the workspace and attempt to copy another file or quit (Q) without making the file, TED will ask for confirmation of the command.

A common mistake is to attempt to make the file (or give other commands) while TED is in input mode, that is, before typing the extra [9F[1.7HCR]] to cause a return to editing mode. If this happens, the attempted commands will simply be entered into the workspace instead of being executed. You will know you are in input mode if —
in screen mode, ENTER TEXT is displayed.
in line mode, the response to all `commands' is always the character >.

Unwanted versions of a file can be removed (`deleted') from the system by the command:
[Q[2.2H^M;[2.6Hname];]]
which deletes the lowest (or only) version of name. This is a dangerous command, so TED will ask for confirmation.

2.7 The Pointer

All editing in TED is performed relative to a pointer which can point to any position on any line of the workspace. In screen mode, the position of the pointer is always displayed by highlighting the character at the current position. In line mode, the position of the pointer may be displayed at any time by entering the command [Q[2.2HNP]] .

Try this on the file TERM. Copy the file by typing [Q[2.2HC;TERM;]] . If you are in line mode, type [Q[2.2HNP]]. Note that the pointer is at the first position of the first line of the workspace, that is, the [Q[2.2HT]] in [Q[2.2HTERMINALS]] .

The pointer can be moved directly by specifying the required movement, or indirectly by searching for items in the workspace or making alterations. The commands for direct movement are ['j]
[Q[2.2HO]] Move the pointer to the start (origin) of the workspace.
[Q[2.2H^O]] Move the pointer to start of the last line of the workspace.
[Q[2.2HJ]] Move the pointer to the start of the current line (`justify').
[Q[2.2H^J]] Move the pointer to the end of the current line (that is, to the column after the last character in the line).
[Q[2.2HL]] Move the pointer one position to the left.
[Q[2.2HR]] Move the pointer one position to the right.
[Q[2.2HB]] Move the pointer one line back.
[Q[2.2HF]] Move the pointer one line forward. [j]
The last four commands may be preceded by a `repetition factor' indicating the number of times the command is to be repeated: n[Q[2.2HL]] means move the pointer n positions to the left, and so on.

Try the following commands. [ ] [Q[2.2H5R]] . The pointer will be at the [Q[2.2HN]] in [Q[2.2HTERMINALS]]. [ ] [Q[2.2H3F]] . The pointer will be at the [Q[2.2HY]] in [Q[2.2HTELETYPE]]. [ ] [Q[2.2H^O]] . The pointer will be at the [Q[2.2HT]] in [Q[2.2HTEKTRONIX]]. [ ] [Q[2.2HOF25R]] . The pointer will be at the [Q[2.2HR]] of [Q[2.2HTERMINAL]].

2.8 Removing and Inserting Text

The following commands remove a character or line from the workspace.
Delete the character at the pointer position.
[Q[2.2HE]] Erase the line at the pointer position.
The gap created by the removal of the character or line is automatically closed up, and the pointer points to the character or line following the one removed. These commands may be preceded by a repetition factor: n– means delete n characters, and n[Q[2.2HE]] means erase n lines.

The following commands insert characters into the workspace. text stands for the group of characters to be inserted. ['j]
[Q[2.2HI;[2.6Htext];]] Insert the characters at the pointer position.
[Q[2.2HZ;[2.6Htext];]] Create a new line just after the line containing the pointer, and insert the characters at the start of the new line. [j]
After the execution of either command, the pointer is positioned just after the last character of the inserted string. Either command may be preceded by a repetition factor.

We shall now make some changes in the file TERM. First, copy TERM, or, if you already have it copied, move the pointer to the start of the workspace. (If, at any stage, you damage the workspace beyond easy repair, remember that the file TERM will not be affected. Just copy it and start again.) Give the command [Q[2.2HF4R]] . The pointer should be positioned at the [Q[2.2HF]] of [Q[2.2HFOUR]]. (If you are in line mode, check the pointer position by typing [Q[2.2HNP]] .) Give the command [Q[2.2H4 –]] . The word [Q[2.2HFOUR]] should disappear, and the pointer should be just before [Q[2.2HMAIN]]. Give the command [Q[2.2HI;THREE;]] . The word [Q[2.2HTHREE]] should now be in the space formerly occupied by [Q[2.2HFOUR]]. Give the command [Q[2.2HJ6I; ;]] . Six spaces will be inserted at the start of the line. Give the command [Q[2.2HF6R3–]] . The characters [Q[2.2HNET]] will be removed from [Q[2.2HCSIRONET]]. Give the command [Q[2.2H2FE]] . The line [Q[2.2HCONTROL DATA 713]] is erased, and the pointer moves to the next line. Give the command [Q[2.2HOZ;*********]]; . A line containing asterisks is inserted between the first and second lines, and becomes the new second line.

2.9 Displaying the Workspace

This section is primarily of interest to users working in line mode, though the [Q[2.2HP]] command can be used in screen mode.

The workspace can be displayed with the command
[Q[2.2H[2.6Hn]P]]
which displays (`prints') the next n lines. The pointer position does not change, that is, it is still in the first line displayed. (Note this carefully. A common mistake is to assume that the pointer moves to the last line displayed.)

Give the command [Q[2.2HO7P]] . The whole workspace will be displayed. It should read [Q][2.2H]
TERMINALS
*********
THE THREE MAIN TYPES OF TERMINAL
IN THE CSIRO SYSTEM ARE:
TELETYPE
SILENT 700
TEKTRONIX [2.6H]
To illustrate the displaying of only part of the workspace, try [Q[2.2H3F2P]] . Only the fourth and fifth lines are displayed.

Displaying (or any other operations) can be stopped by typing [9F[1.7HESC]] . Try this by typing [Q[2.2HO7P]] , then, after displaying has started, [9F[1.7HESC]] .

At this stage, having satisfied yourself that the workspace is correct, you would normally make it. Do not do this for the moment, because some of the later exercises use TERM in its original form.

2.10 Indefinite Repetition

The character @ may be used instead of a numerical repetition factor. It means `indefinitely', or `all', or `as far as possible'.

Try the following commands. [Q[2.2HO3R@–]] . The result will be [Q[2.2HTER]] . [Q[2.2HJ@–]] . The result will be an empty line, as the line now contains no characters. [Q[2.2HI;TERMINALS;]] . The result will be [Q[2.2HTERMINALS]] . [Q[2.2H5F@E]] . The response will be [Q[2.2H?]] , as the E command with a repetition factor is dangerous. Type [Q[2.2HY]] to confirm the command. The line containing the word [Q[2.2HTELETYPE]]  is now the last line of the file.

2.11 Windowing of the Display

The maximum number of characters that can be displayed on one line of a terminal is usually 72, 80, or 132. In screen mode, lines are automatically truncated at the right-hand margin.

In line mode, if a longer line is displayed, the excess characters are either superimposed at the end of the line, or they overflow onto the next line (depending on the type of terminal). This can be avoided by giving the command
nW .
where n is a number (the command is a full stop). This causes subsequent lines to be truncated to n characters before being sent to the terminal.
Similarly, the command
mN .
restricts the display of lines to columns m and greater. In combination, these commands can be used to display a `window' on columns m to n.

If you are in screen mode, enter line mode. Create a new line containing 120 characters by giving the command [Q[2.2HZ;;12I;1234567890;J]] . Then give the command [Q[2.2H72W  .]] , and observe the difference in the way the line is displayed.

In screen mode, only the first 80 characters of each line are normally displayed. You can have the first 132 characters displayed, in compressed symbols, by entering [Q[2.2HW132]] before you run TED (this is short for [Q[2.2HSET TERMINAL /WIDTH=132]]). To restore the 80-character mode, quit and enter [Q[2.2HW80]] .

2.12 Searching

You now know enough TED commands to do any editing job. In fact, you may have noticed that a given task can be carried out in several different ways, and that you could get by with an even smaller set of commands. However, if you try to do much editing using only the commands already described, you will soon find that the most time-consuming part is getting the pointer correctly positioned. The two commands described next are designed to help with this problem.
[Q[2.2HS;[2.6Htext];]] Search for the specified group of characters.
[Q[2.2HD;[2.6Htext];]] Delete the specified group of characters.
These commands move the pointer forward in the workspace until the specified group of characters (text) is found, and position the pointer at the next character. The [Q[2.2HD]] command also deletes the characters, and closes up the gap. Either command may be preceded by an up-arrow (^), which cause the search to be carried out backwards from the current position.

Copy TERM. (Note that TED will ask for confirmation of this command, because the workspace has been changed since the last make. In normal editing, you would abort the command line and make the file before attempting the copy again. However, in this case, you can confirm the command, because we do not want to keep the changes.) Give the command [Q[2.2HS;ARE;]] . The pointer should be positioned at the colon. Give the command [Q[2.2HS;MAIN;]] . The response will be
[Q[2.2H"S" FAILED.]]
The search has failed because the pointer was already past [Q[2.2HMAIN]] when the command was given. After the failure of the search, the pointer is positioned at the start of the last line of the workspace. Try [Q[2.2HOS;MAIN;]] or [Q[2.2H^S;MAIN;]] , and the search will succeed.

Now try making the same alterations as before using the [Q[2.2HD]] command where possible. For example, the second line could be altered with the command
[Q[2.2HOD;FOUR;I;THREE;J6I; ;]]

Next, copy TERM again, and make the alterations using [Q[2.2HS]] and [Q[2.2H–   ]], but not [Q[2.2HD]] . For example, change [Q[2.2HCSIRONET]] to [Q[2.2HCSIRO]] with [Q[2.2HS;CSIRO;3-]] .

Finally, display and check the workspace. When you are satisfied that it is correct (as shown in section 2.9), make the file with the command [Q[2.2HM;*;]] .

2.13 Tabs

The character " carries out the function of the tab key on an ordinary typewriter. When " is encountered in a group of characters being inserted in the workspace, it causes the pointer to skip to the position of the next tab, and insertion of the rest of the characters continues from there.

The tabs are set or cleared by the command
n[Q[2.2H"]]
where n is a number. If n is 0, all the tabs are cleared. Otherwise, a tab is set in position n.

When no tabs are set, " behaves like an ordinary character, and can be inserted in the normal ways. This is the default condition.

Try the command [Q[2.2HZ;A"BCDEF;7"Z;G"HI;BJ2P]] . The result will be
[Q[2.2HA"BCDEF]]
[Q[2.2HG HI]]

The command
[Q[2.2HN"]]
(`No' tabs) deactivates the tabs without clearing them, and
[Q[2.2HW"]]
(`With' tabs) reactivates them. The command
[Q[2.2H:;[2.6Hc];]]
where c is any character, changes the tab character to c.

2.14 Re-entering Input Mode

As already described, new lines can be placed in the workspace by the Z command. However, if several new lines have to be inserted at the same place, it is more convenient to get back into input mode. The pointer must first be moved to the line after which the new lines are to be inserted. Then input mode is entered by giving the command
[Q[2.2HV;?;]]
As before, editing mode is restored by typing a [9F[1.7HCR]] .

We shall now add some more lines to the bottom of TERM. Copy TERM, move the pointer to the end, type [Q[2.2HV;?;]] , and then type the following lines. [Q][2.2H]
THE TEKTRONIX PRINTS ON A SCREEN, AND
CAN ALSO DISPLAY PICTURES. [2.6H]
Return to editing mode and display the workspace. It should read [Q][2.2H]
TERMINALS
*********
THE THREE MAIN TYPES OF TERMINAL
IN THE CSIRO SYSTEM ARE:
TELETYPE
SILENT 700
TEKTRONIX
THE TEKTRONIX PRINTS ON A SCREEN, AND
CAN ALSO DISPLAY PICTURES. [2.6H]
Correct the workspace if necessary, and then make it.

2.15 Joining Files

It is sometimes necessary to combine two or more files into one. This can be done with the command
[Q[2.2HV;[2.6Hname];]]
which inserts the file name in the workspace, immediately after the line currently containing the pointer. The complete procedure to join two files would be: copy the first file; move the pointer to the last line of the workspace; insert the second file with a V command; make the workspace into a third file.

We shall illustrate this command by adding some lines in the middle of TERM. First, make up a file containing the following lines. (For the blank line, you must type in a blank character before typing [9F[1.7HCR]] , otherwise TED will return to editing mode. [Q][2.2H]
THEIR RESPECTIVE PRINTING SPEEDS ARE
10, 30, AND 120 CHARACTERS PER SECOND.

THE FIRST TWO PRINT ON PAPER. [2.6H]
Call the file MIDDLE. Now copy TERM, move the pointer to the line containing [Q[2.2HTEKTRONIX]] , and give the command [Q[2.2HV;MIDDLE;]] . Display the workspace. It should read [Q][2.2H]
TERMINALS
*********
THE THREE MAIN TYPES OF TERMINAL
IN THE CSIRO SYSTEM ARE:
TELETYPE
SILENT 700
TEKTRONIX
THEIR RESPECTIVE PRINTING SPEEDS ARE
10, 30, AND 120 CHARACTERS PER SECOND.

THE FIRST TWO PRINT ON PAPER.
THE TEKTRONIX PRINTS ON A SCREEN, AND
CAN ALSO DISPLAY PICTURES. [2.6H]
Now make the workspace. Notice that the file name is still TERM (not MIDDLE).

2.16 The Journal File

Whenever you use TED, every command entered, including responses to queries, is recorded in a special file called a journal file. The name of the journal file takes the form
[Q[2.2HT]]dddhhmm[Q[2.2H.JOU]]
where ddd is the day number of the year (1-366) on which the file was created, and hhmm is the time (in hours and minutes) at which the TED session began. The file is cleared after every M (`make') command, and when you quit from TED, the file is deleted. However, if TED terminates abnormally, the journal file is saved. In order to recover lost editing, log into TED again, copy the file you were working on, and enter the command
[Q[2.2HK;T]]dddhhmm[Q[2.2H.JOU;]]
where the file name in delimiters is that of the appropriate journal file.

2.17 Cut and Paste

The cut and paste facility provides a mechanism for moving or copying blocks of text within a file or from one file to another. Selected text is saved in a temporary file called a paste buffer, and can then be inserted at any point in the file. The specified section of text may optionally be deleted from its current position in the file when the paste buffer is created.

To define the contents of the paste buffer, move the pointer to the position occupied by the first character of the required text block. Enter the command | (`cut'). Move the pointer to the position after the last character of the required block. If you are using screen mode, the selected text is highlighted. Then enter a second | (`cut') command (or [12F'] | if the text is also to be deleted). The message CUT COMPLETED (or CUT AND DELETE COMPLETED) appears.

To subsequently insert the contents of the paste buffer elsewhere in the file, use the command [Q[2.2HV;]]|[Q[2.2H;]] to insert the text after the current line or [Q[2.2H'V;]] | [Q[2.2H;]] to insert the text at the current character position. [Q[2.2H^|]] is synonymous with the latter command.

TED has only one paste buffer, which means that subsequent cut operations will overwrite the previous contents of the buffer. However, the paste buffer can be stored in a named file by using a # command before the second cut command:
[Q[2.2H#;[2.6Hname];]] |
Note that both commands must be on the same line.

The paste buffer is deleted on exit from TED.

Acknowledgements

I am grateful to D. Fraser, of the (then) CSIRO Division of Computing Research, for permission to use and modify TED.

A1. Differences between TED and ED

This Appendix describes the ways in which TED differs from the CSIRONET Cyber 840/845 editor, ED.

A1.1 Interaction between the Editor and its Environment

Control characters, other than those with special interpretations (such as [9F[1.7HDEL]]), are treated in the same way as ordinary characters.

The prompt character may be changed from colon to a bell by means of the TED command ` , and back to colon by ^` . (On CSIRONET, this is handled by the network.)

A1.2 Discrepancies

There is no distinction between `ASCII' and `DISPLAY' files — all files are mixed-case ASCII. (Use CAPS LOCK to work with upper-case files.)

Dual workspaces are not implemented.

ED libraries are not implemented.

File retention periods are not implemented.

[9F[1.7HCR]] repeats the last command line, rather than displaying the pointer. (The pointer is displayed by NP.)

The U command, and the use of a `repetition factor' to represent a version number, are not implemented. Device, UIC, and version may be incorporated in the file name in the standard VAX/VMS way. Version numbers are ignored in M, #, and ] commands, but not in C, [, &, and ^M commands.

Blanks are squeezed from file names.

All file-open failures (for example, an attempt to copy a file which does not exist) are soft failures. (A soft failure causes termination of the lowest-level parenthesis pair or box containing the failing command.)

M, #, and ] give soft failures if the specified file already exists, except that M does not fail if the file name is the same as at the last successful copy or make. (The failure can be suppressed by using the N modifier, and a default modifier for M, #, and ] commands can be set by specifying the required modifier with an M ;  ; command.)

The T command is implemented differently.

^S, ^D, and ^A search backwards within lines as well as between lines. ^S and ^A leave the pointer at the start of the located text.

The E command gives a soft failure at the last line of the workspace. However, @E does not fail.

@F and @B do not fail.

In I;text ; , the tabs are expanded after text has been inserted, rather than before.

The reserved words CYCL, MSEC, NODE, PROJ, and USER are not implemented. The reserved words TIME and DATE return values in the standard VAX/VMS format.

The [12F'] modifier is not implemented for the commands H, < , and > .

Execution of a box takes place from a copy of the box, which is made when the box is called. Therefore, changes to a box during its execution do not affect the current execution.

A1.3 Extensions

Several levels of `safety' are provided, in which the user may be warned of potentially unsafe commands — those which change more than one line of the workspace, which change a box, or which delete a file. However, no warnings are given if the commands are in a box, or when boxes are entered through box 1. The safety levels are set as follows.
; – fully safe: warn of any danger (default).
[12F']; – warn except when danger results from a box command ($, <, H, or [ ).
2[12F']; – warn except when danger results from a box command or parentheses.
3[12F']; – warn except when danger results from a box command, parentheses, or a repetition factor.
4[12F']; – unsafe: no warnings.
The warning is signaled by the displaying of a question mark under the command. (The line may be displaced from its correct position relative to the question mark if line-editing commands such as [9F[1.7HDEL]] have been used.) Any response to a warning, other than Y, aborts the command string. Except in unsafe mode, TED displays the message MAKE ADVISABLE after every 50 changes.

M;*; and ^M;*; use the file name specified at the last successful C or M command. If no name has been specified (as at the start of execution or after C;?;), the name is requested. The current name is available through the status word NAME.

There is provision for automatically loading and executing a box program when TED starts. The details are installation dependent. On the Division of Entomology system, the file used is [dir]TED.BOX, where dir is the first level (home) user directory. The box program can be used to set the user's preferred working conditions, for example, screen mode, prompt character, safety level, tabs, relaxed mode, default modifiers for M-type commands.

Soft-failing commands (except E) display an error message except when the command is in parentheses or a box. The last error message, whether displayed or not, is available through the status word MESS.

The previous command line is available through the status word WHAT.

^Z and ^V cause the specified text to be inserted above the current line. [12F']Z and [12F']V cause the specified text to be inserted in place of the current line.

[12F']I causes the specified text to replace any existing text. It is equivalent to n–I , where n is the number of characters in the text string.

NY converts the next character to upper case. WY converts the next character to lower case.

The & command (for joining files) is implemented.

nNC or nNV cause copying to start from line n of the file.

The tab character [9F[1.7HHT]] may be used in the standard DEC way. The character is inserted literally in the file, and is expanded only during printing (by the device driver). The tab positions are 9, 17, 25, etc. The [9F[1.7HHT]] characters may be entered directly or indirectly. Indirect entry is set by the command ^: ;c ; — any subsequent occurrences of c in text strings are converted to [9F[1.7HHT]] .

\C and \M copy and make with expansion of the tab control character [9F[1.7HHT]] to spaces. If the current ED-type tab character is not [9F[1.7HHT]] (set by : ; [9F[1.7HHT]] ;), the tab positions used in the expansion are the standard DEC positions: 9, 17, 25, etc. Otherwise, the current ED-type tab positions are used. [2.6H] [5z][1.5'z] [160W][240D] [2.5"T] [16#]

A2. Summary of TED Commands

[2.6HFile Access]

 

C ; name ; Copy the file name to the workspace.

V ; name ; Insert the file name into the workspace after the current line. If name is | , the contents of the current paste buffer are used.

[1.5H^]V ; name ; Insert the file name into the workspace before the current line.

[12F'] V ; name ; Insert the file name into the workspace at the current pointer position.

M ; name ; Make the workspace into the next-highest version of the file name. If name is *, the current file name is used — that is, the name used in the last successful copy or make. The command fails if the file already exists, unless name is the current file name, or the modifier N is present.

M ; ? ; Clear the current file name.

[1.5H^] M ; name ; Delete the file name. The default version is the lowest. If name is *, the name used in the last successful copy or make is used.

mM ;  ; Set m as the default modifier for M, #, and ] commands. m may be N or absent.

# ; name ; Create the next-highest version of the file name, with contents specified by the following P, ?, &, or | commands. The file is terminated at the end of the current command string, or at the next # command, whichever comes first. The command fails if the file already exists, unless the modifier N is present.

# ;  ; Finish the file being created by a preceding # command.

& ; name ; Add the file name to the file being created by a preceding # command.

K ; name ; Read commands and/or data from the file name instead of from the keyboard.

[1.5H^] K ;  ; Terminate reading from the file named in the last K command.

[2.6HDisplaying the Workspace]

 

NP In line mode, display the pointer position. In screen mode, return to line mode.

nWP Initiate screen mode. If n is present, it indicates the number of lines to be displayed. The terminal must be VT100 or VT220 compatible.

nP Display (`print') the next n lines. The pointer position is not changed.

[1.5H^] nP Display the previous n lines. The pointer position is not changed.

[12F']nP Display n lines, centred on the current line. The pointer position is not changed.

nW. In line mode, display only columns 1 to n of the line.

nN. In line mode, display only columns n onwards.

n . Same as nW. if n is greater than 1. If n is absent or 1, cancel other `.' commands — i.e. display the full line.

[2.6HPointer Movement]

 

O Move the pointer to the start of the workspace (`origin').

[1.5H^] O Move the pointer to the start of the last line of the workspace.

J Move the pointer to the start of the line (`justify').

[12F'] J Move the pointer to the first non-blank character in the line.

[1.5H^] J Move the pointer to the end of the line (the column after the last character in the line).

[12F'][1.5H^] J Move the pointer to the position after the last non-blank character in the line.

nL Move the pointer n positions to the left.

[12F']nL Move the pointer n words to the left.

nR Move the pointer n positions to the right.

[12F']nR Move the pointer n words to the right.

nB Move the pointer n lines back.

[12F']nB Move the pointer n `paragraphs' back. (`Paragraphs' are delimited by blank lines.)

nF Move the pointer n lines forward.

[12F']nF Move the pointer n `paragraphs' forward. (`Paragraphs' are delimited by blank lines.)

nS ; text ; Search for the n-th occurrence of text after the current pointer position.

[1.5H^] nS ; text ; Search for the n-th occurrence of text before the current pointer position.

nWS ; text ; Restrict the search operation to columns 1 to n.

nNS ; text ; Restrict the search operation to columns n and greater.

n[12F'] S ; text ; Restrict the search operation to n lines, including the current line.

mS ;  ; Use the modifiers specified in m for all subsequent S commands. m may contain any of the modifiers N, W, and [12F'] . If m is absent, no modifiers will be used.

[2.6HText Insertion]

 

C ; ? ; Clear the workspace and enter text-input mode.

V ; ? ; Enter text-input mode. The text is added below the current line.

[1.5H^] V ; ? ; Enter text-input mode. The text is added above the current line.

[12F'] V ; ? ; Enter text-input mode. Text insertion begins at the current pointer position.

[.66H[9FCR]] Return from text-input mode to editing mode.

I ; text ; Insert text at the pointer position.

[12F'] I ; text ; Insert text at the pointer position, the new text being inserted over any existing text.

Z ; text ; Insert a new line, containing text, after the current line.

[1.5H^] Z ; text ; Insert a new line, containing text, above the current line.

[12F'] Z ; text ; Insert a new line, containing text, in place of the current line.

| Mark the start or end of a paste buffer. If the second | is preceded by the modifier [12F'] , the marked text is deleted from the workspace, but remains in the paste buffer.

[1.5H^] | Insert the contents of the paste buffer at the current pointer position (equivalent to [12F'] V ; | ;).

n+ Insert n blanks at the current pointer position.

[2.6HText Deletion]

 

nD ; text ; Delete the n-th occurrence of text after the current pointer position. Command modifiers are the same as for the S command.

mD ;  ; Use the modifiers specified in m for all subsequent D or A commands. m may contain any of the modifiers N, W, and [12F'] . If m is absent, no modifiers will be used.

nA ; text ; Replace the n-th occurrence of text, after the current pointer position, with blanks. Command modifiers are the same as for the S command.

n Delete n characters from the current line, starting from the current pointer position.

[12F']n Delete n words from the current line, starting from the current pointer position.

nY Replace n characters, starting from the current pointer position, with blanks.

[12F']nY Replace n words, starting from the current pointer position, with blanks.

nE Erase n lines, starting from the current line.

[12F']nE Erase n `paragraphs', starting from the current pointer position.(`Paragraphs' are delimited by blank lines.)

[1.5H^] nE Erase n lines above the current line. The first line erased is the one above the current line.

[12F'] [1.5H^] nE Erase n `paragraphs' above and including the current paragraph. Erasure begins to the left of the current pointer position. (`Paragraphs' are delimited by blank lines.)

[2.6HText Rearrangement]

 

n% Move the current character and the pointer n columns to the right.

[1.5H^] n% Move the current character and the pointer n columns to the left.

nX Move the current line and the pointer n lines forward.

[1.5H^] nX Move the current line and the pointer n lines backward.

G Split the current line into two lines. The current pointer position becomes the start of the second line.

[1.5H^] G Join the current line to the end of the previous line.

[2.6HCase Conversion]

 

NnY Convert n characters, starting from the current pointer position, to upper case.

[12F'] NnY Convert n words, starting from the current pointer position, to upper case.

WnY Convert n characters, starting from the current pointer position, to lower case.

[12F'] WnY Convert n words, starting from the current pointer position, to lower case.

[2.6HTabs]

 

When the `tab character' is encountered in the text of I or Z commands, or in text-input mode, blanks are inserted so that the following text starts at the next tab position. Initially, no tabs are set, and the tab character is " .

n" Set a tab at column n.

0 " Clear all the tabs.

:  ; c ; Alter the tab character to c. If the modifier [1.5H^]  is present, c in subsequent text strings is converted to the tab control character [9F[1.5HHT]] (instead of blanks being inserted).

N " Deactivate the tabs (`No tabs').

W " Reactivate the tabs (`With' tabs).

\C ; name ; Copy the file name to the workspace, replacing the tab control character [9F[1.5HHT]] with spaces. If the current TED-type tab character is not [9F[1.5HHT]] (set by : ; [9F[1.5HHT]] ;), the tab positions used in the expansion are the standard DEC positions: 9, 17, 25, etc. Otherwise, the current TED-type tab positions are used.

\ M ; name ; Make the workspace into the next-highest version of the file name, with tab expansion as for \C.

[2.6HRunning Other Programs]

 

* ; command ; Submit command to VMS, and return to TED when command has finished.

* ;  ; Suspend execution of TED and pass control to VMS. LOGOUT or LO returns control to TED.

[2.6HRepetition and Branching]

 

[.66H[9FCR]] Repeat the last command.

n@ Repetition factor equal to 10000 if n is 0 or absent, otherwise equal to the value in bx n.

n (string) Execute string n times. A `soft' command failure in string causes termination of the lowest-level parenthesis-pair or box containing the failing command. A `hard' failure causes execution of the command string to stop completely. The following errors cause hard failure: invalid command, missing text delimiter, invalid box number.

[12F'] (string) Query before executing string. If the user's response is Y, string is executed; otherwise, it is skipped.

n= Skip to the nth comma following the = in the command string.

, Mark a place in a command string where skipping, initiated by an = command, may terminate.

[2.6HBox Commands and Status Words]

 

nH[ ]; string ; Hold string in box n.

nH ;  ; Clear box n.

n< Store the contents of the current line in box n.

n> Replace the current line by the contents of box n.

n$ Execute the contents of box n.

nT ; number ; Add number to the contents of box n.

[1.5H^] nT ; number ; Subtract number from the contents of box n.

x[12F'] 0 [12F'] Use the next line entered on the terminal as the text string of the command x.

x[12F']n [12F'] Use the contents of box n as the text string of the command x.

x[12F']word [12F'] Use the status corresponding to word as the text string of the command x. word may be COLM (current column number), DATE, LINE (current line number), NAME (file name used in last successful copy or make), MESS (last error message), SIZE (number of lines in workspace), TIME, WHAT (last line typed), or ENDK (whether finished reading from file named in K command: 1=Yes, 0=No).

? ;  ; Display the contents of all the boxes.

? ; text ; Display text. In screen mode, if the modifier [12F'] is present, text is displayed in the screen area rather than in the message area.

] ; name ; Save the contents of the boxes as the next-highest version of the file name. The command fails if the file already exists, unless the modifier N is present.

[ ; name ; Copy the highest version of file name into the boxes. The file must be in the appropriate format, as follows. Lines starting with * are treated as comments. The contents of a box is specified as a pair of lines, the first starting with the box number, and the second containing the contents of the box. The box number may be followed by a comment, which must be separated from the number by at least one blank.

[ ;  ; Clear all the boxes.

[2.6HEditing Modes]

 

[1.5H^] ; Set relaxed editing mode, in which single-character text strings do not require delimiters.

n[12F'] ; Set danger level. n absent or n = 1 : warn except when danger results from a box command ($, <, H, or [ ). n = 2 : warn except when danger results from a box command or paren\theses. n = 3 : warn except when danger results from a box command, parentheses, or a repetition factor. n = 4 : no warnings.

; Clear relaxed editing mode, and set lowest danger level.

[2.6HDelimiters]

 

; / ! Text delimiters.

[12F'] Delimiter used with boxes and status words.

 


DELTA Home DELTA Home Page