Google
 

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

Earlier, we have assumed that the file consists only of one page.
In SOS you have the possibility to insert page marks anywhere
in your file. In this way you can divide your file into
smaller pieces. Line numbers start anew within each page, and
if you print the file, each page will start on a new  sheet
of paper., but a SOS page may extend over several printer pages.
%text t1aa:
For every command that includes a line number, you can also
specify a page number by typing:
                      
         line number/ page number

EXAMPLE:   D500/2
will delete line 500 on page 2.

If you do not specify any page number, the command will be made for
current page.

%question q1:
How do you specify line 700 on page 3 ?
%order
%noextra
%right 700 / 3
%wrong 3 / 700
You have the line- and page numbers in the wrong order.
%wrong 700 /
This is an illegal command in SOS.
%wrong 700
This specifies line 700 on current page.
%extra
%neutral 07
You may have leading zeroes in your numbers, but in
this lesson I would like you to remove them. Try again.
%goto q1
%neutral 03
%same
%lack 700
You did not type the line number 700.
%lack /
You forgot the slash "/" between line- and page number.
%lack 3
You did not type the page number 3.
%wrong sevenhundred / three
Use figures instead of letters.
%wrong d
You were asked to specify a line, not to give a command ("D")
in SOS.
%wrong p
%same
%wrong
Type line number / page number
%wrong
%same
%wrong
%goto t1
%text t1a:
Instead of the first, current and last page, you can use
"^", "." and "*" like you did in the line specifications.

%text
If the specified page does not exist, the error message
"%No such page" is printed by SOS.
%question q2:
Type the command to print line 200 on the first page.
%noextra
%order
%right p 200 / 1
%wrong p 200
This will print line 200 on CURRENT page.
%wrong p 1 / 200
You typed "1" and "200" in the wrong order.
%wrong p 200 /
This is an illegal command in SOS.
%right p 200 / ^
%extra
%neutral 02
You may have leading zeroes in your numbers, but in this
lesson I would like you to remove them.
%goto q2
%neutral 01
%same
%lack p
Use the "P" (print) command.
%lack 200
You did not type the line number 200.
%lack /
You did not type "/" between the line and page number.
%lack ^
Use "^" for the first page.
%wrong
A hint:
The "P" (print) command followed by line- and page number.
%wrong
%same
%wrong
The answer is p200/1 or p200/^
%goto q3
%question q3:
Assume that the current page is page one.
How do you specify line 200 on this page in the shortest way ?
%noextra
%order
%right 200
%wrong 200 / 1
This is a correct SOS command but not the shortest.
%extra
%wrong 200 / .
%same
%wrong 200 / ^
%same
%wrong 1 / 200
You have mixed up the line- and page numbers.
%wrong ^ / 200
%same
%wrong 02
You may have leading zeroes in your numbers, but in this
lesson I would like you to remove them.
%wrong 01
%same
%wrong
Just type the line number.
%wrong
%same
%wrong
%goto t1
%text t2:
If you want to specify a range of line numbers you type a 
colon ":" to separate the first and the last line.

