comp.lang.ada
 help / color / mirror / Atom feed
* DEC Ada and packages
@ 2002-02-07  4:44 Zane H. Healy
  2002-02-07 13:44 ` Charlie McCutcheon
  0 siblings, 1 reply; 12+ messages in thread
From: Zane H. Healy @ 2002-02-07  4:44 UTC (permalink / raw)


I'm trying to teach myself Ada using DEC Ada on OpenVMS.  I've currently run
into a bit of a problem.  How on earth do you deal with Packages?  I've been
reading through the DEC Ada manuals and can't find anything.

As I understand it I should be able to put have a file 'powers.ada' have
something like the following in it (taken from an excellent tutorial I found
online):

package body Powers is
        function Square (Arg: Integer) return Integer is
        begin
                return Arg * Arg;
        end Square;

        function Cube (Arg: Integer) return Integer is
        begin
                return Arg * Square(Arg);
        end Cube;
end Powers;

Then call it from another file with a Proceedure.

However, I end up with the following results:

$ acs
ACS> load powers
%ACS-I-CL_COMPILING, Invoking the Compaq Ada compiler
ACS> compile powers
1 obsolete unit

%ACS-I-CL_COMPILING, Invoking the Compaq Ada compiler

    4   package body Powers is
........1
%ADAC-E-CL_SPENOTFOU, (1) Specification for Powers not found in library
at line number 4 in file MONK$DKB500:[HEALYZH.WORK]POWERS.ADA;4
%ADAC-E-ERRRECOMPILE, Errors recompiling package body Powers in file 
        MONK$DKB500:[HEALYZH.WORK]POWERS.ADA;4
%ADAC-E-ENDDIAGS, Ada compilation completed with 1 diagnostic

1 unit compiled in 00:00:00.14

%ACS-E-CL_ERRDURCOM, Errors during compilations
ACS> load play
%ACS-I-CL_COMPILING, Invoking the Compaq Ada compiler
ACS> compile play
%ACS-E-CL_UNKREFUNI, PLAY depends on unit POWERS, which is not in the
library
ACS> 

So how on earth do I get POWERS into the Library?  I'm sure I'm missing
something obvious, but what?

			Zane



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

* Re: DEC Ada and packages
@ 2002-02-07  5:59 Gautier Write-only-address
  2002-02-07 18:19 ` Zane H. Healy
  0 siblings, 1 reply; 12+ messages in thread
From: Gautier Write-only-address @ 2002-02-07  5:59 UTC (permalink / raw)


Hello!

In your powers.ada you have the "code" (the body), but
the "interface" (the specification) for using Powers
is missing.

Before "package body...", you may want to add:

---
package Powers is
        function Square (Arg: Integer) return Integer;
        function Cube (Arg: Integer) return Integer;
end Powers;
---

Then it should compile fine.

HTH
_________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, address on the Web site!

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx




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

* Re: DEC Ada and packages
  2002-02-07  4:44 DEC Ada and packages Zane H. Healy
@ 2002-02-07 13:44 ` Charlie McCutcheon
  2002-02-07 18:34   ` Zane H. Healy
  2002-02-07 21:29   ` Jeffrey Carter
  0 siblings, 2 replies; 12+ messages in thread
From: Charlie McCutcheon @ 2002-02-07 13:44 UTC (permalink / raw)


> reading through the DEC Ada manuals and can't find anything.

The DEC Ada Language Reference Manaual (LRM) is based on the Ada 83
language standard.  The original standard's text was taken, and words were
added for Digital specific information (in blue/grey print, depending on
your copy of the manual).

You'd probably prefer a tutorial - this is instead a reference manual.
Note if you look for a better tutorial manual that DEC/Compaq Ada
is Ada 83, not Ada 95 (95 is the latest Ada language standard - you'd see
many new featues which aren't in Compaq Ada).

> %ADAC-E-CL_SPENOTFOU, (1) Specification for Powers not found in library

As pointed out in another reply, you're missing a package specification.  This
is
an Ada requirement, and is not specific to Compaq Ada.  The Ada language
standard requires that packages have specifications, and optionally package
bodies. The package specification is the global declaration which tells other
programers how to interface to your objects in the package which can be
hidden away from view in the package body.

> Then call it from another file with a Proceedure.

Note that Compaq Ada compiles programs in files into compilaiton units in the
program library.  This is terminology, but the files where you write the code
aren't as significant as the compilation unit.  You can write code for
procedures
X, Y, Z and put them in file A.TXT and compile them.  We suggest putting them
in their own files, such as X.ADA, Y.ADA, Z.ADA, but you don't have to.

Other compilers, such as GNAT Pro require specific naming conventions
of files depending on the compilation units within (ie procedure X must be
in file X.ADB, ....).

Sorry for the lecture, but you appear to be new to Ada...  Been a long time
since I've explained any of this...  8-)

Charlie
Compaq Ada





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

* Re: DEC Ada and packages
  2002-02-07  5:59 Gautier Write-only-address
@ 2002-02-07 18:19 ` Zane H. Healy
  0 siblings, 0 replies; 12+ messages in thread
From: Zane H. Healy @ 2002-02-07 18:19 UTC (permalink / raw)


Gautier Write-only-address <gautier_niouzes@hotmail.com> wrote:
> Hello!

> In your powers.ada you have the "code" (the body), but
> the "interface" (the specification) for using Powers
> is missing.

> Before "package body...", you may want to add:

> ---
> package Powers is
>         function Square (Arg: Integer) return Integer;
>         function Cube (Arg: Integer) return Integer;
> end Powers;
> ---

> Then it should compile fine.

Thank You!!! That little bit of syntax has been driving me crazy for two
days.  The problem is the one tutorial I'd been looking at showed the two
seperatly, and by the time I thought to try putting it all in the same file
I forgot the 'package Powers is' and 'end Powers;' lines :^(

			Zane



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

* Re: DEC Ada and packages
  2002-02-07 13:44 ` Charlie McCutcheon
@ 2002-02-07 18:34   ` Zane H. Healy
  2002-02-07 20:52     ` Marin David Condic
  2002-02-07 21:29   ` Jeffrey Carter
  1 sibling, 1 reply; 12+ messages in thread
From: Zane H. Healy @ 2002-02-07 18:34 UTC (permalink / raw)


Charlie McCutcheon <charlie.mccutcheon@nospamcompaq.com> wrote:
> You'd probably prefer a tutorial - this is instead a reference manual.
> Note if you look for a better tutorial manual that DEC/Compaq Ada
> is Ada 83, not Ada 95 (95 is the latest Ada language standard - you'd see
> many new featues which aren't in Compaq Ada).

In spite of understanding the Ada 83/Ada 95 issue, I'm using a combination of 
an excellent web tutorial for Ada 95 that I found accidentally on the web
when looking for a simple example program to do a test compile.
http://www.cs.nyu.edu/courses/fall98/G22.2130-001/adaintro.html  The biggest
problem with it, is that it uses GNAT, not that it's for Ada 95.  It's
pretty basic and I double check against a Ada 83 book to make sure I'm not
trying to do something I can't.  So far it appears to work just fine with
either Ada 83 or Ada 95.

I'm also using "Software Engineering With Ada" by Grady Booch, and have
copies of "Understanding Ada A Software Engineering Approach", and
"Programming in Ada".

> Note that Compaq Ada compiles programs in files into compilaiton units in the
> program library.  This is terminology, but the files where you write the code
> aren't as significant as the compilation unit.  You can write code for
> procedures
> X, Y, Z and put them in file A.TXT and compile them.  We suggest putting them
> in their own files, such as X.ADA, Y.ADA, Z.ADA, but you don't have to.

> Other compilers, such as GNAT Pro require specific naming conventions
> of files depending on the compilation units within (ie procedure X must be
> in file X.ADB, ....).

Ah, OK!  I've been searching for some kind of meaning in the names used with
Compaq Ada.

> Sorry for the lecture, but you appear to be new to Ada...  Been a long time
> since I've explained any of this...  8-)

No problem, it's much appreciated, and you've included some very helpful
information that I didn't seem to find in the manuals I was looking at.

You guessed it, I'm new to Ada.  Just don't ask why I'm using Compaq Ada
instead of GNAT, I suspect there isn't a good reason. :^)  Especially as I've 
a copy of the public GNAT for OpenVMS that I've got but haven't installed, 
and as a Hobbyist I can use whatever I want, on whatever platform I want (I 
just happen to prefer OpenVMS).

			Zane



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

* Re: DEC Ada and packages
  2002-02-07 18:34   ` Zane H. Healy
@ 2002-02-07 20:52     ` Marin David Condic
  0 siblings, 0 replies; 12+ messages in thread
From: Marin David Condic @ 2002-02-07 20:52 UTC (permalink / raw)


Just be sure to try to get a grasp on the fact that file naming and
compilation unit organization is something that can vary some from one
compiler to another. The DEC Ada compiler will let you pile multiple
compilation units into the same file because its first step is to enter them
into the "Library" so it can sort out compilation units, dependencies and
what is out of date. Whereas the GNAT Ada compiler uses a native file system
directory to be its "Library" and utilizes the file names and timestamps to
locate compilation units, resolve recompilation issues, etc. (Maybe not 100%
accurate as I'll probably hear about later, but close enough for now.) Hence
GNAT tends to care about the names of files and requires 1 compilation unit
per file. Its not hard to live with once you get used to the tools, but its
a factor you want to understand as you build Ada software.

For more tools, books, tutorials, etc., be sure to look at:
http://www.adapower.com/

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/


"Zane H. Healy" <healyzh@shell1.aracnet.com> wrote in message
news:a3uhbn02832@enews3.newsguy.com...
>
> > Other compilers, such as GNAT Pro require specific naming conventions
> > of files depending on the compilation units within (ie procedure X must
be
> > in file X.ADB, ....).
>
> Ah, OK!  I've been searching for some kind of meaning in the names used
with
> Compaq Ada.
>






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

* Re: DEC Ada and packages
  2002-02-07 13:44 ` Charlie McCutcheon
  2002-02-07 18:34   ` Zane H. Healy
@ 2002-02-07 21:29   ` Jeffrey Carter
  2002-02-15 13:25     ` Charlie McCutcheon
  2002-02-16  1:45     ` Robert Dewar
  1 sibling, 2 replies; 12+ messages in thread
From: Jeffrey Carter @ 2002-02-07 21:29 UTC (permalink / raw)


Charlie McCutcheon wrote:
> 
> Other compilers, such as GNAT Pro require specific naming conventions
> of files depending on the compilation units within (ie procedure X must be
> in file X.ADB, ....).

Uh oh, you're likely to incur the wrath of Robert Dewar for this bit of
misinformation.

-- 
Jeff Carter
"Death awaits you all, with nasty, big, pointy teeth!"
Monty Python & the Holy Grail



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

* Re: DEC Ada and packages
  2002-02-07 21:29   ` Jeffrey Carter
@ 2002-02-15 13:25     ` Charlie McCutcheon
  2002-02-15 13:28       ` Ed Falis
  2002-02-15 17:33       ` Jeffrey Carter
  2002-02-16  1:45     ` Robert Dewar
  1 sibling, 2 replies; 12+ messages in thread
From: Charlie McCutcheon @ 2002-02-15 13:25 UTC (permalink / raw)


Jeffrey Carter wrote:

> Charlie McCutcheon wrote:
> >
> > Other compilers, such as GNAT Pro require specific naming conventions
> > of files depending on the compilation units within (ie procedure X must be
> > in file X.ADB, ....).
>
> Uh oh, you're likely to incur the wrath of Robert Dewar for this bit of
> misinformation.
>

It wouldn't be the first time.  We know each other.  8-)

I may not have used the preferred terms, but GNAT does require specific file
names, or you can't compile your program.  Otherwise GNAT doesn't find package
specifications, etc..

On VMS, GNAT CHOP will take my usual Ada source and create the filenames
required by GNAT.

Charlie





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

* Re: DEC Ada and packages
  2002-02-15 13:25     ` Charlie McCutcheon
@ 2002-02-15 13:28       ` Ed Falis
  2002-02-15 17:33       ` Jeffrey Carter
  1 sibling, 0 replies; 12+ messages in thread
From: Ed Falis @ 2002-02-15 13:28 UTC (permalink / raw)


Charlie McCutcheon wrote:
> I may not have used the preferred terms, but GNAT does require specific file
> names, or you can't compile your program.  Otherwise GNAT doesn't find package
> specifications, etc..
> 
> On VMS, GNAT CHOP will take my usual Ada source and create the filenames
> required by GNAT.
> 
> Charlie
> 
> 
> 

GNAT has a default file-naming scheme, which can be overridden by source 
name pragmas or (in the about-to-be-released version of GNATPRO) by the 
new project scheme.

- Ed

Ada Core







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

* Re: DEC Ada and packages
  2002-02-15 13:25     ` Charlie McCutcheon
  2002-02-15 13:28       ` Ed Falis
@ 2002-02-15 17:33       ` Jeffrey Carter
  1 sibling, 0 replies; 12+ messages in thread
From: Jeffrey Carter @ 2002-02-15 17:33 UTC (permalink / raw)


Charlie McCutcheon wrote:
> 
> I may not have used the preferred terms, but GNAT does require specific file
> names, or you can't compile your program.  Otherwise GNAT doesn't find package
> specifications, etc..

GNAT has a default file-name scheme, but it doesn't require that files
be named using that scheme. See the secret documentation for details.

What GNAT does require that other compilers may not require is that each
compilation unit be in a file by itself.

> 
> On VMS, GNAT CHOP will take my usual Ada source and create the filenames
> required by GNAT.

Gnatchop will create files with the default GNAT file names. You are not
obliged to use those names, though in many cases it's easiest to go with
the flow.

-- 
Jeffrey Carter



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

* Re: DEC Ada and packages
  2002-02-07 21:29   ` Jeffrey Carter
  2002-02-15 13:25     ` Charlie McCutcheon
@ 2002-02-16  1:45     ` Robert Dewar
  2002-02-16  2:08       ` Jeffrey Carter
  1 sibling, 1 reply; 12+ messages in thread
From: Robert Dewar @ 2002-02-16  1:45 UTC (permalink / raw)


Jeffrey Carter <jrcarter@acm.org> wrote in message news:<3C62F1B4.AABA9910@acm.org>...
> Charlie McCutcheon wrote:
> > 
> > Other compilers, such as GNAT Pro require specific naming conventions
> > of files depending on the compilation units within (ie procedure X must be
> > in file X.ADB, ....).
> 
> Uh oh, you're likely to incur the wrath of Robert Dewar 
> for this bit of misinformation.


Not really. There is so much misinformation on CLA these
days that I hesitate to correct anything, since it may
create the false impression that something I do not correct is OK :-)



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

* Re: DEC Ada and packages
  2002-02-16  1:45     ` Robert Dewar
@ 2002-02-16  2:08       ` Jeffrey Carter
  0 siblings, 0 replies; 12+ messages in thread
From: Jeffrey Carter @ 2002-02-16  2:08 UTC (permalink / raw)


Robert Dewar wrote:
> 
> Jeffrey Carter <jrcarter@acm.org> wrote in message news:<3C62F1B4.AABA9910@acm.org>...
> > Uh oh, you're likely to incur the wrath of Robert Dewar
> > for this bit of misinformation.
> 
> Not really. There is so much misinformation on CLA these
> days that I hesitate to correct anything, since it may
> create the false impression that something I do not correct is OK :-)

I see. The kinder, gentler Robert Dewar.

-- 
Jeff Carter
"Sons of a silly person."
Monty Python & the Holy Grail



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

end of thread, other threads:[~2002-02-16  2:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-07  4:44 DEC Ada and packages Zane H. Healy
2002-02-07 13:44 ` Charlie McCutcheon
2002-02-07 18:34   ` Zane H. Healy
2002-02-07 20:52     ` Marin David Condic
2002-02-07 21:29   ` Jeffrey Carter
2002-02-15 13:25     ` Charlie McCutcheon
2002-02-15 13:28       ` Ed Falis
2002-02-15 17:33       ` Jeffrey Carter
2002-02-16  1:45     ` Robert Dewar
2002-02-16  2:08       ` Jeffrey Carter
  -- strict thread matches above, loose matches on Subject: below --
2002-02-07  5:59 Gautier Write-only-address
2002-02-07 18:19 ` Zane H. Healy

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