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=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!2.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: wait does not perform as expected Date: Thu, 23 Feb 2023 21:08:52 +0200 Organization: Tidorum Ltd Message-ID: References: <75c3990e-eaab-47eb-bdba-3827b9fd4751n@googlegroups.com> <72723295-3b36-412f-a5fc-f1dd2f5a56edn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net DqD2JlGM0bvJhsUWJVd2JQv69Vjdv6lxEVZWkjmBNpnUXuI/1/ Cancel-Lock: sha1:vmNYpiCoY3niBh2DT6w8rbwPY3Q= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US In-Reply-To: <72723295-3b36-412f-a5fc-f1dd2f5a56edn@googlegroups.com> Xref: reader01.eternal-september.org comp.lang.ada:64975 List-Id: 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.