Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

24 Apr, 2024: Testing a new version of the Overboard here. If you have an issue post about it to rocksolid.nodes.help (I know. Everyone on Usenet has issues)


devel / comp.lang.ada / Re: How to test if file = Ada.Text_IO.Standard_Input ?

SubjectAuthor
* How to test if file = Ada.Text_IO.Standard_Input ?reinert
`* Re: How to test if file = Ada.Text_IO.Standard_Input ?Jeffrey R.Carter
 +* Re: How to test if file = Ada.Text_IO.Standard_Input ?reinert
 |`- Re: How to test if file = Ada.Text_IO.Standard_Input ?Gautier write-only address
 `- Re: How to test if file = Ada.Text_IO.Standard_Input ?Keith Thompson

1
How to test if file = Ada.Text_IO.Standard_Input ?

<93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:b5c4:: with SMTP id e187mr3758091qkf.27.1634976399191;
Sat, 23 Oct 2021 01:06:39 -0700 (PDT)
X-Received: by 2002:a05:6902:1104:: with SMTP id o4mr4557302ybu.143.1634976399047;
Sat, 23 Oct 2021 01:06:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 23 Oct 2021 01:06:38 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>
Subject: How to test if file = Ada.Text_IO.Standard_Input ?
From: rein...@gmail.com (reinert)
Injection-Date: Sat, 23 Oct 2021 08:06:39 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 21
 by: reinert - Sat, 23 Oct 2021 08:06 UTC

Hello,

the following program:

procedure test1 (file1 : in Ada.Text_IO.File_Type) is
term1 : constant Boolean := file1 in Ada.Text_IO.Standard_Input;
begin
null;
end test1;

compiles under gnat-10 (debian). The point here is to test if "file1" represents the terminal.

However, when I try to compile using the current GNAT Community Edition from AdaCore, I get the error:

test7.adb:38:41: error: invalid operand types for operator "="
test7.adb:38:41: error: left operand has private type "Ada.Text_Io.File_Type"
test7.adb:38:41: error: right operand has type "Ada.Text_Io.File_Access"
gnatmake: "test7.adb" compilation error

So how can I test if "file1" referes to the terminal using the lastest GNAT Community Edition?

reinert

Re: How to test if file = Ada.Text_IO.Standard_Input ?

<sl0npe$c7c$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ?
Date: Sat, 23 Oct 2021 12:22:36 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <sl0npe$c7c$1@dont-email.me>
References: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Oct 2021 10:22:38 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="5ce466cf1605c3c96ed07404ad7a1101";
logging-data="12524"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ccXXOqzHfKznsQTsDjbTjUTXBGBWxSPo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.1.2
Cancel-Lock: sha1:GxSOnW+Y3heHiuLOrjFcSUDrEtk=
In-Reply-To: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Sat, 23 Oct 2021 10:22 UTC

On 10/23/21 10:06, reinert wrote:
>
> So how can I test if "file1" referes to the terminal using the lastest GNAT Community Edition?

Have you tried

Ada.Text_IO.Name (File1) = Ada.Text_IO.Name (Ada.Text_IO.Standard_Input)

? (I haven't.)

--
Jeff Carter
"C++: The power, elegance and simplicity of a hand grenade."
Ole-Hjalmar Kristensen
90

Re: How to test if file = Ada.Text_IO.Standard_Input ?

<1f4b8c1e-a74f-4d43-8136-1868d598595an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:b045:: with SMTP id z66mr4549925qke.271.1634992103793;
Sat, 23 Oct 2021 05:28:23 -0700 (PDT)
X-Received: by 2002:a5b:cce:: with SMTP id e14mr5523600ybr.486.1634992103539;
Sat, 23 Oct 2021 05:28:23 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 23 Oct 2021 05:28:23 -0700 (PDT)
In-Reply-To: <sl0npe$c7c$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com> <sl0npe$c7c$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1f4b8c1e-a74f-4d43-8136-1868d598595an@googlegroups.com>
Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ?
From: rein...@gmail.com (reinert)
Injection-Date: Sat, 23 Oct 2021 12:28:23 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: reinert - Sat, 23 Oct 2021 12:28 UTC

Yes, now it compiles !

reinert

lørdag 23. oktober 2021 kl. 12:22:40 UTC+2 skrev Jeffrey R.Carter:
> On 10/23/21 10:06, reinert wrote:
> >
> > So how can I test if "file1" referes to the terminal using the lastest GNAT Community Edition?
> Have you tried
>
> Ada.Text_IO.Name (File1) = Ada.Text_IO.Name (Ada.Text_IO.Standard_Input)
>
> ? (I haven't.)
>
> --
> Jeff Carter
> "C++: The power, elegance and simplicity of a hand grenade."
> Ole-Hjalmar Kristensen
> 90

Re: How to test if file = Ada.Text_IO.Standard_Input ?

<7e038890-f387-43a2-89fe-00211c0b82dfn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:dc81:: with SMTP id n1mr6049638qvk.36.1635003638033;
Sat, 23 Oct 2021 08:40:38 -0700 (PDT)
X-Received: by 2002:a5b:846:: with SMTP id v6mr6153123ybq.457.1635003637911;
Sat, 23 Oct 2021 08:40:37 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 23 Oct 2021 08:40:37 -0700 (PDT)
In-Reply-To: <1f4b8c1e-a74f-4d43-8136-1868d598595an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:1206:4596:5040:a981:c1a6:b7a2:9cb8;
posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG
NNTP-Posting-Host: 2a02:1206:4596:5040:a981:c1a6:b7a2:9cb8
References: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>
<sl0npe$c7c$1@dont-email.me> <1f4b8c1e-a74f-4d43-8136-1868d598595an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7e038890-f387-43a2-89fe-00211c0b82dfn@googlegroups.com>
Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ?
From: gautier_...@hotmail.com (Gautier write-only address)
Injection-Date: Sat, 23 Oct 2021 15:40:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Gautier write-only a - Sat, 23 Oct 2021 15:40 UTC

Le samedi 23 octobre 2021 à 14:28:24 UTC+2, reinert a écrit :
> Yes, now it compiles !

Interesting to see what name GNAT gives to Standard_Input:

with Ada.Text_IO;

procedure SIO is
begin
Ada.Text_IO.Put_Line ('[' & Ada.Text_IO.Name (Ada.Text_IO.Standard_Input) & ']');
Ada.Text_IO.Put_Line ('[' & Ada.Text_IO.Name (Ada.Text_IO.Standard_Error) & ']');
end;

[*stdin]
[*stderr]

Re: How to test if file = Ada.Text_IO.Standard_Input ?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.lang.ada
Subject: Re: How to test if file = Ada.Text_IO.Standard_Input ?
Date: Sun, 24 Oct 2021 13:51:09 -0700
Organization: None to speak of
Lines: 25
Message-ID: <87fssq2lky.fsf@nosuchdomain.example.com>
References: <93df825f-5c18-4a02-a399-74c7ee7cf784n@googlegroups.com>
<sl0npe$c7c$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="dc53845975de92cdf23a501c594f45fc";
logging-data="29016"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+wi94TkgGBL9gIHFjCcxy5"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:INk1Fb34XgFtFXZz++bjMkRAA5k=
sha1:yeoHN1h3h1KbT9Gyy4SBx96gsv4=
 by: Keith Thompson - Sun, 24 Oct 2021 20:51 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> writes:
> On 10/23/21 10:06, reinert wrote:
>> So how can I test if "file1" referes to the terminal using the
>> lastest GNAT Community Edition?
>
> Have you tried
>
> Ada.Text_IO.Name (File1) = Ada.Text_IO.Name (Ada.Text_IO.Standard_Input)
>
> ? (I haven't.)

That might well serve reinert's needs, but strictly speaking it doesn't
tell you whether File1 refers to the terminal. At best it might tell
you whether File1 and Standard_Input refer to the same external file --
which may not even be a terminal if standard input was redirected.

GNAT apparently uses "*stdin" as the Name of Standard_Input, regardless
of what actual file it refers to. There could be an actual file with
that name. It's not likely, but it means that this method could be
broken maliciously.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor