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,146ef816afa699d1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.46.193 with SMTP id x1mr5870028pbm.7.1319004372189; Tue, 18 Oct 2011 23:06:12 -0700 (PDT) Path: d5ni30885pbc.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Length of unbounded_string. Date: Wed, 19 Oct 2011 08:07:25 +0200 Organization: Tidorum Ltd Message-ID: <9g77mgFribU1@mid.individual.net> References: <4e9a9a6d$0$3238$703f8584@news.kpn.nl> <9fvo6aF3d6U1@mid.individual.net> <4e9ad365$0$3267$703f8584@news.kpn.nl> <9g02plFrnlU1@mid.individual.net> <4e9bdbc7$0$3240$703f8584@news.kpn.nl> <9g3f3kFfr7U1@mid.individual.net> <4e9d6722$0$3244$703f8584@news.kpn.nl> <9g5snkFlh0U1@mid.individual.net> <4e9e37ea$0$3272$703f8584@news.kpn.nl> Mime-Version: 1.0 X-Trace: individual.net w1kv472K/KlUhSi/Ub0osgZuHq89USEQBPJjq3lBFpWRHPTkfK Cancel-Lock: sha1:LVrBnW0oSD/ny+Yy55OIN+NCefo= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: <4e9e37ea$0$3272$703f8584@news.kpn.nl> Xref: news2.google.com comp.lang.ada:14075 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-10-19T08:07:25+02:00 List-Id: On 11-10-19 04:38 , ldries46 wrote: > The complete code of which I would conclude that the comma should be > present is: [ snip ] > nr := nr + 1; > ch := Element(Next_Line, -- Next_LIne is a unbounded_string > that can be connected to str The assignment to ch is incomplete, there should be something after the comma. Looking at the loop below, I guess the statement is meant to be ch := Element(Next_Line, 1); Also, at this point in the code, Next_Line has not been given any value, it has not even been declared. Is it a global variable? What does it contain when your problem occurs? > while ch = ' ' or ch = ASCII.HT loop > Replace_Slice(Next_Line, 1, 1, ""); > ch := Element(Next_Line, 1); > end loop; That loop will end badly if Next_Line contains only whitespace. You should exit the loop when the Replace_Slice makes Next_Line a null string. > str := str & " " & -- After this statement the error is found by the > display function of the GDB > Original_Line := -- Original Line is only meant for the error messges Both those statements are syntactically incomplete. The first one ends with an operator "&"; there should be at least one more operand, and a terminating semicolon. The second one ends with ":=". > Next_Line := To_Unbounded_String(""); You should exit the outer loop ("while not ok") at this point, I think, because otherwise you can loop back to the statement ch := Element(Next_Line, 1); with Next_Line holding a null string, which is an indexing error. I notice that you check for tab characters (HT). Can it happen that the string contains backspace characters? If the string has a comma, then a backspace, the comma is perhaps not visible on the screen when the string is displayed. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .