Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The best diplomat I know is a fully activated phaser bank. -- Scotty


devel / comp.lang.ada / Re: get_immediate echoe character--compiled error?

SubjectAuthor
* get_immediate echoe character--compiled error?richardthiebaud
+* Re: get_immediate echoe character--compiled error?Keith Thompson
|`* Re: get_immediate echoe character--compiled error?richardthiebaud
| `* Re: get_immediate echoe character--compiled error?Keith Thompson
|  +- Re: get_immediate echoe character--compiled error?richardthiebaud
|  `* Re: get_immediate echoe character--compiled error?richardthiebaud
|   `* Re: get_immediate echoe character--compiled error?Niklas Holsti
|    `* Re: get_immediate echoe character--compiled error?Simon Wright
|     `* Re: get_immediate echoe character--compiled error?Keith Thompson
|      `* Re: get_immediate echoe character--compiled error?Simon Wright
|       +* Re: get_immediate echoe character--compiled error?Jeffrey R.Carter
|       |`* Re: get_immediate echoe character--compiled error?Simon Wright
|       | `* Re: get_immediate echoe character--compiled error?Jeffrey R.Carter
|       |  `- Re: get_immediate echoe character--compiled error?Randy Brukardt
|       `* Re: get_immediate echoe character--compiled error?Niklas Holsti
|        `* Re: get_immediate echoe character--compiled error?Keith Thompson
|         `- Re: get_immediate echoe character--compiled error?Niklas Holsti
+- Re: get_immediate echoe character--compiled error?G.B.
`* Re: get_immediate echoe character--compiled error?Jeffrey R.Carter
 `* Re: get_immediate echoe character--compiled error?Keith Thompson
  `- Re: get_immediate echoe character--compiled error?Jeffrey R.Carter

1
get_immediate echoe character--compiled error?

<ufdamv$2nn4h$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10163&group=comp.lang.ada#10163

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiebauddick2@aol.com (richardthiebaud)
Newsgroups: comp.lang.ada
Subject: get_immediate echoe character--compiled error?
Date: Sun, 1 Oct 2023 22:42:39 -0400
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <ufdamv$2nn4h$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 2 Oct 2023 02:42:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b2b4138bc43a6837da3f434592450ccc";
logging-data="2874513"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/z/4CTFsN+X91KDT6FtnyXgPrJeH3jP6w="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:wxrbO5krQfx/725A2LjNHOr2x4M=
Content-Language: en-US
 by: richardthiebaud - Mon, 2 Oct 2023 02:42 UTC

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?

with ada.text_io; use ada.text_io;
procedure test3 is
c: character;
avail: boolean;
begin
loop
loop
Get_Immediate(c, Avail);
if Avail then
exit;
end if;
delay 0.01;
end loop;
end loop;
end test3;

This does not happen if I call get_immediate without the avail
parameter, i.e. get_immediate(c);

Re: get_immediate echoe character--compiled error?

<87fs2tr2vf.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10164&group=comp.lang.ada#10164

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Sun, 01 Oct 2023 22:48:36 -0700
Organization: None to speak of
Lines: 31
Message-ID: <87fs2tr2vf.fsf@nosuchdomain.example.com>
References: <ufdamv$2nn4h$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="6816c872b10fd8ea07c97b3fd0fa3d65";
logging-data="2953770"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u9e32XvDIil0E2nUC/RHi"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:rBYVNbt6zLW5WmfDRZe7B8NXP5k=
sha1:m5sqTHA5VNP7JlfFXsEOPpZVkiE=
 by: Keith Thompson - Mon, 2 Oct 2023 05:48 UTC

richardthiebaud <thiebauddick2@aol.com> 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?

> with ada.text_io; use ada.text_io;
> procedure test3 is
> c: character;
> avail: boolean;
> begin
> loop
> loop
> Get_Immediate(c, Avail);
> if Avail then
> exit;
> end if;
> delay 0.01;
> end loop;
> end loop;
> end test3;
>
> This does not happen if I call get_immediate without the avail
> parameter, i.e. get_immediate(c);
>

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: get_immediate echoe character--compiled error?

<uff7ul$33ojr$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10166&group=comp.lang.ada#10166

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiebauddick2@aol.com (richardthiebaud)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Mon, 2 Oct 2023 16:07:49 -0400
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <uff7ul$33ojr$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 2 Oct 2023 20:07:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b2b4138bc43a6837da3f434592450ccc";
logging-data="3269243"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w6+pnoeMd4V1a5FlfowFfUnDvyBD93NU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:rPXJsUI7KshKFD4z1TB46tgFK+E=
In-Reply-To: <87fs2tr2vf.fsf@nosuchdomain.example.com>
Content-Language: en-US
 by: richardthiebaud - Mon, 2 Oct 2023 20:07 UTC

On 10/2/23 01:48, Keith Thompson wrote:
> richardthiebaud <thiebauddick2@aol.com> 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?
https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html

>
>> with ada.text_io; use ada.text_io;
>> procedure test3 is
>> c: character;
>> avail: boolean;
>> begin
>> loop
>> loop
>> Get_Immediate(c, Avail);
>> if Avail then
>> exit;
>> end if;
>> delay 0.01;
>> end loop;
>> end loop;
>> end test3;
>>
>> This does not happen if I call get_immediate without the avail
>> parameter, i.e. get_immediate(c);
>>
>

Re: get_immediate echoe character--compiled error?

<87lecku0bu.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10167&group=comp.lang.ada#10167

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Mon, 02 Oct 2023 15:27:33 -0700
Organization: None to speak of
Lines: 28
Message-ID: <87lecku0bu.fsf@nosuchdomain.example.com>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="a16d87f2beab0c7c4b748bfb6f88102e";
logging-data="3324474"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Svbcu7HRShrpsTbOERSXl"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:ksTeALmRilbSFVrcVO30/7IHdsI=
sha1:beV/YORkrGt7LOZh8xBhCfieE7w=
 by: Keith Thompson - Mon, 2 Oct 2023 22:27 UTC

richardthiebaud <thiebauddick2@aol.com> writes:
> On 10/2/23 01:48, Keith Thompson wrote:
>> richardthiebaud <thiebauddick2@aol.com> 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?
> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html

I don't see anything there about the character being echoed, or not.

> 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?

[...]

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: get_immediate echoe character--compiled error?

<uffgva$35kih$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10168&group=comp.lang.ada#10168

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiebauddick2@aol.com (richardthiebaud)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Mon, 2 Oct 2023 18:41:46 -0400
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uffgva$35kih$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 2 Oct 2023 22:41:46 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="710d5c33788100218ae4a79b4c7ea352";
logging-data="3330641"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fEtZ6X3Y44ZEvcphC4s4c38poU4fhOgs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:L3PdrfuoP6cAVotq+7niI2b+GHc=
Content-Language: en-US
In-Reply-To: <87lecku0bu.fsf@nosuchdomain.example.com>
 by: richardthiebaud - Mon, 2 Oct 2023 22:41 UTC

On 10/2/23 18:27, Keith Thompson wrote:
> richardthiebaud <thiebauddick2@aol.com> writes:
>> On 10/2/23 01:48, Keith Thompson wrote:
>>> richardthiebaud <thiebauddick2@aol.com> 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?
>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html
>
> I don't see anything there about the character being echoed, or not.
>
>> 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?
>
> [...]
>
Yes.

Re: get_immediate echoe character--compiled error?

<uffh97$35kih$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10169&group=comp.lang.ada#10169

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: thiebauddick2@aol.com (richardthiebaud)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Mon, 2 Oct 2023 18:47:03 -0400
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <uffh97$35kih$2@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 2 Oct 2023 22:47:03 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="710d5c33788100218ae4a79b4c7ea352";
logging-data="3330641"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+k0Nql3HLvm7Q18pgh0HpNbaQUYwQ4Cz4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:nIFwk8DPgCJRfTdBkTluR0W2WXE=
Content-Language: en-US
In-Reply-To: <87lecku0bu.fsf@nosuchdomain.example.com>
 by: richardthiebaud - Mon, 2 Oct 2023 22:47 UTC

On 10/2/23 18:27, Keith Thompson wrote:
> richardthiebaud <thiebauddick2@aol.com> writes:
>> On 10/2/23 01:48, Keith Thompson wrote:
>>> richardthiebaud <thiebauddick2@aol.com> 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?
>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html
>
> I don't see anything there about the character being echoed, or not.
>
>> 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.

