Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50537/sed02.gno
There are no other files named sed02.gno in the archive.
%NOCONTROLC
%VARIABLES INTEGER ANSWER1, ANSWER2, ANSWER3, DUMMY;
%VARIABLES string answer4;
%variables boolean MIME;
%ALGOL EXTERNAL PROCEDURE NOECHO,XECHO,NOCRLF,INCH,TTOPEN;
%INITIALIZE stopkc; f10call(nocrlf); INPUT(0,"TTY");
%TEXT
This lesson describes the screen editor SED as used on a MIME-2A
or VT-100, in VT-52 mode.
You shouldn't be running this lesson on any other terminal.

%QUESTION  mime2a:
Are you using a MIME-2A?
%neutral yes
%algol MIME := TRUE;
%GOTO continue;
%neutral YES
%algol MIME := TRUE;
%GOTO continue;
%neutral Yes
%algol MIME := TRUE;
%GOTO continue;
%neutral Y
%algol MIME := TRUE;
%GOTO  continue;
%neutral y
%algol MIME := TRUE;
%GOTO  continue;
%neutral no
%GOTO vt100;
%neutral NO
%SAME
%neutral N
%same
%neutral n
%same
%neutral No
%Same
%neutral
Please answer yes or no.
%goto mime2a;
%QUESTION  vt100:
Are you using a VT-100?
%neutral yes
%algol MIME := FALSE;
%GOTO continue;
%neutral YES
%algol MIME := FALSE;
%GOTO continue;
%neutral Yes
%algol MIME := FALSE;
%GOTO continue;
%neutral Y
%algol MIME := FALSE;
%GOTO  continue;
%neutral y
%algol MIME := FALSE;
%GOTO  continue;
%neutral no
Well then, please try again when you're on a MIME or VT-100.
%GOTO endoflesson;
%neutral NO
%SAME
%neutral N
%same
%neutral n
%same
%neutral No
%Same
%neutral
Please answer yes or no.
%goto vt100;
%TEXT continue: pause;
The text of this lesson is taken mostly from the
document DOC:SEDMAN.DOC (by Christopher Hall).
The SED lessons do not give you a complete description of SED,
but will give you enough knowledge to get you started.
If you want to learn the more complicated commands, you should
read the document DOC:SED.DOC, but it is not recommended that you
read it until you're comfortable with the commands you learn
in the lessons.
%TEXT outsymbol(12);
The preceeding lesson got you started. You can do a lot more
than just typing, inserting and deleting text. This lesson
will give you a taste of the full power of SED.
%TEXT
Purpose of this Lesson
======================
     In this lesson you will learn:
        -how to use parameters,
        -how to move long distances through the file, and
        -how to insert and delete lines and spaces.
%TEXT outsymbol(12);
INTRODUCTION TO COMMANDS AND PARAMETERS
=======================================

    You know (from lesson SED01) how to roll the screen: just
type one of the <ROLL-LINES> commands: CTRL-T for <ROLL-FORWARD-LINES>
or CTRL-W for <ROLL-BACKWARD-LINES>. Actually, there's more to the
general command format than that.
%TEXT
    Each command takes a parameter, which is a value or string used
by the command. For example, the parameter for the <ROLL-LINES>
commands is the number of lines to roll. Initially there is a default
parameter, in this case, 8 lines. But you can change the parameter to any
(positive) value you want; the screen will then roll that many lines
until you change the value again.
%TEXT outsymbol(12);
     To give a parameter to a command you need to give the
<ENTER-PARAMETER> command, which consists of typing the
BLUE (MIME-2A) or PF1 (VT-100) key at the top right of
the keyboard.
     SED will then give you a prompt at the bottom of the
screen, and you can type the value of the parameter, and
then issue the desired command.
%TEXT
     So if you want the screen to roll 4 lines forward, type

	<ENTER-PARAMETER>4<ROLL-FORWARD-LINES>

