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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1b1a6e7f6b4388de X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-17 08:10:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!in.100proofnews.com!in.100proofnews.com!news-xfer.cox.net!peer01.cox.net!cox.net!border3.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Thu, 17 Jul 2003 10:11:00 -0500 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: Ada.Streams.Stream_IO.File_Type Date: Fri, 18 Jul 2003 03:10:35 +1200 Message-ID: References: X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone5.qsi.net.nz!unknown@tnt1-3.quicksilver.net.nz X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone5-svc-skyt.qsi.net.nz X-Original-Trace: 18 Jul 2003 03:10:32 +1200, drone5-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-FsGxei9rQ67Zb1df4Debf93uJZUYdyYBoLyOIYjWA+oc+nakIAHvSbU+eJSwqRwV8ypUzlwsY7pFz0O!ZU2QWGpTVGWFGh3L9nHcbE9ktZfAtsMbswXMbxEe3drF1tv1LV5cx0rncLs1kDV4A573CGumY0iO!x324r+4= X-Complaints-To: Complaints to abuse@clear.net.nz X-DMCA-Complaints-To: Complaints to abuse@clear.net.nz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:40405 Date: 2003-07-18T03:10:35+12:00 List-Id: On Tue, 15 Jul 2003 20:13:37 GMT, tmoran@acm.org wrote: --------------------------- >Why is this [Ada.Streams.Stream_IO.File_Type] not a descendant of > Ada.Finalization.Limited_Controlled? --------------------------- That would be done to allow no call to Close(). Close might raise errors. GNAT's already code has the doubly linked list (in GNAT-'only' package System.File_Control_Block). --- >From another thread (mis)titled "Re: Terminating a task" It was on the 2nd computer language shootout contest: http://dada.perl.it/shootout/ (wc example: counting words in binary) --------------------------- On Tue, 15 Jul 2003 13:30:33 -0500, "David C. Hoos" >The package Ada.TextIO.Text_Streams allows one to obtain the stream > object corresponding to the standard input -- i.e.: > >Standard_Input_Stream : Ada.Text_IO.Text_Streams.Stream_Access = > Ada.Text_IO.Text_Streams.Stream (Ada.Text_IO.Standard_Input); --------------------------- This comment is not on Text_Streams: --------------------------- From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Fill string with multiple lines from standard_input Date: Fri, 16 Aug 2002 21:26:29 -0500 ... Keep in mind that Stream_IO was virtually untested by the ACATS until recently, and even now the standard has serious problems which can make the use of Stream_IO non-portable (since compilers pretty much all do the wrong thing). So even an implementation which passes the ACATS tests may still have problems in some cases (having to do with writing, [...] --------------------------- It is a problem with the design rather than the testing. ACT doesn't like the design. A fix would be to add this next line to Ada.Streams.Stream_IO: function Standard_Input return File_Type; Anyone know why it is not in there already?. Portable Ada programs handling piping or CGI I/O may need that unless using C (etc.). I looked for an AI or comment at Ada-Comment, hinting that a fix is desired or intended, but found nothing. Using C's setmode() and read() seems to be a good solution. -- Currently GNAT 3.15's Text_IO.Text_Streams feature stops reading, on encountering a ASCII.SUB character (= character 10#26#). Presumably they don't like the RM's design. Demo code: % cat data | tr \\032-\\032 " " | wc ---------------------------------- type Tio is Ada.Text_IO; In_Stream : Tio.Text_Streams.Stream_Access; Out_Stream : Tio.Text_Streams.Stream_Access; Input_Chars : Ada.Streams.Stream_Element_Array (1 .. 1024); Last : Ada.Streams.Stream_Element_Offset; ... -- Now use the "do a type conversions on a pointer" package: In_Stream := Tio.Text_Streams.Stream (Tio.Current_Input); Out_Stream := Tio.Text_Streams.Stream (Tio.Current_Output); -- Now use the text package to handle binary I/O: loop Ada.Streams.Read (In_Stream.all, Input_Chars, Last); exit when Last = 0; -- Quit on the first ASCII.SUB character Ada.Streams.Write (Out_Stream.all, Input_Chars (1 .. Last)); end loop; ---------------------------------- AARM A.12.2: Package Text_IO.Text_Streams: http://www.adaic.org/standards/95aarm/html/AA-A-12-2.html AARM 13.13.1: Package Streams: http://www.adaic.org/standards/95aarm/html/AA-13-13-1.html AARM A.12.1: Package Streams.Stream_IO: http://www.adaic.org/standards/95aarm/html/AA-A-12-1.html ______ - Craig Carey How to Cross-Compiled in FreeBSD to/for a x86 Linux target: http://www.ijs.co.nz/code/ada95-freebsd-to-linux-cross-compiler.txt