From: Marin David Condic <nobody@noplace.com>
Subject: Re: Keyboard Polling Solution
Date: Thu, 19 Feb 2004 11:47:08 GMT
Date: 2004-02-19T11:47:08+00:00 [thread overview]
Message-ID: <4034A229.8080403@noplace.com> (raw)
In-Reply-To: slrnc37s7u.10d.randhol+valid_for_reply_from_news@k-083152.nt.ntnu.no
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
======================================================================
next prev parent reply other threads:[~2004-02-19 11:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-18 21:37 Keyboard Polling Solution Me
2004-02-18 23:10 ` Preben Randhol
2004-02-19 0:30 ` Bruce or Tracy Jacobs
2004-02-19 11:47 ` Marin David Condic [this message]
2004-02-19 22:57 ` Bruce or Tracy Jacobs
2004-02-20 12:15 ` Marin David Condic
2004-02-20 20:59 ` Chad R. Meiners
2004-02-22 21:26 ` Bruce or Tracy Jacobs
2004-02-23 10:40 ` Preben Randhol
2004-02-25 0:44 ` Bruce or Tracy Jacobs
2004-02-25 2:05 ` Chad R. Meiners
2004-03-03 16:20 ` Me
2004-02-20 21:38 ` Warren W. Gay VE3WWG
2004-02-22 21:30 ` Bruce or Tracy Jacobs
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox