Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50537/sed01.gno
There are no other files named sed01.gno in the archive.
%NOCONTROLC
%VARIABLES INTEGER ANSWER1, ANSWER2, ANSWER3, DUMMY;
%VARIABLES BOOLEAN MIME;
%ALGOL EXTERNAL PROCEDURE NOECHO,XECHO,INCH,TTOPEN;
%INITIALIZE stopkc; INPUT(0,"TTY");
%TEXT
This lesson describes the screen editor SED as used on a MIME-2A
or a 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);
Purpose of This Lesson
======================
    In this lesson, you will be aquainted with the general
concepts of the SED editor. You will also learn
	-how to enter and exit the SED editor,
	-how to move the cursor around,
	-how to insert and delete text, and
	-how to move through the file.
%TEXT outsymbol(12);
The Viewing Window Concept
==========================
     SED thinks of a text file as if it were a scroll of  writing  -
lots  and  lots  of  lines of text, one line after another.  The CRT
terminal screen is like a magnifying glass held over the scroll:  it
shows  a  certain number of lines and a certain number of characters
per line, but the file may extend beyond the limits of the glass  on
all  sides.   Like  the magnifying glass, the terminal screen can be
moved forward, backward, left, or right over the file.
%TEXT outsymbol(12);
      The terminal screen is called the  "viewing  window"  into  the
file.   Moving  the window forward or backward in the file is called
"rolling" the  window,  and  moving  it  left  or  right  is  called
"sliding".
%TEXT outsymbol(12);
Talking to SED
==============
       You can do three types of functions with SED: put text in the
file,  move  the  cursor  around, and issue editor commands.  Editor
commands do such things as insert blank lines  or  spaces  into  the
text,  move  the  viewing  window  around,  and  search  for  items.
Descriptions of the various  commands  make  up  the  bulk  of  this
tutorial.
%TEXT outsymbol(12);
    You issue a command by typing a control  character,  a  special
key, or an escape sequence.  You type a control character by holding
down the button labeled  "CTRL"  and  pressing  a  letter  key  (for
example, to get a ^T press "CTRL" and "T").

     Special keys are keys which are off to the side of  the  normal
keyboard. The editor understands special keys to be commands.

     You get an escape sequence by typing the "ESCAPE" or  "ALTMODE"
character  followed  by  some  other  character.
%TEXT outsymbol(12);
Running SED
===========

    If you want to edit a file that already exists on your area, type:

                          SED file.ext

where file is the file-name and ext is the extension.

   If you want to create a file, type:

                          SED file.ext=
%TEXT outsymbol(12);
Exiting SED
===========

     If you want to exit SED, and save all the changes you have made
in your file, use the <EXIT> command, control-Z.
     If you want to exit SED, leaving the file the way it was before
editing began, use the <ABORT> command, control-C.
%QUESTION outsymbol(12);
What command do you give if you want to edit a file on your disk area
called "MYFILE.FOR" ?
%NOEXTRA
%RIGHT SED MYFILE.FOR
%RIGHT sed myfile.for
%NEUTRAL SED MYFILE.FOR=
Actually, you can use the equal sign for a file that already exists,
but you don't need it.
%goto question1;
%NEUTRAL sed myfile.for=
%same
%WRONG SED
You didn't type the file name
%WRONG sed
%same
%LACK FOR
You forgot the extension. (.FOR)
%EXTRA
%WRONG
%WRONG
You should type SED MYFILE.FOR
%text
Note that if the file does not exist on your area, it will not
be created, but you will enter SED. At this point the best thing
to do would be to exit and try again.
%ALGOL
BEGIN question1:
  OUTSYMBOL(12);
  write("[N]OK. Now say you are in SED, and you want to exit, saving all");
  write("[N]your editing.");
  write("[N]What command do you give?");
  write("[N](Use the command, not it's name. The lesson will simulate a SED exit).");
  write("[N]--->");
  breakoutput;
