1.3.2. Getting Started

page033 Entering the Workfile and Getting a Program

On entering the Editor

No workfile is present. File? ( <ret> for no file <esc-ret> to exit):
appears.

There are three ways to answer this question :

  1. With a name, for example “string1 <ret>”. The file named string1 will now be retrieved. The file string1 could contain a program, also called string1, as in Fig. 2.1. after typing the name, a copy of the text of the first part of the file appears on the screen.
    Figure 2.1
    PROGRAM STRING1;
    BEGIN
      WRITE('TOO WISE ');
      WRITE('YOU ARE');
      WRITELN(',');
      WRITELN('TOO WISE');
      WRITELN('YOU BE')
    END.

  2. With a <return>. This implies that a new file is to be started. The only thing visible on the screen after doing this is the editor prompt line. A new workfile is opened and currently has nothing in it. Type “I” to begin inserting a program or text.
  3. With <escape + return>. This causes the editor to drop you back to the system command level. Useful when you didn't mean to type ‘E’.

Workfiles: No questions are asked if a workfile already exists. The workfile is displayed and can be modified or can be cleared, in order to start a file, by using the N(ew command in the Filer.

page034 Moving the Cursor

In order to edit, it is necessary to move the cursor. On the keyboard are four keys with arrows (which may look like triangles) which move the cursor. The <up-arrow> moves the cursor up one line, the <right-arrow> moves the cursor right one space and so forth. On terminals which do not have cursor keys, the system will have to be set up with a set of control keys to act as vector keys. Refer to section 4.3 for more information on setting control keys.

The cursor does not like to be outside of the text of the program. For example, after the “N” in “BEGIN” in Fig. 2.2 , push the <right-arrow> and the cursor moves to the “W” in “WRITE”. Similarly at the “W” in “WRITE('TOO WISE ');”, use <left-arrow> to move to after the “N” in “BEGIN”.

Figure 2.2
BEGIN_
  WRITE('TOO WISE ');

BEGIN
  WRITE('TOO WISE ');

If it is necessary to change the “WRITE('TOO WISE ');” found in the third line to a “WRITE('TOO SMART ');”, the cursor must first be moved to the right spot.

For example: if the cursor is at the “P” in “PROGRAM STRING1”, go down two lines by pressing the down arrow 2 times. To mark the positions the cursor occupies, labels a,b,c are used in Fig. 2.3. “a” is the initial position of the cursor; “b” is where the cursor is after the first <down-arrow>; “c”, after the second <down-arrow>.

Figure 2.3
aROGRAM STRING1
bEGIN
c WRITE('TOO WISE ');

Now, using the <right-arrow>, move until the cursor sits on the “W” of “WISE”. Note that with the use of <down-arrow> the cursor appears to be outside the text. Actually it is at the “W” in “WRITE”, so do not be surprised when on typing the first <left-arrow> the cursor jumps to the “R” in “WRITE”. The point being that when the cursor is outside the text, it is conceptually on the closest character to the right or left.

page035 Using Insert

The Edit level prompt line shows that to I(nsrt (insert) an item, type “I”. The cursor must be in the correct position before typing “I”. Earlier, the cursor was moved to the “W” in “TOO WISE”; now, on typing “I”, an insertion will be made before the “W”. The rest of the line from the point of insertion will be moved to the right hand side of the screen. In the event that the insertion is lengthy, that part of the line will be moved down to allow room on the screen. After typing “I” the following prompt line should appear on the screen:

>Insert: text {<bs> a char,<del> a line} t<etx> accepts, <esc> escapes]
If that prompt line did not appear at the top of the screen it is not insert mode and a wrong key may have been typed.

If the cursor is at the “W” in “WISE”, and on typing “I” the insert prompt line appeared, “SMART” may be inserted by typing those five letters. They will appear on the screen as they are typed.

There remains one more important step. The choice at the end of the prompt line indicates that pushing the <etx> key accepts the insertion, while pushing the <esc> key rejects the insertion and the text remains as it was before typing “I”.

Figure 2.4 (Screen after typing “SMART”)
BEGIN WRITE('TOO SMART WISE `);

Figure 2.5 (Screen after <etx>)
BEGIN
  WRITE('TOO SMARTWISE ');

Figure 2.6 (Screen after <esc>)
BEGIN
  WRITE('TOO WISE ');

It is legal to insert a carriage return. This is done by typing <return> while in the INSERT mode and causes the Editor to start a new line. Notice where carriage return places the cursor. This is intended as a programming aid.

page036 Using Delete

The DELETE mode works like the INSERT mode. Having inserted the ‘SMART’ into the STRING1 program and having pushed <etx>, ‘WISE’ must be deleted. Move the cursor to the first of the items to delete and type “D” to put the Editor into DELETE mode. The following prompt line should appear:

>Delete: < > <Moving commands> {<etx> to delete, <esc> to abort}
Each time <space> is typed a letter disappears. In this example typing 4 spaces will cause “WISE” to disappear. Now the same choice must be made as in insert. Type <etx> and the proposed deletion is made or type <esc> and the proposed deletion reappears and remains part of the text.

It is legal to delete a carriage return. At the end of the line, enter DELETE mode, and <space> until the cursor moves to the beginning of the next line.

These are sufficient commands to edit any file desired. The next section describes many more commands in the Editor which make editing easier.

Leaving the Editor and Updating the Workfile

When all the changes and additions have been made, exit the Editor and “save” a copy of the modified program. This is done by typing “Q” which will cause the prompting display shown in Fig. 2.7.

Figure 2.7
>Quit:
 U(pdate the workfile and leave
 E(xit without updating
 R(eturn to the editor without updating
 W(rite to a file name and return

The most elementary way to save a copy of the modified file on disk is to type “U” for U(pdate which causes the workfile to be saved as SYSTEM.WRK.TEXT. With the workfile thus saved, it is possible to use the R(un command, provided of course the file is a program. It is also possible to use the S(ave option in the Filer to save the modified file before using the Editor to modify or create another file.

Miscellaneous commands, in the next section, explains in greater detail the options available at >Quit.


This page last regenerated Sun Jul 25 01:09:47 2010.