Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50334/tops6t.gno
There are no other files named tops6t.gno in the archive.
%switch qz false
%if qz
%nocontrolc
%nextlesson pub("TOPQ");
%ifend qz
%qend begin integer misscount;
%TEXT
Text editing with TECO.
======================

TECO is one of the most powerful text editors on the DEC 10.
This course will not teach you all commands of TECO, only a
few of the mostly used ones.
%TEXT ESCAPE:
The ESCAPE key.
===============

A very important key on your keyboard is the ESCAPE or ALTMODE key.
This is used all the time by TECO.
If the ESCAPE key does not work, or if there is no such key,
you could sometimes push CONTROL-# instead, that is simultaneously
pushing the CONTROL and "#" key on your terminal. On other
terminals you should use CONTROL-[ or CONTROL-$ to get ESCAPE.
If nothing works, please consult your local system manager.

The ESCAPE character is not printable. Therefore, in this
lesson it will be printed as $. Wherever the $ character occurs
in this lesson, it does not really mean $, it means ESCAPE.
%QUESTION printESCAPE:
Push the ESCAPE key!
%RIGHT 
%wrong stop
Write "%" if you want to stop.
%extra
%wrong $
Press the ESCAPE key, not the character it will be printed as.
%wrong [
%same
%wrong #
%same
%wrong ESC
Push the ESCAPE key. Do not type the whole word ESCAPE.
%wrong CONTROL
Push the CONTROL key and another key. Don't type the
word CTRL or CONTROL or the character "^"!
%wrong CTRL
%same
%wrong ^
%same
%WRONG
%wrong
%WRONG
Your terminal and the computer probably do not quite understand
each other. This may be remedied by the tty command, ask someone
about it.
%GOTO printESCAPE
%TEXT PAGE; INSERT:
Inserting text into the file.
============================

The first thing you do when you are creating a new file is to
insert some text into the new file. You do this by using the
"INSERT" command which is written with the single letter "I".
After "I" follows the text to be inserted, and the text is
finished by an ESCAPE.

EXAMPLE: to insert the text "BEGIN" you type "IBEGIN$".
%QUESTION insertend:
What do you type to insert the text "END" into the file?
%NOEXTRA
%RIGHT IEND
%right iend
%extra
%wrong IEND 
There should not be any space between "END" and ESCAPE.
%wrong CONTROL
Do not write the character sequence "CONTROL", push the key labelled
CONTROL or CTRL on your terminal.
%wrong ctrl
%same
%wrong #
You wrote "#" when you probably intended ESCAPE. CONTROL-# means
ESCAPE, and is printed by first pushing the CONTROL key, then keeping
that key down, then pushing the # key while keeping the CONTROL key,
then releasing both keys.
%wrong {
You wrote "{" when you probably intended ESCAPE. CONTROL-# means
ESCAPE, and is printed by first pushing the CONTROL key, then keeping
that key down, then pushing the # key while keeping the CONTROL key,
then releasing both keys.
%ALGOL COMMENT $ BELOW SHOULD BE DOLLAR, NOT ESCAPE;
%WRONG IEND$
The last character "$" should not be "$" but "ESCAPE".
%wrong IENDA
You wrote the letter "A" when ESCAPE was expected. Try CONTROL-#
if ESCAPE does not work on your terminal.
%wrong I END 
You wrote CONTROL-A instead of CONTROL-#. A is the
first letter of the alphabet, # the second last.
%WRONG IEND
You did not type ESCAPE. Maybe the ESCAPE key is not working
as it should on your terminal? Try CONTROL-# instead.
%wrong I END
There should not be any space between "I" and "END".
%lack 
You did not type ESCAPE. Maybe the ESCAPE key is not working
as it should on your terminal? Try CONTROL-# instead.
%wrong ESCAPE
ESCAPE is a special key on your terminal. It is on some
terminals labelled ALTMODE. If you cannot find it, or if it does not
work, try CONTROL-# instead.
%lack i
The INSERT command in TECO is the letter "I". Your answer did not
contain this letter.
%WRONG
First you type "I", then the string to be inserted, and then
ESCAPE. Nothing more, no blanks allowed.
%WRONG
%SAME
%WRONG
You should type "IEND$".
%GOTO NEXT
%EXTRA
%TEXT
You can also insert several lines of text with one insert command.
EXAMPLE: to insert the text
"BEGIN
    TEXT FIRSTWORD, SECONDWORD;
"
You should type on your terminal
IBEGIN
   TEXT FIRSTWORD, SECONDWORD;
$
You end each line by pushing the RETURN key, just as you would do
on an electric typewriter.
%QUESTION misscount:= qcount - score; if false then TWOLINES: nopause:= true;
Write the TECO command to insert the two lines
ABC
DEF
into your file.
%NOEXTRA
%NEUTRAL IABC
%GOTO NEXT
%right iabc
%extra
%wrong IABC
Your answer was right except for the unexpected characters.
%algol extratest;
%lack i
The TECO insert command is spelled "I".
%wrong i abc
Do not write any space between "I" and "ABC".
%wrong begin
You are trying to insert the text "BEGIN" into the first line, but
that was not asked for.
%wrong text
You are trying to insert the text "TEXT" into the first line, but
that was not asked for.
%wrong i
Immediately after "I" you should write the first line to be inserted
that is "ABC".
%wrong 
You should not push the ESCAPE until the end of the whole text
which you are to put in. Since the text contains two lines, you
should not push ESCAPE until after the end of the second line.
The end of the first line is indicated by "RETURN", not by "ESCAPE".
%wrong DEF
You tried to put the text "DEF" into the first line, not into the
second line. You indicate a new line by pushing "RETURN".
You must thus push "RETURN" before typing the text "DEF".
%wrong ,
You tried to put in the character comma(",") into the text,
but you were not asked to do that.
%WRONG
First you should type "I", and then the first line to
be inserted, and then push RETURN.
%WRONG
%WRONG
Type "IABC" and then push RETURN.
%WRONG
%SAME
%WRONG
Time for some repetition.
%GOTO INSERT
%QUESTION comment def; nopause:= TRUE;
%noextra
%NEUTRAL DEF
%GOTO NEXT
%right def
%extra
%wrong 
To put in a whole line into the text, you must push "RETURN" after
the line, since "RETURN" will put an end-of-line indicator into
the text file. Thus push "RETURN" before pushing "ESCAPE".
%goto twolines
%wrong abc
You are trying to put the text "ABC" into the second line,
although you have already put that text into the first line.
%goto twolines
%wrong begin
You are trying to put the text "BEGIN" into the second line,
but you were not asked to put the text "BEGIN" into the text
file at all.
%goto twolines
%wrong ,
You are trying to put the character comma(",") into the text
file, but you were not asked to do that.
%goto twolines
%wrong def
The second line of your answer was right expect for the unexpected
characters:
%algol extratest; goto twolines;
%WRONG
The first line was right, but the second line should just be "DEF".
%GOTO TWOLINES
%QUESTION comment abc/def/$; nopause:= TRUE;
%noextra
%RIGHT 
%extra
%wrong $
You typed "$" instead of ESCAPE.
%goto twolines
%wrong ESCAPE
ESCAPE is a special key on your terminal, not a string
of characters. If you cannot find it, try
CONTROL-# instead.
%goto twolines
%wrong #
To get CONTROL-# you first push the button labelled CONTROL or CTRL
on your terminal. Then you push the # key without releasing the
CONTROL key.
%goto twolines
%WRONG
The first two lines were right, but on the third line, you should
have typed ESCAPE(and nothing else) to finish the "INSERT" command.
%GOTO TWOLINES
%WRONG
Time for some repetition.
%GOTO INSERT
%qend if qcount - score <= misscount then goto pointer;
%question if false then twolinesrepetition: nopause:= true;
Write the TECO command to insert the two lines
XX
YYY
into your file.
%noextra
%neutral IXX
%goto next
%right ixx
%extra
%lack i
A TECO insertion should begin with the letter "I".
%wrong 
No "ESCAPE" is necessary on the first line.
%wrong
First you should type "I", then the first line to
be inserted, and then push RETURN.
%wrong
%same
%wrong
Type "IXX" and then push RETURN.
%wrong
%same
%wrong
Time for some repetition.
%goto insert
%question comment yyy; nopause:= true;
%neutral YYY
%goto next
%right yyy
%extra
%wrong 
You must finish the second line by typing "RETURN" before
ending the TECO insertion by typing "ESCAPE".
%goto twolinesrepetition
%wrong
The first line was right, but the second line should be
just "YYY" followed by RETURN and nothing else.
%goto twolinesrepetition
%question comment xx/yyy/$; nopause:= true;
%right 
%wrong
The first two lines were right, but the third line in input
to TECO should just contain an ESCAPE(ALTMODE) character
and nothing else.
%goto twolinesrepetition
%TEXT POINTER: if lastrights > 0 then
The last question was difficult, but you made it,
which shows that you are clever.
%text

Moving the position pointer in the text file.
============================================

When you are using TECO, there is always an imaginary pointer
referring to a position in a file. Usually, the pointer refers
to the end of the place where the last TECO command was done.
After the TECO command "IABC$", this pointer is thus referring
to the character after the newly inserted "C" in "ABC".
Each new TECO command always begins its actions where this
pointer is referring.

Example: If an insert("I") command is done in the string
"123456789" with the pointer referring to the
"6", then the new insertion is done between "5" and "6" in
the buffer.
%QUESTION rquestion:
Assume that the file contains "ABCD", that this pointer refers
to the "C", and that you execute the TECO command "IX$".
What will the file contain thereafter?
%NOEXTRA
%RIGHT "ABXCD"
%RIGHT ABXCD
%extra
%neutral "
DO NOT PRINT THE DOUBLEQUOTE IN YOR ANSWER.
%goto repeat
%WRONG ABCXD
The new string "X" is inserted in front of the place where
the pointer refers, that is in front of the "C".
%wrong ABCDX
%same
%extra
%wrong I
The letter "I" is the TECO command for insertion, not any character
inserted into the string, so your answer should not contain that
character.
%wrong $
Your answer should not contain the character "$".
%wrong 
The ESCAPE key signifies the end of the string to be inserted,
but the ESCAPE character itself is not inserted into the string,
so your answer should not contain any ESCAPE character("$").
%wrong ABXCD
Your answer was right except for the extra unexpected characters.
%algol extratest;
%lack X
The TECO command string "IX$" does insert X somewhere in the string,
so your answer must contain the character "X".
%lack D
The TECO insertion command ("I") does not remove anything from
the file, so the letter "D" should still be there.
%lack C
The TECO insertion command ("I") does not remove anything from
the file, so the letter "C" should still be there.
%lack A
The TECO insertion command ("I") does not remove anything from
the file, so the letter "A" should still be there.
%WRONG
Since the pointer refers to the c, you insert the new string
immediately before the c, that is between the b and the c.
%WRONG
%SAME
%WRONG
The correct answer is "ABXCD", the new "X" onserted immediately
before the pointer in the string "ABCD".
%GOTO NEXT
%QUESTION IF LASTERRORS > 0 THEN cquestion:
Assume that the file contains the string "1234" and
the imaginary pointer refers to the "3" and you type in the
TECO command "I9$". What will happen to the file - type in the
text of the file after this command has been executed.
%RIGHT 12934
%lack 3
The TECO "I" insert command will never remove anything
from the text file. What happened to the "3" in the original
text?
%wrong 12394
The new string "9" is inserted before the pointer, that is
before the "4" in the original file "1234".
%WRONG
%same
%WRONG
%SAME
%WRONG
Time for some repetition.
%GOTO POINTER
%TEXT PAGE; POINTERMOVE:
Some simple commands for moving the pointer:
nC = move the pointer n characters forward in the file.
nR = move the pointer n characters backward in the file.
J = move the pointer to the beginning of the current page of the file.
ZJ = move the pointer to the end of the current page of the file.
0L = move the pointer to the beginning of the current line.
nL = move the pointer to the beginning of the n-th line from
previous position of the pointer.

You should substitute an integer for "n" in the commands
"nC", "nL" and "nR" above. The integer n can be negative, to
move the pointer backwards in the file.
%QUESTION rcommand:
Assume that the file contains "ABCD" and that the pointer refers to
the "D" how do you make it refer to the "A". Type in the TECO command
to do this, and nothing else.
%NOEXTRA
%right j
%RIGHT 3R
%RIGHT -3C
%right 0l
%RIGHT 3R
The ESCAPE was not necessary, since there was no string argument to
this command. The $ marks the end of a string argument in a
command like "IABCD$".
%right -3c
%same
%right 0L
%same
%extra
%wrong n
The TECO "N" command is a search command, but you do not need
any search for the simple task in this question.
%wrong 4R
You moved the pointer too many characters to the left.
%wrong 2R
You moved the pointer too few characters to the left.
%wrong o
You probably miswrote the letter "o" instead
of the digit "0".
%wrong - R
To move the pointer a negative number of steps backwards is
the same as moving it a positive number of steps forwards.
But you should move it backwards, so delete the "-".
%wrong 3c
"3C" will move the pointer three characters forward in the
text, not three characters backward.
%wrong -3R
Two negations annul each other. "-3R" means move -3 steps
backward, that is, move 3 steps forward!
%WRONG r
Use the "R" command to move the pointer backwards. Precede it
with the number indicating how many characters you want to move
the pointer.
%wrong
%same
%WRONG
%SAME
%WRONG
The correct answer is "3R".
%GOTO NEXT
%question if lasterrors > 0 then comment "C" command;
Assume that the file contains the text "ABCDEFGH" and that the
pointer refers to the "B". How do you make it refer to the "H"?
%noextra
%right 6c
%right -6r
You could also have written "6C".
%extra
%neutral s
You have not learned the "S" command yet, so please don't use it!
%extra
%wrong 
No "ESCAPE" is necessary, since there is no string whose
end to mark with an "ESCAPE".
%wrong cc
Instead of typing "C" more than once, you can put a number in
front of the "C" indicating how many characters you want
to move the pointer.
%wrong c
The text below is wrong:
%algol extratest;
%lack c
Use the "C" command of TECO.
%lack 6c
You rightly used the "C" command, but you put the wrong number
in front of the c.
%wrong 
You do not have to print "ESCAPE" except in the following two
cases:

a) After a string argument to a TECO command such as "I".
b) Two "ESCAPE"s to cause execution of the previous command string.
%wrong
A hint: Use the "C" command.
%wrong
A hint: The "nC" command moves the pointer n characters forward
in the file.
%wrong
The correct answer is "6C", to move the pointer from the "B" to
the "H", that is, 6 characters forward.
%goto rquestion
%QUESTION comment "L" command;
Assume that the file contains the following text:
"BEGIN
BOOLEAN GOOD, BAD;
TEXT SUNSHINE, THUNDER;
"
and the pointer is referring to the "," after "SUNSHINE". How do
you write to TECO, using the L command, to move the pointer to
the beginning of the second line, that is referring to the "B" in
"BOOLEAN"?
%NOEXTRA
%RIGHT -1L
%RIGHT -L
%WRONG JL
This gives the right result, but you can manage without the "J"
if you remember that you can put a negative number in
front of the "L" to move the pointer backwards.
%EXTRA
%wrong - L
Your answer was right expect for the unexpected characters:
%algol extratest;
%wrong 
You do not have to print "ESCAPE" except in the following two
cases:

a) After a string argument to a TECO command such as "I".
b) Two "ESCAPE"s to cause execution of the previous command string.
%WRONG R
You should only use the "L" command, no other TECO command.
%WRONG C
%SAME
%WRONG J
%SAME
%WRONG I
Why do you use "I" which is an insertion command? There is nothing
to insert.
%WRONG "
Do not put any doublequote into your answer, just type what
you would type if you had been communicating with TECO and
not with this lesson.
%wrong t
"T" is a printing command, which only prints, does not
move the pointer.
%wrong L
The number in front of "L" should be "-1" to get to the start
of the previous line.
%lack l
Your answer does not contain the letter "L" indicating the
L command.
%WRONG
A hint: use a negative number in front of "L", since you want to
move the pointer backwards in the file. "01" Moves the pointer
to the beginning of the line you are in. What will then move
it to the beginning of the previous line?
%WRONG
%SAME
%WRONG
%WRONG
The correct answer is "-1L". Time for repetition.
%GOTO POINTERMOVE
%TEXT PAGE; PRINTING: if lastrights > 0 and lasterrors > 1 then
The last question was quite difficult. But you did it!! Good!!
%text

