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:7046:0:b0:3bf:b62a:37f9 with SMTP id y6-20020ac87046000000b003bfb62a37f9mr1228902qtm.11.1677251413681; Fri, 24 Feb 2023 07:10:13 -0800 (PST) X-Received: by 2002:a05:6830:2468:b0:690:ef0d:d946 with SMTP id x40-20020a056830246800b00690ef0dd946mr1681347otr.3.1677251413302; Fri, 24 Feb 2023 07:10:13 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!peer03.ams4!peer.am4.highwinds-media.com!peer02.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: Fri, 24 Feb 2023 07:10:13 -0800 (PST) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=3.68.230.196; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf NNTP-Posting-Host: 3.68.230.196 References: <75c3990e-eaab-47eb-bdba-3827b9fd4751n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <79efa06f-180f-4b94-ae83-c0b818248340n@googlegroups.com> Subject: Re: wait does not perform as expected From: AdaMagica Injection-Date: Fri, 24 Feb 2023 15:10:13 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 3614 Xref: reader01.eternal-september.org comp.lang.ada:64982 List-Id: Dmitry A. Kazakov schrieb am Donnerstag, 23. Februar 2023 um 21:41:16 UTC+1: > It is to expect it to work with the "standard" terminal [emulator]. > Anything else is a long shot. Right, there may be weird file kinds where Get_Immediate fails. Niklas Holsti schrieb am Donnerstag, 23. Februar 2023 um 19:29:36 UTC+1: > On my system, if Look_Ahead uses getc and ungetc, it seems Get_Immediate > does not use the same buffers, and has no effect on those buffers. That > could be desirable behaviour in some cases, undesirable in others. > > On AdaMagica's system, it seems that Get_Immediate uses the same buffers > as Look_Ahead (getc/ungetc). I further experimented. loop Get_Immediate (Char, Avl); Put ("Get_Immediate: '" & Char & "', Available => " & Avl'Image); New_Line; delay 1.0; end loop; Run in GPS, it behaves strangely (seems to be one of Dmitry's weird files) ab c Get_Immediate: 'a', Available => TRUE Get_Immediate: 'b', Available => TRUE Get_Immediate: ' ', Available => TRUE Get_Immediate: 'c', Available => TRUE Get_Immediate: ' ', Available => TRUE long pause until: Get_Immediate: ' ', Available => TRUE It only reacts after is pressed. On a terminal window, the same executable reacts as I expect (this is why the delay statement is there). Get_Immediate: ' ', Available => FALSE Get_Immediate: ' ', Available => FALSE Get_Immediate: ' ', Available => FALSE as long as no is pressed a note: no Get_Immediate: 'a', Available => TRUE Get_Immediate: ' ', Available => FALSE and so on. So bevore discussing how Get_Immediate is implemented on different hardware or different implementations, please read the RM paras I referenced and discuss them. Looks to me like the behaviour shown last is the correct one (let aside weird terminals). Niklas, your GNAT is two years older than mine. I guess GNAT has been corrected (at least changed) in between. If we all disagree how it should work, we should post this on Ada Comment.