That is, Blue (or PF1) key 4 CTRL-T. The screen will roll 4
lines. From then on, every time you issue a <ROLL-FORWARD-LINES>
or a <ROLL-BACKWARD-LINES> SED will roll 4 lines, until
you change the parameter again.
%TEXT outsymbol(12);
     Certain pairs of commands share a single parameter.
Thus setting a parameter for <ROLL-FORWARD-LINES> also
sets it for <ROLL-BACKWARD-LINES>. This sharing is done
where it is natural and expected, like the key for
searching forward or back, the number of lines to insert
or delete (which you will learn later).

%TEXT
     If you accidentally push the <ENTER-PARAMETER> key,
you can cancel your request for a parameter by typing the
DELETE key (located above the RETURN key on the regular
keyboard).
%ALGOL
begin dummy:=0; qcount:=qcount+1; COMMENT initialize dummy, increment qcount;
COMMENT dummy counts the number of times that a particular question is tried
over, qcount keeps track of the number of questions attempted;
question1:
COMMENT clear screen, cursor home;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
write("Pretend you are in SED, and this is the text of the file.");
write("[N]You want to roll forward 3 lines.");
write("[N]What commands do you give to SED?");
breakoutput;
f10call(noecho);
outsymbol(27); outsymbol(61); COMMENT enter alternate keypad mode;
breakoutput;
COMMENT position cursor at last line, blank out anything written there, cursor
home;
getenter: outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
outsymbol(27); outsymbol(72);
breakoutput;
dummy := dummy + 1; COMMENT increment dummy;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if ESC, see next character, if "R" then user pushed blue key, which is
the SED <ENTER-PARAMETER> command;
if answer1 = 27 then
  begin
     if answer2 = 80 then
          goto getparam
  end;
COMMENT if control-C or "%" allow user to exit question;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT;
COMMENT if not blue key, output error message and start over;
if MIME then
     write("[NNNNNN]No! The <ENTER-PARAMETER> command is the BLUE key")
else
     write("[NNNNNN]No! The <ENTER-PARAMETER> command is the PF1 key");
write("[N]Please try over.                    ");
goto getenter;
getparam: COMMENT position cursor at bottom of screen;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
COMMENT reverse video, type ">", normal video;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(66);
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(50); outsymbol(52); outsymbol(59);
     outsymbol(48); outsymbol(72); comment position to last line;
     outsymbol(27); outsymbol(91); outsymbol(55); outsymbol(109);
     comment reverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
write(">"); breakoutput;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(64)
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(48); outsymbol(109);
     comment unreverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if "3" (correct parameter), get command;
if answer1 = 51 then
  begin
     outsymbol(51);
     breakoutput;
     goto getcommand
  end;
COMMENT if ESC, see next char, if "?", see next, if "s", then user typed
numerical keypad "3", which is an error;
if answer1 = 27 then
  begin
     if answer2 = 63 then
       begin
	  if answer3 = 115 then
            begin
	       outsymbol(27); outsymbol(72);
               write("[NNNN]Keep in mind that the numerical keypad keys");
	       write("[N]are commands for SED, not characters")
	    end
       end
  end;
COMMENT if control-C or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT;
COMMENT  if char is printable, print it;
if answer1 > 31 then
     outsymbol(answer1);
COMMENT if not "3", type error message, start over;
outsymbol(27); outsymbol(72); COMMENT cursor home;
write("[6N]The parameter you want to enter is the number 3    ");
write("[N]Please try over, from the beginning");
breakoutput;
goto getenter;
getcommand: f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT;
COMMENT if control-T, correct answer, get out;
if answer1 = 20 then
	goto outCT;
COMMENT if control-W, special error message;
if answer1 = 23 then
  begin
     outsymbol(27); outsymbol(72);
     write("[NNNNNN]Control-W is <ROLL-BACKWARD-LINES>.             ");
     write("[N]Please try over, from the beginning");
     goto getenter
  end;
COMMENT if control char, error message, start over;
if answer1 < 27 then
  begin
     outsymbol(27); outsymbol(72);
     write("[NNNNNN]<ROLL-FORWARD-LINES> command is control-T              ");
     write("[N]Please try over, from the beginning"); breakoutput;
     goto getenter
  end;
COMMENT if printable, print char;
if answer1 > 31 then
     outsymbol(answer1);
outsymbol(27); outsymbol(72); COMMENT cursor home;
COMMENT if not a control char, error message, start over;
write("[NNNNNN]Give the command after you give the parameter              ");
write("[N]Please try over, from the beginning"); breakoutput;
goto getenter;
OUTCT: COMMENT position cursor at last line, blank the parameter;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
COMMENT cursor on bottom line, write next 3 lines;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32); breakoutput;
write("[NNN]");
outsymbol(27); outsymbol(89); outsymbol(53); outsymbol(32); breakoutput;
write("This is the contents of the next");
write("[N]three lines in the text");
write("[N]Please push return to continue");
breakoutput; getline;
COMMENT clear screen, cursor home, update scores, get out;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
write("That was just fine! Keep up the good work.");
breakoutput;
latescore := latescore + 1; if dummy = 1 then score := score + 1;
goto question1out;
COMMENT go here if control-C or "%";
KCOUT: outsymbol(27); outsymbol(72); outsymbol(27);
outsymbol(74);
write("Type BACK to try this question over");
write("[N]     SKIP to go to the next section");
write("[N]     STOP to end this lesson");
write("[N]--->");
breakoutput;
getline;
POS:=1;
if anywhere("STOP") then goto endoflesson;
POS:=1;
if anywhere("BACK") then goto question1;
POS:=1;
if anywhere("SKIP") then goto question1out;
goto KCOUT
END;
%TEXT QUESTION1OUT: outsymbol(27); outsymbol(62);

%TEXT outsymbol(12);
Rolling the screen a long distance
==================================
     You now know how to roll the screen forward or backward any
number of lines. However, if the file is long and you want to
get to a place several screens-full away, it would be awkward to
have to figure out how many lines to roll. There are two other
commands for long distance rolls: <ROLL-FORWARD-PAGES>, CTRL-Y,
and <ROLL-BACKWARD-PAGES>, CTRL-A. A page is defined as one
screen-full of lines (24, on the MIME-2A and VT-100).

%text
     So if you type <ROLL-FORWARD-PAGES> the entire screen will
be re-written, and the new line at the top of the screen will be
the one beneath the line previously at the bottom of the screen.

     The parameter to the two <ROLL-PAGES> commands is the number
of pages to be rolled. Note that setting the parameter for one of
these commands sets it for the other as well.
%ALGOL
begin dummy:=0; qcount:=qcount+1; COMMENT initialize dummy, increment qcount;
question2:
COMMENT clear screen, cursor home;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
write("Pretend you are in SED, and this is the text of the file.");
write("[N]You want to roll backward 5 pages.");
write("[N]What command do you give to SED?");
breakoutput;
f10call(noecho);
outsymbol(27); outsymbol(61); COMMENT enter alternate keypad mode;
breakoutput;
getenter2: COMMENT position cursor bottom line, blank out anything there;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
outsymbol(27); outsymbol(72); COMMENT cursor home;
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
dummy := dummy + 1; COMMENT increment dummy;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT2;
COMMENT if ESC, see next character, if "R" then user pushed blue key, which is
the SED <ENTER-PARAMETER> command;
if answer1 = 27 then
  begin
     if answer2 = 80 then
          goto getparam2
  end;
COMMENT if not blue key, output error message and start over;
if MIME then
     write("[NNNNNN]No! The <ENTER-PARAMETER> command is the BLUE key")
else
     write("[NNNNNN]No! The <ENTER-PARAMETER> command is the PF1 key");
write("[N]Please try over.                    ");
goto getenter2;
getparam2: COMMENT position cursor at bottom of screen;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
COMMENT reverse video, type ">", normal video;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(66)
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(50); outsymbol(52); outsymbol(59);
     outsymbol(48); outsymbol(72); comment position to last line;
     outsymbol(27); outsymbol(91); outsymbol(55); outsymbol(109);
     comment reverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
write(">"); breakoutput;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(64)
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(48); outsymbol(109);
     comment unreverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT2;
COMMENT if "5" (correct parameter), get command;
if answer1 = 53 then
  begin
     outsymbol(53);
     breakoutput;
     goto getcommand2
  end;
COMMENT if ESC, see next char, if "?", see next, if "s", then user typed
numerical keypad "5", which is an error;
if answer1 = 27 then
  begin
     if answer2 = 63 then
       begin
	  if answer3 = 117 then
            begin
	       outsymbol(27); outsymbol(72);
               write("[NNNN]Keep in mind that the numerical keypad keys");
	       write("[N]are commands for SED, not characters")
	    end
       end
  end;
COMMENT  if char is printable, print it;
if answer1 > 31 then
     outsymbol(answer1);
outsymbol(27); outsymbol(72); COMMENT cursor home;
COMMENT if not "5", type error message, start over;
write("[NNNNNN]The parameter you want to enter is the number 5    ");
write("[N]Please try over, from the beginning");
breakoutput;
goto getenter2;
getcommand2: f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT2;
COMMENT if control-A, correct answer, get out;
if answer1 = 1 then
	goto outCA;
COMMENT if control-Y, special error message;
if answer1 = 25 then
  begin
     outsymbol(27); outsymbol(72);
     write("[NNNNNN]Control-Y is <ROLL-FORWARD-PAGES>.             ");
     write("[N]Please try over, from the beginning");
     goto getenter2
  end;
COMMENT if control char, error message, start over;
if answer1 < 27 then
  begin
     outsymbol(27); outsymbol(72);
     write("[NNNNNN]<ROLL-BACKWARD-PAGES> command is control-A              ");
     write("[N]Please try over, from the beginning"); breakoutput;
     goto getenter2
  end;
COMMENT if printable, print char;
if answer1 > 31 then
     outsymbol(answer1);
outsymbol(27); outsymbol(72);
COMMENT if not a control char, error message, start over;
write("[NNNNNN]Give the command after you give the parameter              ");
write("[N]Please try over, from the beginning"); breakoutput;
goto getenter2;
OUTCA: COMMENT position cursor at last line, blank the parameter;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
COMMENT clear screen, cursor home;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
COMMENT write page 5 screens before;
write("This is the text of the file");
write("[N]five pages before the page  ");
write("[N]at which you gave the command.");
breakoutput;
write("[NN]You did very well. Keep up the good work.");
breakoutput;
COMMENT update scores, get out;
latescore := latescore + 1; if dummy = 1 then score := score + 1;
goto question2out;
COMMENT go here if control-C or "%";
KCOUT2: outsymbol(27); outsymbol(72); outsymbol(27);
outsymbol(74);
write("Type BACK to try this question over");
write("[N]     SKIP to go to the next section");
write("[N]     STOP to end this lesson");
write("[N]--->");
breakoutput;
getline;
POS:=1;
if anywhere("STOP") then goto endoflesson;
POS:=1;
if anywhere("BACK") then goto question2;
POS:=1;
if anywhere("SKIP") then goto question2out;
goto KCOUT2
END;
%TEXT QUESTION2OUT: outsymbol(27); outsymbol(62);

%TEXT outsymbol(12);
Inserting and deleting lines and spaces
=======================================
   So far as long as you have been typing text into your
file things have been all right. But suppose you wanted to
add a word or even a line of text, in the middle of what
you've already done? This section shows you two new commands,
<INSERT-SPACES> and <INSERT-LINES>, which add "air holes" to
your file, and two commands <DELETE-SPACES> and <DELETE-LINES>,
which remove unwanted text from the file.
%TEXT
     The <INSERT-SPACES> command is control-B. It inserts
