From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:4118:0:b0:3bf:b828:ab0d with SMTP id q24-20020ac84118000000b003bfb828ab0dmr34181qtl.11.1677162814090; Thu, 23 Feb 2023 06:33:34 -0800 (PST) X-Received: by 2002:a05:6820:1389:b0:524:f77c:5443 with SMTP id i9-20020a056820138900b00524f77c5443mr1035484oow.1.1677162813514; Thu, 23 Feb 2023 06:33:33 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 23 Feb 2023 06:33:33 -0800 (PST) In-Reply-To: <75c3990e-eaab-47eb-bdba-3827b9fd4751n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=2001:861:3006:e580:fb20:5e3c:f153:3003; posting-account=I_eLtQoAAAA-qV4zTYNhsy2EmfPsGcSc NNTP-Posting-Host: 2001:861:3006:e580:fb20:5e3c:f153:3003 References: <75c3990e-eaab-47eb-bdba-3827b9fd4751n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <6eacc599-b9a9-4c89-9122-862825d23423n@googlegroups.com> Subject: Re: wait does not perform as expected From: Daniel Gaudry Injection-Date: Thu, 23 Feb 2023 14:33:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3360 Xref: reader01.eternal-september.org comp.lang.ada:64967 List-Id: On Thursday, February 23, 2023 at 3:26:09=E2=80=AFPM UTC+1, AdaMagica wrote= : > Niklas Holsti schrieb am Mittwoch, 22. Februar 2023 um 18:36:06 UTC+1:=20 > > On my system, Get_Immediate does /not/ use the inputs collected (but no= t=20 > > "consumed") by Look_Ahead, but instead checks if there are _new_ input= =20 > > keystrokes. If there are none, Get_Immediate returns "not Available"=20 > > (Hit is False) and so the loop continues. > Are you sure? With GNAT Community 2021 (20210519-103) targeting x86_64-w6= 4-mingw32,=20 >=20 > loop=20 > Look_Ahead (Char, EoL); Put ("Look_Ahead: '" & Char & "', End_of_Line =3D= > " & EoL'Image); New_Line;=20 > Get_Immediate (Char, Avl); Put ("Get_Immediate: '" & Char & "', Available= =3D> " & Avl'Image); New_Line;=20 > end loop;=20 >=20 > I get:=20 >=20 > ab x=20 > Look_Ahead: 'a', End_of_Line =3D> FALSE=20 > Get_Immediate: 'a', Available =3D> TRUE=20 > Look_Ahead: 'b', End_of_Line =3D> FALSE=20 > Get_Immediate: 'b', Available =3D> TRUE=20 > Look_Ahead: ' ', End_of_Line =3D> FALSE=20 > Get_Immediate: ' ', Available =3D> TRUE=20 > Look_Ahead: 'x', End_of_Line =3D> FALSE=20 > Get_Immediate: 'x', Available =3D> TRUE=20 > Look_Ahead: '0', End_of_Line =3D> TRUE=20 > Get_Immediate: ' <- This is the EoL=20 > ', Available =3D> TRUE=20 >=20 > So Get_Immediate returns the next not yet consumed character. This is inl= ine with A.10.7(12/3):=20 > If a character, either control or graphic, is available from the specifie= d File or the default input file, then the character is read; Available is = True and Item contains the value of this character. If a character is not a= vailable, then Available is False and the value of Item is not specified. Hi, Many thanks for your time and answers My problem under ubuntu is that get_immediate pauses the program if no key = is hit. Therefore available is not set and this little routine cannot perform as I = want. Any idea on how i can write such a simple routine that works ?? Best regards