comp.lang.ada
 help / color / mirror / Atom feed
* Hi! How I can make _indexed_ stream file  Input/Output ? Thanks.
@ 2021-06-27 19:33 Daniel Norte Moraes
  2021-06-28  1:36 ` Dennis Lee Bieber
  2021-07-02 20:57 ` Shark8
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Norte Moraes @ 2021-06-27 19:33 UTC (permalink / raw)


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.

Thanks!
Best Whishes,
Dani.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hi! How I can make _indexed_ stream file  Input/Output ? Thanks.
  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
  2021-07-02 20:57 ` Shark8
  1 sibling, 0 replies; 5+ messages in thread
From: Dennis Lee Bieber @ 2021-06-28  1:36 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hi! How I can make _indexed_ stream file Input/Output ? Thanks.
  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
@ 2021-07-02 20:57 ` Shark8
  2021-07-05  4:06   ` zac brown
  1 sibling, 1 reply; 5+ messages in thread
From: Shark8 @ 2021-07-02 20:57 UTC (permalink / raw)


On Sunday, June 27, 2021 at 1:33:28 PM UTC-6, daniel wrote:
> 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. 
> 
> Thanks! 
> Best Whishes, 
> Dani.

Streams are a bit different than files; you see, streams are an abstraction on input/output and therefore different than files. Consider, for example, an output stream that controls a radio transmitter. There's no possible way to "unsend" the data: it's a write-only device.

If you're using Ada's standard library, with the XXX_IO packages, I believe what you want is Ada.Direct_IO.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hi! How I can make _indexed_ stream file Input/Output ? Thanks.
  2021-07-02 20:57 ` Shark8
@ 2021-07-05  4:06   ` zac brown
  2021-07-05  4:06     ` zac brown
  0 siblings, 1 reply; 5+ messages in thread
From: zac brown @ 2021-07-05  4:06 UTC (permalink / raw)


On Saturday, July 3, 2021 at 6:57:31 AM UTC+10, Shark8 wrote:
> On Sunday, June 27, 2021 at 1:33:28 PM UTC-6, daniel wrote: 
> > 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. 
> > 
> > Thanks! 
> > Best Whishes, 
> > Dani.
> Streams are a bit different than files; you see, streams are an abstraction on input/output and therefore different than files. Consider, for example, an output stream that controls a radio transmitter. There's no possible way to "unsend" the data: it's a write-only device. 
> 
> If you're using Ada's standard library, with the XXX_IO packages, I believe what you want is Ada.Direct_IO.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Hi! How I can make _indexed_ stream file Input/Output ? Thanks.
  2021-07-05  4:06   ` zac brown
@ 2021-07-05  4:06     ` zac brown
  0 siblings, 0 replies; 5+ messages in thread
From: zac brown @ 2021-07-05  4:06 UTC (permalink / raw)


On Monday, July 5, 2021 at 2:06:36 PM UTC+10, zac brown wrote:
> On Saturday, July 3, 2021 at 6:57:31 AM UTC+10, Shark8 wrote: 
> > On Sunday, June 27, 2021 at 1:33:28 PM UTC-6, daniel wrote: 
> > > 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. 
> > > 
> > > Thanks! 
> > > Best Whishes, 
> > > Dani. 
> > Streams are a bit different than files; you see, streams are an abstraction on input/output and therefore different than files. Consider, for example, an output stream that controls a radio transmitter. There's no possible way to "unsend" the data: it's a write-only device. 
> > 
> > If you're using Ada's standard library, with the XXX_IO packages, I believe what you want is Ada.Direct_IO.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-05  4:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-07-02 20:57 ` Shark8
2021-07-05  4:06   ` zac brown
2021-07-05  4:06     ` zac brown

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