a space in your file where the cursor is. The parameter to
<INSERT-SPACES> is the number of spaces to insert.

    The <DELETE-SPACES> command is control-N. It deletes
characters (not just spaces) where the cursor is. It shares
its parameter with <INSERT-SPACES>.
%TEXT
     The <INSERT-LINES> command, control-D, inserts a blank
line where the cursor is. If the cursor is at the beginning
of the line, it will insert a whole blank line, otherwise it
will break the current line in two, at the cursor position.
The parameter to <INSERT-LINES> is the number of lines to
insert.
    The <DELETE-LINES> command, control-F, deletes a line.
If it is at the beginning of a line it will delete the whole
line, and move the next line up to fill the gap. If it is
at the end of a line, it will join the next line to the current
line. If it is within the line it will delete the part of the
line following the cursor and replace it with the next line.
The parameter to the <DELETE-LINES> command is the number
of lines to delete, and is shared with the <INSERT-LINES>
command.
%TEXT
     When joining two lines with the <DELETE-LINES> command,
if you get a line longer then the width of the screen (80
columns), the end of the line will disappear to the right of the
screen, but it will still be in your file.
%ALGOL
begin dummy:=0; qcount:=qcount+1; COMMENT initialize dummy, increment qcount;
question7:
COMMENT clear screen, cursor home;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
write("Pretend you are in SED, and this is the text of the file.");
write("[N]In the text below the cursor is positioned at the beginning");
write("[N]of the last occurrence of ""was"" which, as you can see, does");
write("[N]not belong there.  ");
write("[N]1) Using a parameter, delete the superfluous ""was"". ");
write("[N]2) Then break the line in two at that point, so that the");
write("[N]   rest of the line is on the next line.");
write("[2N]The sun was shining on the sea,");
write("[N]Shining with all his might,");
write("[N]He did his very best to make");
write("[N]The billows smooth and bright");
write("[N]And this was odd because it was was The middle of the night.");
breakoutput;
f10call(noecho);
outsymbol(27); outsymbol(61); COMMENT enter alternate keypad mode;
breakoutput;
getenter7: COMMENT position cursor at bottom line, blank it;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
COMMENT position cursor at last "was";
outsymbol(27); outsymbol(89); outsymbol(44); outsymbol(64);
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
dummy := dummy + 1; COMMENT increment dummy;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT7;
COMMENT if ESC, get next character, if "R" then user pushed blue key, which is
the SED <ENTER-PARAMETER> command;
if answer1 = 27 then
  begin
     if answer2 = 80 then
          goto getparam7
  end;
COMMENT if not blue key, output error message and start over;
outsymbol(27); outsymbol(72);
if MIME then
     write("[16N]No! The <ENTER-PARAMETER> command is the BLUE key")
else
     write("[16N]No! The <ENTER-PARAMETER> command is the PF1 key");
write("[N]Please try over.                    ");
goto getenter7;
getparam7: COMMENT position cursor at bottom of screen;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
COMMENT reverse video, type ">", normal video;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(66)
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(50); outsymbol(52); outsymbol(59);
     outsymbol(48); outsymbol(72); comment position to last line;
     outsymbol(27); outsymbol(91); outsymbol(55); outsymbol(109);
     comment reverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
write(">");
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(64)
  end
else
  begin
     outsymbol(27); outsymbol(60); comment go into vt100 mode;
     outsymbol(27); outsymbol(91); outsymbol(48); outsymbol(109);
     comment reverse video;
     outsymbol(27); outsymbol(91); outsymbol(63); outsymbol(50);
     outsymbol(108); comment return to vt52 mode;
  end;
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT7;
COMMENT if "4" (correct parameter), get command;
if answer1 = 52 then
  begin
     outsymbol(52);
     breakoutput;
     goto getcommand7
  end;
COMMENT if ESC, see next char, if "?", see next, if "s", then user typed
numerical keypad "3", which is an error;
if answer1 = 27 then
  begin
     if answer2 = 63 then
       begin
	  if (answer3 = 115) or (answer3 = 116) then
            begin
	       outsymbol(27); outsymbol(72);
               write("[14N]Keep in mind that the numerical keypad keys");
	       write("[N]are commands for SED, not characters     ")
	    end
       end
  end;
COMMENT  if char is printable, print it;
if answer1 > 31 then
     outsymbol(answer1);
outsymbol(27); outsymbol(72); COMMENT cursor home;
COMMENT if "3" output error message;
if answer1 = 51 then
  begin
     write("[14N]Although ""was"" has only 3 characters, you");
     write("[N]also want to delete the following space.");
     outsymbol(27); outsymbol(72)
  end;
COMMENT if not "4", type error message, start over;
write("[16N]The parameter you want to enter is the number 4    ");
write("[N]Please try over, from the beginning");
breakoutput;
goto getenter7;
getcommand7: f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT7;
COMMENT if control-N, correct answer, get to next part of question;
if answer1 = 14 then
	goto outCN;
COMMENT if control-B, special error message;
if answer1 = 2 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-B is <INSERT-SPACES>.                          ");
     write("[N]Please try over, from the beginning");
     goto getenter7
  end;
COMMENT if control-D, special error message;
if answer1 = 4 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-D is <INSERT-LINES>.                           ");
     write("[N]Please try over, from the beginning");
     goto getenter7
  end;
COMMENT if control-F, special error message;
if answer1 = 6 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-F is <DELETE-LINES>.                           ");
     write("[N]Please try over, from the beginning");
     goto getenter7
  end;
COMMENT if control char, error message, start over;
if answer1 < 27 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]<DELETE-SPACES> command is control-N.                  ");
     write("[N]Please try over, from the beginning"); breakoutput;
     goto getenter7
  end;
COMMENT if printable, print char;
if answer1 > 31 then
     outsymbol(answer1);
outsymbol(27); outsymbol(72); COMMENT cursor home;
COMMENT if not a control char, error message, start over;
write("[16N]Give the command after you give the parameter              ");
write("[N]Please try over, from the beginning"); breakoutput;
goto getenter7;
OUTCN: COMMENT position cursor at last line, blank the parameter;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
write("    ");
COMMENT position cursor at "was", delete 4 chars;
breakoutput; outsymbol(27); outsymbol(89);
outsymbol(44); outsymbol(64); breakoutput;
outsymbol(27); outsymbol(75); write("The middle of the night");
outsymbol(27); outsymbol(89); outsymbol(44); outsymbol(64);
breakoutput;
getcommand72: COMMENT make sure cursor is well-positioned;
outsymbol(27); outsymbol(89); outsymbol(44); outsymbol(64); breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then goto KCOUT7;
COMMENT if control-D, correct answer, get out;
if answer1 = 4 then
	goto outCD;
COMMENT if control-B, special error message;
if answer1 = 2 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-B is <INSERT-SPACES>.                          ");
     write("[N]Please try the last command over.  ");
     goto getcommand72
  end;
COMMENT if control-N, special error message;
if answer1 = 14 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-N is <DELETE-SPACES>.                          ");
     write("[N]Please try the last command over.  ");
     goto getcommand72
  end;
COMMENT if control-F, special error message;
if answer1 = 6 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]Control-F is <DELETE-LINES>.                           ");
     write("[N]Please try the last command over.  ");
     goto getcommand72
  end;
COMMENT if control char, error message, start over;
if answer1 < 27 then
  begin
     outsymbol(27); outsymbol(72);
     write("[16N]<INSERT-LINES> command is control-D.                   ");
     write("[N]Please try the last command over.  "); breakoutput;
     goto getcommand72
  end;
COMMENT if not a control char, error message, start over;
outsymbol(27); outsymbol(72); COMMENT cursor home;
write("[16N]Give the command to break the line in two.                  ");
write("[N](You don't need a parameter.)      "); breakoutput;
goto getcommand72;
OUTCD: COMMENT erase to end of line, go to beginning of next line, insert a
blank line, write "The middle of the night";
outsymbol(27); outsymbol(75); write("[N]");
if MIME then
     outsymbol(1);
