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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,27544cb48c942326 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.25.194 with SMTP id e2mr838674pbg.7.1320171739168; Tue, 01 Nov 2011 11:22:19 -0700 (PDT) Path: p6ni57000pbn.0!nntp.google.com!news2.google.com!news4.google.com!feeder.news-service.com!news.mixmin.net!news.tornevall.net!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Length of unbounded_string. Date: Tue, 01 Nov 2011 11:22:14 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <4ea68441$0$8041$703f8584@textnews.kpn.nl> <4eafc489$0$3081$703f8584@textnews.kpn.nl> NNTP-Posting-Host: f8e997c3519723c0025bffeda09b7f3b Mime-Version: 1.0 X-Trace: 10331c47b30a64479c12e10f4c0af632 X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <4eafc489$0$3081$703f8584@textnews.kpn.nl> X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=10331c47b30a64479c12e10f4c0af632 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: news2.google.com comp.lang.ada:14263 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-11-01T11:22:14-07:00 List-Id: On 11/01/2011 03:05 AM, ldries46 wrote: > I finally have rewritten my routine continuation to try to make a work around . > I believe that this has been succesfull. > But The discrepancy between the display and the print facility with debugging > stays as can be seen in the attachment. Also a strance behavior with the display > of the character comma can be seen with lastch, that with an 'e' would have the > output 109 'e' but for the comma gives 44 ' > I think I found a bug in the compiler so I will report this to AdaCore. I don't see any evidence that this is a compiler error. It appears to be a debugger error. 17 nextlen := Length(Next_Line) -- Next_Line is Global 18 ok1 := nextlen /= 0; You seem to be missing a semicolon on line 17. Ok1 is never referenced. You have two big if statements that are essentially if Condition then Do_This; else exit; -- Ok := True; end if; which I would write exit when not Condition; Do_This; The latter is clearer, especially given that small else parts tend to be overlooked after a large if part. 30 while (nextch = ' ' or nextch = ASCII.HT) loop 31 Replace_Slice(Next_Line, 1, 1, ""); 32 nextch := Element(Next_Line, 1); 33 end loop; Why do you use Replace_Slice with a null replacement rather than Delete? If this loop reduces Next_Line to the null string, you'll get Constraint_Error from Element. 35 str := To_Unbounded_String(Slice(str, 1, lenstr - 1)); Why do you use To_Unbounded_String (Slice (...) ) rather than Unbounded_Slice? Cleaning this up, and removing everything not related to the processing, I came up with procedure Continuation(Str : in out Unbounded_String; Nr : in out Integer) is Lenstr : Integer; Nextlen : Integer; Lastch : Character; Nextch : Character; begin All_Continuations : loop Lenstr := Length(Str); exit All_Continuations when Lenstr = 0; Lastch := Element(Str, Lenstr); Nextlen := Length(Next_Line); -- Next_Line is Global exit All_Continuations when Lastch = ';' or Lastch = '{' or Lastch = '}' or Nextlen = 0; Nr := Nr + 1; Skip_Blanks : loop Nextch := Element (Next_Line, 1); exit Skip_Blanks when Nextch /= ' ' and Nextch /= ASCII.HT; Delete (Source => Next_Line, From => 1, Through => 1); exit Skip_Blanks when Length (Next_Line) = 0; end loop Skip_Blanks; Str := Str & ' ' & Next_Line; -- I don't see any reason to slice the last character off and then -- concatenate it back on again. if Nr < Buffer1.Length - 1 then Next_Line := Buffer1.Get_Buffer( Nr + 1 ); -- Buffer1 is a global else Next_Line := Null_Unbounded_String; end if; end loop All_Continuations; end Continuation; -- Jeff Carter "Sir Lancelot saves Sir Gallahad from almost certain temptation." Monty Python & the Holy Grail 69