help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: get_immediate echoe character--compiled error?
Date: Tue, 3 Oct 2023 11:41:05 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <uffh97$35kih$>

On 2023-10-03 1:47, richardthiebaud wrote:
> On 10/2/23 18:27, Keith Thompson wrote:
>> richardthiebaud <> writes:
>>> On 10/2/23 01:48, Keith Thompson wrote:
>>>> richardthiebaud <> writes:
>>>>> When I build and run the following program using Gnat 11 in Linux Mint
>>>>> 21.2, the keys I press are echoed on the console. According to the Ada
>>>>> Reference Manual, they should not be echoed. Is this a compiler error?
>>>> Where does the ARM say that?
>> I don't see anything there about the character being echoed, or not.

Nor do I. But perhaps there should be something, since "not echoing" is 
useful behavior and the program can itself echo characters if that is 

Possibly this is why AdaCore have given different echoing behaviors to 
the two forms of Get_Immediate, with and without the "Available" 
parameter. If so, this echo difference is unfortunately coupled with the 
wait/no-wait behavior difference, and that coupling may be unwanted.

There are (or have been) computer terminals with local echo, where the 
program cannot prevent the display of each keystroke. So the "no echo" 
behavior cannot be an absolute requirement in the Ada manual, but it 
could be Implementation Advice.

>>> If a character, either control or graphic, is available from the
>>> specified File or the default input file, then the character is read;
>>> Available is True and Item contains the value of this character. If a
>>> character is not available, then Available is False and the value of
>>> Item is not specified. Mode_Error is propagated if the mode of the file
>>> is not In_File. End_Error is propagated if at the end of the file. The
>>> current column, line and page numbers for the file are not affected.
>> Are you assuming that not updating the current column, line, and page
>> numbers for the file implies that the character is not echoed?
>> [...]
> In any case, when it echos the character. it increases the current 
> column by 1, and that does contradict the Ada Reference Manual.

You are assuming that "current column" in the Ada Reference Manual means 
the same as the "current column position of the terminal/screen cursor", 
which is not the case, so there is no formal contradiction. The Ada 
"current column" refers to an internal state of the file.

For an unknown type of terminal/screen, deducing the current cursor 
column from the stream of input characters and output characters is not 
feasible, because it depends on the device's interpretation of 
formatting control characters such as TABs and on the width of the 
screen or terminal window.

  reply	other threads:[~2023-10-03  8:41 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 [this message]
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
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