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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6c383a046f41e91 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 31 Mar 2008 21:17:10 +0200 From: Gautier User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Text_IO from a stream References: <0465edf8-7272-43c8-82fd-fcae7cf0ef11@y21g2000hsf.googlegroups.com> <1y2oi69ev939v.1xugoel9fadnb$.dlg@40tude.net> <0c9ab8b7-a666-4fd2-a876-dca818ad5461@c65g2000hsa.googlegroups.com> <17unr8ffxzcm.1ee1ucd0fwd1q$.dlg@40tude.net> In-Reply-To: <17unr8ffxzcm.1ee1ucd0fwd1q$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 83.76.158.99 X-Original-NNTP-Posting-Host: 83.76.158.99 Message-ID: <47f138b6$1_5@news.bluewin.ch> X-Trace: news.bluewin.ch 1206991030 83.76.158.99 (31 Mar 2008 21:17:10 +0200) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns11feed!worldnet.att.net!164.128.36.58!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news1.google.com comp.lang.ada:20684 Date: 2008-03-31T21:17:10+02:00 List-Id: Dmitry A. Kazakov: > But a stream has no defined formatting and is unrelated to ASCII. Still, you can read the stream through Character'Read(s,c). > Then the idea of parsing stream looks problematic. If you have in the stream a > sequence " + -", what Get should do after discovering '-'? Exactly the same behaviour as when parsing an ill-formatted text. Reading a text file (or supposedly so) indirectly via a stream and Stream_IO would have the same result that via Ada.Text_IO. > Anyway, it is quite simple to do. You can do > > type Formatted_Stream (Source : access Root_Stream_Type'Class) is > tagged limited private; > function Get (Stream : access Formatted_Stream) return Integer; > ... > > The implementation of Formatted_Stream will use Source for all its I/O. So > you could hang it on any existing stream. Fine, seems I need to rewrite a Text_IO for streams. I hoped for a ready-made solution... Well, I think I'll switch to a binary format... ______________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/index.htm Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, e-mail address on the Web site!