Looking at selected parts of the file.
=====================================

If you want to print out part of the text in the file on your
terminal, then you use the "T" command. Some examples:
0T = print from the beginning of this line up to pointer.
T = print from the pointer to the end of this line.
-3T = print from three lines before the pointer up to the pointer.
3T = print three lines forward from the pointer.
HT = print the whole current page from the input file.
%TEXT
EXAMPLE: if the buffer contains
"BEGIN
BOOLEAN GOOD, BAD;
TEXT SUNSHINE, THUNDER;
"
and the pointer refers to the "," after "SUNSHINE", then
"0T" will print out "TEXT SUNSHINE",
"T" will print out ", THUNDER;
"
"-T" will print out
"BOOLEAN GOOD, BAD;
TEXT SUNSHINE"

%QUESTION comment "T" command;
Assume that the buffer contains
"IN THE HALF-LIGHT SHE TOOK HIS HAND
AND PRESSED IT, WITHOUT TURNING
HER EYES TOWARDS HIM.
"
And that the pointer refers to the "," after "IT".
What will be printed by the TECO command "0T"?
%NOEXTRA
%ORDER
%RIGHT AND PRESSED IT
%wrong and pressed it ,
No, the comma (,) is after the pointer and thus not printed
by "0T".
%extra
%wrong "
Do not includethe double quote (") in your answer.
%goto repeat;
%wrong with
No, "0T" will not print the part of the line which comes after
the position of the pointer.
%wrong turn
%same
%lack it
That's not all of it! Remember, the pointer is located at the comma.
%WRONG
Remember that "0T" prints everything from the beginning of
the current line up to the pointer.
%WRONG
%SAME
%WRONG
%WRONG
The correct answer is "AND PRESSED IT". Time for repetition.
%GOTO PRINTING
%text if lastrights > 0 and lasterrors > 0 then
You may feel that I am deliberately trying to defeat
you with too hard questions. But as long as you succeed
as well as you are doing, you are still coming out on
top, are you not?
%QUESTION comment "T" command second time;
Which TECO command will print out the previous line plus the current
line up to the pointer?
%NOEXTRA
%right -t
%RIGHT -1T
%wrong - t
Do not print space between - and t.
%wrong t
You did not write the number indicating the start line of the printing.
This number should be written in front of the t.
%extra
%wrong - t
Your answer was right except for the unexpected characters:
%algol extratest;
%wrong pres
I meant to ask you to indicate the TECO command which will
write out those lines, not to write out the lines yourself.
%wrong 
You do not have to print "ESCAPE" except in the following two
cases:

a) After a string argument to a TECO command such as "I".
b) Two "ESCAPE"s to cause execution of the previous command string.
%wrong l
The "L" command will move the pointer. But you should write a
command which prints without moving the pointer.
%wrong ht
The "HT" command will print the whole text, not just one and a
half line.
%wrong ot
You probably typed the letter "O" instead of the zero digit "0".
%wrong 0tt
"0TT" will print also the part of the current line which is
after the pointer position. You were only asked to print the
part up to the pointer position.
%wrong 0t
"0T" will begin printing at the start of the current line.
If you want to begin at the start of the previous line,
then another number should be in front of the "T". Which number?
%wrong t
The text below is wrong. Remember that "0t" prints out
the current line up to the pointer position. What digit
should you put in front of "t" to get one line further back
in the file?
%algol extratest;
%lack t
A hint: you use the "T" command. Remember that "0T" prints
from the beginning of the current line. How do you begin at the
previous line?
%lack -
Use a negative number, since you should begin before the
current line in the file.
%WRONG
A hint: you use the "T" command. Remember that "0T" prints
from the beginning of the current line. How do you begin at the
previous line?
%WRONG
%SAME
%WRONG
%WRONG
The correct answer is "-1T". Time for repetition.
%GOTO PRINTING
%TEXT COMBINING:
Executing strings of TECO commands.
==================================

When you write commands to TECO, they are just stored until
you push the ESCAPE key twice in sequence. Then all the commands
are executed. Thus, by typing "0TT$$" you can print the whole
current line and by typing "IABCD$-3T2T$$" you can first insert
"ABCD" at the pointer and then print five surrounding lines.
%QUESTION comment commandstrings;
What do you print to first move the pointer to the first line in
the current page, and then print that line, using the commands
described above. Also include the two ESCAPEs to cause execution
of your TECO command string.
%NOEXTRA
%right j 0l t 
"0L" was not necessary, since the pointer was already moved
to the beginning of the first line by the "J" command.
%right j 1t 
"1"was not necessary since the default value with no
digit in front of a "T" is "1".
%RIGHT J0TT
"0T" was not necessary, since the pointer was
moved to the beginning of a line by the "J" command.
%RIGHT J T 
%EXTRA
%lack t
Your answer did not contain any "T" which is the TECO command to
print out something from the text file to your terminal.
%wrong j0t
"0T" prints everything up to the current pointer position.
After "J" there is nothing before the pointer, so "0T" will print
nothing.
%wrong o
You probably typed the letter "O" instead of the zero digit "0".
%wrong #
Your answer contained the character "#". Remember that to get
ESCAPE, you must keep the CONTROL key down while pushing the
"#" key.
%wrong zj
"ZJ" will move the pointer to the end of the page, not to
the beginning of the page.
%wrong $
Your answer contained the character "$" which is not the same
as ESCAPE although TECO prints it and ESCAPE in the same way
on your terminal.
%wrong J
The "ESCAPE" after "J" was not necessary.

