comp.lang.ada
 help / color / mirror / Atom feed
* Wrong program structure
@ 2010-10-23 21:08 George
  2010-10-23 21:16 ` Vinzent Hoefler
  0 siblings, 1 reply; 3+ messages in thread
From: George @ 2010-10-23 21:08 UTC (permalink / raw)


Hi All,

GNAT is complaining about "begin" being used as identifier and a missing 
"begin" for procedure "keywords4". The progam structure is like this:

with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Characters.Handling;

procedure keywords4 is

procedure Ada83 is
begin
-- some string output
end Ada83;

procedure Ada95 is
begin
-- some string output
end Ada95;

procedure Ada2005 is
begin
-- some string output
end Ada2005;

procedure Attributes is
begin
-- some string output
end Attributes;

procedure Sources is
begin
-- some string output
end Sources;

procedure Author is
begin
-- some string output
end Author;

begin
-- Ada.Command_Line.Argument_Count is "0" if
-- a) Command_Line.Argument_Count is not implemented (Compiler, OS)
-- b) no arguments given
if Ada.Command_Line.Argument_Count > 0 then
   for counter in 1..Ada.Command_Line.Argument_Count loop
      declare
      Arg : constant String := Ada.Characters.Handling.To_Upper
(Ada.Command_Line.Argument(counter));
     -- some commands
   end loop;
else -- if Argument_Count = 0 print help
   -- some commands
end if;
end keywords4;

I nested the procedures Ada83, Ada95, etc. into keywords4 because I can 
not have multiple compilation units. I tried defining a package but when 
executing the program the runtime library came back with the message that 
the code could not be executed.

Maybe I am asking simple questions. Its because I am new to Ada and try 
get used to the language.

What is the problem with the above code?

Regards

George



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Wrong program structure
  2010-10-23 21:08 Wrong program structure George
@ 2010-10-23 21:16 ` Vinzent Hoefler
  2010-10-23 21:24   ` George
  0 siblings, 1 reply; 3+ messages in thread
From: Vinzent Hoefler @ 2010-10-23 21:16 UTC (permalink / raw)


On Sat, 23 Oct 2010 23:08:32 +0200, George <mail2george@gmx-topmail.de> wrote:

> GNAT is complaining about "begin" being used as identifier and a missing
> "begin" for procedure "keywords4". The progam structure is like this:
>
[...]
> begin
> -- Ada.Command_Line.Argument_Count is "0" if
> -- a) Command_Line.Argument_Count is not implemented (Compiler, OS)
> -- b) no arguments given
> if Ada.Command_Line.Argument_Count > 0 then
>    for counter in 1..Ada.Command_Line.Argument_Count loop
>       declare
>       Arg : constant String := Ada.Characters.Handling.To_Upper
> (Ada.Command_Line.Argument(counter));

begin

>      -- some commands

end;

>    end loop;
> else -- if Argument_Count = 0 print help
>    -- some commands
> end if;
> end keywords4;

You are declaring a block, but its "end" is missing.


Vinzent.

-- 
There is no signature.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Wrong program structure
  2010-10-23 21:16 ` Vinzent Hoefler
@ 2010-10-23 21:24   ` George
  0 siblings, 0 replies; 3+ messages in thread
From: George @ 2010-10-23 21:24 UTC (permalink / raw)


Am Sat, 23 Oct 2010 23:16:20 +0200 schrieb Vinzent Hoefler:

> 
> You are declaring a block, but its "end" is missing.
> 
> 
> Vinzent.

That's it. Many thanks Vinzent.

Regards

George





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-23 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-23 21:08 Wrong program structure George
2010-10-23 21:16 ` Vinzent Hoefler
2010-10-23 21:24   ` George

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