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:a05:620a:15ed:b0:71f:b908:7b74 with SMTP id p13-20020a05620a15ed00b0071fb9087b74mr1771986qkm.0.1677162367751; Thu, 23 Feb 2023 06:26:07 -0800 (PST) X-Received: by 2002:a05:6870:cc89:b0:172:473d:25a with SMTP id ot9-20020a056870cc8900b00172473d025amr1141751oab.151.1677162367440; Thu, 23 Feb 2023 06:26:07 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!news.misty.com!border-2.nntp.ord.giganews.com!nntp.giganews.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:26:07 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=3.70.231.225; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 3.70.231.225 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <75c3990e-eaab-47eb-bdba-3827b9fd4751n@googlegroups.com> Subject: Re: wait does not perform as expected From: AdaMagica Injection-Date: Thu, 23 Feb 2023 14:26:07 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:64965 List-Id: Niklas Holsti schrieb am Mittwoch, 22. Februar 2023 um 18:36:06 UTC+1: > On my system, Get_Immediate does /not/ use the inputs collected (but not= =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-w64-= mingw32, loop Look_Ahead (Char, EoL); Put ("Look_Ahead: '" & Char & "', End_of= _Line =3D> " & EoL'Image); New_Line; Get_Immediate (Char, Avl); Put ("Get_Immediate: '" & Char & "', Availa= ble =3D> " & Avl'Image); New_Line; end loop; I get: ab x Look_Ahead: 'a', End_of_Line =3D> FALSE Get_Immediate: 'a', Available =3D> TRUE Look_Ahead: 'b', End_of_Line =3D> FALSE Get_Immediate: 'b', Available =3D> TRUE Look_Ahead: ' ', End_of_Line =3D> FALSE Get_Immediate: ' ', Available =3D> TRUE Look_Ahead: 'x', End_of_Line =3D> FALSE Get_Immediate: 'x', Available =3D> TRUE Look_Ahead: '0', End_of_Line =3D> TRUE Get_Immediate: ' <- This is the Eo= L ', Available =3D> TRUE So Get_Immediate returns the next not yet consumed character. This is inlin= e with A.10.7(12/3): If a character, either control or graphic, is available from the specified = File or the default input file, then the character is read; Available is Tr= ue and Item contains the value of this character. If a character is not ava= ilable, then Available is False and the value of Item is not specified.