COMMENT set the terminal no echo, answer3 will count the number of errors,
qcount is incremented (qcount is number of questions attempted);
  F10CALL(NOECHO); answer3:=0; qcount:=qcount+1;
  GETANSWER:   F10CALL(INCH,ANSWER1,answer2,answer3);  COMMENT input a character;
  if answer1 = 37 then goto zpercentout;  COMMENT if "%", get out of question;
COMMENT if control-Z (correct answer), increment latescore, if correct first try
(answer3 = 0) increment score, clear screen, output exiting message;
  if answer1 = 26 then
    begin
       if answer3 = 0 then
            score := score +1;
       latescore := latescore +1 ;
       outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
       write("SAVING FILE: DSKB:MYFILE.FOR[[107007,3232]] (WITH BACKUP)[N]");
       write("[NN]");
       breakoutput
    end
  else
    begin
COMMENT if control-C output appropriate error message;
       if answer1 = 3 then begin
            write("No. A control C will exit without saving the file[N]");
	    breakoutput end
       else
         begin
            if answer1 > 26 then
COMMENT if not a control character output error message;
              begin
                 write("No! Use a CONTROL character![N]");
                 write("Type a character while holding down the CTRL key[N]");
		 breakoutput
              end;
COMMENT if control character not Z or C output error message;
            else begin write("No, that's wrong, try again.[N]"); breakoutput end
         end
    end;
COMMENT if wrong answer, increment answer3, start question over;
  if answer1 # 26 then
    begin
       answer3:=answer3+1;
       goto getanswer
    end;
COMMENT if right answer, turn echoing back on, exit from question;
  else F10CALL(XECHO);
goto goodzout;
COMMENT if "%" go here;
ZPERCENTOUT: 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 Zout;
goto ZPERCENTOUT
end;
%TEXT goodzout:
Very good. The above text is what SED will write when you exit.
Note that SED also puts a backup file on your area with a ".BAK"
extension. This is a copy of the file as it was before editing.
%TEXT zout: outsymbol(12);
Moving the Cursor
=================
     The cursor is the blinking blot or dash that is always  present
on the terminal screen.  It represents your position in the file you
are editing.  If you type a character it appears where the cursor is
(both on the screen and in the file you are editing) and the  cursor
moves  one  space  to the right.
%TEXT
     The  cursor can be moved up, down, left and right by typing one
of the keys  with an arrow on  it  (these are  located at the top of
the keyboard). The direction of the arrow indicates the direction in
which the cursor will move.
     You can also  move the cursor  to the top  left position of the
screen (called the "home" position) by typing the unmarked black key
(for MIME-2A) or PF3 key (for VT-100) at the top right of the keyboard.
%TEXT outsymbol(12);
In the next question it is important that you do not try to
type ahead of the computer. Give the computer time to
operate after each keystroke you give it.
%ALGOL
BEGIN question2:
COMMENT clear screen, go to home position, output question;
outsymbol(27); outsymbol(72); outsymbol(27); outsymbol(74);
write("Pretend you are in SED, and this is the text of the file.");
write("[N]What key will you press to get the cursor to the top left");
write("[N]corner of the screen? (press the key itself)");
breakoutput;
COMMENT turn echo off, initialize answer3, increment qcount;
F10CALL(NOECHO); answer3:=0; qcount:=qcount+1;
GETANSWER2:   F10CALL(INCH,ANSWER1,answer2,answer3); COMMENT input character;
COMMENT if <ESC> then look at next character, if R then its the correct answer;
if answer1 = 27 then
  begin
     if answer2 = 82 then
       begin
          if answer3 = 0 then
               score := score +1;
          latescore := latescore +1 ;
          outsymbol(27); outsymbol(72); COMMENT cursor home;
          write("[NNNNNN]Ok!!!! Great! Now how do you move the cursor");
          write("[N]one space to the right? ");
	  breakoutput
       end
     else
       begin
          write("[NN]No, that's wrong, try again.[N]");
	  breakoutput;
          answer3:=answer3+1;
          goto getanswer2
       end;
  end
else
  begin
     if answer1 = 37 then goto done; COMMENT if "%" goto done;
     write("[NNNNNN]No, that's wrong, try again.[N]");
     breakoutput;
     answer3:=answer3+1;
     goto getanswer2
  end;
COMMENT next question, initialize answer3, increment qcount;
answer3:=0; qcount:=qcount+1;
goright: outsymbol(27); outsymbol(72); COMMENT cursor home;
breakoutput;
F10CALL(INCH,ANSWER1,answer2,answer3); COMMENT input character;
if answer1 = 37 then goto pcout; COMMENT if "%" goto pcout;
COMMENT if <ESC> look at next char, if "C", then correct answer;
if answer1 = 27 then
  begin
     if answer2 = 67 then
       begin
          if answer3 = 0 then
              score :=score +1;
          latescore:=latescore+1;
          outsymbol(27); outsymbol(67); COMMENT cursor right (ESC C);
          write("[NNNNNNNNNNNNN]Good Work! I knew you could do it!");
	  write("[NNN]");
	  breakoutput;
          goto done
       end
     else
COMMENT if ESC D, that is cursor left, try again, if not C or D try again;
       begin
          if answer2 = 68 then
            begin
               answer3 := answer3+1;
               write("[NNNNNNNNN]No, that is move to the LEFT.                     ");
               write("[N]Try again                                       ");
	       breakoutput;
	       goto goright
            end
	  else
            begin
               write("[NNNNNNNNN]No, that is wrong. Use the right arrow.           ");
               write("[N]Try again                                       ");
               breakoutput
            end
       end
  end
else
  begin
COMMENT if a printable character, print it to show user what (s)he did,
if a space explain why space is wrong, try again;
     if answer1 > 31 then outsymbol(answer1);
     if answer1 = 32 then
       begin
          answer3 := answer3+1;
          write("[NNNNNNNNN]No that puts a space as the first character");
          write("[N]You want to move the cursor, not insert a space");
	  breakoutput
       end
     else
       begin
          write("[NNNNNNNNN]No, that is wrong. Use the right arrow.           ");
          write("[N]Try again                                       ");
	  breakoutput
       end
  end;
goto goright;
COMMENT go here if "%";
PCOUT: 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 done;
goto PCOUT;
done: F10CALL(XECHO); pause
end;
%TEXT outsymbol(12);
     There are five other cursor movers:
	1) <RETURN> or <CTRL> M  moves the cursor to the
           start of the next line
	2) <TAB> or <CTRL> I moves the cursor to the next tab stop.
           Tab stops are positioned every 8 columns, by default.
	   (Note that it does not INSERT a tab.)
	3) <CTRL> U (called BACKTAB) moves to the previous tab stop.
	4) The 8 on the NUMERICAL keypad (next to the regular keypad)
	   moves the cursor to the start of the line. This command
	   is called "<BEGIN-LINE>".
	5) The 5 on the NUMERICAL keypad (next to the regular keypad)
	   moves the cursor to the end of the line. This command is
	   called "<END-LINE>".
%QUESTION outsymbol(12);
If you are at the beginning of a line (leftmost position), and
you push the numerical keypad "8", where on the line will the
cursor go to?
	1) Stays at the beginning of current line
	2) Goes to the end of the line
	3) Goes to the beginning of next line
	4) Goes to the end of previous line
(Please give the number of the appropriate response)
%NOEXTRA
%RIGHT 1
%RIGHT 1)
%WRONG 2
That used to be true, in the original version of SED, but now the
<END-LINE> command, keypad 5, is what puts you at the end of the line.
%WRONG 2)
%SAME
%WRONG 3
It will only deal with your current line.
%WRONG 3)
%same
%WRONG 4
%same
%WRONG 4)
%same
%WRONG
%TEXT outsymbol(12);
Putting Text into the File
==========================
    To put text into the file, just type it. The text will appear
where the cursor is. Use the cursor movement commands described
earlier to move the cursor to the location on the screen where
you want the text to be.
    If there is already text there, it will be over-written. This
is a good way to correct mistakes.
%TEXT OUTSYMBOL(12);
Inserting Characters
====================
    If you want to insert a word between two other words
use the <INSERT-MODE> command, which is given by typing the
key marked "ENTER" on the numerical keypad. Then, characters
you type, instead of replacing the ones in the file, will
be inserted where the cursor is. The rest of the line will
shift to the right as you type.
    You can get out of insert mode and back into replace
mode by giving the <INSERT-MODE> command again.
%TEXT
In the next question it is important that you do not try to
type ahead of the computer. Give the computer time to
operate after each keystroke you give it.
%ALGOL
begin question3:
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]The cursor is before the word ""brown"" (actually ON the ""b"")");
write("[N]in the sentence below. You wish to insert the word ""quick""");
write("[N]at that position. Do this using the <INSERT-MODE> command.");
write("[N]Remember to put a space in after ""quick"" and to do the ");
write("[N]<INSERT-MODE> command again to end the inserting.");
write("[N]SED will tell you that you are in INSERT-MODE and");
write("[N]will ring a bell at each character you insert");
write("[NN]   The brown fox jumped over the lazy dog."); breakoutput;
COMMENT dummy counts the number of tries, initialize dummy, increment
qcount, turn echo off;
dummy:=0; qcount:=qcount+1; f10call(noecho);
getanswer3: dummy:=dummy+1; COMMENT increment dummy;
COMMENT position cursor to bottom of screen, blank over anything that's there,
position cursor home;
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
outsymbol(27); outsymbol(72);
COMMENT if 5th try, remind user that a "%" will take him/her out of the
question;
if dummy = 5 then
     write("[11N]If you are having trouble, type a ""%"".");
breakoutput;
COMMENT enter alternate keypad mode, get cursor in place;
outsymbol(27); outsymbol(61);
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if ESC, look at next char, if "?" look at next char, if "M", then user
pushed the numeric keypad "ENTER", which is the "INSERT-MODE" command, so
go to get "q" (to insert "quick");
if answer1 = 27 then
  begin
     if answer2 = 63 then
       begin
	  if answer3 = 77 then goto getq
       end
  end
else
  begin
COMMENT if control-C or "%", allow user to get out;
     if (answer1 = 3) or (answer1 = 37) then
       begin
	  dummy := 100;
	  goto KCOUT
       end
  end;
COMMENT if not ESC ? M, try again;
write("[NNN]Use the keypad <ENTER> key");
breakoutput;
goto getanswer3;
getq:
COMMENT position cursor at bottom of screen, reverse video, output "INSERT
MODE" message, return to normal video (video reversal for MIME only);
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
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(" *** INSERT MODE *** "); breakoutput;
if MIME then
  begin
     outsymbol(27); outsymbol(83); outsymbol(64); breakoutput
  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;
COMMENT reposition cursor to "brown";
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if char input is printable, insert it;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(40);
     breakoutput;
  end;
COMMENT if char is a "q" or a "Q", got to get a "u";
if (answer1 = 113) or (answer1 = 81) then goto getu;
if (answer1 = 3) or (answer1 = 37) then
begin
   dummy := 100;
   goto KCOUT
