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:00:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.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> <3F148227.6060702@attbi.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:00:41 GMT NNTP-Posting-Host: 67.75.63.213 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1058331641 67.75.63.213 (Tue, 15 Jul 2003 22:00:41 PDT) NNTP-Posting-Date: Tue, 15 Jul 2003 22:00:41 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:40323 Date: 2003-07-16T05:00:41+00:00 List-Id: "Robert I. Eachus" wrote in message news:3F148227.6060702@attbi.com... > > If you change: > if Last < Line'Last then... > > to: > if End_of_Line then > Word := False; > NL := NL + 1; > end if; > > maybe that will end the 'discussion' about whether it is possible to > count lines properly in Ada. Why should this make a difference? The idiom in my example is per Ada83 AI-50. What does End_Of_Line do, that Last < Line'Last does not? >Oh, you might want to stick: > > exit when End_of_File; > > after the call to Get_Line. Of course the need to do that or not > depends on the number of lines and characters you want to count for the > implict End_of_Page at the end of the file. The canonical wc program in the shootout seems to count the line terminator among the count of characters. The program I posted does not. To make the outputs match all you'd need to do is add the line count to the character count, to make up the difference. Other than that, given the input.txt file at the shootout page, the wc program I posted gives the correct results. So I'm not sure why anyone thinks there is a problem. Except for the interpretation of character count, as far as I can tell the program I wrote is correct as is. > Notice that with these > changes your program should work fine even if you set Line to > String(1..10); But that's true even without your changes. In fact before I posted the program, I tested it using String (1 .. 5) as the subtype indication, and it worked fine. -Matt