From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Keyboard input time out routine
Date: 1999/11/11
Date: 1999-11-11T00:00:00+00:00 [thread overview]
Message-ID: <382b4b61_4@news1.prserv.net> (raw)
In-Reply-To: B94C2AACE5FD49E5.F586390D9ABF88C3.A2C5492FFC18140C@lp.airnews.net
In article
<B94C2AACE5FD49E5.F586390D9ABF88C3.A2C5492FFC18140C@lp.airnews.net> ,
Ray <crwhite12@airmail7.net> wrote:
> Thanks Matthew, I was able to expand your information to get a working idea of
> what to do. Looks like I need to write a procedure (like I did in C++ using
> kbhit and getch) to process any keystrokes and build the number, and time out
> if the enter key is not hit in the allotted time.
That's right. Predefined I/O packages are "potentially blocking," so
you don't really know whether they'll abort right away. For example,
Get could be implemented like this:
procedure Get (Item : out Num) is
pragma Abort_Deferred; -- GNAT-specific pragma
begin
...
end Get;
in which case Get won't abort, even if the delay expires.
In your example, Get didn't abort. I coded your example using Get_Line,
and it did abort. But you can't depend on this.
The best thing to do is as you suggest: assemble the lexeme yourself by
consuming one character at a time using Get_Immediate, and terminate
when you consume the line terminator (or too much time passes).
You don't need ATC at all (for this problem).
--
Science is, foremost, a method of interrogating reality: proposing
hypotheses that seem true and then testing them -- trying, almost
perversely, to negate them, elevating only the handful that survive to
the status of a theory. Creationism is a doctrine, whose adherents are
interested only in seeking out data that support it.
George Johnson, NY Times, 15 Aug 1999
next prev parent reply other threads:[~1999-11-11 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11FADB0F359D6AC2.1F52588FCDAC2F80.5B1126BE5AE8CD31@lp.airnews. net>
1999-11-11 0:00 ` Keyboard input time out routine Matthew Heaney
1999-11-11 0:00 ` Ray
1999-11-11 0:00 ` Matthew Heaney [this message]
1999-11-11 0:00 ` Ray
1999-11-11 0:00 ` David C. Hoos, Sr.
1999-11-09 0:00 Ray
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox