comp.lang.ada
 help / color / mirror / Atom feed
From: "ldries46" <bertus.dries@planet.nl>
Subject: Re: Length of unbounded_string.
Date: Mon, 24 Oct 2011 17:10:57 +0200
Date: 2011-10-24T17:10:57+02:00	[thread overview]
Message-ID: <4ea580d4$0$8044$703f8584@textnews.kpn.nl> (raw)
In-Reply-To: <9g77mgFribU1@mid.individual.net>

1. Indeed for some reason then the 1); is of the E-mail but the compiler 
would not have compiled the program without.
ch now has the value of the first character of Next_Line.
2. Next Line is a Global variable to be used in a lot of routines before and 
after this one.
3. You are right but I am sure the Next_Line has other characters in the 
line. If not the program would have never come in this routine.
4. I see that the message was not correctly received both statements also 
had correct syntax.
    str := str & " " & Next_Line;
    Original_Line := str;
5. The string should not have BackSpaces but I think that if so comma should 
be found with a next position statement searching for it, and it did not.

"Niklas Holsti"  schreef in bericht news:9g77mgFribU1@mid.individual.net...

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
       .      @       . 




  reply	other threads:[~2011-10-24 15:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-16  8:48 Length of unbounded_string ldries46
2011-10-16  9:59 ` Niklas Holsti
2011-10-16 12:06   ` ldries46
2011-10-16 12:52   ` ldries46
2011-10-16 13:00     ` Niklas Holsti
2011-10-17  7:39       ` ldries46
2011-10-17 19:49         ` Niklas Holsti
2011-10-18 11:47           ` ldries46
2011-10-18 17:54             ` Niklas Holsti
2011-10-19  2:38               ` ldries46
2011-10-19  6:07                 ` Niklas Holsti
2011-10-24 15:10                   ` ldries46 [this message]
2011-10-19  6:37                 ` Simon Wright
2011-10-19 14:48                 ` Alex Mentis
2011-10-24 17:04                   ` ldries46
2011-10-16 10:14 ` Vinzent Hoefler
  -- strict thread matches above, loose matches on Subject: below --
2011-10-25  9:37 ldries46
2011-10-25 17:57 ` Jeffrey Carter
2011-10-28  2:54   ` ldries46
2011-10-28  4:55     ` Jeffrey Carter
2011-10-25 20:23 ` Vadim Godunko
2011-10-25 21:28   ` Simon Wright
2011-10-26  4:41     ` Simon Wright
2011-10-26 22:47     ` Randy Brukardt
2011-10-27  8:05       ` AdaMagica
2011-10-27  8:56       ` Simon Wright
2011-10-27 11:05         ` Brian Drummond
2011-10-28  3:12           ` ldries46
     [not found]           ` <4eafc489$0$3081$703f8584@textnews.kpn.nl>
2011-11-01 18:22             ` Jeffrey Carter
2011-10-27 11:28         ` Georg Bauhaus
2011-10-27 12:17           ` Dmitry A. Kazakov
2011-10-27 13:31             ` Georg Bauhaus
2011-10-27 14:34               ` Dmitry A. Kazakov
replies disabled

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