comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: Hi! How I can make _indexed_ stream file  Input/Output ? Thanks.
Date: Sun, 27 Jun 2021 21:36:29 -0400	[thread overview]
Message-ID: <b29idg9eknu35725n3emp42omi3n429s6u@4ax.com> (raw)
In-Reply-To: 68f867d3-2b83-4092-a33e-0fcc78f5a24bn@googlegroups.com

On Sun, 27 Jun 2021 12:33:27 -0700 (PDT), Daniel Norte Moraes
<danielcheagle@gmail.com> declaimed the following:

>How I can make _indexed_  stream file  Input/Output ?
>
>For 'indexed' i mean manually  setting file position:
> => 'from'  in $type'input() and
>=> 'to' in $type'output()
>
>Actually I use Ada.Streams.Stream_IO.
>
>My main need is examples.
>

	What part of
https://www.adaic.org/resources/add_content/standards/05aarm/html/AA-A-12-1.html
is lacking?

"""
21	    -- Operations on position within file
22	    procedure Set_Index(File : in File_Type; To : in Positive_Count);
23	    function Index(File : in File_Type) return Positive_Count;
	    function Size (File : in File_Type) return Count;
"""
"""
31/1	{8652/0055} {AI95-00026-01} The Index function returns the current
file index, as a count (in stream elements) from the beginning of the file.
The position of the first element in the file is 1. 
31.a/1	This paragraph was deleted.Ramification: The notion of Index for
Stream_IO is analogous to that of Index in Direct_IO, except that the
former is measured in Stream_Element units, whereas the latter is in terms
of Element_Type values. 
32		The Set_Index procedure sets the current index to the specified
value.
32.1/1	   {8652/0055} {AI95-00026-01} If positioning is supported for the
external file, the current index is maintained as follows:
32.2/1	   {8652/0055} {AI95-00026-01} For Open and Create, if the Mode
parameter is Append_File, the current index is set to the current size of
the file plus one; otherwise, the current index is set to one.
32.3/1	 {8652/0055} {AI95-00026-01} For Reset, if the Mode parameter is
Append_File, or no Mode parameter is given and the current mode is
Append_File, the current index is set to the current size of the file plus
one; otherwise, the current index is set to one.
"""
"""
33		If positioning is not supported for the given file, then a call of
Index or Set_Index propagates Use_Error. Similarly, a call of Read or Write
with a Positive_Count parameter propagates Use_Error.
33.a/2	Implementation Note: {AI95-00085-01} It is permissible for an
implementation to implement mode Append_File using the Unix append mode
(the O_APPEND bit). Such an implementation does not support positioning
when the mode is Append_File, and therefore the operations listed above
must raise Use_Error. This is acceptable as there is no requirement that
any particular file support positioning; therefore it is acceptable that a
file support positioning when opened with mode Out_File, and the same file
not support positioning when opened with mode Append_File. But it is not
acceptable for a file to support positioning (by allowing the above
operations), but to do something other than the defined semantics (that is,
always write at the end, even when explicitly commanded to write somewhere
else). 
"""


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

  reply	other threads:[~2021-06-28  1:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27 19:33 Hi! How I can make _indexed_ stream file Input/Output ? Thanks Daniel Norte Moraes
2021-06-28  1:36 ` Dennis Lee Bieber [this message]
2021-07-02 20:57 ` Shark8
2021-07-05  4:06   ` zac brown
2021-07-05  4:06     ` zac brown
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox