comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
To: <comp.lang.ada@ada-france.org>
Subject: Re: Tagged Types
Date: Sun, 12 Sep 2004 23:08:16 -0500
Date: 2004-09-12T23:08:16-05:00	[thread overview]
Message-ID: <mailman.20.1095048526.390.comp.lang.ada@ada-france.org> (raw)

Zero-based strings are _not_ legal, because the declaration
of String allows only _Positive_ array indices.

Other array types can be declared allowing other
types for the array indices -- in fact, any
_discrete_ type can be so used.


"Patrice Freydiere" <frett27@free.fr> wrote in message 
news:pan.2004.09.12.19.29.12.644532@free.fr...
>> --- Patrice Freydiere <frett27@free.fr> wrote:
>> > Jeff, I pointed out the problem ..
>> > i was converting a stream_element_array in a string,
>> > using the
>> > stream_element_array bounds ... the array was
>> > starting at 0. So at runtime,
>> > an index out of bounds was raised because strings
>> > starting to 0 are not
>> > allowed...
>> >
>> > i can't get a stream_element_array formal
>> > description to check if zero base
>> > array is valid ??
>>
>> I don't understand what you mean by this. Why can you
>> not get the formal description for this. You are using
>> GNAT? it is in a-stream.ads
>>
>> Yes it is legal to start at 0 (or even negative
>> values).
>>
>> Can you post (either here or comp.lang.ada) just the
>> snippet of code from the declare block that you are
>> talking about or is it too proprietary.
>>
>>
>
> Here is the involve code :
>
>                  begin
>                     Ais.Log.Log("Image retreived - " &
> Image.Get_Name(Im.all));
>                     if Im=null then
>                        Ais.Log.Log("null address  ");
>                     end if;
>                     declare
>                        Ba : Ada.Streams.Stream_Element_Array
>                            := Ais.image.Create_Thumbnail(ic);
>                     begin
>                        declare
>                           S : String( 1 .. Natural(Ba'Length) );
> --&&&&&&&&&&&&& when i used a 0 based string, it hang with a (null): Bad
> address
> -- &&&&&&&&&&&&&& with a 1 based string, OK
> -- &&&&&&&&&&&&&& with using Get_Content for retrieving the
> Stream_Element_Array, it 's OK  ?????
>                        begin
>                           for J in Ba'Range loop
>                             S(Integer(J-Ba'first)+S'first) :=
>
> Character'Val(Ada.Streams.Stream_Element'pos(Ba(J)));
>                              null;
>                           end loop;
>                           As(I) :=
>
> Client.Base64_Data(To_String(AIS.Image.Get_Name(Im.all)),
> 
> Aws.Translator.Base64_Encode(
> S ));
>                        end;
>
>
> tell me if you wanna have more code,
> or you can get the entier code from imgsvr.org cvs repository
>
> Cheers,
> Patrice
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>
> 





             reply	other threads:[~2004-09-13  4:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-13  4:08 David C. Hoos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-12 19:29 Tagged Types Patrice Freydiere
2002-05-30 15:30 tagged types Sami Evangelista
2002-05-30 19:11 ` Stephen Leake
2002-05-31 13:13   ` Stephen Leake
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox