|
Any basic peripheral file may be amended by use of the George editor. Editing a GRAPHIC mode file is straight forward but problems may arise if an attempt is made to edit a file in NORMAL or ALLCHAR modes. The editing process copies the file to be edited (the old file) into a new file making changes as directed by editing instructions. The editing instructions are normally read from the job source (i.e. job description file or on-line console), but may be contained in an editfile. The general form of the command is: Thus, Similarly, The Pointer A serial file is regarded as a series of records, which, for all practical purposes, correspond to a unit on some physical medium, i.e. a card, a block of paper tape, or a line of print. Each record consists of a series of characters. Editing is done in terms of a conceptual pointer which indexes a particular character within a particular record of the old file. The pointer is initially at the first character of the file, that is, character 0 of record 0. Editing instructions are used to move the conceptual pointer from the beginning to the end of the old file creating the new file by transcribing text from the old file and by deleting, inserting and replacing characters and records as specified by the editing instructions. Off-line and on-line editing Any editing operation may be performed either off-line or from an on-line console. Editing is ideally suited to on-line access since progress is visible and errors can be corrected immediately, e.g. by F(forget) command. Some editor facilities can only really useful on-line, e.g. W(window). Off-line editing The editor is entered using the EDIT command from within the job description. The editing instructions follow immediately on the next lines or cards of the job description (or may be contained in an editfile). Each instruction is terminated by a comma or newline. On-line editing The editor is entered by typing the EDIT command from an on-line console after
logging-in. The system replies Editing instructions Instructions to the editor are all one character mnemonics usually followed by associated parameters. Each record of input to the editor may contain several editing instructions separated by commas. All editing instructions except the I instruction must be complete in one record. Records input to the editor are listed to the monitoring file in the COMMANDS category. Several editing instructions require as a parameter a character string and several an endpoint. It is convenient to describe these before the various editing instructions. Character string A character string consists of any number of characters
enclosed within a pair of identical string delimiters. These
are taken from the character set: Note that Endpoint Many editing instructions specify that a particular operation
is to be carried out up to a certain place in the old file.
This place is known as the endpoint and can be specified in
several ways. The general format of an endpoint specification
is <record> specifies the record of the oldfile which is to be the endpoint. It may be omitted in which case the current record is assumed but the . must be present. .<character> specifies the character position of the endpoint within the record. It may be omitted in which case the start of the specified record is assumed. In what follows n signifies an integer and string signifies a character string as previously defined. The following forms may be used and have the effect stated. Specifying a record
Specifying a character position
Transcription and deletion of records and characters T<endpoint> transcribes (or copies) characters from the old file to the new file starting at the current position and continuing to the endpoint specified. P<endpoint> positions the pointer at the endpoint specified. No text is copied over from the old to the new file so that this in effect deletes text. Note that with this instruction only the pointer may be moved backwards by specifying the endpoint in the form -n or #n only. This facility enables the contents of a file to be re-ordered. E transcribes the rest of the old file to the new file and terminates the edit. Consider the file The pointer is initially at 0.0
Thus, the sequence Note the separation of editing instructions by commas. There are clearly a large number of ways of achieving the
same effect, e.g. Note that if a transcribe (T) instruction moves the pointer past the end of a record then that record is extended as necessary in the new file by the addition of spaces. If a position (P) instruction moves from the start of a
record to the start of another record then intervening records
are deleted. If a P instruction starts from within a
record then the front of the starting record is joined to the
endpoint record. For example, if the sequence Inserting text The Insert instruction The I instruction is used to insert information into the new file. The string must be delimited by a pair of identical
delimiters from the set previously given and has the format
I If a multi-record insert is being made on-line, the user
types an Accept where he requires a new record in the string.
The system will then remind him that the second delimiter has
not been given by replying with the delimiter and the
invitation to type, e.g. Consider the file The pointer is initially at 0.0
The result would be If the second Insert had been I/XYZ/ the result would instead
have been The Replace Instruction The Replace (R) instruction has the format: For example, if the current record is Note that to retain the position of APR, the instruction would be R/CH/ /. R/CH// is equivalent to T./CH/,P.2 and The After and Before instructions The A and B instructions have the format: They cause the current record to be transcribed to after or
before the first occurrence of the oldtext specified, and then
the newtext to be inserted. Thus, if the pointer is at the
first character of Note that Also, Repetition A sequence of editing instructions may be repeated by placing the sequence in brackets, and following it either with *n or <endpoint>. *n means that the sequence should be repeated n times. <endpoint> means that repetition should be performed until the pointer reaches <endpoint>. For example, to change all statements of the form This says "transcribe to any line containing FORMAT, replace the first occurrence of a left hand bracket with (1H , then repeat this sequence until the end of the file, then terminate the edit". Note that the use of the TC string facility in this way is somewhat expensive in processor utilisation. Merging files The George editor allows a number of files to be edited and
merged into a single new file during one edit by using the
Merge (M) instruction which has the format: This causes the current old file to be closed and the position of the pointer in that file to be remembered. The file specified in the M instruction is then opened with the pointer at 0.0, and may then be edited. A file that is closed as a result of the M instruction is placed at the top of a push-down stack. Subsequent M instructions place files on the top of the stack, and cause the pointer position to be remembered. Up to ten old files may be in use at any one time. The X instruction, which has the format: Suppose the file ALPHA contains If the pointer is at 0.0 of ALPHA, then Note that a file may be merged with itself. This can be
especially useful for re-ordering a file. Thus, if FRED
contains The instructions Note the use of FRED(-1) in this M instruction. This is
necessary since the EDIT command creates a new file called
FRED and the old file is therefore now FRED(-1). Notice also
that the same effect could be achieved by Terminating or abandoning the edit Normally an edit is terminated by the E instruction which has already been described. The rest of the oldfile is automatically copied to the new file before control is returned to the George command source. When using the editor on-line it is possible to abandon an edit by means of the Q (Quit) instruction. The edit is terminated immediately and the new file is left as it was before the edit. Special features for editing on-line Any fault in the editing instructions produces a suitable error message. If editing off-line the message is simply sent to the monitoring file of the job and the edit continues. If editing on-line the message is sent to the terminal and control is returned to the console. The user can then decide what to do according to the circumstances. A number of features of the editor are designed specifically to simplify on-line editing. The Window facility The user can switch on a "window" facility. If the switch is
on and the pointer is moved to a new record by a T or P
instruction then that record is listed on the console. The
window facility is controlled by the following
instructions: The Listing facility This is controlled by the instructions L ON, L OFF and L in the same way as the window facility. If listing is switched on then all lines transcribed to the new file are listed on the console. This facility should be used with caution. Having made some alterations to a line a useful sequence to
see whether the line is now correct is The F (Forget) instruction The F instruction has the effect of resetting the
pointer to the position it was at before the last editing
record was obeyed. Any records copied to the new file as
a result of instructions in the last editing record are
removed. E.g. This instruction is a useful dodge when a mistake has been made, but note that two or more consecutive F instructions are not allowed. Break-in during an edit If the Control A key is pressed while the editor is obeying
an instruction then the following message is output: Editor messages The most common editor messages are:
Other facilities A number of other facilities are available within the editor. For a full description of these Chapter 6 of the George reference manual should be consulted. |