Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-04 - 43,50334/tops8t.gno
There are no other files named tops8t.gno in the archive.
%switch qz false
%if qz
%nocontrolc
%nextlesson pub("TOPQ");
%ifend qz
%TEXT
Partitioning of text files into pages.
=====================================

When you are using TECO to handle a large text file,
then you usually divide that file into pages. Each page should
contain less than about 50 lines of text.

When the file is printed, a new page is always printed at the top of
a new paper form.

You divide a file into pages by insertion of the special character
FORM FEED into the file. There is a key for that character on your
terminals and you can insert it just like any other character.
On some terminals, the FORM FEED key is labeled FF or ERASE PAGE.
%QUESTION formfeedquestion:
Push the FORM FEED key on your terminal, and then push the RETURN key.
%ALGOL
If answerlength = 1 and answer.[1] = 12 then
begin rightmessage; goto next;
end;
if answerlength > 1 then
begin write("YOU PUSHED MORE THAN ONE KEY BEFORE RETURN.[N]");
   wrongmessage; goto repeat;
end;
if answer.[1] = linefeed then 
write("You pushed LINE FEED instead of FORM FEED.[N]");
goto repeat;
%wrong L
You forgot to hold down the CONTROL key while pushing "L"!
%WRONG 
You pushed ESCAPE instead of FORM FEED.
%WRONG
You did not hit the FORM FEED key. Look for a key labelled
"FORM FEED" or "FF" or "ERASE PAGE". Make sure that you used
upper case if that character is upper case on the keyboard
of your terminal.
%WRONG
%SAME
%wrong
%goto cantfind
%qend
%algol if false then begin cantfind:
%question cantfindquestion:
You seem to have trouble finding the FORM FEED key. Maybe you
are using a terminal which is not equipped with that key?
Do you want to try some more keys? Answer "YES"
if you want to, answer "NO" if you want to assume that your
terminal does not have any FORM FEED key!
%extra
%neutral yes
%goto formfeedquestion
%neu y
%same
%neutral no
%neu n
%same
%goto next
%wrong
Answer either "YES" or "NO"!
%text
We will assume that your terminal does not have any FORM FEED
key. However, you can still use TECO. There is a special command
in TECO to insert characters which have no key on your terminal.
Instead, you use the decimal value of the character. The decimal
value of FORM FEED is "12". To insert that character into a file
you write the TECO command string "12I$". This command string
will introduce one character with a decimal value of 12, that is,
one FORM FEED character.

To divide a file into pages, you simply execute that command string
to insert FORM FEED characters into your file.
%algol goto panda; end;
%TEXT
To divide a text file into pages, you simply insert a FORM FEED
with TECO just as you would insert any other text into your file.
That is, you write the letter "I", you push "FORM FEED" and then
you push "ESCAPE" twice.
%TEXT PANDA:
After a file has been divided into pages, all the TECO commands
you have learned so far will only work within one page.

Thus for example:
"J" will place the pointer at the beginning of the current page
    (not at the beginning of the entire file),
"ZJ" will place the pointer at the end of the current page,
"S" will only search within the current page,
"T" will only print within the current page etc.
%TEXT
TECO commands for page handling.
===============================

This means that you cannot serach for, skip or delete
FORM FEED characters using the ordinary "S", "L" or "D"
commands of TECO.

There are instead special commands for this. The most important
ones are the "P" and the "A" commands.

"P" means move the pointer to the beginning of the next page
in the text file.
"A" means append the next page to the current page and remove
the FORM FEED between the two pages.
%QUESTION !firstlineofnextpage;
Write a TECO command string to print the first line of the
next page. Include the two final ESCAPE-s.
%NOEXTRA
%RIGHT PT
%RIGHT P0TT
You could also have written "PT$$" to get the same result.
%EXTRA
%WRONG o
You probably wrote "o" (the letter) instead of "0" (the zero digit).
%WRONG l
There is no need to use the "L" command.
%WRONG T
"T$$" will print the first line of the next page. First just
use the "P" command to get to that line.
%WRONG T
"T" will print the first line, so after "T" just push ESCAPE
twice to finish the command string to TECO.
%WRONG P
After "P" you are at the beginning of the next page, and
you only have to use the "T" command to print
the first line of it.
%WRONG
A hint: First use the "P" command to get to the beginning
of the next page, then use the "T" command to print the first
line of that page.
%WRONG
%SAME
%WRONG
Maybe you should repeat reading the text about the "P" and "T"
commands.
%WRONG
%SAME
%QUESTION ! a command;
Which TECO command is used to remove a page dividing FORM FEED
from the file?
%NOEXTRA
%RIGHT A
%EXTRA
%NEUTRAL A
Just write the single command letter and nothing else in answer to
the question.
%GOTO REPEAT
%wrong P
The P command will move the pointer to the next page, but that
command will not remove the FORM FEED between the two pages
from the file.
%wrong I
The "I" command is used to insert things into a file, not remove
things.
%WRONG D
The "D" or DELETE command cannot be used to remove FORM FEED
characters.
%WRONG
Remember that by removing a FORM FEED you are a p p e n d i n g
two pages.
%Wrong
%SAME
%WRONG
Time for some repetition.
%GOTO PANDA
%TEXT
Searching from page to page.
===========================

