comp.lang.ada
 help / color / mirror / Atom feed
* Re: help, i'm totally new but have to finsh project
  1999-11-26  0:00 help, i'm totally new but have to finsh project ibliss
@ 1999-11-25  0:00 ` kdjsd
  1999-11-26  0:00 ` David C. Hoos, Sr.
  1 sibling, 0 replies; 4+ messages in thread
From: kdjsd @ 1999-11-25  0:00 UTC (permalink / raw)


GNAT wants the interface and the body to be in separate files. Is this
what you have? put the interface in a file with .ads extenstion
and the body in a .adb file and try again.

(look also at gnatchop)


In article <383de8d1.14772213@news.kulnet.kuleuven.ac.be>, ibliss@kotnet.org
says...
>
>help
>
>i'm totally new to this, and we have to make a project in ADA. The
>problem is that i typed over something from the course material (i'll
>copy it here below) but when i try to compile it with the GNAT95
>compiler, it says that on the first line it expects the word 'body'
>
>Can someone tell me why this happens and what i can do about it? or
>how i should write it then?
>
>package rand_pak is  -- here it says 'keywoard body expected here [see
>		         -- filename]
>   protected beheer is
>      entry lock;
>      procedure unlock;
>   private
>      bezig: boolean:=false;
>   end beheer;
>   procedure instellen;
>   -- function random return float;
>   -- procedure afsluiten;
>end rand_pak;
>
>with Ada.Text_Io,Ada.Integer_Text_Io;
>--Use Ada.Text_Io,Ada.Integer_Text_Io;
>package body rand_pak is
>   S1,S2: integer;
>   FILE: file_type;
>   
>   protected body beheer is
>      entry lock when not bezig is
>      begin
>         bezig := true;
>      end lock;
>      procedure unlock is
>      begin
>         bezig := false;
>      end unlock;
>   end beheer;
>   
>   procedure instellen is
>   begin
>      open(FILE,in_file, "random.sed");
>      get(FILE,S1); get(FILE,S2);
>      delete(FILE);
>   exception
>      when NAME_ERROR =>
>         S1:=1234567;
>         S2:=87654321;
>   end instellen;
>end rand_pak;
>
>
>pleaz help me, it is really URGENT :((





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

* Re: help, i'm totally new but have to finsh project
  1999-11-26  0:00 help, i'm totally new but have to finsh project ibliss
  1999-11-25  0:00 ` kdjsd
@ 1999-11-26  0:00 ` David C. Hoos, Sr.
  1999-11-26  0:00   ` ibliss
  1 sibling, 1 reply; 4+ messages in thread
From: David C. Hoos, Sr. @ 1999-11-26  0:00 UTC (permalink / raw)



<ibliss@kotnet.org> wrote in message
news:383de8d1.14772213@news.kulnet.kuleuven.ac.be...
> help
>
> i'm totally new to this, and we have to make a project in ADA. The
> problem is that i typed over something from the course material (i'll
> copy it here below) but when i try to compile it with the GNAT95
> compiler, it says that on the first line it expects the word 'body'
>
> Can someone tell me why this happens and what i can do about it? or
> how i should write it then?

Did you read (and foillow) the GNAT rules for filenames given in the
Gnat User's Guide, viz.:

File Naming Rules
The default file name is determined by the name of the unit that the
file contains. The name is formed by taking the full expanded name of
the unit and replacing the separating dots with hyphens and using
lowercase for all letters.

An exception arises if the file name generated by the above rules
starts with one of the characters a,g,i, or s, and the second
character is a minus. In this case, the character tilde is used
in place of the minus. The reason for this special rule is to
avoid clashes with the standard names for child units of the
packages System, Ada, Interfaces, and GNAT, which use the prefixes
s- a- i- and g- respectively.

The file extension is `.ads' for a spec and `.adb' for a body. The
following list shows some examples of these rules.

`main.ads'
Main (spec)
`main.adb'
Main (body)
`arith_functions.ads'
Arith_Functions (package spec)
`arith_functions.adb'
Arith_Functions (package body)
`func-spec.ads'
Func.Spec (child package spec)
`func-spec.adb'
Func.Spec (child package body)
`main-sub.adb'
Sub (subunit of Main)
`a~bad.adb'
A.Bad (child package body)

-- end of GNAT User's Guide excerpt --

Also, you specified neither the compiler version nor the platform
on which you're working.

>
> package rand_pak is  -- here it says 'keywoard body expected here [see
>          -- filename]
>    protected beheer is
>       entry lock;
>       procedure unlock;
>    private
>       bezig: boolean:=false;
>    end beheer;
>    procedure instellen;
>    -- function random return float;
>    -- procedure afsluiten;
> end rand_pak;
>
> with Ada.Text_Io,Ada.Integer_Text_Io;
> --Use Ada.Text_Io,Ada.Integer_Text_Io;
> package body rand_pak is
>    S1,S2: integer;
>    FILE: file_type;
>
>    protected body beheer is
>       entry lock when not bezig is
>       begin
>          bezig := true;
>       end lock;
>       procedure unlock is
>       begin
>          bezig := false;
>       end unlock;
>    end beheer;
>
>    procedure instellen is
>    begin
>       open(FILE,in_file, "random.sed");
>       get(FILE,S1); get(FILE,S2);
>       delete(FILE);
>    exception
>       when NAME_ERROR =>
>          S1:=1234567;
>          S2:=87654321;
>    end instellen;
> end rand_pak;
>
>
> pleaz help me, it is really URGENT :((






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

* help, i'm totally new but have to finsh project
@ 1999-11-26  0:00 ibliss
  1999-11-25  0:00 ` kdjsd
  1999-11-26  0:00 ` David C. Hoos, Sr.
  0 siblings, 2 replies; 4+ messages in thread
From: ibliss @ 1999-11-26  0:00 UTC (permalink / raw)


help

i'm totally new to this, and we have to make a project in ADA. The
problem is that i typed over something from the course material (i'll
copy it here below) but when i try to compile it with the GNAT95
compiler, it says that on the first line it expects the word 'body'

Can someone tell me why this happens and what i can do about it? or
how i should write it then?

package rand_pak is  -- here it says 'keywoard body expected here [see
		         -- filename]
   protected beheer is
      entry lock;
      procedure unlock;
   private
      bezig: boolean:=false;
   end beheer;
   procedure instellen;
   -- function random return float;
   -- procedure afsluiten;
end rand_pak;

with Ada.Text_Io,Ada.Integer_Text_Io;
--Use Ada.Text_Io,Ada.Integer_Text_Io;
package body rand_pak is
   S1,S2: integer;
   FILE: file_type;
   
   protected body beheer is
      entry lock when not bezig is
      begin
         bezig := true;
      end lock;
      procedure unlock is
      begin
         bezig := false;
      end unlock;
   end beheer;
   
   procedure instellen is
   begin
      open(FILE,in_file, "random.sed");
      get(FILE,S1); get(FILE,S2);
      delete(FILE);
   exception
      when NAME_ERROR =>
         S1:=1234567;
         S2:=87654321;
   end instellen;
end rand_pak;


pleaz help me, it is really URGENT :((




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

* Re: help, i'm totally new but have to finsh project
  1999-11-26  0:00 ` David C. Hoos, Sr.
@ 1999-11-26  0:00   ` ibliss
  0 siblings, 0 replies; 4+ messages in thread
From: ibliss @ 1999-11-26  0:00 UTC (permalink / raw)


On Fri, 26 Nov 1999 04:02:07 -0600, "David C. Hoos, Sr."
<david.c.hoos.sr@ada95.com> wrote:


thanx to all u guys :)






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

end of thread, other threads:[~1999-11-26  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-26  0:00 help, i'm totally new but have to finsh project ibliss
1999-11-25  0:00 ` kdjsd
1999-11-26  0:00 ` David C. Hoos, Sr.
1999-11-26  0:00   ` ibliss

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