Re: get_immediate echoe character--compiled error?

<ko22d1Fejg3U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10170&group=comp.lang.ada#10170

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.holsti@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Tue, 3 Oct 2023 11:41:05 +0300
Organization: Tidorum Ltd
Lines: 56
Message-ID: <ko22d1Fejg3U1@mid.individual.net>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net lpGhMTTotjl29k5CB7zpxA7FYZuWnrkWsJ1y0gnqRhp3JngxGv
Cancel-Lock: sha1:5jEnlbQvVfIWA4IPaE97G22JptI= sha256:BV3rJZzNSub3rg/ILRUqmaJAL9as8gpR+Mq0922WyzM=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.12.0
Content-Language: en-US
In-Reply-To: <uffh97$35kih$2@dont-email.me>
 by: Niklas Holsti - Tue, 3 Oct 2023 08:41 UTC

On 2023-10-03 1:47, richardthiebaud wrote:
> On 10/2/23 18:27, Keith Thompson wrote:
>> richardthiebaud <thiebauddick2@aol.com> writes:
>>> On 10/2/23 01:48, Keith Thompson wrote:
>>>> richardthiebaud <thiebauddick2@aol.com> 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?
>>> https://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html
>>
>> 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
desired.

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.

Re: get_immediate echoe character--compiled error?

<lyttr8knwn.fsf@pushface.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10171&group=comp.lang.ada#10171

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Tue, 03 Oct 2023 11:20:40 +0100
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <lyttr8knwn.fsf@pushface.org>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
<uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="16e27560e867034c0ef7a61f231f7847";
logging-data="3690401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++VRfYGuEFWGTdw+pVkM2fB3cd6wzWX84="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
Cancel-Lock: sha1:Zo+c6wSEOcEusYBoBcdxEllSSBM=
sha1:z6zJ1i6rilD1Bl9sKW/S0tCmZ/k=
 by: Simon Wright - Tue, 3 Oct 2023 10:20 UTC

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> 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.

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.

https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387

Re: get_immediate echoe character--compiled error?

<ufhvdo$3o1a5$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10172&group=comp.lang.ada#10172

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bauhaus@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Tue, 3 Oct 2023 23:00:40 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <ufhvdo$3o1a5$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
Reply-To: nonlegitur@notmyhomepage.de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 3 Oct 2023 21:00:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="78df64d6b629a0a5e32c0dd94b99ec96";
logging-data="3933509"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19XbyHrr8t2dAZzsvUw8uuxTwQvdfGQdmU="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.15.1
Cancel-Lock: sha1:+vA0hmtJQp59ra+A/SJYz1nzoWQ=
Content-Language: en-US
In-Reply-To: <ufdamv$2nn4h$1@dont-email.me>
 by: G.B. - Tue, 3 Oct 2023 21:00 UTC

On 02.10.23 04:42, richardthiebaud wrote:
> 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.

Which console?

Can you try to run a C program in the same console
that tests for it to be y TTY? See Simon Wright's link
to GNAT's implementation. The C program would be
calling isatty(0) or isatty(fileno(your_stream));

Some IDEs have a console window that is not
a TTY in the sense of termios(4)/tcsetattr(3).
Echoing is different, then.

Re: get_immediate echoe character--compiled error?

<874jj75joi.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10175&group=comp.lang.ada#10175

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Tue, 03 Oct 2023 17:13:17 -0700
Organization: None to speak of
Lines: 41
Message-ID: <874jj75joi.fsf@nosuchdomain.example.com>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
<uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net>
<lyttr8knwn.fsf@pushface.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="9da464444b2257c989bb4d90b174d1f1";
logging-data="4004415"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GM/bSb3vp+7NXAK2daKGZ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:dJCqfIL75nFnCRgGPKT8cua9yPo=
sha1:ZtJ9CqSTbyL2NqKm9U6ZwYQNUuk=
 by: Keith Thompson - Wed, 4 Oct 2023 00:13 UTC

Simon Wright <simon@pushface.org> writes:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>> 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.
>
> 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.
>
> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387

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?)

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: get_immediate echoe character--compiled error?

