![]() |
Section 8.10.3.8: |
This class implements a model of a cursor (and associated buffer) into a file whose contents is text data in some encoding.
The following routines are required to be implemented for this class in accordance with the specifications given in the abstract class $FILE_CURSORS :-
This feature retracts the cursor by one character position (which is not in general one storage unit.
retract | : SAME |
This routine moves the file cursor back by one character position and returns the resulting cursor.
This skip variant searches for the first occurrence of the given character in the file (if there is one).
Note that the definition below implies that the remaining contents of the file may be anything and the post-condition must therefore be true.
This feature moves the cursor forward until the next occurrence of the given character or the end of the file, whichever occurs first.
This skip variant searches for the first occurrence of the given character in the file (if there is one) and then moves the cursor past it.
Note that the definition below implies that the remaining contents of the file may be anything and the post-condition must therefore be true.
This feature moves the cursor forward until after the next occurrence of the given character or the end of the file, whichever occurs first.
This skip variant looks for the encoding which represents the end of line mark in the file encoding and repertoire and skips over it - or to the end of file.
Note that the definition below implies that the remaining contents of the file may be anything and the post-condition must therefore be true.
This feature moves the cursor forward past the next end of line mark or to the end of the file, whichever occurs first.
This first input routine merely returns the next character in the file (which will always be a single encoding, but may be of up to four octets).
This feature returns a single character from the current cursor position, moving the position forward by as many octets as needed.
This input feature searches for the given character in the buffer on the current text line. The contents of the buffer up to either the character or the end of the line are returned as a string.
This feature returns a (possibly empty) text string up to the next occurrence of ch or up to the end of the current line of text, whichever occurs first.
This final input feature returns the contents of the file up to but not including the next end of line mark.
This feature returns all of the character remaining on the current line of text, advancing the cursor by as many places. The string returned does not include the end of line mark.
This first variant of plus places the value of the single character item at the current position in the file buffer. Note that this may involve up to four octets, dependent on the encoding in use.
This feature sets the value of item into the current file position in the file buffer associated with this cursor.
This second variant of plus places the value of the single character at the current position in the file buffer and then returns the cursor.
This feature makes the value of the current file position equal to item and moves the cursor forward by one.
This is the first of the two features which are provided to send a string of text data to the file associated with this cursor. Note that the amount of storage occupied will never be less than the number of characters in the string, but may be much more, dependent on the encoding in use for the given string.
This feature appends the given test string at the current position in the file buffer. The cursor position is moved forward by the storage size of the string. This action may or may not involve writing to the underlying file.
This is the second feature provided to send a string of text data to the file associated with this cursor, extending the length of the file as needed. This variant returns the cursor itself.
This feature sets the file contents for the number of octets in the binary string to be the values of the binary string. The cursor position is moved forward by that number of octets. The cursor itself is then returned.
This feature ensures that any buffer contents which has not been written to the file has been written, synchronising the program with the file store.
This is vacuously true.
Any output which has been sent to the file since either it was opened or the most recent previous call of this routine, will be forced out to synchronise the file with the program.
This routine flushes the cursor buffer to the file, ensuring that file and program are synchronised.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Input/Output Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Monday, 17 July 2000. |
![]() |