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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e61c8636ef35379d X-Google-Attributes: gid103376,public From: Brian Orpin Subject: Re: Ada Streams usage (was Escape Sequences in Strings) Date: 2000/11/20 Message-ID: #1/1 X-Deja-AN: 695697343 Content-Transfer-Encoding: 7bit References: <3A17B0E2@MailAndNews.com> <3A129A89.1B69E2FE@acm.org> <3A13D59E.63A6F92@earthlink.net> <3A168546.89CA38F7@acm.org> <01HW.B63C385A02A386E107765D2C@news.pacbell.net> <3A17ED81.3FD596@acm.org> <3A181D0F.B1FC2485@acm.org> Content-Type: text/plain; charset=us-ascii X-Trace: 20 Nov 2000 10:09:14 GMT, esk2461.ct.edinbr.gecm.com MIME-Version: 1.0 Reply-To: abuse@borpin.co.uk (Brian Orpin This is valid) Newsgroups: comp.lang.ada Date: 2000-11-20T00:00:00+00:00 List-Id: On Sun, 19 Nov 2000 13:33:51 -0500, Marin David Condic wrote: >Marin David Condic wrote: > >> I'll see what I can do to trim down a small example and post it here. > type My_Stream_Type is new Ada.Streams.Root_Stream_Type with record > -- > -- This is where you would retain information about I/O buffers, > -- I/O ports, etc. so that Read and Write can know where to > -- retreive or send their data. A simple case might be a big ring > -- buffer with Write attaching to the end and Read pulling stuff > -- off from the beginning. Not really useful, but it makes the > -- point. > -- > null ; > end record ; Can't see how information on the IO buffers goes in here. > procedure Read ( > Stream : in out My_Stream_Type ; > Item : out Ada.Streams.Stream_Element_Array ; > Last : out Ada.Streams.Stream_Element_Offset) is > -- > -- This is called automagically from the background as things > -- are being converted by Something'Read. > -- > begin > -- > -- Normally, you'd do something to access a low-level I/O > -- device or use some other means to get hold of raw bytes > -- from some source at this point in the code. Here we > -- just fill it with zeros as a not too useful example. > -- > for X in Item'Range loop > Item (X) := 0 ; > end loop ; > Last := Item'Last ; > end Read ; It is the bit about getting the raw bytes that interested me. I was hoping that Streams did a bit more but obviously not. I just can't believe that someone hasn't done this and made it available. It is such a common problem. Ho Hum I suppose I will need to find the time to do it. -- Brian Orpin BAE SYSTEMS, Edinburgh "If you really know C++, there isn't much you can't do with it, though it may not always be what you intended!" Tucker Taft 1998