comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: wait does not perform as expected
Date: Thu, 23 Feb 2023 21:08:52 +0200	[thread overview]
Message-ID: <k5pru4Fqm4vU2@mid.individual.net> (raw)
In-Reply-To: <72723295-3b36-412f-a5fc-f1dd2f5a56edn@googlegroups.com>

On 2023-02-23 20:47, Daniel Gaudry wrote:
> On Thursday, February 23, 2023 at 7:29:36 PM UTC+1, Niklas Holsti wrote:
>> 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).
> 
> 
> Hi,
> On my ubuntu system the
> ada.text_io.GET_IMMEDIATE(ITEM => CHAR, AVAILABLE => HIT);
> just pause the program regardless of any key being hit.
> I just cannot use a wait  (several shorts one in a row) interrupted by a key hit.
> Any possibility you may know of ??


Please show the Ada code you have now. I assume there is no Look_Ahead 
there, right?

Best if you can write, test and post a short, stand-alone program that 
just contains the wait-for-keystroke procedure, then we can be sure that 
there is nothing else in the program that might interfere.

  reply	other threads:[~2023-02-23 19:08 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
2023-02-23 18:47           ` Daniel Gaudry
2023-02-23 19:08             ` Niklas Holsti [this message]
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