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,345fce79e8dbda9d X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Keyboard input time out routine Date: 1999/11/11 Message-ID: <382b4b61_4@news1.prserv.net>#1/1 X-Deja-AN: 547525008 Content-transfer-encoding: 7bit References: <11FADB0F359D6AC2.1F52588FCDAC2F80.5B1126BE5AE8CD31@lp.airnews. net> <382ac169_3@news1.prserv.net> Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: abuse@prserv.net X-Trace: 11 Nov 1999 23:04:01 GMT, 129.37.62.135 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-11T00:00:00+00:00 List-Id: In article , Ray 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