help / color / mirror / Atom feed
From: Keith Thompson <>
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 04 Oct 2023 12:39:27 -0700	[thread overview]
Message-ID: <> (raw)

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> On 2023-10-04 11:22, Simon Wright wrote:
>> 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.
>>> 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! 
> Yes indeed.
> A possible solution in Text_IO would be for Get_Immediate with
> Available not to enable echo when it exits. Get_Immediate with
> Available is typically called repeatedly, with no other input from the
> terminal in between these calls, so it should be ok to keep echo
> disabled from one such call to another. Any non-immediate input
> operation on the terminal (that is, on this Text_IO file) should start
> by re-enabling echo if it was disabled. Possibly the same should apply
> also to Get_Immediate without Available, that is, it should leave echo
> disabled, until some non-immediate input operation re-enables echo.

The *first* character typed would still echo.

I suggest that what's needed is a way to turn echoing on and off.

Meanwhile, would calling Get_Immediate *without* the Available parameter
(which blocks and turns echoing off until after a character is typed) in
a separate task work?  I haven't tried it.  Of course you'd need to be
careful not to have I/O calls from separate tasks interfere with each

Keith Thompson (The_Other_Keith)
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

  reply	other threads:[~2023-10-04 19:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-02  2:42 get_immediate echoe character--compiled error? richardthiebaud
2023-10-02  5:48 ` Keith Thompson
2023-10-02 20:07   ` richardthiebaud
2023-10-02 22:27     ` Keith Thompson
2023-10-02 22:41       ` richardthiebaud
2023-10-02 22:47       ` richardthiebaud
2023-10-03  8:41         ` Niklas Holsti
2023-10-03 10:20           ` Simon Wright
2023-10-04  0:13             ` Keith Thompson
2023-10-04  8:22               ` Simon Wright
2023-10-04 10:48                 ` Jeffrey R.Carter
2023-10-04 11:38                   ` Simon Wright
2023-10-04 13:05                     ` Jeffrey R.Carter
2023-10-05  0:43                       ` Randy Brukardt
2023-10-04 16:55                 ` Niklas Holsti
2023-10-04 19:39                   ` Keith Thompson [this message]
2023-10-04 21:20                     ` Niklas Holsti
2023-10-03 21:00 ` G.B.
2023-10-04 21:14 ` Jeffrey R.Carter
2023-10-04 22:12   ` Keith Thompson
2023-10-05  9:51     ` 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