From: Daniel Gaudry <gaudry.dg@gmail.com>
Subject: wait does not perform as expected
Date: Wed, 22 Feb 2023 08:34:17 -0800 (PST) [thread overview]
Message-ID: <ac87b5c5-7c01-4af9-b9bf-8c3ffc3fe74dn@googlegroups.com> (raw)
hi
the following code :
with Gnat.Os_Lib;
with Ada.Strings;
with Ada.Strings.Fixed;
with Ada.Strings.Maps;
with Ada.Strings.Maps.Constants;
with ada.text_io;
with Ada.Strings;
procedure Hit_Return_To_Continue(Header : in String := "HIT RETURN TO CONTINUE";
Mandatory : in Boolean := False;
Skip_After : in Duration := 0.0)
is
Char : Character := ' ';
Hit : Boolean := True;
Timer : Duration := 0.0;
begin
-- ANYTHING TO DO ?
if Mandatory
then
ada.text_io.Put(Header);
-- ANY WAITING PERIOD TO DISPLAY ?
if Skip_After > 0.0
then
-- KEEP THE USER'S ATTENTION
while Timer < Skip_After loop
Timer := 1.0 + @;
delay 1.0;
ada.text_io.Put(Natural(Skip_After - Timer)'Img);
--USER ENDS THE WAITING PERIOD BEFORE IT'S END ?
TIO.LOOK_AHEAD(ITEM => CHAR,
END_OF_LINE => HIT);
ada.text_io.GET_IMMEDIATE(ITEM => CHAR,
AVAILABLE => HIT);
IF HIT THEN
RETURN;
END IF;
end loop;
-- USER WAITED FOR THE WHOLE WAITING PERIOD
-- LET HIM READ THE ZERO ON THE SCREEN
delay 1.0;
return;
end if;
Atio.Get_Immediate(Item => Char,
Available => Hit);
Atio.New_Line(Spacing => 1);
end if;
end Hit_Return_To_Continue;
the following call:
Hit_Return_To_Continue(Header => "HIT RETURN TO CONTINUE",
Mandatory => true,
Skip_After => 5.0);
does not return if the user hits a key before the end of the countdown.
Can anybody help
Best regards
next reply other threads:[~2023-02-22 16:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 16:34 Daniel Gaudry [this message]
2023-02-22 17:36 ` wait does not perform as expected Niklas Holsti
2023-02-23 14:26 ` AdaMagica
2023-02-23 14:32 ` AdaMagica
2023-02-23 14:33 ` Daniel Gaudry
2023-02-23 14:39 ` AdaMagica
2023-02-23 17:15 ` Niklas Holsti
2023-02-23 17:35 ` Niklas Holsti
2023-02-23 17:49 ` Niklas Holsti
2023-02-23 18:14 ` Dmitry A. Kazakov
2023-02-23 18:29 ` Niklas Holsti
2023-02-23 18:47 ` Daniel Gaudry
2023-02-23 19:08 ` Niklas Holsti
2023-02-23 19:31 ` Niklas Holsti
2023-02-23 20:41 ` Dmitry A. Kazakov
2023-02-24 15:10 ` AdaMagica
2023-02-24 18:23 ` Niklas Holsti
2023-02-24 21:16 ` Jeffrey R.Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox