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-91-241.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=none autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: get_immediate echoe character--compiled error? Date: Wed, 04 Oct 2023 09:22:05 +0100 Organization: A noiseless patient Spider Message-ID: References: <87fs2tr2vf.fsf@nosuchdomain.example.com> <87lecku0bu.fsf@nosuchdomain.example.com> <874jj75joi.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: dont-email.me; posting-host="41c12c1851762027ac3899a04691550a"; logging-data="90332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9ghrryYXqMUKGO6B6+dlha/JLfmzFg94=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) Cancel-Lock: sha1:FMhiGR0KH5Nn60wvzSiZYnfbeKk= sha1:uXeyl8/NByT1aPpb+jpwV0xIAe4= Xref: news.eternal-september.org comp.lang.ada:65776 List-Id: Keith Thompson writes: > Simon Wright writes: >> The low-level Get_Immediate implementation is in sysdep.c (probably >> not in the adainclude/ directory in an installed compiler), in >> getc_immediate() and getc_immediate_nowait(), both of which call >> getc_immediate_common(), and I can't see any difference! ECHO gets >> turned off in getc_immediate_common(), regardless of caller - see >> link. >> >> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387 > > I haven't really looked into this, but I *think* what's happening is > that for the versions with the Available parameter, ECHO hasn't yet been > turned off when the user types the character. If you type 'x', it > echoes immediately, because the program has no way of knowing that the > character will later be consumed by a call to Get_Immediate. Presumably > if the user hasn't typed anything, causing Available to be set to false, > Get_Immediate will turn echoing off and back on again very quickly. > Echoing is disabled only for small fraction of a second it takes for > Get_Immediate to be executed. > > The Get_Immediate functions without the Available parameter block > until a character is entered. They can disable echoing before the > character is entered. Echoing will typically be disabled for minutes > or seconds, from the time Get_Immediate is called and the time the > user types something. > > The only solution I can think of would be to disable echoing (in some > non-portable manner; I don't think the standard library provides this) > before the user starts typing. (Perhaps you want to run the > Get_Immediate without the Available parameter in a separate task?) Great analysis! Is this worth raising a PR on GCC Bugzilla? (maybe only on the documentation?) Or, alternatively, don't turn echoing off at all - what's the use case for turning it off? After all, the ARM says nothing about it.