comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: stream_tools 1.0.1
Date: Wed, 8 Apr 2015 16:41:45 -0500
Date: 2015-04-08T16:41:45-05:00	[thread overview]
Message-ID: <mg47ap$ug2$1@loke.gir.dk> (raw)
In-Reply-To: 5524cdd3$0$14715$862e30e2@ngroups.net

"Per Sandberg" <per.s.sandberg@bahnhof.se> wrote in message 
news:5524cdd3$0$14715$862e30e2@ngroups.net...
> First release of stream-tools
>
> https://github.com/persan/a-stream-tools/releases/tag/1.0.1
>
> They provides a small set of utility streams.

For what it's worth, there was/is a proposal to include what you called a 
"memory stream" in Ada 202x. There's been one in Claw since it was created, 
and I hear that it comes up frequently enough that it probably should be 
standard.

The Claw version (Claw.Marshalling.Buffer_Type) uses a discriminanted type 
so that the dangerous use of 'Address isn't necessary. It expands the buffer 
when necessary, but I would expect that would get dropped from a Standard 
version. And probably the names would get changed. But here's the spec:

package Claw.Marshalling is

  type Buffer_Type(Initial_Length : Ada.Streams.Stream_Element_Count)
  is new Ada.Streams.Root_Stream_Type with private;

  procedure Read(
    Stream : in out Buffer_Type;
    Item   :    out Ada.Streams.Stream_Element_Array;
    Last   :    out Ada.Streams.Stream_Element_Offset);

  procedure Write(
    Stream : in out Buffer_Type;
    Item   : in     Ada.Streams.Stream_Element_Array);

  function Length(Stream : in Buffer_Type)
      return Ada.Streams.Stream_Element_Count;
        -- Return the total length of data written into the buffer.

  procedure Clear(Stream : in out Buffer_Type);
        -- Empty the buffer.

private
....


      parent reply	other threads:[~2015-04-08 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08  6:42 ANN: stream_tools 1.0.1 Per Sandberg
2015-04-08  7:01 ` Simon Wright
2015-04-08 21:41 ` Randy Brukardt [this message]
replies disabled

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