comp.lang.ada
 help / color / mirror / Atom feed
* is this a mistake in the book or ...
@ 2014-09-10  8:26 gdotone
  2014-09-10  8:36 ` anon
  2014-09-10 15:02 ` Adam Beneschan
  0 siblings, 2 replies; 6+ messages in thread
From: gdotone @ 2014-09-10  8:26 UTC (permalink / raw)


The following coming from Ada 95 Problem Solving and Program
Design p.121

Program 3.8 Specification for Screen Package
----------------------------------------------------------------------

Package Screen is
----------------------------------------------------------------------
-- | Procedure for drawing pictures on ANSI Terminal Screen
-- | Author: Michael B. Feldman, The George Washington University
-- | Last Modified: July 1995
----------------------------------------------------------------------

   -- constants: the number of rows and columns on the terminal

   Screen_Depth : constant Integer := 24;
   Screen_Width : constant Integer := 80;

   -- subtypes giving the ranges of acceptable inputs
   -- to the cursor-positioning operation

   subtype Depth is Integer range 1..Screen_Depth;
   subtype Width is Integer range 1..Screen_Width;

   procedure Beep;
   -- Pre:  None;
   -- Post: Terminal makes its beep sound once

   procedure ClearScreen;
   -- Pre:  None
   -- Post: Terminal Screen is cleared

   procedure MoveCursor (Column : Width; Row : Depth);
   -- Pre:  Column and Row have been assigned in-range value
   -- Post: Cursor is moved to the given spot on the screen

End Screen;

when i compile this using gnatmake -gnatl Screen.adb

i get an error message: >>> keyword "Body" expected here [see file name]
and a pointer to the location right after Package and before Screen

are package specification able to be compiled without the body?
and or how do i compile this?

in program 3.9 p 122 Body of Screen Package
i do see

PACKAGE BODY Screen is ...

so do they need to be compiled together?
if so, how do i do that?


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

* Re: is this a mistake in the book or ...
  2014-09-10  8:26 is this a mistake in the book or gdotone
@ 2014-09-10  8:36 ` anon
  2014-09-10  8:53   ` gdotone
  2014-09-10 15:02 ` Adam Beneschan
  1 sibling, 1 reply; 6+ messages in thread
From: anon @ 2014-09-10  8:36 UTC (permalink / raw)


Since your using GNAT compiler 

  Specification files must have extension ".ads"
  while the body is extension ".adb"

  
In <f169bcf2-5558-4e2e-acf5-7bf887a1032c@googlegroups.com>, gdotone@gmail.com writes:
>The following coming from Ada 95 Problem Solving and Program
>Design p.121
>
>Program 3.8 Specification for Screen Package
>----------------------------------------------------------------------
>
>Package Screen is
>----------------------------------------------------------------------
>-- | Procedure for drawing pictures on ANSI Terminal Screen
>-- | Author: Michael B. Feldman, The George Washington University
>-- | Last Modified: July 1995
>----------------------------------------------------------------------
>
>   -- constants: the number of rows and columns on the terminal
>
>   Screen_Depth : constant Integer := 24;
>   Screen_Width : constant Integer := 80;
>
>   -- subtypes giving the ranges of acceptable inputs
>   -- to the cursor-positioning operation
>
>   subtype Depth is Integer range 1..Screen_Depth;
>   subtype Width is Integer range 1..Screen_Width;
>
>   procedure Beep;
>   -- Pre:  None;
>   -- Post: Terminal makes its beep sound once
>
>   procedure ClearScreen;
>   -- Pre:  None
>   -- Post: Terminal Screen is cleared
>
>   procedure MoveCursor (Column : Width; Row : Depth);
>   -- Pre:  Column and Row have been assigned in-range value
>   -- Post: Cursor is moved to the given spot on the screen
>
>End Screen;
>
>when i compile this using gnatmake -gnatl Screen.adb
>
>i get an error message: >>> keyword "Body" expected here [see file name]
>and a pointer to the location right after Package and before Screen
>
>are package specification able to be compiled without the body?
>and or how do i compile this?
>
>in program 3.9 p 122 Body of Screen Package
>i do see
>
>PACKAGE BODY Screen is ...
>
>so do they need to be compiled together?
>if so, how do i do that?



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

* Re: is this a mistake in the book or ...
  2014-09-10  8:36 ` anon
@ 2014-09-10  8:53   ` gdotone
  0 siblings, 0 replies; 6+ messages in thread
From: gdotone @ 2014-09-10  8:53 UTC (permalink / raw)


On Wednesday, September 10, 2014 4:36:06 AM UTC-4, an...@att.net wrote:
> Since your using GNAT compiler 
> 
>   Specification files must have extension ".ads"
>   while the body is extension ".adb"

thanks, 

g.


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

* Re: is this a mistake in the book or ...
  2014-09-10  8:26 is this a mistake in the book or gdotone
  2014-09-10  8:36 ` anon
@ 2014-09-10 15:02 ` Adam Beneschan
  2014-09-10 15:49   ` Pascal Obry
  2014-09-11  1:03   ` gdotone
  1 sibling, 2 replies; 6+ messages in thread
From: Adam Beneschan @ 2014-09-10 15:02 UTC (permalink / raw)


On Wednesday, September 10, 2014 1:26:11 AM UTC-7, gdo...@gmail.com wrote:

> so do they need to be compiled together?
> if so, how do i do that?

"anon" gave you the answer you need, it appears.  I just wanted to emphasize that that's a GNAT-specific answer.  GNAT requires specifications to be in files with .ads extensions and bodies to be in files with .adb extensions, but other Ada compilers do things differently.  

                            -- Adam



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

* Re: is this a mistake in the book or ...
  2014-09-10 15:02 ` Adam Beneschan
@ 2014-09-10 15:49   ` Pascal Obry
  2014-09-11  1:03   ` gdotone
  1 sibling, 0 replies; 6+ messages in thread
From: Pascal Obry @ 2014-09-10 15:49 UTC (permalink / raw)


Le mercredi 10 septembre 2014 à 08:02 -0700, Adam Beneschan a écrit : 
> On Wednesday, September 10, 2014 1:26:11 AM UTC-7, gdo...@gmail.com wrote:
> 
> > so do they need to be compiled together?
> > if so, how do i do that?
> 
> "anon" gave you the answer you need, it appears.  I just wanted to
> emphasize that that's a GNAT-specific answer.  GNAT requires
> specifications to be in files with .ads extensions and bodies to be in
> files with .adb extensions

Just to precise that GNAT does not *requires* but it is the default. Any
naming convention can be used by using proper definitions via pragmas or
in the Naming package of project files.

-- 
  Pascal Obry /  Magny Les Hameaux (78)

  The best way to travel is by means of imagination

  http://v2p.fr.eu.org
  http://www.obry.net

  gpg --keyserver keys.gnupg.net --recv-key F949BD3B




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

* Re: is this a mistake in the book or ...
  2014-09-10 15:02 ` Adam Beneschan
  2014-09-10 15:49   ` Pascal Obry
@ 2014-09-11  1:03   ` gdotone
  1 sibling, 0 replies; 6+ messages in thread
From: gdotone @ 2014-09-11  1:03 UTC (permalink / raw)


On Wednesday, September 10, 2014 11:02:41 AM UTC-4, Adam Beneschan wrote:
> On Wednesday, September 10, 2014 1:26:11 AM UTC-7, gdo...@gmail.com wrote:

> "anon" gave you the answer you need, it appears.  I just wanted to emphasize that that's a GNAT-specific answer.  GNAT requires specifications to be in files with .ads extensions and bodies to be in files with .adb extensions, but other Ada compilers do things differently.  

Thanks, Adam and Pascal, i was actually head back to "the well of knowledge",  comp.lang.ada, to pose just those questions and i saw you guys' reply. i'm glad to see the posts.

Thanks again,

g.


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

end of thread, other threads:[~2014-09-11  1:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-10  8:26 is this a mistake in the book or gdotone
2014-09-10  8:36 ` anon
2014-09-10  8:53   ` gdotone
2014-09-10 15:02 ` Adam Beneschan
2014-09-10 15:49   ` Pascal Obry
2014-09-11  1:03   ` gdotone

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