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,e2b1bd6557babda6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-15 22:26:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: <1ec946d1.0307141545.2175a770@posting.google.com> <5ra8hvkkabsvevc2r0abu4mp71dfochelr@4ax.com> Subject: Re: Terminating a task X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: Date: Wed, 16 Jul 2003 05:26:41 GMT NNTP-Posting-Host: 67.75.63.213 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1058333201 67.75.63.213 (Tue, 15 Jul 2003 22:26:41 PDT) NNTP-Posting-Date: Tue, 15 Jul 2003 22:26:41 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:40325 Date: 2003-07-16T05:26:41+00:00 List-Id: "Craig Carey" wrote in message news:5ra8hvkkabsvevc2r0abu4mp71dfochelr@4ax.com... > > Ada 95 can't read data accurately from the console: (a) Text_IO has an > undefined behaviour on what bounds lines. No, Text_IO doesn't define what control characters terminate a line, but that's the whole point, to abstract away the representation of a line of text. And of course, the behavior of Text_IO wrt consumption of a line of text is defined. So I still don't know what you're talking about. The programs I posted all work fine using Text_IO. >The Stream_IO package does not > let the standard input be specified. GNAT extensions were not used (i.e. > fread() in Interfaces.C_Streams). This is irrelevent. The point of the shootout was to use the standard idioms for the language. So in Ada, if you want to consume a line of text from standard input, that means using Text_IO.Get_Line. To test whether you've consumed the entire line, do this: declare Line : String (1 .. N); Last : Natural; begin Get_Line (Line, Last); if Last < Line'Last then --we've consumed the entire line ... end; See my CLA post with the subject "Get_Line Mystery" (it's archived at adapower.com), which explains how Get_Line works. > My code is better: http://dada.perl.it/shootout/gnat_allsrc.html Your code is a completely incomprehensible mess. > A program called "word counter" need not receive data containing text. I don't care to speculate what the behavior is of a program that counts lines of text, if the input isn't text. Certainly, the input.txt file he used to test the wc programs is text, so it is pointless to debate what should happen if the input file is not text. > Ada.Text_IO was not portable over to ObjectAda 7.2.2: End_Error on a > missing NL at the end of the file. The program I wrote should not raise End_Error. If it does, then the compiler is broken, and you should take the matter up with Aonix. > Using Ada.Text_IO's Read_Line is not > safe in presumably all samples programs if GNAT might not be used. I am not familiar with any Text_IO operation called Read_Line. -Matt