<lyh6n64x1u.fsf@pushface.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10176&group=comp.lang.ada#10176

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 04 Oct 2023 09:22:05 +0100
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <lyh6n64x1u.fsf@pushface.org>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
<uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net>
<lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="41c12c1851762027ac3899a04691550a";
logging-data="90332"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9ghrryYXqMUKGO6B6+dlha/JLfmzFg94="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
Cancel-Lock: sha1:FMhiGR0KH5Nn60wvzSiZYnfbeKk=
sha1:uXeyl8/NByT1aPpb+jpwV0xIAe4=
 by: Simon Wright - Wed, 4 Oct 2023 08:22 UTC

Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:

> Simon Wright <simon@pushface.org> 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.
>>
>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>
> 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! Is this worth raising a PR on GCC Bugzilla? (maybe only
on the documentation?)

Or, alternatively, don't turn echoing off at all - what's the use case
for turning it off? After all, the ARM says nothing about it.

Re: get_immediate echoe character--compiled error?

<ufjfu9$4ev8$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10178&group=comp.lang.ada#10178

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 4 Oct 2023 12:48:41 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <ufjfu9$4ev8$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me>
<ko22d1Fejg3U1@mid.individual.net> <lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com> <lyh6n64x1u.fsf@pushface.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 4 Oct 2023 10:48:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a9060ec1726ff2e1f2ed7a51493568fc";
logging-data="146408"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sl8P24MGvWR3uJymwh6d8gwb7437yO9A="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:TfOL4z/+TM1StN/bPFsMWMHpD+k=
In-Reply-To: <lyh6n64x1u.fsf@pushface.org>
Content-Language: en-US
 by: Jeffrey R.Carter - Wed, 4 Oct 2023 10:48 UTC

On 2023-10-04 10:22, Simon Wright wrote:
>
> Or, alternatively, don't turn echoing off at all - what's the use case
> for turning it off? After all, the ARM says nothing about it.