The search command ("S") will only work within the current page.

If the string you are looking for is on the next page, the search
will not succeed.

There is therefore the "N" command which continues searching over
page boundaries.

The "N" command is used exactly as the "S" command.
There is also a "FN" command corresponding to the
"FS" command but searching over page boundaries.
%QUESTION ! NLOVE;
Write the shortest TECO command string which will search
across page boundaries for the word "LOVE" and print the first
line found with that word in it.
%NOEXTRA
%RIGHT NLOVE0TT
%RIGHT NLOVE0TT
%neutral nlove0lt
That was correct but might cause trouble if you try to use the
command sequence several times in succession. Since you move the
pointer back before "LOVE" you will find the same line several
times.

Try to find a solution which does not use the "L" command, only
the "N" and the "T" command, so that the command string can be
used several times in succession to find different lines with
the word "LOVE" in them.
%neutral nlove0lt
%same
%EXTRA
%WRONG ot
You probably wrote "o" (the letter) instead of "0" (the zero digit).
%WRONG FN
Use the "N", not the "FN" command.
%WRONG NLOVET
"T" will only print the part of the found line after the word
"LOVE". To print the whole line, use "0TT".
%WRONG NLOVE
After "NLOVE$" you write "0TT" to print the found line.
%WRONG S
Use the "N" command, since the "S" command will not skip over
page boundaries.
%WRONG NLOVE
You forgot the ESCAPE after "NLOVE".
%WRONG
A hint: first use the "N" command to find the word
"LOVE" and then use the "T" command to print the found line.
%WRONG
%SAME
%QUESTION ! FNHATE;
Write the shortest TECO command string which will search in
the text file, skipping page boundaries if necessary, until
the word "HATE" is found, and then changing the first occurence
of the word "HATE" for the word "LOVE".
%NOEXTRA
%RIGHT FNHATELOVE
%RIGHT FNHATELOVE
%EXTRA
%WRONG FNHATELOVE
You forgot the final ESCAPE after "LOVE".
%WRONG FNHATE
The format of the "FN" command is
"FN...SEARCH STRING...$...SUBSTITUTE STRING...$".
%WRONG FNHATE
You forgot the ESCAPE after "FNHATE".
%SAME
%WRONG FN
After "FN" you write the string to search for, that is, "HATE".
%WRONG N
Use the "FN", not the "N" command.
%WRONG S
The "S" and "FS" commands will not skip
across page boundaries. Exchange "N" for "S".
%WRONG
A hint: use the "FN" command to find "HATE" and replace it with
"LOVE".
%WRONG
You are not using the FN command. Don't you like it?
Are you angry with me? I am sorry if I have been rude to you.

%SAME
%TEXT
Avoid too large pages.
=====================

A warning: if your file contains too large pages, or if it does
not contain any page boundaries, then TECO will automatically
assume invisible page boundaries at regular intervals in your text.
Thus you may unexpectedly find that a search with an "S" command
will not succeed. In that case, either use the "N" command or
use the "P" command to get to the next page and then use the
"S" command to search within that page.

This difficulty will not occur if you divide
your file into small enough pages.
%TEXT
Moving to a previous page.
=========================

If you are on one page, and want to move to the next page,
you just use the "P" command. Moving backwards to previous
pages is more difficult.

The simplest way to move backwards is to leave TECO and
then enter TECO again at the beginning of the file. You do
this by first writing "EX$$", then waiting until you get
to the monitor, and then writing "TECO" to get back to TECO
again.

It is anyway always good practice to perform this operation of
leaving and entering TECO now and then, since if there is
a machine failure, you may lose everything that
you did since the last time you entered TECO.
%text summary:
Summary
=======

TECO Command	Effect
------------	------
I<form feed>$	Insert a page mark
P		Move the pointer to the next page
A		Append the next page and remove the page mark
nN<str>$	Search for the first occurence of the string
		<str> over page boundaries
nFN<str1>$<str2>$ Substitute the n:th occurence of <str1> to
		  <str2> and look over page boundaries.
%ALGOL PAUSE;
%END