comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: functions, packages & characters
Date: Fri, 22 Feb 2002 09:11:56 -0500
Date: 2002-02-22T14:11:56+00:00	[thread overview]
Message-ID: <a55jjc$5ar$1@nh.pace.co.uk> (raw)
In-Reply-To: dcb99faa.0202211448.537be1d4@posting.google.com

You seem to be missing some fundamental concepts of Ada - and possibly
programming in general. Type checking is your problem here and that is
something lots of languages do - not just Ada. One type is not
interchangeable with another - that's the whole reason for their existence.
A String is not identical to a Character so you have assignments and
comparisons that are incorrect.

You really should spend some time looking at one of the Ada books or
tutorials that have been recommended. Barring that, you ought to be making
better use of your compiler. It undoubtedly is outputting error messages
that will help you figure out what is going on. If you can't figure out what
the error messages are telling you, you could post the relavent code
snippets here & possibly get a more detailed explanation.

You don't say what compiler you are using, but if you are using Gnat, try
the following command line options:

gnatmake -gnatvl <your_program_name_here>

That will give you verbose error messages and a program listing that may be
helpful when posting questions.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


<unversedangel@aol.com> wrote in message
news:dcb99faa.0202211448.537be1d4@posting.google.com...
> unversedangel@aol.com (Unversed Angel) wrote in message
news:<20020221130715.12738.00000034@mb-bg.aol.com>...
>  i thought of an unbounded string but the program will not go through
> the compiler, no matter which one i use or how i change the program.
>
>
> with Text_io; use Text_io;
> procedure main is
> ---pre: text is in the mark up language
> ---post: text has been converted to english
> ---test: once thru
>
> procedure Get_line is
> ---pre:text needs to be input
> ---post:text has been input
> ---test: once thru
>  Line_Buffer : String(Unbounded_String);
>   Line_Length : Natural range 0 .. Line_Buffer'Last;
>   Line_Store  : array (1 .. 10_000) of Unbounded_String;
>   Line_Count  : Natural range 0 .. Line_Store'Last;
> begin
>   loop
>     Get_Line (Line_Buffer, Line_Length);
>     Line_Count := Line_Count + 1;
>     Line_Store (Line_Count) :=
>       To_Unbounded_String (Line_Buffer (1 .. Line_Length));
>     new_line;
>   end loop;
> end;
>
> Procedure doubleslash is
> ---pre:mark up language has been input
> ---post:doubleslash has been converted to single slash
> ---test: /,//,///
> begin
>  Loop
>   For i in s'range loop
>     if s(i)="//" then
>       s:='/';
>     end if;
>  end loop;
> end;
>
> procedure unformatted is
> ---pre: mark up language has been input
> ---post:/N tag has left the text formatted as it was
> ---test: /N, /N/N,/N/U
>  Loop
>   For i in s'range loop
>     if s(i)=/N then
>        do nothing
>       elseif exit
>       end if;
>     end if;
>   end_loop;
> End;
>
> Begin --of main
>      s:string;
> Put("Please enter text: ");
> Get_Line(s);
> doubleslash;
> unformatted;
> end;
> -------------------Target: Win32 (Intel) Debug--------------------
> main.adb: Error: line 11 col 23 LRM:4.1(3), Direct name,
> Unbounded_String, is not visible, Ignoring future references
>
> main.adb: Error: line 11 col 40 LRM:3.3.1(5), an object declaration
> with an indefinite subtype must have an initialization expression,
> continuing
>
> main.adb: Error: line 20 col 7 LRM:4.1(3), Direct name,
> To_Unbounded_String, is not visible, Ignoring future references
>
> main.adb: Error: line 31 col 12 LRM:4.1(3), Direct name, s, is not
> visible, Ignoring future references
>
> main.adb: Error: line 36 col 1 Parse error: expected END_LOOP, got
> END, Skipping up to semicolon
>
> main.adb: Error: line 38 col 1 LRM:5.1(2), Parse error expecting
> statement got PROCEDURE, skipping to after next semicolon
>
> main.adb: Error: line 48 col 5 Parse error: expected END, got END_IF,
> Inserting END
>
> main.adb: Error: line 48 col 5 Parse error: expected SEMICOLON, got
> END_IF, Inserting SEMICOLON
>
> main.adb: Error: line 48 col 5 LRM:3.1(3), Parse error expecting
> declaration got END_IF, Skipping to after next semicolon
>
> main.adb: Error: line 49 col 11 Parse error: expected COLON, got
> SEMICOLON, Inserting COLON
>
> main.adb: Error: line 49 col 11 LRM:4.1(2), Syntax error: the token
> SEMICOLON can not be used as a name, skipping to next separator
>
> main.adb: Error: line 50 col 1 Parse error: expected BEGIN, got END,
> Inserting BEGIN
>
> main.adb: Error: line 50 col 1 LRM:5.1(2), Unexpected ending token END
> where statement is required, continuing
>
> main.adb: Error: line 52 col 1 LRM:10.1.1(5), BEGIN is unexpected
> here, Continuing
>
> main.adb: Error: line 53 col 6 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 53 col 7 LRM:10.1.1(5), COLON is unexpected
> here, Continuing
>
> main.adb: Error: line 53 col 8 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 53 col 14 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> main.adb: Error: line 54 col 1 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 54 col 4 LRM:10.1.1(5), LEFT PARENTHESIS is
> unexpected here, Continuing
>
> main.adb: Error: line 54 col 5 LRM:10.1.1(5), Character String is
> unexpected here, Continuing
>
> main.adb: Error: line 54 col 26 LRM:10.1.1(5), RIGHT PARENTHESIS is
> unexpected here, Continuing
>
> main.adb: Error: line 54 col 27 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> main.adb: Error: line 55 col 1 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 55 col 9 LRM:10.1.1(5), LEFT PARENTHESIS is
> unexpected here, Continuing
>
> main.adb: Error: line 55 col 10 LRM:10.1.1(5), Identifier is
> unexpected here, Continuing
>
> main.adb: Error: line 55 col 11 LRM:10.1.1(5), RIGHT PARENTHESIS is
> unexpected here, Continuing
>
> main.adb: Error: line 55 col 12 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> main.adb: Error: line 56 col 1 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 56 col 12 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> main.adb: Error: line 57 col 1 LRM:10.1.1(5), Identifier is unexpected
> here, Continuing
>
> main.adb: Error: line 57 col 12 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> main.adb: Error: line 58 col 1 LRM:10.1.1(5), END is unexpected here,
> Continuing
>
> main.adb: Error: line 58 col 4 LRM:10.1.1(5), SEMICOLON is unexpected
> here, Continuing
>
> Front end of ..\..\..\..\my documents\cs131\main.adb failed with 34
> errors. (0 Warnings)
> Tool execution failed.





  parent reply	other threads:[~2002-02-22 14:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21  8:59 functions, packages & characters Christoph Grein
2002-02-21 18:07 ` Unversed Angel
2002-02-21 18:28   ` Hyman Rosen
2002-02-21 23:44     ` Randy Brukardt
2002-02-22  0:37       ` Matthew Heaney
2002-02-22  1:12         ` Matthew Heaney
2002-02-22  2:57         ` Randy Brukardt
2002-02-22 13:54           ` Marin David Condic
2002-02-23  1:10             ` Matthew Heaney
2002-02-25 15:47               ` Marin David Condic
2002-02-26 15:58                 ` Matthew Heaney
2002-02-25 19:37             ` Randy Brukardt
2002-02-25 20:49               ` Marin David Condic
2002-02-26  3:30               ` David Starner
2002-02-26 15:44                 ` Hyman Rosen
2002-02-26 21:43                   ` David Starner
2002-02-27  6:32                     ` Hyman Rosen
2002-02-28  3:55                       ` Chad R. Meiners
2002-02-28 18:44                         ` Hyman Rosen
2002-03-02  3:25                           ` Chad R. Meiners
2002-03-03  8:22                             ` Hyman Rosen
2002-03-03 17:50                               ` Chad R. Meiners
2002-03-01  2:08                         ` David Starner
2002-03-05 14:36                       ` Marin David Condic
2002-02-26  7:42               ` tmoran
2002-02-22 15:34           ` Matthew Heaney
2002-02-22  2:47       ` Jeffrey Carter
2002-02-22 13:41       ` Marin David Condic
2002-02-23  1:08         ` Matthew Heaney
2002-02-23  2:03         ` Jeffrey Carter
2002-02-22 16:27       ` Hyman Rosen
2002-02-21 23:49     ` unversedangel
2002-02-21 22:48   ` unversedangel
2002-02-21 23:14     ` Hyman Rosen
2002-02-22 14:11     ` Marin David Condic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-02-21  0:16 Unversed Angel
2002-02-21  0:37 ` tmoran
2002-02-21  1:13   ` Unversed Angel
2002-02-21  2:53     ` tmoran
2002-02-21  8:25       ` Unversed Angel
2002-02-21 13:47         ` Marin David Condic
2002-02-22  0:22         ` tmoran
replies disabled

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