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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c58a5b8372dc24a0 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 17 Apr 2010 21:13:44 -0500 From: brett Subject: Re: confusion with string initialization Newsgroups: comp.lang.ada UserIpAddress: 202.168.117.52 InternalId: 3213991f-6eae-4ac1-a5b2-7db06ed9b147 References: Message-ID: Date: Sat, 17 Apr 2010 21:13:44 -0500 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-ZyTHNtCsLg6ZRLFUsmLaQSLkc1C0LiV7n65X9tXJJk8B69lKdipqpplIcaCQWwYhoKR5nKzraJSvxFy!urWWcU3/dv6dCpqQ35rCat82Tf72p94XnBVTzJEGyM+lAsh0ruVqVQanCaNdrKLYYdqTniJ9OQ== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Lines: 4 Xref: g2news2.google.com comp.lang.ada:11021 Date: 2010-04-17T21:13:44-05:00 List-Id: Thank you all for your very useful information, Thomas Locke's full example of Barnes code was extremely helpful. Which I dropped into GNAT for testing. I was having problems resolving the what? packages I needed to be able to process bounded strings, I'd already sucessfully written a Unbounded strings program and could not see why Bounded strings were causing me so many problems ! The need for "Generic_Bounded_Length" part was very unclear, and hoe it related to the rest of my code. BTW: John Barnes Ada 2005 Book is truly excellent, however I think I also need a more "Practical Ada 2005 Programming" book as well. The titles I see on Internet book sellers are mainly Ada95 and I'm unsure if they have any relevance to learning Ada 2005. Any Suggestions ?? My finished test program is : -- brett hallett : 18/10/2010 -- testing --redefined Integer type Temp_Int --Bounded String type with Ada.Strings.Bounded; use Ada.Strings.Bounded; with Ada.Text_IO.Bounded_IO; procedure calctemp4 is use Ada.Strings.Bounded; use Ada.Text_IO; subtype Temp_Int is integer range 50 .. 350 ; package BS is new Generic_Bounded_Length(30); use BS; -- define the 'base' string to work with package BS_IO is new Bounded_IO ( BS ); use BS_IO; strline : BS.Bounded_String := (BS.Max_Length * " "); -- create & initialize strline to spaces C : Temp_Int := Temp_Int'First; -- start temperature F : Integer; function convert ( X : Integer ) return Integer is F : Integer; begin F := (( X * 9 )/ 5 ) +32; -- standard C to F calc return F; end convert; begin put_line("calctemp"); put(" Celsius Farhenheit"); new_line; while C < Temp_Int'Last loop -- loop in range BS.overwrite(strline, 1, c'img); f := convert(c); BS.overwrite(strLine, 10, f'img); BS_IO.Put_line(strline); C := C + 25; strline := BS.Max_Length * "*"; -- 'clear' strline ( not necessary , just testing :-) end loop; put(" -- finished--"); new_line; end calctemp4; --- frmsrcurl: http://compgroups.net/comp.lang.ada/confusion-with-string-initialization