Text processing apparatus with editing of stored document at each keystroke4464730Abstract A text terminal in which a text stream received on a communication link is segmented by a segmenter into chained variable-length segments which are stored in a random access text store. Each segment can contain at most one extended formatting command. Segments have slack areas to allow the subsequent insertion of text. A text editor receives keystroke signals from a keyboard and modifies the stored text stream, new segments being created as necessary for extended formatting commands or when slack areas are full. An interpreter/formatter is invoked when a received text stream has been segmented or when the stored text stream has been modified to format and map the stored text stream into a refresh buffer driving a cathode ray tube (CRT) display. The interpreter/formatter maintains a status index with condensed versions of the extended formatting commands stored in the text stream. Formatting is inhibited by the editor if it receives a keystroke requiring modification of the stored text. After editing segmented text is desegmented by a desegmenter and returned to the host along a communication link in the form in which it was received. Preferably, the terminal is implemented with a microprocessor which can also control standard data entry applications as well as text processing. Claims Having thus described our invention, what we claim as new and desire to secure by Letters Patent is: Description BRIEF SUMMARY OF THE INVENTION
______________________________________
1. Host link communication.
2. Keyboard adapter providing keyboard data
service
3. Keystroke processing, text editing,
interpreting and store management.
4. Inbound (to the host) data stream processing,
desegmentation.
5. Outbound (from the host) data stream
processing, segmenting.
6. Monitoring, scheduling.
______________________________________
Table I below is a flowchart in tabular form of the segmentation process:
TABLE I
______________________________________
(SEGMENTATION PROCESS)
______________________________________
1. Interpret first character in text data stream,
go to 2.
2. If extended formatting command, go to 3; if not,
go to 8.
3. Create new segment, store command, and go to 4.
4. Interpret next character in data stream and if new
line command store with extended formatting command
and go to 7; if no, go to 5 if it is not an extended
formatting command, but to 2, if it is.
5. Create new segment and store character, go to 6.
6. If another character in text data stream go to 7,
if not go to 11.
7. Interpret character and go to 2.
8. If existing segment at maximum go to 9; if not,
go to 10.
9. Create new segment, store character and go to 6.
10. Store character in existing segment and go to 6.
11. Terminate segmenting process.
______________________________________
In step 1, the segmenter 5 interprets the first character in the text data stream. In step 2, when an extended formatting command is recognized, a request is made to the store manager 7 for a new storage segment in which the extended formatting command is stored. The next character is interpreted in step 4 and if a blank or new line command is stored with the extended formatting command. If the character is not a blank or new line character, the segmenter 5 requests a new segment from the store manager 7 and stores the character therein (step 5). If this character were an extended formatting command, step 2 would be repeated but if it is not a space, a new line command or an extended formatting command, step 6 would follow. In step 6, a determination is made by the segmenter whether there is another character in the text stream and if there is, it is interpreted as in step 7: if there is no further character, the segmenting process is terminated (step 11) because the text data stream has been segmented and stored. If the determination in step 7 shows there is another character in the text stream, step 2 is repeated to determine whether or not it is an extended formatting command. If the determination at step 2 is that the character is not an extended formatting command, a determination is made in step 8 as to whether the existing segment has reached its maximum size and if it has, a new segment is requested from the store manager 7 and the character stored therein, step 6 then being repeated. If the determination in step 8 indicates that the existing segment is below the maximum size, the character is stored therein as in step 10 and step 6 is repeated. Thus, during the segmentation process, a new segment is obtained by the segmenter 5 from the store manager 7 each time an extended formatting command is encountered and each time an existing segment is at its maximum size. Each time a new segment is created, it is forward chained with the preceding segment which is reverse chained with it. This forward and reverse chaining is performed by the editor 10. Each time a character is stored in a segment, the length field 19 in the text segment is updated, also by the editor 10. As explained above, the interpreter/formatter 6 updates the status index 13 each time an extended formatting command is encountered during the formatting process. Each segment containing an extended formatting command has a length corresponding to the length of that command plus one byte for the trailing blank or new-line character. The other segments have variable lengths up to the maximum 256 bytes including a slack area for the subsequent insertion of characters during editing. The Store Manager The aforementioned European Patent application entitled, "Virtual Memory Terminal" (application No. 80 3021922) describes the store manager in detail and the creation and modification of fields 15 and 16 of the segments. One difference between the present arrangement and that described in the aforementioned application is that the latter does not use slack areas in the segments. However, the process by which segments (including their slack areas) is managed within the store memory is the same so it will not be described in more detail in the present specification. The store manager will only need to create new segments during the editing process when a new extended formatting command is inserted or a slack area is filled during character insertion. The store manager will only need to delete segments when it is informed by the editor 10 (by means of a call) that all characters have been deleted from the segment. It should be emphasized that the forward and reverse pointers in fields 17 and 18 and length count in field 19 are not used by the store manager 7 which also assumes that all segments passed to it are full--in other words, it does not recognize the slack space and does not attempt to shorten segments. Table II below is a flowchart in tabular form showing the character insertion process during editing of the stored text:
TABLE II
______________________________________
(CHARACTER INSERTION PROCESS)
______________________________________
1. If character being inserted is extended formatting
command go to 2; if not, go to 3.
2. Create new segment, and modify pointers.
3. If insertion point is first character position in
segment, go to 4; if not, go to 5.
4. If slack available in previous segment, fetch
and store inserted character; if not, go to 5.
5. If slack available in current segment, insert
character; if not, go to 6.
6. Request new segment and if sufficient space in
store available, go to 10; if not, go to 7.
7. Consolidate text segments in storage and go to 8.
8. If sufficient space available, go to 10; if not,
go to 9.
9. Indicate storage full or use backing store.
10. Create new segment, insert text in existing
segment to right of insertion point in new
segment, delete text to right of insertion point
in existing segment and insert new character at
end of existing segment, modifying pointers in
existing and next segments, and length fields
in existing and new segments.
______________________________________
In step 1, a determination is made by the editor 10 whether or not the entered character is an extended formatting command. If it is, the store manager 7 is asked for a new segment as in step 2 and the character is stored therein: the pointers in fields 17 and 18 of the preceding and succeeding segments are changed (the store manager 7 modifying the information in the header field 15). If the determination in step 1 is negative a determination is made in step 3 to determine if the insertion point is the first character position in the segment and, if it is, a determination is made at step 4 to determine if there is slack available and if so, the inserted character is inserted at the end of the text stream in the previous segment, the length count field 19 being suitably increased. If the determination in step 4 is negative, a determination is made in step 5 as to whether there is slack available in the current segment; if there is, the character is inserted and the length count in field 19 incremented. If the determination in step 5 is negative, the store manager is asked for a new segment and if there is sufficient space in the store a new segment will be provided and the character will be inserted in the new segment as in step 10. If the store manager indicates that there is insufficient space to supply a new segment, an attempt is made to consolidate text segments in the store as in step 7. Consolidation involves the segmenter 5 scanning the stored segments for segments with relatively large slack areas due to character deletion and decreasing the size of such segments to release storage space. A determination is made in step 8 to see whether sufficient free space has been released within the store to allow a new segment to be created; if it has, step 10 will be performed. If there is still insufficient space in the store, then the segments in the store are relocated by the storage manager to free fragmented inter segment space. If after this, there is still insufficient space, an indication is given to the operator as at step 9 that the store is full. The operator can then transmit text which has already been edited from the terminal to the host processor to release space in the store. (The desegmenter (DES) 11, FIG. 1, will strip segment headers from the text stream as it passes to the host.) This would be the case where no backing store is provided to the store. However, if a backing store were provided, either in the terminal or at the host, in accordance with the teaching of the aforementioned application entitled "Virtual Memory Terminal", the store manager would page text from the text store into the backing store to create more free space in the text store; this alternative is indicated in step 9. Step 10 represents the position where there was no slack available for character insertion. In this event, a new segment is created with text to the right of the insertion point being deleted from the existing segment and stored in the new segment. The segment pointers and length are appropriately adjusted. Should the terminal utilize such a backing store, this would not be apparent to the operator since the management of the store and backing store would be handled automatically by the storage manager of the aforementioned application. Thus, each time a new segment is required during the editing process, the appropriate pointers are set within the adjacent segments. Each time a character is entered into a segment, the count field of that segment is set. When an extended formatting command is entered, it is stored within the text stream and the status index subsequently updated. Deletion of characters is somewhat less complicated. If an extended formatting command is deleted, its segment is deleted from the text stream and the pointers of the segments which previously surrounded it are set to point to one another. As other characters are deleted, the slack area of the segment in which they are stored grows and the length field count decreased. When a segment contains no text, it is deleted from the segmented text stream with appropriate re-setting of the pointers in the segments surrounding it. After the document, or that part of a document stored in the store, has been edited to the satisfaction of the operator, the segmented text stream is read from the store and passed to the desegmenter 11, FIGS. 1 and 4, where the header fields 15 to 19 are removed for onward transmission of the text stream to the host processor in the same form that it was received. The Interpreter/Formatter The operation of the interpreter/formatter 6 on the segmented text stream will now be described in more detail. The input to the interpreter/formatter 6 is certain status information pertaining to the first row to be written (for example display/non-display controls flag, etc.), the left hand screen address of the first row to be written, and the address of the entry in the row index corresponding to the first row to be displayed (this contains the `starting` parameters). To display the top of the document, the first entry in the page index is moved into the current index. The first entry in the row index is where the current status is to be saved. Remember that the current status is accumulated while scanning the text data stream. The Row Index update takes place at the end of each row. To move a screen "forward" for a screen of N rows of text, the current index is created from the data held in the row index N-1 entries further on from that describing the top of the screen. Formatting starts at the second row of the screen. If a page boundary is encountered during interpretation, then formatting ceases and the current index is transferred to the next page index entry. To move a screen "backward" for a screen of N rows of text, the current index is created from the row index entry N-1 entries back from that describing the top of the screen. If such a row does not exist then the first row index entry is the source of the current index. To move a page forward, the current page number is incremented by one and the corresponding entry in the page index is transferred to the current index. Formatting starts at the top of the screen and stores status information into the row index starting with the first entry. To move a page backwards, the current page number is decremented by one and the corresponding entry in the page index is transferred to the current index. Formatting starts at the top of the screen and stores status information into the row index starting with the first entry. In a cursor scroll operation, the screen row containing the cursor is found and the corresponding entry in the row index is moved to the current index. The address to the entry in the row index is passed to the interpreter. Formatting starts at the top of the screen. The cursor address is decremented by W, the screen width + left and right hand margin bytes, for each row it is moved up. When the first screen of a document is displayed for the first time, these commands are not shown. When a designated function key is depressed, the text formatter changes to a `display controls` mode of operation. the screen of text is reshown but this time all recognized commands are displayed. The single-character commands that can be displayed are tab, space, required space, new line, required new line. This is achieved by modifying the EBCDIC to internal code translation table. The extended formatting commands that can be displayed are width, depth, tab setting, adjust on/off, center on/off, skip, required page boundary, page boundary, temporary left margin. With the exception of the temporary left margin command which is displayed as a single character embedded within the text, the commands are displayed on separate screen rows in a mnemonic form. The tab set command is displayed in a way similar to the tab rack at the top of the screen. Each command row begins with a sign to highlight the command. When the editor is in display mode and a temporary left margin character is to be displayed, the right hand margin for that row is moved one column to the right by one position. When the same Function key is next depressed the text is re-displayed without the control characters visible and the display is said to be in `non-display controls` mode. Thus, the key toggles the display between the two display modes. The interpreter/formatter 6 begins formatting at a given starting row and continues to build one row at a time until the end of the screen. As each row is processed, status information is gathered in the current index. This is saved for successive rows in the row index starting at the specified entry. If a page end command is encountered during row processing, then the following rows on the screen will be erased. If a key is depressed during formatting, then the interpreter is terminated at the end of the current row and control is passed back to the keystroke processor 9. The effect of this is to give higher priority to keystroke processing than to screen formatting. The operator's typing rhythm will not be interrupted by inadvertently causing the keyboard to overrun the screen formatting process with an inevitable loss of keystrokes. The interpreter/formatter 6 commences processing by fetching the segment containing the first byte of the text data stream. This segment identification and offset within the segment are stored in the current index passed on entry. The store manager 7 returns a real storage address corresponding to the segment. The associated offset is added to this address to give the effective address of the first byte of text data. Subsequently, all accesses to the text data stream are made using a set of macro primitives that take care of segment boundaries and the bi-directional segment chaining. The interpreter accesses each character in turn and, in the case of text symbols, translates and writes them to the display refresh buffer 8. The current temporary left margin position determines where the first character on a row is to be written. A tab character will cause the next character to be written at the next tab position as specified in the current index tab settings. If the right most character is not a word delimiter, then the position is cleared and the screen and text stream pointers are decremented until one is found. This is equivalent to word spilling in other text systems. If an extended formatting command is encountered, it is immediately interpreted and the current index is updated. Row formatting is terminated when any of the following conditions are detected:
______________________________________
(a) Page Boundary
(b) Required New Line
(c) Extended formatting command and terminal in
`display controls` mode.
(d) New Line and terminal not in `Adjusted Text`
mode.
(e) The right hand margin of the document is
reached.
(f) Skipping is in effect.
(g) End of Text Stream encountered.
(h) The logical cursor has been found as requested
by the editor 10.
(i) In `no display controls` mode an extended
formatting command is found while formatting
to the right of the left hand margin.
______________________________________
When not in adjusted text mode, the right hand margin corresponds with the right hand edge of the screen. In adjust mode, it is coincident with the page width. Summary What has been described is a text processing terminal in which a text stream is stored in a text store as a chained series of variable-length segments containing slack areas for the insertion of text during editing, incoming text streams being segmented in accordance with specified rules. During subsequent editing, characters are inserted or deleted from segments and new segments created as necessary. A formatter reads text segments from the text store and maps and formats the text characters into a refresh buffer for display on the screen. The editing process has a higher priority than the formatting process so that keystrokes are processed to change the text in the text store before the changed text is mapped onto the screen by the formatter. A status index containing condensed extended formatting commands speeds up the formatting process. With such an arrangement, the text processing terminal can be implemented with a single microprocessor. Although the use of a microprocessor has been described and is preferred because of its flexibility, those skilled in the art will appreciate that conventional hard-wired logic could be used instead for the text segmenting, formatting, editing and desegmenting processes. As mentioned earlier, a backing store could be provided within the terminal to allow larger documents to be stored therein, text being paged to and fro between the backing store and the text store as necessary in accordance with the teachings of the aforementioned application entitled "Virtual Memory Terminal." While the invention has been particularly shown and described with reference to a preferred embodiment thereof, it will be understood by those skilled in the art that various other changes in form and detail may be made therein without departing from the spirit and scope of the invention.
|
Same subclass Same class Consider this |
||||||||||
