comp.lang.ada
 help / color / mirror / Atom feed
From: Alain De Vos <devosalain71@gmail.com>
Subject: Re: gnat.string_split , howto manipulate slice numbers
Date: Tue, 29 Oct 2019 04:20:44 -0700 (PDT)
Date: 2019-10-29T04:20:44-07:00	[thread overview]
Message-ID: <7fb6d1d0-18df-43b9-bcdc-9782dfb5171c@googlegroups.com> (raw)
In-Reply-To: <5d710dac-d172-4a31-899e-1bf95e220ed6@googlegroups.com>

On Tuesday, October 29, 2019 at 12:08:12 PM UTC+1, Alain De Vos wrote:
> On Tuesday, October 29, 2019 at 9:35:31 AM UTC+1, Simon Wright wrote:
> > Alain De Vos <devosalain71@gmail.com> writes:
> > 
> > > I have a String_Split.Slice_Number , but I need the number before.
> > > ...
> > > J := String_Split.Slice_Count (Lines);
> > > for I in 2 .. J loop
> > > ...
> > > This works but ,
> > > ...
> > > J := String_Split.Slice_Count (Lines) - 1 ;
> > > for I in 2 .. J loop
> > > ...
> > > This does not work.
> > > Error :
> > > lsblk.adb:91:44: operator for type "Slice_Number" defined at
> > > g-arrspl.ads:116, instance at g-strspl.ads:39 is not directly visible
> > 
> > The error message says that there is an operator "-" for Slice_Number,
> > but it needs to be made directly visible; either "use String_Split", or
> > "use type String_Split.Slice_Count".
> > 
> > However! clearly Lines is of some numeric type (Natural?) defined
> > earlier, for which operator "-" is visible. So use that operator
> > instead, by applying it before the conversion:
> > 
> >    J := String_Split.Slice_Count (Lines - 1);
> 
> Lines is of type ,
> 
> Lines : String_Split.Slice_Set;

-------------------------------------------------
I tested and the addition of ,
use type GNAT.String_Split.Slice_Number; 
fixed it.
I looks like without it the operator - is not understood.

  reply	other threads:[~2019-10-29 11:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  1:54 gnat.string_split , howto manipulate slice numbers Alain De Vos
2019-10-29  8:17 ` briot.emmanuel
2019-10-29 16:56   ` Jeffrey R. Carter
2019-10-29 19:36     ` Niklas Holsti
2019-10-29 23:06       ` J-P. Rosen
2019-11-01  9:45         ` joakimds
2019-10-29 23:36   ` Stephen Leake
2019-10-29  8:35 ` Simon Wright
2019-10-29 11:08   ` Alain De Vos
2019-10-29 11:20     ` Alain De Vos [this message]
2019-10-29 16:44       ` J-P. Rosen
2019-10-29 16:47       ` Simon Wright
2019-10-29 18:33         ` J-P. Rosen
2019-10-29 19:37           ` Dmitry A. Kazakov
2019-10-30 11:30             ` Simon Wright
2019-10-31  9:30               ` joakimds
2019-10-31 10:12               ` Dmitry A. Kazakov
2019-10-31 18:36                 ` J-P. Rosen
2019-11-01  9:39                   ` joakimds
2019-10-29 16:41   ` Simon Wright
2019-10-29 16:53 ` 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