comp.lang.ada
 help / color / mirror / Atom feed
* Re: building a package -- newbie
       [not found] <3143fb37.0411110817.6e5200da@posting.google.com>
@ 2004-11-11 16:25 ` Jacob Sparre Andersen
  2004-11-11 18:27 ` Martin Krischik
  2004-11-12  2:17 ` Steve
  2 siblings, 0 replies; 6+ messages in thread
From: Jacob Sparre Andersen @ 2004-11-11 16:25 UTC (permalink / raw)


backdoctor@gmail.com wrote:

> My first real question is, "what extension should I use to name my
> package?"  statistal_functions.ads?  statistal_functions.adb?  Do I
> need to compile it before it can be WITH'd into my main program?  I
> compile my main procedures with "gnatgcc -c file".  Is that the same
> for the package?

The Ada standard does not say anything about file names for the source
code, so you can in principle name it completely as you like, but
among GNAT users the convention is to put the:

 * Specification in a file named as the package name (in lower case,
   and with "." substituted with "-"), with ".ads" appended.

 * Body in a file named as the package name (in lower case, and with
   "." substituted with "-"), with ".adb" appended.

Jacob
-- 
�By becoming continuous, war has fundamentally changed its character.
 In past ages, a war, almost by definition, was something that sooner
 or later came to an end, usually in unmistakable victory or defeat.�
                               -- Nineteen Eighty-Four, George Orwell
�I don't think you can win [the war on terror].�    -- George W. Bush



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

* Re: building a package -- newbie
       [not found] <3143fb37.0411110817.6e5200da@posting.google.com>
  2004-11-11 16:25 ` building a package -- newbie Jacob Sparre Andersen
@ 2004-11-11 18:27 ` Martin Krischik
  2004-11-12  9:15   ` Martin Dowie
  2004-11-12  2:17 ` Steve
  2 siblings, 1 reply; 6+ messages in thread
From: Martin Krischik @ 2004-11-11 18:27 UTC (permalink / raw)


backdoc wrote:

> I am working on an assignment for my Software Engineering class.  We
> must write a package and put statistical functions in it.  I am using
> Gnat and Linux.  I've written a half dozen little applications using
> Ada.  But, this is my first experience with building my own package.
> 
> So far, I've gotten the basic main procedure written.  As long as I
> don't try to WITH my package in, it will compile, read a binary file
> and print the file contents.  It's actually the float data I will have
> to write statistical functions for.
> 
> My instructor gave us the specifications.  So, I just copied those
> into a separate file.  I plan to put the body of the package in the
> same file as the specifications.

No good. There is a special limitation in GNAT that allows only one package
per file. So you need a seperate statistal_functions.adb file.

> But, I wanted to get the main 
> procedure working with only the specifications first.
> 
> My first real question is, "what extension should I use to name my
> package?"  statistal_functions.ads?  statistal_functions.adb?

In theory you can use any name you like. But GNAT is a lot more happy if you
just use the lowercase packagename and replace '.' with '-'.

> Do I 
> need to compile it before it can be WITH'd into my main program?

No. "gnat make" will take care of everthing. Just "gnat make pkg" will do.

> I 
> compile my main procedures with "gnatgcc -c file".  Is that the same
> for the package?

"gnatgcc"? - the command for compiling ada is "gnat compile". But you are
better of using "gnat make" then "gnat compile" since "gnat make" will
compile all packages in one go. 

> Any suggestions?

Yes: Read the GNAT Documentation!

With Regards

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



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

* Re: building a package -- newbie
       [not found] <3143fb37.0411110817.6e5200da@posting.google.com>
  2004-11-11 16:25 ` building a package -- newbie Jacob Sparre Andersen
  2004-11-11 18:27 ` Martin Krischik
@ 2004-11-12  2:17 ` Steve
  2 siblings, 0 replies; 6+ messages in thread
From: Steve @ 2004-11-12  2:17 UTC (permalink / raw)


There is probably a GNAT users guide on your system.  If you can't find it,
there is one here: http://lml.ls.fi.upm.es/manuales/gnat_ug.html, it is not
the latest version but should answer your question.

Look in the section: "File Naming Rules".

Steve
(The Duck)

"backdoc" <backdoctor@gmail.com> wrote in message
news:3143fb37.0411110817.6e5200da@posting.google.com...
> I am working on an assignment for my Software Engineering class.  We
> must write a package and put statistical functions in it.  I am using
> Gnat and Linux.  I've written a half dozen little applications using
> Ada.  But, this is my first experience with building my own package.
>
> So far, I've gotten the basic main procedure written.  As long as I
> don't try to WITH my package in, it will compile, read a binary file
> and print the file contents.  It's actually the float data I will have
> to write statistical functions for.
>
> My instructor gave us the specifications.  So, I just copied those
> into a separate file.  I plan to put the body of the package in the
> same file as the specifications.  But, I wanted to get the main
> procedure working with only the specifications first.
>
> My first real question is, "what extension should I use to name my
> package?"  statistal_functions.ads?  statistal_functions.adb?  Do I
> need to compile it before it can be WITH'd into my main program?  I
> compile my main procedures with "gnatgcc -c file".  Is that the same
> for the package?
>
> Here's links to the code:
>      specs:
>      http://www.usmstudent.com/tmp/STATISTICAL_FUNCTIONS.ads
>
>      main:
>      http://www.usmstudent.com/tmp/pkg.adb
>
> Any suggestions?
>
> TIA,
> backdoc





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

* Re: building a package -- newbie
  2004-11-11 18:27 ` Martin Krischik
@ 2004-11-12  9:15   ` Martin Dowie
  2004-11-12  9:54     ` Martin Krischik
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Dowie @ 2004-11-12  9:15 UTC (permalink / raw)


Martin Krischik wrote:
> No. "gnat make" will take care of everthing. Just "gnat make pkg"
> will do.

Isn't "gnatmake" all one word?..





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

* Re: building a package -- newbie
  2004-11-12  9:15   ` Martin Dowie
@ 2004-11-12  9:54     ` Martin Krischik
  2004-11-12 10:51       ` Sascha Wilde
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Krischik @ 2004-11-12  9:54 UTC (permalink / raw)


Martin Dowie wrote:

> Martin Krischik wrote:
>> No. "gnat make" will take care of everthing. Just "gnat make pkg"
>> will do.
> 
> Isn't "gnatmake" all one word?..

Thats your choice, you can write it either way. Here is the complete list of
one and two word commands (on Unix all commands are lowercase).

-----
gnat
GNAT 3.4.3 20040926 (prerelease) Copyright 1996-2004 Free Software
Foundation, Inc.

List of available commands

GNAT BIND               gnatbind
GNAT CHOP               gnatchop
GNAT CLEAN              gnatclean
GNAT COMPILE            gnatmake -f -u -c
GNAT ELIM               gnatelim
GNAT FIND               gnatfind
GNAT KRUNCH             gnatkr
GNAT LINK               gnatlink
GNAT LIST               gnatls
GNAT MAKE               gnatmake
GNAT NAME               gnatname
GNAT PREPROCESS         gnatprep
GNAT PRETTY             gnatpp
GNAT STUB               gnatstub
GNAT XREF               gnatxref

Commands FIND, LIST, PRETTY, STUB and XREF accept project file switches
-vPx, -Pprj and -Xnam=val
-----

Interesting to the OP might be that "GNAT COMPILE" is not "gnatgcc" but
"gnatmake -f -u -c". In fact I don't even have a "gnatgcc":

-----
locate gnatgcc
-----

Nothing found on the hole computer.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



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

* Re: building a package -- newbie
  2004-11-12  9:54     ` Martin Krischik
@ 2004-11-12 10:51       ` Sascha Wilde
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Wilde @ 2004-11-12 10:51 UTC (permalink / raw)


Martin Krischik <martin@krischik.com> wrote:

> Interesting to the OP might be that "GNAT COMPILE" is not "gnatgcc" but
> "gnatmake -f -u -c". In fact I don't even have a "gnatgcc":

The gnat package of the Debian Linux Distribution is patched, so that
the gcc from the gnat package is renamed to gnatgcc (to maintain two
gcc versions, one "normal" and the gnatgcc which is based on an older
gcc version).

I guess thats what th OP uses...

cheers
sascha
-- 
Sascha Wilde
"Gimme about 10 seconds to think for a minute..."



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

end of thread, other threads:[~2004-11-12 10:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3143fb37.0411110817.6e5200da@posting.google.com>
2004-11-11 16:25 ` building a package -- newbie Jacob Sparre Andersen
2004-11-11 18:27 ` Martin Krischik
2004-11-12  9:15   ` Martin Dowie
2004-11-12  9:54     ` Martin Krischik
2004-11-12 10:51       ` Sascha Wilde
2004-11-12  2:17 ` Steve

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