The use case is inputting passwords and the like. See Password_Line
(https://github.com/jrcarter/Encryption-utilities/blob/master/password_line.ads)
for an example. Note that this has identical behavior with GNAT/Linux and
ObjectAda/Windows.

--
Jeff Carter
“[A]bout half the patterns in the 'Gang of Four'
book only exist because of defects in C++ ...”
Brian Drummond
174

Re: get_immediate echoe character--compiled error?

<ly5y3m4nxw.fsf@pushface.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10179&group=comp.lang.ada#10179

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 04 Oct 2023 12:38:51 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <ly5y3m4nxw.fsf@pushface.org>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
<uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net>
<lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com>
<lyh6n64x1u.fsf@pushface.org> <ufjfu9$4ev8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="41c12c1851762027ac3899a04691550a";
logging-data="168070"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18dU+kZ+cj3XchtbkdRMhV4wh1zgXRAIyM="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)
Cancel-Lock: sha1:YwSSsyGBI/VskaQ9FxZdPaE1Mb0=
sha1:GowzpsPJaIoaWtW+sq8vTGEDebA=
 by: Simon Wright - Wed, 4 Oct 2023 11:38 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:

> On 2023-10-04 10:22, Simon Wright wrote:
>> Or, alternatively, don't turn echoing off at all - what's the use
>> case
>> for turning it off? After all, the ARM says nothing about it.
>
> The use case is inputting passwords and the like. See Password_Line
> (https://github.com/jrcarter/Encryption-utilities/blob/master/password_line.ads)
> for an example. Note that this has identical behavior with GNAT/Linux
> and ObjectAda/Windows.

Obviously you need to turn echoing off for password input. But neither
the ARM nor the GNAT RM says anything about Get_Immediate's echoing
behaviour, so it's hard to explain why OA does the same thing. Does its
manual specify this behaviour?

Re: get_immediate echoe character--compiled error?

<ufjnu0$62ki$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10181&group=comp.lang.ada#10181

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 4 Oct 2023 15:05:03 +0200
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <ufjnu0$62ki$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me>
<ko22d1Fejg3U1@mid.individual.net> <lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com> <lyh6n64x1u.fsf@pushface.org>
<ufjfu9$4ev8$1@dont-email.me> <ly5y3m4nxw.fsf@pushface.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 4 Oct 2023 13:05:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="23db2b78be619bad34dfefd5064badd8";
logging-data="199314"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+z6FbgUSy+BU0cAucbBAX2+I0LTgVCMNQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:r0R2Ul4SkllZSndLVbtFrfISDaE=
In-Reply-To: <ly5y3m4nxw.fsf@pushface.org>
Content-Language: en-US
 by: Jeffrey R.Carter - Wed, 4 Oct 2023 13:05 UTC

On 2023-10-04 13:38, Simon Wright wrote:
>
> Obviously you need to turn echoing off for password input. But neither
> the ARM nor the GNAT RM says anything about Get_Immediate's echoing
> behaviour, so it's hard to explain why OA does the same thing. Does its
> manual specify this behaviour?

Unfortunately, Ada does not provide a standard way to turn off echo.

I agree that the ARM says nothing about echo for any of its operations on
Standard_Input, but clearly there is a broad consensus of Ada.Text_IO writers
and users who think this is desirable behavior.

--
Jeff Carter
“[A]bout half the patterns in the 'Gang of Four'
book only exist because of defects in C++ ...”
Brian Drummond
174

Re: get_immediate echoe character--compiled error?

<ko5jonF3ld1U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10182&group=comp.lang.ada#10182

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.holsti@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 4 Oct 2023 19:55:51 +0300
Organization: Tidorum Ltd
Lines: 49
Message-ID: <ko5jonF3ld1U1@mid.individual.net>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me>
<ko22d1Fejg3U1@mid.individual.net> <lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com> <lyh6n64x1u.fsf@pushface.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net JgugGi40E9qFStkztCiI4w85yy08EpDhaTUU58nGEss7t3+sE5
Cancel-Lock: sha1:zagDyc8DYkzSH6xhJxTHSyIO7Iw= sha256:KpA//pkFfkfnxLcit0mNBEIIw+w8Pe8LbefIR8FvmUs=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.12.0
Content-Language: en-US
In-Reply-To: <lyh6n64x1u.fsf@pushface.org>
 by: Niklas Holsti - Wed, 4 Oct 2023 16:55 UTC

On 2023-10-04 11:22, Simon Wright wrote:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>
>> Simon Wright <simon@pushface.org> 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.
>>>
>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>>
>> 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.

Re: get_immediate echoe character--compiled error?

<87v8bm41ow.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10183&group=comp.lang.ada#10183

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 04 Oct 2023 12:39:27 -0700
Organization: None to speak of
Lines: 62
Message-ID: <87v8bm41ow.fsf@nosuchdomain.example.com>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com>
<uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com>
<uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net>
<lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com>
<lyh6n64x1u.fsf@pushface.org> <ko5jonF3ld1U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="9da464444b2257c989bb4d90b174d1f1";
logging-data="506786"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TtbNS9Ry/hL/nqABUVwRO"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:CZoAI6bp/a3f2PdyJuTc6PVU7K0=
sha1:q1gF+D0iDO7rS5KBqrutm+418so=
 by: Keith Thompson - Wed, 4 Oct 2023 19:39 UTC

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
> On 2023-10-04 11:22, Simon Wright wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> Simon Wright <simon@pushface.org> 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.
>>>>
>>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>>>
>>> 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
other.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: get_immediate echoe character--compiled error?

<ufkkj3$e348$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10184&group=comp.lang.ada#10184

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 4 Oct 2023 23:14:11 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ufkkj3$e348$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 4 Oct 2023 21:14:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c7e3e1e64b3dc17248dbb7b5d1f3ccc0";
logging-data="461960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+h1xlu3b7iM6lTeYOxXxwCO6ez38Upln4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:zugeK92FpdnDiyRUMLDUIK6eCvY=
Content-Language: en-US
In-Reply-To: <ufdamv$2nn4h$1@dont-email.me>
 by: Jeffrey R.Carter - Wed, 4 Oct 2023 21:14 UTC

On 2023-10-02 04:42, richardthiebaud wrote:
>
> with ada.text_io; use ada.text_io;
> procedure test3 is
>   c: character;
>   avail: boolean;
> begin
>   loop
>     loop
>       Get_Immediate(c, Avail);
>       if Avail then
>         exit;
>       end if;
>       delay 0.01;
>     end loop;
>   end loop;
> end test3;

I should have checked this earlier, but this does not echo with ObjectAda.

--
Jeff Carter
“[A]bout half the patterns in the 'Gang of Four'
book only exist because of defects in C++ ...”
Brian Drummond
174

Re: get_immediate echoe character--compiled error?

<ko6385F3ld0U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10185&group=comp.lang.ada#10185

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.holsti@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Thu, 5 Oct 2023 00:20:05 +0300
Organization: Tidorum Ltd
Lines: 88
Message-ID: <ko6385F3ld0U1@mid.individual.net>
References: <ufdamv$2nn4h$1@dont-email.me>
<87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me>
<87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me>
<ko22d1Fejg3U1@mid.individual.net> <lyttr8knwn.fsf@pushface.org>
<874jj75joi.fsf@nosuchdomain.example.com> <lyh6n64x1u.fsf@pushface.org>
<ko5jonF3ld1U1@mid.individual.net> <87v8bm41ow.fsf@nosuchdomain.example.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net E+2iktha7TqLRkp5tqCHOwMEs/SO2D/h+j/jB8zkatBa9EP1n+
Cancel-Lock: sha1:uqFg2Wg56BvyC91gdqygHcJxbg8= sha256:gFFK94md5HWgpQPlbWNRyM6HGdcZ+reQkzaoXzXuT2M=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:102.0)
Gecko/20100101 Thunderbird/102.12.0
Content-Language: en-US
In-Reply-To: <87v8bm41ow.fsf@nosuchdomain.example.com>
 by: Niklas Holsti - Wed, 4 Oct 2023 21:20 UTC

On 2023-10-04 22:39, Keith Thompson wrote:
> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>> On 2023-10-04 11:22, Simon Wright wrote:
>>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>>> Simon Wright <simon@pushface.org> 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.
>>>>>
>>>>> https://github.com/gcc-mirror/gcc/blob/3ca09d684e496240a87c0327687e2898060c2363/gcc/ada/sysdep.c#L387
>>>>
>>>> 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.

Only if the user is quick enough to type it before the first call of
Get_Immediate.

If Get_Immediate is called for example to enter a password, usually the
program will first prompt the user to "Enter password:" and then at once
call Get_Immediate. Only a user who starts typing before the prompt is
visible would have time to type something before the (first) call of
Get_Immediate.

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

The user could still be quick enough to type characters before the echo
is turned off, so they would echo.

> 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.

That should work, provided that the Ada run-time system does not block
the whole program when one task blocks on an I/O request. There have
been, and perhaps still are, Ada programming systems where the whole Ada
program appears to the OS as a single OS thread so that one Ada task
waiting on a blocking OS call blocks all other tasks in the program.

> Of course you'd need to be careful not to have I/O calls from
> separate tasks interfere with each other.

Yes, but other tasks should be able to output text through
Standard_Output even while one task is reading Standard_Input using a
blocking I/O call. Except under a one-thread run-time system.

Re: get_immediate echoe character--compiled error?

<87r0ma3ulk.fsf@nosuchdomain.example.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10186&group=comp.lang.ada#10186

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S.Thompson+u@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 04 Oct 2023 15:12:39 -0700
Organization: None to speak of
Lines: 26
Message-ID: <87r0ma3ulk.fsf@nosuchdomain.example.com>
References: <ufdamv$2nn4h$1@dont-email.me> <ufkkj3$e348$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="f16245aab5d617db3860d3e57f5229e5";
logging-data="575492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oRGi+msnsdbAmvjWz/gPs"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:9BSJ4D5Li1L73WTXGndtrqRCYb4=
sha1:VCaaUoQrnOKViDEUReL8DeglfxY=
 by: Keith Thompson - Wed, 4 Oct 2023 22:12 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 2023-10-02 04:42, richardthiebaud wrote:
>> with ada.text_io; use ada.text_io;
>> procedure test3 is
>>   c: character;
>>   avail: boolean;
>> begin
>>   loop
>>     loop
>>       Get_Immediate(c, Avail);
>>       if Avail then
>>         exit;
>>       end if;
>>       delay 0.01;
>>     end loop;
>>   end loop;
>> end test3;
>
> I should have checked this earlier, but this does not echo with ObjectAda.

On what target system?

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: get_immediate echoe character--compiled error?

<ufl0rh$jbtg$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10187&group=comp.lang.ada#10187

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Wed, 4 Oct 2023 19:43:55 -0500
Organization: A noiseless patient Spider
Lines: 39
Message-ID: <ufl0rh$jbtg$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me> <87fs2tr2vf.fsf@nosuchdomain.example.com> <uff7ul$33ojr$1@dont-email.me> <87lecku0bu.fsf@nosuchdomain.example.com> <uffh97$35kih$2@dont-email.me> <ko22d1Fejg3U1@mid.individual.net> <lyttr8knwn.fsf@pushface.org> <874jj75joi.fsf@nosuchdomain.example.com> <lyh6n64x1u.fsf@pushface.org> <ufjfu9$4ev8$1@dont-email.me> <ly5y3m4nxw.fsf@pushface.org> <ufjnu0$62ki$1@dont-email.me>
Injection-Date: Thu, 5 Oct 2023 00:43:29 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ed5b3a88a5d01c01ded57c1be25af20a";
logging-data="634800"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+m7n53Q1mwQftUBre1OCkZzqY7bjmjLw8="
Cancel-Lock: sha1:EByjs05KYrVR1Iwcu2GrjILfeyI=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MSMail-Priority: Normal
X-Priority: 3
X-RFC2646: Format=Flowed; Response
 by: Randy Brukardt - Thu, 5 Oct 2023 00:43 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:ufjnu0$62ki$1@dont-email.me...
> On 2023-10-04 13:38, Simon Wright wrote:
>>
>> Obviously you need to turn echoing off for password input. But neither
>> the ARM nor the GNAT RM says anything about Get_Immediate's echoing
>> behaviour, so it's hard to explain why OA does the same thing. Does its
>> manual specify this behaviour?
>
> Unfortunately, Ada does not provide a standard way to turn off echo.
>
> I agree that the ARM says nothing about echo for any of its operations on
> Standard_Input, but clearly there is a broad consensus of Ada.Text_IO
> writers and users who think this is desirable behavior.

For what it's worth, Janus/Ada turns off echoing, and that was decided
without referring to any other implementation's choice in the matter.
Rather, it was done to provide a way using standard calls to provide
functionality that had always been available in Janus/Ada in a non-standard
way.

Specifically, Janus/Ada has always had a predefined file name "KBD:" (or
"/dev/kbd" on Unix), which provides raw access to the keyboard device (or
standard input on more modern systems). This did not echo (or do any line
editing) on CP/M and MS-DOS, and we carried that same behavior over into
more modern systems.

For instance, the "Continue or Abort?" question in the compiler uses KBD: to
take and discard input immediately without any waiting (usual standard input
is line buffered and usually input is not processed until "enter" or similar
is pressed). It seemed to us that the Get_Immediate function was intending
the same sorts of uses. Note that implementing it this way makes it hard to
get meaningful results if Get_Immediate is mixed with other input on the
same file. (That's why we treated it as a special file in the beginning, but
even that gets confused if someone else reads from Standard_Input.)

Randy.

Re: get_immediate echoe character--compiled error?

<ufm0uj$spkl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10188&group=comp.lang.ada#10188

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: get_immediate echoe character--compiled error?
Date: Thu, 5 Oct 2023 11:51:15 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <ufm0uj$spkl$1@dont-email.me>
References: <ufdamv$2nn4h$1@dont-email.me> <ufkkj3$e348$1@dont-email.me>
<87r0ma3ulk.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 5 Oct 2023 09:51:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="6977c78cf9ab8936c172ead1138d02f3";
logging-data="943765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XIT+BWCFRb7HyDhaoKwrRUERZriaFSzs="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:75FU3Z2hY79hgZDQlPWa4bQpuSs=
Content-Language: en-US
In-Reply-To: <87r0ma3ulk.fsf@nosuchdomain.example.com>
 by: Jeffrey R.Carter - Thu, 5 Oct 2023 09:51 UTC

On 2023-10-05 00:12, Keith Thompson wrote:
> "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
>>
>> I should have checked this earlier, but this does not echo with ObjectAda.
>
> On what target system?

Windows.

--
Jeff Carter
"You cheesy lot of second-hand electric donkey-bottom biters."
Monty Python & the Holy Grail
14

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor