Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Mr. Watson, come here, I want you." -- Alexander Graham Bell


devel / comp.lang.ada / Re: Text_io package's Positive_Count type

SubjectAuthor
* Text_io package's Positive_Count typeMace Ayres
`* Re: Text_io package's Positive_Count typeNiklas Holsti
 `* Re: Text_io package's Positive_Count typeMace Ayres
  +- Re: Text_io package's Positive_Count typeNiklas Holsti
  `- Re: Text_io package's Positive_Count typeJeffrey R.Carter

1
Text_io package's Positive_Count type

<1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:5052:0:b0:532:2e21:8c0a with SMTP id m18-20020ad45052000000b005322e218c0amr709839qvq.78.1673432044095;
Wed, 11 Jan 2023 02:14:04 -0800 (PST)
X-Received: by 2002:a0c:8e8a:0:b0:531:913e:3ba3 with SMTP id
x10-20020a0c8e8a000000b00531913e3ba3mr3428731qvb.37.1673432043948; Wed, 11
Jan 2023 02:14:03 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 11 Jan 2023 02:14:03 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=71.202.101.82; posting-account=1sN4oQoAAABANGeLN5K5KDzu7t8XhLSV
NNTP-Posting-Host: 71.202.101.82
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>
Subject: Text_io package's Positive_Count type
From: mace.ayres@icloud.com (Mace Ayres)
Injection-Date: Wed, 11 Jan 2023 10:14:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1477
 by: Mace Ayres - Wed, 11 Jan 2023 10:14 UTC

I am using GNAT's,2018, GPS on 1 2012 Macbook Pro, Intel Chip, for some Ada programming with IO to a terminal. I want to capture the cursor position, row, and column with Text_IO line and col functions returning to my variables of type Positive_count, declared in my package's specification, *.ids file, Compile fails with an ambiguous message about my line of code that calls line and col returning to Postiive_count type variables.

Re: Text_io package's Positive_Count type

<k27t8eFp6k8U2@mid.individual.net>

  copy mid

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

  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: Text_io package's Positive_Count type
Date: Wed, 11 Jan 2023 15:52:14 +0200
Organization: Tidorum Ltd
Lines: 20
Message-ID: <k27t8eFp6k8U2@mid.individual.net>
References: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net E/3XXAGOr7OOn1G8x2i4ew5SsTW2VH36dwGITslteSRbamoEFv
Cancel-Lock: sha1:HVEA9xjc4e65darTi1+a2BdYoJI=
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: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>
 by: Niklas Holsti - Wed, 11 Jan 2023 13:52 UTC

On 2023-01-11 12:14, Mace Ayres wrote:
> I am using GNAT's,2018, GPS on 1 2012 Macbook Pro, Intel Chip, for
> some Ada programming with IO to a terminal. I want to capture the
> cursor position, row, and column with Text_IO line and col functions
> returning to my variables of type Positive_count, declared in my
> package's specification, *.ids file, Compile fails with an ambiguous
> message about my line of code that calls line and col returning to
> Postiive_count type variables.

Please show the code that declares Positive_count, and the calls of Line
and Col, and explain in which file they are located, and whether those
files (or the corresponding .ads files) contain any "use" context-clauses.

Showing the compiler's error message would also be helpful. Usually an
ambiguity problem means that there are several different subprograms
with the same name, and the compiler does not know which one you want to
call, because the types of the parameters and the result are not
sufficiently constraining, or because the call does not qualify the
subprogram name with a package name.

Re: Text_io package's Positive_Count type

<fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:3509:b0:532:1605:97fe with SMTP id nk9-20020a056214350900b00532160597femr2448198qvb.15.1673471063235;
Wed, 11 Jan 2023 13:04:23 -0800 (PST)
X-Received: by 2002:ac8:73ca:0:b0:3a5:4f9b:215a with SMTP id
v10-20020ac873ca000000b003a54f9b215amr3700917qtp.394.1673471063093; Wed, 11
Jan 2023 13:04:23 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 11 Jan 2023 13:04:22 -0800 (PST)
In-Reply-To: <k27t8eFp6k8U2@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=71.202.101.82; posting-account=1sN4oQoAAABANGeLN5K5KDzu7t8XhLSV
NNTP-Posting-Host: 71.202.101.82
References: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com> <k27t8eFp6k8U2@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>
Subject: Re: Text_io package's Positive_Count type
From: mace.ayres@icloud.com (Mace Ayres)
Injection-Date: Wed, 11 Jan 2023 21:04:23 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2285
 by: Mace Ayres - Wed, 11 Jan 2023 21:04 UTC

-- combinations.ads -- physical file
with gearbox; use gearbox;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Term_IO; use TERM_IO;
with Text_IO; use Text_IO;
package combinations is
....
col_is : Positive_Count ; -- types from Text_IO
row_is : Positive_Count ;
procedure build;
....
end combinations;
-- *************************************
-- combinations.adb -- physical file
package body combination is
.....
procedure build is
...
begin
....
put(" Row is " ); put(row_is);
put(" Column is "); put(col_is);
....
end combinations;

-- *****************************
compiler error
line_no : no candidate interpretations match the actual:
missing argument for parameter 'Item' in call to "put"
...
possible missing instantiation of Text_IO.Integer_IO
expected type "Standard Integer"
found type Ada.Text_IO.count

____
This is different error than before and I easily see Put() is expecting Integer but has the.. count type; so I need some sort of translation to satisfy put(), maybe with and use Text_IO.Integer_IO as error message suggest?

Re: Text_io package's Positive_Count type

<k28opqFr7d5U1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: niklas.holsti@tidorum.invalid (Niklas Holsti)
Newsgroups: comp.lang.ada
Subject: Re: Text_io package's Positive_Count type
Date: Wed, 11 Jan 2023 23:42:17 +0200
Organization: Tidorum Ltd
Lines: 75
Message-ID: <k28opqFr7d5U1@mid.individual.net>
References: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>
<k27t8eFp6k8U2@mid.individual.net>
<fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net L2VLQGkAv720F1xydhxFww8c9IN5yTlFR7zqqc/9XfhaGW+Mki
Cancel-Lock: sha1:amXYy8exPcO43EC1VyQ/HyMePwk=
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: <fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>
 by: Niklas Holsti - Wed, 11 Jan 2023 21:42 UTC

On 2023-01-11 23:04, Mace Ayres wrote:
> -- combinations.ads -- physical file
> with gearbox; use gearbox;
> with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
> with Term_IO; use TERM_IO;
> with Text_IO; use Text_IO;
> package combinations is
> ...
> col_is : Positive_Count ; -- types from Text_IO
> row_is : Positive_Count ;
> procedure build;
> ...
> end combinations;
> -- *************************************
> -- combinations.adb -- physical file
> package body combination is
> ....
> procedure build is
> ..
> begin
> ...
> put(" Row is " ); put(row_is);
> put(" Column is "); put(col_is);
> ...
> end combinations;
>
> -- *****************************
> compiler error
> line_no : no candidate interpretations match the actual:
> missing argument for parameter 'Item' in call to "put"
> ...
> possible missing instantiation of Text_IO.Integer_IO
> expected type "Standard Integer"
> found type Ada.Text_IO.count

Thanks for showing the code (although it seems you have changed it since
you asked the question originally).

> ____
> This is different error than before and I easily see Put() is
> expecting Integer but has the.. count type; so I need some sort of
> translation to satisfy put(), maybe with and use Text_IO.Integer_IO
> as error message suggest?

Well, yes. But note that the message says you should _instantiate_
Text_IO.Integer_IO, not "with" it. This is because Text_IO.Integer_IO is
not its own library unit, but a generic package nested within Text_IO,
which you already "withed". So the message suggests that you should do
this, somewhere in the declaration part of the body of package combination:

package Count_IO is new Text_IO.Integer_IO (Num => Positive_Count);

and then you can call

Count_IO.Put (row_is);

and so forth. Or, if you add "use Count_IO" after the instantiation, you
can write just Put (row_is).

However, the simplest method for occasional or debugging output is to
use the 'Image attribute to convert a number to text, as for example

Put (row_is'Image);

or (for older Ada versions)

Put (Positive_Count'Image (row_is));

where the "Put" is the Put in Text_IO for strings. With 'Image, you
don't need Text_IO.Integer_IO (but you have less control over the form
of the output).

Re: Text_io package's Positive_Count type

<tpnaog$sra1$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Text_io package's Positive_Count type
Date: Wed, 11 Jan 2023 22:46:56 +0100
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tpnaog$sra1$1@dont-email.me>
References: <1ef161c8-8e65-4a82-8db8-c772e813be80n@googlegroups.com>
<k27t8eFp6k8U2@mid.individual.net>
<fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Jan 2023 21:46:56 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="fa41f8827690066173a54e7bc84a6dd8";
logging-data="945473"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+hj31e39qo2+XRG1kcrfOmE5A3AaHv/cA="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.4.2
Cancel-Lock: sha1:vPEtX9c1tRaaEm4ELO1cih8z6ug=
Content-Language: en-US
In-Reply-To: <fa48ad91-93de-41e2-a314-3ae2925f547cn@googlegroups.com>
 by: Jeffrey R.Carter - Wed, 11 Jan 2023 21:46 UTC

On 2023-01-11 22:04, Mace Ayres wrote:
> ____
> This is different error than before and I easily see Put() is expecting Integer but has the.. count type; so I need some sort of translation to satisfy put(), maybe with and use Text_IO.Integer_IO as error message suggest?

Ada.Text_IO.Integer_IO is a generic package that you would instantiate with
Ada.Text_IO.Positive_Count. The instantiation would then have a Put procedure
for Positive_Count.

Alternatively, you could use Positive_Count'Image to convert your values into
Strings that may be used directly with Ada.Text_IO.Put.

--
Jeff Carter
"You me on the head hitted."
Never Give a Sucker an Even Break
108


devel / comp.lang.ada / Re: Text_io package's Positive_Count type

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor