To read a Text programmatically, a RECORD termed a Reader is opened on the Text at a specified offset. (A Reader is a RECORD; not a procedure.) With reader open, the Read(reader, ch) procedure retrieves a character each time it is executed. The font of a character is referenced in the Objects.Library of the Reader. The Reader also has fields, col, the color of the character and voff, vertical offset of the character. After an execution of Read(reader, ch), the freshly read character is available in ch and attributes are in the components of reader. This assumes that the object read was a character as evidenced by (reader.lib IS Fonts.Font) being TRUE. Each execution of Read() advances reader through the Text by one character until the end is reached and reader.eot becomes TRUE.
These tables show the structure of records in memory representing a Text. When Texts.Store() records a Text in a file for a storage medium, the information in the record structure is serialized. In the inverse process, Texts.Load() deserializes the information to the record structure of the Text in memory.
Click on a hyperlink to see the module where a type is defined.
For a given Text, T, and offset pos in [0, T.len), procedure Texts.FindPiece has the task of locating the piece containing pos. At each execution, FindPiece could begin at offset 0 and add lengths of pieces until the piece containing pos is located. A cache based upon T.pce and T.org allows better efficiency. When FindPiece completes a search, the pointer to the found piece is recorded in T.pce; the offset of the first character of that piece is recorded in T.org. The next execution of FindPiece begins at that cached location. With a result from FindPiece often being near the preceeding result, this strategy avoids repeated summation of lengths from the beginning of the first piece.
↑In V5 the only integer type is INTEGER. Cf. LONGINT in V2.