outsymbol(27); outsymbol(75);
write("The middle of the night");
write("[6N]Excellent! You got it!");
breakoutput;
COMMENT update scores;
latescore := latescore + 1;
if dummy = 1 then score := score + 1;
goto question7out;
COMMENT go here if control-C or "%";
KCOUT7: outsymbol(27); outsymbol(72); outsymbol(27);
outsymbol(74);
write("Type BACK to try this question over");
write("[N]     SKIP to go to the next section");
write("[N]     STOP to end this lesson");
write("[N]--->");
breakoutput;
getline;
POS:=1;
if anywhere("STOP") then goto endoflesson;
POS:=1;
if anywhere("BACK") then goto question7;
POS:=1;
if anywhere("SKIP") then goto question7out;
goto KCOUT7
END;
%TEXT QUESTION7OUT: outsymbol(27); outsymbol(62);

%TEXT outsymbol(12);
Deleting from the cursor to the end of the line
===============================================

     When you use the <DELETE-LINES> command, the deleted
text is replaced by the text following it. However, you may
want to delete the end of a line without the next line coming up.
The <ERASE-LINE> command does exactly that. It deletes all
characters from the cursor position to the end of the line.
It performs exactly as if you typed <ENTER-PARAMETER>1000<DELETE-SPACES>.
To give this command, type a control-J or a LINE-FEED.

     This command does not take a parameter; it erases only one
line at a time.

%TEXT
REVIEW
======
     Before ending this lesson, let's have a quick review
test of the commands you've learned so far.

     For the following questions, give the number of the
answer which you think is correct.

%QUESTION
The <ENTER-PARAMETER> command is given by typing:
        1) The unmarked red key (PF2 on VT-100)
        2) The numeric keypad ENTER
        3) The unmarked blue key (PF1 on VT-100)
        4) The unmarked black key (PF3 on VT-100)
%EXTRA
%RIGHT 3
%RIGHT 3)
%WRONG 1
The red (PF2) key is the <RECALL> command, which is not covered
in this lesson.
%WRONG 2
The numeric keypad ENTER is the <INSERT-MODE> command.
%WRONG 4
The black (PF3) key is the <HOME> command, which positions
the cursor at the top right corner.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
The parameter to the <ROLL-PAGES> commands is:
        1) The number of pages to roll
        2) The number of lines per page
        3) The number of lines to roll
%RIGHT 1
%RIGHT 1)
%WRONG 2
The number of lines per page is always 24 on a MIME-2A.
%WRONG 3
The number of lines to roll is the parameter for the <ROLL-LINES>
commands.
%WRONG
Answer 1, 2, or 3.
%WRONG
%SAME
%QUESTION
The <ROLL-FORWARD-PAGES> command is:
        1) Control-T
        2) Control-Y
        3) Control-A
        4) Control-W
%RIGHT 2
%RIGHT 2)
%WRONG 1
Control-T is the <ROLL-FORWARD-LINES> command
%WRONG 3
Control-A is the <ROLL-BACKWARD-PAGES> command
%WRONG 4
Control-W is the <ROLL-BACKWARD-LINES> command
%WRONG
Answer 1, 2, 3, or 4
%WRONG
%SAME
%QUESTION
The <INSERT-SPACES> command is:
        1) Control-D
        2) Control-N
        3) Control-F
        4) Control-B
%RIGHT 4
%RIGHT 4)
%WRONG 1
Control-D is <INSERT-LINES>.
%WRONG 2
Control-N is <DELETE-SPACES>.
%WRONG 3
Control-F is <DELETE-LINES>.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
To roll the text 4 pages forward you would type:
        1) <BLUE or PF1 KEY> 4 <CONTROL-A>
        2) <BLACK or PF3 KEY> 4 <CONTROL-T>
        3) <BLUE or PF1 KEY> 4 <CONTROL-Y>
        4) <BLUE or PF1 KEY> 4 <CONTROL-T>