You do not have to print "ESCAPE" except in the following two
cases:

a) After a string argument to a TECO command such as "I".
b) Two "ESCAPE"s to cause execution of the previous command string.

Note that "J" is not the last command to be executed, since
the printing with "T" comes after the "J" command.
%lack  
You forgot the two final "ESCAPE"s.
%lack j
Use the "J" command to move the pointer to the beginning of the page.
%wrong 0t
After "0T" you should write "T" to print the line after the pointer.
In fact, only "T" is necessary, since the pointer is already
at the start of a line after the "J" command.
%wrong L
The "L" command is not necessary, since you can use the "J"
command. "J" will move the pointer directly to the top of
the page, just where you want it to be.
%wrong 1j
You do not have to write any digit in front of the "J" command
if you want to get to the top of the page, since the digit
"0" is default.
%wrong 0j
%same
%wrong h
Your answer contains the letter "h". This letter in TECO
represents the whole buffer, not a particular place in the
buffer. You were not asked to print out or move to the whole
buffer, and therefore the "H" command is not appropriate
in an answer to this question.
%wrong   
Your answer contained more than two ESCAPES, but only two ESCAPES
are necessary to finish a command string in TECO.
%wrong -
There should be no dash (-) in the answer.
%WRONG
%WRONG
First use the "J" command to move the pointer, then the "T" command
to print the first line.
%WRONG
%SAME
%TEXT EX:
Leaving TECO.
============

