From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,FAKE_REPLY_C, MAILING_LIST_MULTI,STOX_REPLY_TYPE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bb67e5f4739c02 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!proxad.net!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: Tagged Types Date: Sun, 12 Sep 2004 23:08:16 -0500 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-15"; reply-type=original Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1095048527 18645 212.85.156.195 (13 Sep 2004 04:08:47 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 13 Sep 2004 04:08:47 +0000 (UTC) To: Return-Path: X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:3651 Date: 2004-09-12T23:08:16-05:00 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" wrote in message news:pan.2004.09.12.19.29.12.644532@free.fr... >> --- Patrice Freydiere 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 > >