![]() |
Section 8.10.1.5: |
![]() |
This page contains the definition of the two variants of the $FILE_CURSORS abstractions.
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstraction models a cursor which indicates a particular position in a very large storage file. It is defined in order to enable programs to handle large files for which there is insufficient space in computer system memory.
This feature provides the current size of the associated file.
The pre-condition is vacuously true since the cursor cannot be created unless the file exists (see the cursor feature of the class BIN_FILE for example).
The result, in the absence of filing system errors, is the size of the associated file in octets.
This feature returns the size of the associated file. The value provided is the same as that which could be obtaines by enquiring of the file directly.
This predicate returns true if and only if the associated file is readable. It provides the same answer as would be provided by a direct enquiry of the associated file.
Being a predicate the pre-condition is vacuously true.
Being a predicate the post-condition is also vacuously true.
This feature returns true if and only if the associated file is readable, otherwise false.
This predicate returns true if and only if the associated file is writable. It provides the same answer as would be provided by a direct enquiry of the associated file.
Being a predicate the pre-condition is vacuously true.
Being a predicate the post-condition is also vacuously true.
This feature returns true if and only if the associated file is writable, otherwise false.
This predicate returns true if and only if the cursor is positioned at the end of the associated file.
Being a predicate the pre-condition is vacuously true.
Being a predicate the post-condition is also vacuously true.
This feature returns true if and only if the cursor is positioned at the end of the file.
This routine returns the current position of the cursor in the file in storage units.
This feature is defined irrespective of pre-condition.
This feature provides the numeric value of the position of the cursor in the associated file based on an offset from the first position in the file which is position 0.
This feature is the writer routine corresponding to the above reader routine, enabling the cursor position in the associated file to be adjusted to the given offset from the beginning.
This feature provides the facility to set a new current position of the cursor in the file to be the value given as an offset in storage units (number of octets) from the beginning of the file, returning the modified cursor resulting from this.
This feature provides for relative positioning within a file from the current position to a new position count storage units (octets) nearer to the end of the file.
This feature provides the facility to set a new current position of the cursor in the file to be the value given as an offset in storage units (number of octets) from the current position in the file, returning the modified cursor resulting from this.
This feature provides for relative positioning within a file from the current position to a new position count storage units (octets) closer to the beginning of the file.
This feature provides the facility to set a new current position of the cursor in the file to be the value given as an offset in storage units (number of octets) towards the beginning of the file from the current position, returning the modified cursor resulting from this.
This feature provides a facility for skipping a given number of stored items (which need not all be of the same storage size). If there are insufficient items remaining in the file then void is returned instead of the modified cursor.
Since the size of the underlying stored items may be variable, the pre-condition cannot guarantee that there will be no problem; any problem has to be detected dynamically during program execution (see post-condition below).
If there are insufficient stored items remaining in the file beyond the current position then the return value is nil, otherwise the modified cursor repositioned as requested.
This feature provides a facility to move forward by a number of stored items in the file rather than in terms of storage units. Only where storage units are identical in storage size to the stored items will this be equivalent to the forward feature above.
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 in the environment.
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 environment with the program.
This routine flushes the cursor buffer to the file, ensuring that file and program are synchronised.
This predicate may be used to determine whether there has been a problem relating to the file with which this cursor and buffer are associated.
Being a predicate the pre-condition is vacuously true.
Being a predicate the post-condition is also vacuously true.
This feature provides an indication whether some error in the program environment has affected the behaviour of the buffer since either creation or the most recent use of the clear feature defined below.
This feature provides a program environment dependent string indicating the nature of any error which may have been detected. Note that the message only refers to the latest error (if any) in an environment-defined manner.
This feature provides an indication whether some error in the program environment has affected the behaviour of the buffer since either creation or the most recent prior use of the clear feature defined below.
This feature clears any error which may have occurred in the underlying file system in relation to the file which is associated with this cursor and buffer.
This feature provides a way of clearing any error which may have occurred in relation to the file with which this cursor and buffer are associated.
This abstract class defines a state component which is a set of all instantiations of objects of any class sub-typing from this class in addition to the vdm model types used wherever this class name is used. Note that SAME has to be an instantiated class, not an abstract one.
The type definitions in this class specification fall into two groups :-
NOTE | See the important note about vdm state in the notes on vdm-sl usage in this specification. |
This abstraction models a cursor in a file consisting of a sequence of elements of the first argument type (ETP) which may be composed into strings which are the second argument type(SEQ). It only specifies output operations directly.
This first variant of plus places the value of the single item at the current position in the file buffer.
plus | ( |
item : ETP | |
) |
Note the use of the position routine which is inherited from the parent class.
This feature inserts the given item at the current position of the file cursor, oevrwriting any previous item in doing so. The cursor position is advanced by one.
This second variant of plus inserts the given item at the current cursor position and then returns the cursor.
plus | ( |
item : ETP | |
) : SAME |
This feature inserts the given item at the file position indicated by the cursor, overwriting any previous element at that position in doing so. The cursor position is advanced by one and the cursor object is returned.
This is the first of the two features which are provided to insert a string of data at the current position in the file. The current cursor position is advanced by the length of the string.
plus | ( |
entity : SEQ | |
) |
This feature inserts the string at the current position in the file buffer, overwriting any previous contents in doing so. The cursor position is moved forward by the length of the string.
This is the second feature provided to insert a string of data in the file at the current cursor position. This version returns the cursor itself.
plus | ( |
entity : SEQ | |
) : SAME |
This feature inserts the contents of the string in the file at the current cursor position, overwriting previous file contents (if any). The cursor position is then moved forward by that number of items. The cursor itself is returned.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Input/Output Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Friday, 17 November 2000. |
![]() |