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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eb6461ca23607ed4 X-Google-Attributes: gid103376,public From: "Jeffrey D. Cherry" Subject: Re: Stopwatch project Date: 1999/04/26 Message-ID: <37249B01.4EF5CF28@utech.net>#1/1 X-Deja-AN: 471106198 Content-Transfer-Encoding: 7bit References: <924946678.23882.0.nnrp-04.c2de4c02@news.demon.co.uk> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: 925145943 202 (none) 206.61.179.87 Organization: Logicon Geodynamics MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-04-26T00:00:00+00:00 List-Id: Mr. Heaney's test driver does indeed work using GNAT 3.11p under Win95. To demonstrate the differences between Get and Get_Immediate, I've copied Mr. Heaney's test driver and replaced the appropriate procedure call. The result is included below. Try both programs on your system and observe the difference in behavior. On my system the behavior is as follows: For the Get version -- The user must press a letter command and then the key before the test driver responds to the input. The letter key pressed is echoed to the display as is the newline sequence in response to the key. For the Get_Immediate version -- The test driver responds to a letter command as soon as the key is pressed. The letter is not echoed to the display. Note that both versions have advantages and disadvantages. You should perform additional testing on your system to determine which approach will meet your requirements. I would recommend you test both drivers with multiple character inputs. For example, type in several letter commands before pressing the key for the Get version, and enter the same keys for the Get_Immediate version. Try invalid keys, function keys, and redirected input. Note the behavior in each case. This should assist in choosing the most appropriate implementation. Regards, Jeffrey D. Cherry Logicon Geodynamics ----- with Stopwatch; with Ada.Text_IO; use Ada.Text_IO; procedure Test_Stopwatch is C : character; begin -- Test_Stopwatch loop Get_Immediate(C); case C is when 'r' | 'R' => Stopwatch.Reset; Put_Line ("Stopwatch has been reset."); when ' ' => Stopwatch.Start; Put_Line ("Stopwatch has been started."); when 's' | 'S' => Stopwatch.Stop; Put_Line("Stopwatch stopped; total time is " & duration'image(Stopwatch.Total_Time) & "."); when 'x' | 'X' => exit; when others => null; end case; end loop; end Test_Stopwatch; -----