Trailing-Edge - PDP-10 Archives - steco_19840320_1er_E35 - 10,5676/teco/manual/tecsim.rnm
There is 1 other file named tecsim.rnm in the archive. Click here to see a list.
.Chapter Simple Editing
This is a working subset of TECO. It presents enough TECO for one
to create and modify files. However, the material presented herein is
correct (hopefully) but not complete. Complete descriptions and explanations
can be found in the remainder of this document.
.HL1 Making and changing files
TECO can be invoked either to edit an existing file or to create a new
file.  The way TECO is invoked depends on the operating system and may
vary from system to system.  
.HL2 The TOPS-10 Operating System
The commands
that invoke TECO are MAKE and TECO.
.ENTRY ^Operating ^System ^Commands
.ENTRY ^Operating ^System ^Commands ><MAKE
.ENTRY ^Operating ^System ^Commands ><TECO
.HL3 Making a new file
&.MAKE filespec
 The command "MAKE filespec" invokes TECO. When the user exits from TECO the
file specified by "filespec" is saved permanently. If that file
already existed and is not protected, it will be destroyed by the
new one. If the file already exists you will be warned:
%TECSUP Superseding existing file 'filename'
If the file exists and is protected TECO will give the error message:
?TECPRT Protection failure or directory full on a DECtape for 'filename'
However if one does not wish to superceed the old file, typing
"_^^C" (control-^C) twice will kill TECO without any damage to the original 
.ENTRY ^Operating ^System ^Commands ><MAKE
&.TECO oldfile
.ENTRY ^Operating ^System ^Commands ><TECO
The TECO command is used to edit an already existing file. If
the file does not exist or is protected then TECO will respond with an error
message. One can then escape from TECO by typing "_^^C" (control C) twice.
.HL2 The TOPS-20 Operating System
.HL1 Executing Commands
.index prompt
When TECO prompts with an asterisk "*", it is waiting for input;  at this point
you may enter commands. What you type will not be executed
until you type two escape characters in succession.  The escape key
is marked either ESC, ESCAPE, ALT or ALTMODE.  If 
there is no escape key on the 
termimal, use "_^^[" (control-[). Escape echos like dollar sign ($). 
For example,
.INDEX escape
.INDEX altmode
types the contents of the buffer. To correct typing errors before them,
use "_^^H" or the delete key to delete one character at a time; to
erase the whole command, type "_^^G_^^G".
.HL1 Commands
Elementary commands for moving the pointer, inserting, deleting and
typing out are explained in this section.
The complete explainations 
of all the commands can be found in the command summary chapter.
.HL2 Positioning the Pointer
.index moving the pointer
TECO is a position oriented text editor.  The pointer is the
number of characters from the beginning of the buffer.
Where many commands take effect depends on the position of the pointer.
.HL3 Moving Character by Character
.index ^Command ><C
  The C command takes a number as an argument and moves
the pointer that number of characters.  Positive numbers
move the pointer to the end of the text buffer; negative numbers 
moves the pointer towards the beginning of the buffer.  This means that
a "1C" command will move the pointer one character position towards the
end of the file, while a "-1C" command will move the pointer one character
back towards the beginning.
 Here is an example of the C command:
If the pointer is between represented by
the "_^" symbol in the text "DEC_^system" then a "3C" command will result
in the pointer being positioned as follows: "DECsys_^tem".
.note ** Note **
An end of line is two charcters, a carriage return and a line feed.
This means that you must be careful moving the pointer over the
end of a line.
.end note
.HL3 Moving Line by Line
.INDEX ^Command ><L
The L command causes the pointer to be advanced to after the
Nth end of line character, where N is the argument given to the command.
A negative number will cause the
the pointer to be moved backwards and a zero means to position the pointer
at the beginning of the line it is currently in.
&*5L$$	; Advance five lines.
&*0L$$	; Position to the beginning of the current line.
.HL3 Jumping to Absolute Positions
.B.index ^Command ><J
The J command allows you to position the pointer to an absolute character
location in the text buffer.  The character locations is specified by the
argument that is given before the command.  The location before the first
character in the text buffer is considered to be zero, before the second,
one, and so on.
The two most useful forms of the "J" command are:
&*J_$_$ ; puts the pointer before the first character in the text buffer and
&*ZJ_$_$ ; puts the pointer after the last character in the text buffer.
"J" is identical to "0J". "Z" is the number of characters in the buffer.
.HL2 Inserting text into the buffer
There are two basic ways to insert text using TECO.  The I command and
.index ^Command ><I
.index ^Command >^Control ^I (_^^I)
_^I (or tab) command.
Both of these commands are terminated by an escape character to denote
the end of the string that is to be input.  Some control characters can
not be directly inserted into the buffer.
.HL3 I command
.B.index ^Command ><I
The I command will insert the text that follows it into the current
text buffer.  The text being inserted is normally refered  to as an
insert string; it is terminated by an escape character. 
.note ** Note **
If you continue typing after you reach the right margin, the rest of the line will be displayed on successive lines even though
you did not type any _<returns_>. TECO treats this as one long line!
Line oriented commands, like
L and K, operate on the line as it is not as it appears. 
.end note
 An example of an I command is:
&*IThis is inserted on the first line.
This is inserted on the second line.
.HL3 Control I command (Tab)
.b.index ^Command >^Control ^I (_^^I)
The Control I insert command is identical to the I command, except that the
_^I (tab) is also inserted.
.index ^Command ><I
.index ^Command >^Control ^I (_^^I)
 An example of this is:
_*########This text follows a tab.$$
.note ** Note **
It is a good habit to type a carrage return at the end of each insertion.
Consistency will help you to avoid mistakes like entering two lines that are
actually one because there is no carrage return between them. Furthermore,
some programs and compilers cannot read the last line of a file unless
it is followed by a carrage return.
.end note
.HL2 Type out
In order to see what you are doing and where the pointer is you must list
portions of the text. 
To type n lines of text, enter "nT". If n is positive,
then n lines after the pointer will be typed, if n is zero then the line 
containing the pointer up to the pointer will be typed and if n is negative
then n lines before the pointer are typed. Note: the T command does not move
the pointer. Here are some typial command strings:
HT_$_$ ; Types the whole contents of the buffer.
-5T5T_$_$ ; Types the five lines before and after the pointer.
.index ^Command ><T
.HL2 Delete
There are two basic ways of deleting text in TECO.  The D command will delete
a specified number
.index ^Command ><D
of characters. The K command will delete a specified number of lines.
.index ^Command ><K
.HL3 Deleting Character by Character
.b.index ^Command ><D
The D command deletes a specified number of characters.  It
takes a single numeric argument before it to specify the number of characters
to be deleted.  If the argument is not supplied it will default
to one.
.HL3 Killing Lines
.b.index ^Command ><K
  To save yourself from much unnecessary character counting, you can delete
whole lines with the K command. The syntax, as you may have guessed, is nK,
where n is the number of lines to delete; positive values of n delete towards
the end of the buffer and negative towards the beginning. Zero is special.
0K deletes from the beginning of the current line to the pointer.
.HL2 Searching and Replacing
TECO contains a set of command that search for a
specific string and optionally modify it.
.HL3 Searching for a string
.b.index ^Command ><S
.index searching
The S command searches for a specific string.  The
string is specified directly after the S command and must be ended with an
escape character.
 &*Sstring to look for$$
 The above example will search for the string "string to look
for".  If the string is not found, TECO will give the error message,
"?TECSRH Cannot Find 'string to look for'"
and leave the pointer where it was.
If the string was found then the pointer will be left after the end of the
.HL3 Replacing one string with another
.index ^Command ><FS
.index replacing strings
This command will search for the specified text string and then replace the
text that was found with the second text string specified in the command.
The format of the command is:
&*FSold string$new string$$
 This searches for the "old string" and replaces it with the 
"new string".  If the "old string" is not found then "?TECSRH Cannot
find 'old string'" is displayed and the pointer is left where it was.
If successful, that is, the "new string" replaces the "old string" then the
pointer will point to the end of "new string". You may include end of line
characters in search or replace strings.
.HL2 Exiting
.index exiting <TECO
When you are finished editing, you can either save the changes and additions
you made or you can abort them leaving the file as it was before you started
.HL3 Saving your changes
.index ^saving the file
.index ^Command ><EX
The EX command will cause the editing session to be saved and TECO
to exit directly to the operating system.
Type EX$$ and your changes will be saved. The obselete version of the file
(if there was one) then becomes a backup file.
.note ** Note **
.end note
.HL3 Aborting TECO
.b.index ^Operating ^System ^Commands >^Control ^C
.index ^Command >^Control ^C (_^^C)
Typing _^^C stops TECO. The monitor will prompt and monitor commands
can then be given. No changes are made to the original file if there was one
and if the file was newly created it will not be made permanent. However,
if inadvertently you type _^^C, do not panic -- the file is intact but you
must immediately type:
If you do anything else in between you may "smash your core image", i.e.
lose everything done in the previous TECO session.