end;
COMMENT if not a "q" or "Q", output error message, position cursor, and if the
wrong char was typed, delete it, and start all over again;
write("[NNN]Insert the word ""quick""    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
     breakoutput
  end;
goto getanswer3;
getu: f10call(inch,answer1,answer2,answer3); COMMENT input next char;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(41);
     breakoutput;
  end;
COMMENT if "u" or "U", then go to get an "i";
if (answer1 = 117) or (answer1 = 85) then goto geti;
COMMENT if control-C or "%", allow user to exit question;
if (answer1 = 3) or (answer1 = 37) then
begin
   dummy := 100;
   goto kcout
end;
COMMENT if not "u" or "U" output error message, position cursor, delete
end of line and start over from beginning;
write("[NNN]Insert the word ""quick""    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
outsymbol(27); outsymbol(75);
write("brown fox jumped over the lazy dog");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
goto getanswer3;
geti: f10call(inch,answer1,answer2,answer3); COMMENT input next character;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(42);
     breakoutput;
  end;
COMMENT if "i" or "I" then go get a "c";
if (answer1 = 105) or (answer1 = 73) then goto getc;
COMMENT if control-c or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then
  begin
     dummy := 100;
     goto kcout
  end;
COMMENT if not "i" or "I", error message, position cursor, delete
end of line, and start over again;
write("[NNN]Insert the word ""quick""    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
outsymbol(27); outsymbol(75);
write("brown fox jumped over the lazy dog");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
goto getanswer3;
getc: f10call(inch,answer1,answer2,answer3); COMMENT input next character;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(43);
     breakoutput;
  end;
COMMENT if "c" or "C" go get a "k";
if (answer1 = 99) or (answer1 = 67) then goto getk;
COMMENT if control-C or "%" let user exit;
if (answer1 = 3) or (answer1 = 37) then
  begin
     dummy := 100;
     goto kcout
  end;
COMMENT if not "c" or "C", error message, position cursor, delete 3 or 4
characters, and start over;
write("[NNN]Insert the word ""quick""    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
outsymbol(27); outsymbol(75);
write("brown fox jumped over the lazy dog");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
goto getanswer3;
getk: f10call(inch,answer1,answer2,answer3); COMMENT input next char;
COMMENT if character is printable, insert it;
if answer1 > 31 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(44);
     breakoutput;
  end;
COMMENT if "k" or "K" go get a space;
if (answer1 = 107) or (answer1 = 75) then goto getspace;
COMMENT if control-C or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then
  begin
     dummy := 100;
     goto kcout
  end;
COMMENT if not "k" or "K", write error message, position cursor, delete
end of line, start over;
write("[NNN]Insert the word ""quick""    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
outsymbol(27); outsymbol(75);
write("brown fox jumped over the lazy dog");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
goto getanswer3;
getspace: f10call(inch,answer1,answer2,answer3); COMMENT input next char;
COMMENT if a space, insert it and go get another INSERT-MODE;
if answer1 = 32 then
  begin
     outsymbol(27); outsymbol(75);
     outsymbol(answer1); outsymbol(7); breakoutput;
     write("brown fox jumped over the lazy dog");
     outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(45);
     breakoutput;
     goto getout
  end;
COMMENT if control-C or "%" allow user to get out;
if (answer1 = 3) or (answer1 = 37) then
  begin
     dummy := 100;
     goto kcout
  end;
COMMENT if not a space, output error message, position cursor, rewrite
end of line and start over;
write("[NNN]Put a space in at the end    ");
write("[N]Please try over (starting with the <INSERT-MODE> command)");
breakoutput;
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
outsymbol(27); outsymbol(75);
write("brown fox jumped over the lazy dog");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(39);
breakoutput;
goto getanswer3;
getout: f10call(inch,answer1,answer2,answer3); COMMENT input char;
COMMENT if ESC see next char, if "?" see next, if M, then user
typed numerical keypad "ENTER" (SED INSERT-MODE), and is done;
if answer1 = 27 then
  begin
     if answer2 = 63 then
       begin
	  if answer3 = 77 then goto thatsit
       end
  end;
COMMENT if control-C or "%" allow user to exit;
if (answer1 = 3) or (answer1 = 37) then
  begin
     dummy := 100;
     goto kcout
  end;
COMMENT if not ENTER, error message, position cursor, and get ENTER again;
write("[NNN]End with the <INSERT-MODE> command");
write("[N]                                                         ");
outsymbol(27); outsymbol(89); outsymbol(41); outsymbol(44);
breakoutput;
goto getout;
COMMENT if "%" or control-C go here;
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 question3;
POS:=1;
if anywhere("SKIP") then goto thatsit;
goto KCOUT;
thatsit:
outsymbol(27); outsymbol(89); outsymbol(55); outsymbol(32);
outsymbol(27); outsymbol(75);
outsymbol(27); outsymbol(89); outsymbol(47); outsymbol(32);
outsymbol(27); outsymbol(62);
if dummy # 100 then
  begin
     write("[NN]Excellent! Keep up the good work!"); breakoutput;
     latescore:=latescore+1;
     if dummy = 1 then score:=score+1
  end
end;
%TEXT

%TEXT outsymbol(12);
Deleting Characters
===================
    You can delete the character to the left of the cursor by
typing the <DELETE-CHARACTER> command which is done by typing
the KEYPAD period (".").
    If the character to the left of the cursor is a tab, the
entire tab is deleted. If the cursor is at the start of a line,
<DELETE-CHARACTER> has no effect.
%TEXT
    There are other ways both to insert and to delete text.
These will be covered in later lessons.
%TEXT outsymbol(12);
    This lesson is almost finished, so you can go and try to create
a file with SED, but first there is one more set of commands you
should know before trying to use SED.
%TEXT Outsymbol(12);
Moving the screen forward and backward in the file
==================================================
     If you type on the bottom line of the screen and  then  type  a
carriage  return  the  screen  will roll one line.  That is, the top
line disappears, the other lines move up, and a blank  line  appears
at  the  bottom.   The  top line has not been deleted;  it is simply
above the viewing window.
     You can get the lines above the viewing window back  by  typing
the <ROLL-BACKWARD-LINES> command:  <CTRL> W.  This command does the
following: lines disappear from the bottom, the remaining lines roll
down,  and  lines  which  were  above  the screen appear at the top.
<ROLL-BACKWARD-LINES> will attempt to roll about  8  lines,  but  it
won't go farther than the beginning of the file (so if you're at the
start of the file and type the command nothing will happen).
     Similarly, you can roll the screen forward  about  8  lines  by
typing the <ROLL-FORWARD-LINES> command: <CTRL> T.
%QUESTION outsymbol(12);
Does a CTRL-T move the screen forward or backward?
%right forward
%wrong backward
%wrong
%text
Just one more question before you go.
%Question
What command do you give to the monitor to CREATE a file called
"TEXT.RNO" with sed?
%NOEXTRA
%RIGHT SED TEXT.RNO=
%RIGHT sed text.rno=
%WRONG SED TEXT.RNO
You must have an "=" at the end of your command.
%wrong sed text.rno
%same
%wrong sed text
You must type the extension
%wrong SED TEXT
%SAME
%WRONG SED TEXT=
%SAME
%WRONG sed=text.rno
The "=" should be after the file name.
%WRONG SED=TEXT.RNO
%SAME
%WRONG SED=TEXT
%SAME
%WRONG sed=text
%SAME
%WRONG sed = text.rno
%same
%WRONG SED = TEXT.RNO
%SAME
%WRONG SED = TEXT
%SAME
%WRONG sed = text
%SAME
%WRONG create
No, use the SED command.
%wrong CREATE
%same
%wrong CREATE TEXT
%same
%wrong create text
%same
%wrong CREATE TEXT.RNO
%same
%wrong create text.rno
%same
%wrong CREATE TEXT.RNO=
%same
%wrong create text.rno=
%same
%wrong
%wrong
%text outsymbol(12);
All right. Now you can at least start to write a file with SED.
But do try the other lessons, as you won't be able to go very
far with just this one.
%finish
%end