%RIGHT 3
%RIGHT 3)
%WRONG 1
Control-A is <ROLL-BACKWARD-PAGES>
%WRONG 2
The black key is the <HOME> command (positions cursor at top left corner),
and control-T is <ROLL-FORWARD-LINES>.
%WRONG 4
Control-T is <ROLL-FORWARD-LINES>, not <ROLL-FORWARD-PAGES>.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
If you type <BLUE or PF1 KEY> 10 <CONTROL-N>, this will:
        1) Delete the next 10 lines
        2) Insert 10 spaces
        3) Insert 10 blank lines
        4) Delete the next 10 characters on the line
%RIGHT 4
%RIGHT 4)
%WRONG 1
Control-F is the <DELETE-LINES> command.
%WRONG 2
Control-B is the <INSERT-SPACES> command.
%WRONG 3
Control-D is the <INSERT-LINES> command.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
In reference to the last question, if you NOW type <CONTROL-N>
again, using no parameter, SED will:
        1) Delete one (1) character
        2) Delete ten (10) characters
        3) Delete one (1) line
        4) Delete ten (10) lines
%RIGHT 2
%RIGHT 2)
%WRONG 1
Once the <DELETE-SPACES> is given a parameter, it will keep
that parameter until it is given another parameter.
%WRONG 3
Control-N deletes characters, not lines.
%WRONG 4
%SAME
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
Again in reference to the last two questions, if you
now type a <CONTROL-F>, SED will:
        1) Delete one (1) character
        2) Delete ten (10) characters
        3) Delete one (1) line
        4) Delete ten (10) lines
%RIGHT 3
This is assuming of course that neither <DELETE-LINES> (^F)
nor <INSERT-LINES> (^D) has been given a parameter.
%RIGHT 3)
%SAME
%WRONG 1
Control-F deletes lines, not characters.
%WRONG 2
%SAME
%WRONG 4
Ha! Fooled you! <DELETE-SPACES> (^N) shares its parameter
with <INSERT-SPACES> (^B), not with <DELETE-LINES>.
<DELETE-LINES> (^F) shares its parameter with <INSERT-LINES> (^D).
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
The <ERASE-LINE> command is:
        1) Control-J or LINEFEED
        2) Control-N
        3) Control-D
        4) Control-F
%RIGHT 1
%RIGHT 1)
%WRONG 2
Control-N is <DELETE-SPACES>.
%WRONG 3
Control-D is <INSERT-LINES>.
%WRONG 4
Control-F is <DELETE-LINES> which deletes entire
lines, and replaces them with the following lines.
<ERASE-LINE> only erases from the cursor to the end
of the line, and leaves it blank, without moving
the following lines up.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%QUESTION
If you type <BLUE or PF1 KEY> 6 <CONTROL-J>, SED will:
        1) Do nothing.
        2) Erase 1 line without replacing it.
        3) Erase 6 lines without replacing them.
        4) Erase 6 lines and replace them with the following lines.
%RIGHT 1
The <ERASE-LINE> command (^J or Line-feed) does not
take a parameter.
%RIGHT 1)
%SAME
%WRONG 2
The <ERASE-LINE> command does not take a parameter,
and will not change the file at all if you try giving
it a parameter.
%WRONG 3
The <ERASE-LINE> command does not take a parameter.
%WRONG 4
Control-J is the <ERASE-LINE> command, not <DELETE-LINES>.
%WRONG
Answer 1, 2, 3, or 4.
%WRONG
%SAME
%TEXT
That is enough for this lesson.
Initially, you will probably have trouble remembering
all the different commands, so you should type or
print out a copy of the SED.HLP file, which has a list
of all the SED commands.

To type SED.HLP (on a hard-copy terminal, preferably), type:

        HELP SED

when you are at monitor (when you get the "." prompt).

To print it out, type:

        PRINT HLP:SED.HLP

when you are at monitor.

%END