Version 1.1 of ais/ai-00026.txt
!standard A.12.1 (31) 96-06-05 AI95-00026/03
!class binding interpretation 95-06-25
!status WG9 approved 95-06-14
!status ARG approved 11-0-0 (by letter ballot) 96-06-05
!status ARG approved (subject to letter ballot) 10-0-0 95-11-01
!status received 95-06-25
!subject Stream_IO.Read and Stream_IO.Write advance the current index
Opening a file of type Streams.Stream_IO.File_Type in mode Append_File,
or resetting such a file to mode Append_File, sets the current file index
to Size(File)+1. Beyond this, the current file index maintained by
Stream_IO is set in the same manner as the current file index maintained
by instances of Direct_IO.
Which operations set and modify the current file index of a stream file?
The following operations set the value of the current index if
positioning is supported for the specified file:
- Open(File,Mode,Name,Form) and Create(File,Mode,Name,Form) set the
current index to Size(File)+1 if Mode(File) = Append_File, and to 1
- Read increments the current index by the number of stream elements
- Write increments the current index by the number of stream elements
- Set_Index(File,To) sets the current index to the value of To (which
may be greater than Size(File)).
- Set_Mode(File,Mode) sets the current index to Size(File)+1 if Mode =
Append_File, and leaves it unchanged otherwise.
- Reset(File,Mode) sets the current index to Size(File)+1 if Mode =
Append_File, and to 1 otherwise; Reset(File) sets the current index
to Size(File)+1 if Mode(File) = Append_File, and to 1 otherwise.
Set_Index and the versions of Read and Write with Positive_Count
parameters raise Use_Error if positioning is not supported for the
A.12.1 describes the current index, or position, of a stream file, but
does not indicate that its value is set by any operation other than
Set_Index and Set_Mode. The intent was to model the current index of a
stream file after the current index of a direct file (except that the
index counts stream elements rather than file elements, and except that a
stream file can be opened in or reset to mode Append_File). The
recommendation is based on the behavior described in A.8(4), A.8.2, and
A.8.5 for direct files. (The part of the recommendation about the
raising of Use_Error echoes A.12.1(33).)
!subject Do Read and Write advance the current index?
!from Norman Cohen
!reference as: 95-5088.a Norman H. Cohen 95-1-30>>
Is it intended that calls on Stream_IO Read and Write procedures advance
the current index, as in instances of Direct_IO? That is not stated
anywhere in A.12.1. If no, what is the point of maintaining a current
index? If yes, it should also be stated that opening a Stream_IO file
sets the current index to 1. (Paragraph 35 does state that
Set_Mode(F,Append) advances the current index to the end of the file.)
Questions? Ask the ACAA Technical Agent