Operation of the Editor
When you edit an existing Reality item, you are dealing with three independent versions of that item.
Primary Version
The primary version is the one on the disk. This version remains unchanged until you issue a FI (File) or FS (File Save) command.
Secondary Versions
Two other versions of the item are stored in areas of your process workspace.
The first of these (the current version) contains the version of the item you are currently working with.
The second (the updated version) contains all lines from the current version up to the current active line.
Lines and Attributes
Each line (attribute) in the current version of the item is associated with a line number. A line pointer points to the line just entered or revised; an EOI (end-of-item) pointer is positioned at the end of the last line of the item. Editor operations are performed on one line at a time in an ascending line number sequence from Top (Line 1) to bottom (EOI).
As lines in the item are changed, inserted, or deleted, the Editor builds a new updated version of the item in the second version. Updating must continue in an ascending line number sequence until the F (Flip) command is entered.
If you try to edit a lower numbered line before you issue the F command, the following message is displayed:
Sequence?
Enter F, then go
to the line you want to edit.
Flipping the Editor Buffers
The F command performs four functions:
-
Copies any remaining unaltered lines from the current into the updated version.
-
Renumbers the lines (attributes) sequentially within the item.
-
Repositions the current line pointer to the first line of the item and the EOI pointer to the last line of the item.
-
Switches (toggles) the function of both versions (that is, Version 1 becomes the update buffer and Version 2 becomes the current buffer).
The next editing session occurs in Version 2 with changes accumulating in Version 1. This toggling of workspace can go on indefinitely until the item is filed on the disk by means of an FI (File) or FS (File Save) command.
Note
The only way you can change an item's permanent, or disk, version is to file it using either the FI or FS command.
An editing session is illustrated in the examples below.
A four line item is shown below in Buffer 1 (current buffer) with the current line pointer positioned at Line 2. Two lines ("1234" and "5678") are then inserted after Line 2, as can be seen in Buffer 2 (update buffer).
|
Buffer 1 |
|
Buffer 2 |
|
Top |
|
Top |
|
1 AAAAA |
|
1 AAAAA |
|
2 BBBB |
← Current Line Pointer |
2 BBBB |
|
3 CCCC |
|
3 1234 |
|
4 DDDD |
← EOI Pointer |
4 5678 |
|
5 |
|
5 |
|
6 |
|
6 |
|
. |
|
. |
|
. |
|
. |
|
n |
|
n |
When the F command is issued, the versions are toggled (see below). Here Buffer 2 becomes the current buffer. Further changes made to the item are accumulated in Buffer 1, which has now become the update buffer.
|
Buffer 1 |
|
Buffer 2 |
|
Top |
Current Line Pointer → |
Top |
|
1 |
|
1 AAAAA |
|
2 |
|
2 BBBB |
|
3 |
|
3 1234 |
|
4 |
|
4 5678 |
|
5 |
|
5 CCCC |
|
6 |
EOI Pointer → |
6 DDDD |
|
. |
|
. |
|
. |
|
. |
|
n |
|
n |
Internal Attribute Pointer
The internal attribute pointer keeps track of the position of the current line. Note that, after executing a command that specifies a number of attributes, such as R (Replace) or DE (Delete), the pointer is moved to the end of the affected lines. For example, executing DE20 followed by L1 displays the first line after the 20 deleted lines.
In earlier releases of the Editor (prior to Reality Release 7.0), this pointer was not updated immediately after executing a command that specifies a number of attributes, such as R or DE.
For example, in earlier releases, executing DE20 followed by L1 listed the first line affected by the DE command. Now, the same sequence of commands displays the first line after the 20 deleted lines.