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-14 16:45:32 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: Terminating a task Date: 14 Jul 2003 16:45:32 -0700 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0307141545.2175a770@posting.google.com> References: NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1058226332 5900 127.0.0.1 (14 Jul 2003 23:45:32 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 14 Jul 2003 23:45:32 GMT Xref: archiver1.google.com comp.lang.ada:40272 Date: 2003-07-14T23:45:32+00:00 List-Id: Craig Carey wrote in message news:... > > PS. The new "Computer Language Shootout" website now has Ada. > > http://dada.perl.it/shootout/index.html > > My "wc" word count program got eliminated probably since the tester > could not link in Win32 "_setmode" and "_read". (Ada 95 packages do not > allow accurate reading from the standard input). Your word count program got eliminated because it is junk. I have no idea what you mean about not being able to accurately read from standard input. Here is a simplified version of the program, which closely follows the gcc example: with Ada.Text_IO; use Ada.Text_IO; with Ada.Characters.Latin_1; use Ada.Characters; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure WC is Line : String (1 .. 133); Last : Natural; NL, NW, NC : Integer'Base := 0; Word : Boolean := False; begin while not End_Of_File loop Get_Line (Line, Last); NC := NC + Last; for I in Line'First .. Last loop if Line (I) = Latin_1.Space or Line (I) = Latin_1.HT then Word := False; elsif not Word then Word := True; NW := NW + 1; end if; end loop; if Last < Line'Last then Word := False; NL := NL + 1; end if; end loop; Put ("NL="); Put (NL, Width => 0); New_Line; Put ("NW="); Put (NW, Width => 0); New_Line; Put ("NC="); Put (NC, Width => 0); New_Line; end WC; -Matt