EXAMPLE:  P1000/5:*/*
will print line 1000 on page 5 up to the last line on the last page.

%question q4:
How do you specify line 250 on page 3 up to line 500 on page 4 ?
%noextra
%order
%right 250 / 3 : 500 / 4
%wrong 250 / 3 : 500 /
You forgot the page number.
%wrong 250 / : 500 / 4
%wrong 250 : 500 / 4
This specifies line 250 on the CURRENT page up to line 500
on page 4.
%same
%wrong 250 / 3 : 500
This specifies line 250 on page 3 up to line 500 on the same page.
%wrong 250 : 500
This specifies line 250 up to 500 on CURRENT page.
%extra
%neutral 02
You may have leading zeroes in your numbers, but in this
lesson I would like you to remove them. 
%goto q4
%neutral 03
%same
%neutral 04
%same
%neutral 05
%same
%wrong p
You were asked to specify some lines, not to give any
command "P" in SOS.
%lack 250
The first line number is 250.
%lack / /
You have to use the slash between each line number and page number.
%lack :
Separate the first and the last line with a colon ":".
%lack 3
The first page number is 3.
%lack 4
The last page number is 4.
%wrong
A hint:
Type line number/page number:line number/page number
%wrong
%goto t2
%question q5:
Type the command to print line 1000 up to 1500 on the current page.
%noextra
%order
%right P 1000 : 1500
%right p 1000 / . : 1500 / .
It is not necessary to specify current page.
The command P1000:1500 is sufficient.
%right p 1000 / . : 1500
%same
%right p 1000 : 1500 / .
%same
%extra
%neutral 01
You may have leading zeroes in your numbers, but in this
lesson I would like you to remove them.
%goto q5
%lack p
Use the "P" command to print lines.
%lack :
Use a colon ":" to separate the line numbers.
%wrong 
A hint:
Type the "P" (print) command followed by the first and the last line.
%wrong
%same
%text t3:
There is another form of range specification in SOS.
This form specifies the starting line and a number of lines
separated by a "!".

EXAMPLE: 100/3!4
specifies 4 lines starting with line 100 on page 3.

%question q6:
Specify ten lines starting with line 300 on page 3.
%noextra
%order
%right 300/3!10
%wrong 300!10
This command specifies ten lines starting with line 300
on CURRENT page.
%wrong 300 ! 3 / 10
The slash must be typed immediately after the line number.
%wrong 300 / 3 : 10
You should use "!" instead of ":".
%extra
%neutral 03
You may have leading zeroes in your numbers, but
in this lesson I would like you to remove them.
%goto q6
%neutral 01
%same
%wrong .
You don't need any of the characters ".","^" or "*".
%wrong ^
%same
%wrong *
%same
%wrong p
Who told you to use the "P" command? You were only to
give the range specification.
%lack 300
First you type the line number.
%lack /
Type "/" between the line and the page number.
%lack 3
The page number is 3.
%lack !
Type the "!" after the page number.
%lack 10
After the "!" you type the number of lines.
%wrong
A hint:
Line specification ! number of lines
%wrong
%same
%wrong
%goto t3
%question q7:
Give the shortest specification of five lines starting with
line 1500 on current page.
%noextra 
%order
%right  1500 ! 5
%wrong 1500 / ! 5
If you type the slash "/", you must also type the page number.
%wrong 1500 / . ! 5
This is not the shortest one.
It is not necessary to specify the current page.
%extra
%wrong 05
You may have leading zeroes in your numbers, but
the command will be shorter if you remove them.
%goto q6
%wrong 01
%same
%wrong .
You don't need any of the characters ".","^" or "*".
%wrong ^
%same
%wrong *
%same
%wrong 1500 / 1 ! 5
This gives five lines with start on the first page.
%wrong 1500 / ^ ! 5
%same
%lack !
Use the "!" to separate the starting line and the number of lines.
%wrong
A hint:
First you type the starting line, then the "!" followed by the 
number of lines.
%wrong
%same
%wrong
The right answer is  1500!5
%goto next
%text t4:
Addition and subtraction can also be used in line and page 
specifications.

EXAMPLE: 
           /5-3               Page 2.
           /.+1               The next page.
           /.-1               The previous page.
         .-1:.+1              Three lines, including current line.

%question
How do you specify the line before the last line on the last page ?
%noextra
%order
%right * - 1 / *
%wrong * / * - 1
This will specify the last line on the page before the last page.
%extra
%lack *
Use the "*" to represent the last line and the last page.
%lack -1
The line before last line is specified by "*-1".
%lack /
Use "/" to separate the line and the page.
%wrong / * - 1
That is on the page before the last page.
%wrong * /
That is the last line on the page.
%wrong
A hint:
The line before last line is specified by "*-1".
The last page is represented by "*".
%wrong
%same
%wrong
%goto t4
%text t5:
The Mark command.
=================

To insert a page mark into your text, you use the MARK command.
It is written as "M" followed by a line number and will insert
a page mark immediately before the specified line number.

EXAMPLE:  M5200/3
will insert a page mark before line 5200 on page 3.

The page numbers are always consecutive, so inserting a page 
mark will increase all the following page numbers by one.

If the specified page number does not exist, the error
message %NO SUCH PAGE is printed by SOS.

%question qm1:
Give the command to insert a new page mark before line 4500
on page one.
%noextra
%order
%right m 4500 / 1
%right m 4500 / ^
%wrong m 4500
This command will insert a page mark before line 4500 on CURRENT page.
%wrong m 4500 /
You forgot to type the page number.
%wrong m 4500 / 2
This command will insert a page mark before line 4500 on page 2.
%extra
%neutral 04
You may have leading zeroes in your numbers, but in
this lesson I would like you to remove them
%goto qm1
%neutral 02
%same
%wrong / 3
It was page one, not three.
%wrong mark
The MARK command is typed "M".
%lack m
Use the mark "M" command.
%lack 4500
Type the line number after the "M" command.
%lack /
Separate the line and page numbers by a slash "/".
%lack 1
You did not specify page 1.
%wrong
A hint:
First the "M" command, then the line and page numbers.
%wrong
%same
%wrong
%goto t5
%text
If you want to insert a page mark after the last line on current
page, you can type "M99999". The next insert command will then refer 
to the new page.
%text t6:
The kill command.
==================

To delete a page mark (page number), you use the KILL command.
It is typed as "K" followed by a slash and the page mark you
want to delete. The page mark has the same number as the page
which follows it. There is no page mark number 1.

EXAMPLE:  K/5
will delete the page mark in front of line five.

Do not mix up the kill "K" and delete "D" commands in SOS.

D/5 will delete the contents of page 5. (Not the page mark)
K/5 will delete the page marks on page 5. (Not the contents)
%text t6a:
NOTE: The page marks are numbered by counting from the beginning
of the file. After you have removed a page mark, all page  marks
further out in the file get numbers one less than they had before.
To remove all page marks, the best way is to do K/2 repeatedly
until you get the error message "%No such page".
%question
Type the command to delete the page mark in front of page 2.
%noextra
%order
%right k / 2
%wrong d / 2
You did it!!
You mixed up the "K" and "D" commands.
%wrong c / 2
The kill command is typed "K".
%extra
%neutral 02
You may have leading zeroes in your numbers, but in
this lesson I would like you to remove them
%goto qm1
%wrong / 2
It was page two, not five.
%wrong kill
The kill command is typed "K".
%lack k
Use the "K" (kill) "K" command.
%lack /
Type a slash after the "K" command.
%lack 2
The page number is 2.
%wrong
Type the "K" command, a slash and the page number.
%wrong
%same
%wrong
%goto t6
%text
If you try to kill page number one or a page number that 
does not exist, you will get the error message %NO SUCH PAGE

%text t6b:
When a page mark is removed, the lines of the adjoining pages are
not renumbered. No information is lost, but several lines
may have the same line number.
It is wise to give an "N" command after one or more "K" commands.
%text t8:
The join command.
=================

This command will join two consecutive lines into one.
The command is typed "J" followed by the line number of the first line.
The combined line that is formed will be given the specified line number.

EXAMPLE: J500/3
will join line 500 and the next line on page three.
The extended line will get the line number 500.

If the joined line is too long, you will get the message %LINE TOO LONG.
If it is the last line on the page, you get %NO NEXT LINE.

%question
Type the shortest join command to change the file below

00020	 BEGIN
00050    A:=B+
00200    C;
00300    D:=E;

to become

00100    A:=B+C;
00300    D:=E;

%noextra
%order
%right j 50
%wrong j ^ + 1
This is a correct command, but not the shortest.
%wrong j * - 2
%same
%wrong j 200
If you use this command, you will get the result:

00100    A:=B+
00200    C;D:=E;
%wrong 50 / j
First the "J" command. Then the line number.
%extra
%wrong 05
You may have leading zeroes in your numbers, but the
command will be shorter if you remove them.
%wrong 02
%same
%wrong /
This file has just one page, so page specification is not nescessary.
%lack j
Use the "J" (join) command.
%lack 50
The first of the two joined lines has line number 50.
%wrong
A hint:
First the "J" (join) command. Then the line number of the first
of the two combined lines.
%wrong
%same
%wrong
%goto t8
%text t9:
The give information command.
=============================

Any time you are in SOS command mode, you can request the value
of a parameter by using the GIVE INFORMATION command.
It is typed as  =<parameter><return>

EXAMPLE of parameters:

            INC       Print the current increment in line numbers.
            .         Print current line / current page
            BIG       Print the page number of the largest page.
            ERROR     Print the last error message.
            NAME      Print the name of the file
            STRING    Print the text strings used by the find and 
                      substitute commands.

%question
Give the command in SOS that informs you about  current line / current page.
%noextra
%order
%right = .
%wrong .
Before the point "." you must type the give information command "=".
%wrong . =
You typed the characters in the wrong order.
%extra
%wrong give information
The GIVE INFORMATION command is typed "=".
%wrong INC
INC is the current increment while "." is the current line/
current page parameter.
%lack =
Use the give information command "=".
%lack .
The parameter is ".".
%wrong <
Do not type "<" or ">".
%wrong >
%same
%wrong
Type the give information command "=" followed by the correct parameter.
%wrong
%same
%wrong
%goto t9
%text t10:
Many of the SOS commands that we have been talking about can be
used in a more advanced manner.
You can for instance use the copy command to copy lines 
from other files.
The substitute and find commands can be used for groups of characters.
There are also many commands in SOS that we have not talked about.
All this would, however, go beyond the scope of this introductory
course in SOS.
%text sosdoc:
How to learn more about SOS:
============================
The file HLP:SOS.HLP contains a summary of all SOS commands
and parameters. It will be typed on your terminal when you give
the monitor command:
		HELP SOS
You need not be logged in to use the HELP command, but you
must get out of the TOPSTEACH course.
%question
Do you want to repeat this lesson ?
%noextra
%order
%neutral yes
%goto start
%neu y
%same
%neutral no
%goto summary;
%neu n
%same
%extra
%neutral
Answer yes or no
%goto repeat
%text summary:
Summary
=======

For a line number in a command you can specify a page number
by adding a slash ("/") and the page number to the line number.
The characters "^","." and "*" can also be used:
/^	is the first page
/.	is the current page
/*	is the last page.

In most commands where you can use a line number, you can also use
line number/page number .

You can give a range specification of the form m/n!k, which
means k lines starting with line m on page n.

SOS Commands	Effect
------------	------
Jm/n		Append line m on page n with the line after that one.
Mm/n		Put in a page mark at line m on page n.
K/n		Delete page mark n.
%algol pause;
%end