When you are ready with TECO, you write the "EX$$" command to
leave TECO if you want to save the new file.
If you do not want to save the new file, then you leave TECO with
control-c.
%text if percent < 80.0 then
I know this lesson was not easy, but you have worked
hard and patiently. That is good.
%TEXT
Now you know enough about TECO to experiment a little yourself
with it before taking the next lesson.

You can get into TECO by writing "MAKE TEST.TMP" to the
monitor. But first you must leave this lesson.
%if qz

To test TECO, you must get a project-programmer number and
LOGIN on that number.
%ifend qz
%text summary:
Summary
=======

TECO Command	Effect
------------	------
$$		Two ESCAPEs finishes and executes a command string.
I<string>$	inserts the text <string> at the pointer.
EX		Ends the editing and leaves TECO.

Moving the pointer
------------------
nC	move the pointer n characters forward in the file.
nR	move the pointer n characters backward in the file.
J	move the pointer to the beginning of the current page of the file.
ZJ	move the pointer to the end of the current page of the file.
0L	move the pointer to the beginning of the current line.
nL	move the pointer to the beginning of the n-th line from
	previous position of the pointer.

You should substitute an integer for "n" in the commands
"nC", "nL" and "nR" above. The integer n can be negative, to
move the pointer backwards in the file.

The print command
-----------------
0T	print from the beginning of this line up to pointer.
T	print from the pointer to the end of this line.
-3T	print from three lines before the pointer up to the pointer.
3T	print three lines forward from the pointer.
HT	print the whole current page from the input file.
%qend end;
%END