From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: wait does not perform as expected
Date: Thu, 23 Feb 2023 20:29:32 +0200 [thread overview]
Message-ID: <k5ppkcFqm4tU3@mid.individual.net> (raw)
In-Reply-To: <tt8aec$1u7lt$1@dont-email.me>
On 2023-02-23 20:14, Dmitry A. Kazakov wrote:
> On 2023-02-23 18:35, Niklas Holsti wrote:
>> On 2023-02-23 16:26, AdaMagica wrote:
>>> 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
>>>> "consumed") by Look_Ahead, but instead checks if there are _new_ input
>>>> keystrokes. If there are none, Get_Immediate returns "not Available"
>>>> (Hit is False) and so the loop continues.
>>>
>>> Are you sure?
>>
>> That is what I observe.
>
> The implementation of Look_Ahead calls getc followed by ungetc. Thus it
> blocks until an input if there is no buffered. And not just input, but
> for a line or file end.
That seems in order.
However, the crux of the question is in Get_Immediate. Do you know how
that is implemented on various systems? It has to disable line buffering
and line editing on the input stream. One question is whether and how
such "tty" configuration changes affect whatever buffers getc/ungetc use.
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).
next prev parent reply other threads:[~2023-02-23 18:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 16:34 wait does not perform as expected Daniel Gaudry
2023-02-22 17:36 ` Niklas Holsti
2023-02-23 14:26 ` AdaMagica
2023-02-23 14:32 ` AdaMagica
2023-02-23 14:33 ` Daniel Gaudry
2023-02-23 14:39 ` AdaMagica
2023-02-23 17:15 ` Niklas Holsti
2023-02-23 17:35 ` Niklas Holsti
2023-02-23 17:49 ` Niklas Holsti
2023-02-23 18:14 ` Dmitry A. Kazakov
2023-02-23 18:29 ` Niklas Holsti [this message]
2023-02-23 18:47 ` Daniel Gaudry
2023-02-23 19:08 ` Niklas Holsti
2023-02-23 19:31 ` Niklas Holsti
2023-02-23 20:41 ` Dmitry A. Kazakov
2023-02-24 15:10 ` AdaMagica
2023-02-24 18:23 ` Niklas Holsti
2023-02-24 21:16 ` 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