From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: stream_tools 1.0.1 Date: Wed, 8 Apr 2015 16:41:45 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <5524cdd3$0$14715$862e30e2@ngroups.net> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1428529306 31234 24.196.82.226 (8 Apr 2015 21:41:46 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 8 Apr 2015 21:41:46 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:25478 Date: 2015-04-08T16:41:45-05:00 List-Id: "Per Sandberg" 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 ....