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,e759c9142eba3ec1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-19 03:47:09 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nx02.iad01.newshosting.com!newshosting.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread1.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <4034A229.8080403@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Keyboard Polling Solution References: <4033DB01.2CE34E32@me.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 19 Feb 2004 11:47:08 GMT NNTP-Posting-Host: 165.247.66.16 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.atl.earthlink.net 1077191228 165.247.66.16 (Thu, 19 Feb 2004 03:47:08 PST) NNTP-Posting-Date: Thu, 19 Feb 2004 03:47:08 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:5665 Date: 2004-02-19T11:47:08+00:00 List-Id: An observation would be that this is not truly "polling" in the sense that Get_Immediate is going to block waiting for a keystroke. It does get one keystroke at a time - which is often what you want, but Preben is right about tasks. If you want to test for a keystroke being available and otherwise go on about some other business, you should look at building a task around Get_Immediate that would queue up keystrokes. MDC Preben Randhol wrote: >> >>with Text_IO; use Text_IO; >> >>procedure Test is >> >> My_Char : CHARACTER := ' '; >> Character_Exists : BOOLEAN := FALSE; >> Loop_Counter : INTEGER := 0; >> >>procedure Take_A_Break is begin put_line ("Taking a break from >>polling..."); end Take_A_Break; >> >>begin >> >> loop >> Loop_Counter := Loop_Counter + 1; >> for X in 1..10000 loop >> Get_Immediate (Item => My_Char, >> Available => Character_Exists); >> if (Character_Exists) then >> put_line ("Character entered. Done."); >> return; >> end if; >> end loop; >> Take_A_Break; >> end loop; >> >>end; >> >> > > > Hmm, to me this looks like you want to read about tasks in Ada. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================