comp.lang.ada
 help / color / mirror / Atom feed
* ada and gnat (mingw)
@ 2012-12-04 14:06 Hans Vlems
  2012-12-04 14:21 ` Simon Clubley
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Hans Vlems @ 2012-12-04 14:06 UTC (permalink / raw)


This is not a real ADA language question and thus possibly off topic
but don't be too hard on a newbie :)
I want to use my own packages. Example:

package my_constants is

 cc_hyphen : constant character := '-';
 cc_comma : constant character := ',';
 cc_digit9   : constant character := '9';

end my_constants;

This file is stored as my_constants.adb (on a WIndows platform).
gnatmake my_constants.adb results in:
gnatmake: my_constants.adb:1:08: keyword "body" expected here [see
file name]

Inserting the reserverd word body after package on line 1 doesn't
help...
What am I doing wrong and where can I find information on how to drive
this compiler?
Hans

PS
Apologies for the OT post



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

* Re: ada and gnat (mingw)
  2012-12-04 14:06 ada and gnat (mingw) Hans Vlems
@ 2012-12-04 14:21 ` Simon Clubley
  2012-12-04 15:17   ` Hans Vlems
  2012-12-04 14:21 ` Dmitry A. Kazakov
  2012-12-04 14:26 ` Vinzent Höfler
  2 siblings, 1 reply; 8+ messages in thread
From: Simon Clubley @ 2012-12-04 14:21 UTC (permalink / raw)


On 2012-12-04, Hans Vlems <hvlems@freenet.de> wrote:
> This is not a real ADA language question and thus possibly off topic
> but don't be too hard on a newbie :)
> I want to use my own packages. Example:
>
> package my_constants is
>
>  cc_hyphen : constant character := '-';
>  cc_comma : constant character := ',';
>  cc_digit9   : constant character := '9';
>
> end my_constants;
>
> This file is stored as my_constants.adb (on a WIndows platform).
> gnatmake my_constants.adb results in:
> gnatmake: my_constants.adb:1:08: keyword "body" expected here [see
> file name]
>
> Inserting the reserverd word body after package on line 1 doesn't
> help...
> What am I doing wrong and where can I find information on how to drive
> this compiler?
> Hans
>
> PS
> Apologies for the OT post

Not OT, IMHO.

With GNAT, the package specification goes into a .ads file; the package
body goes into a .adb file.

(This assumes you really are defining a specification above. :-))

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world



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

* Re: ada and gnat (mingw)
  2012-12-04 14:06 ada and gnat (mingw) Hans Vlems
  2012-12-04 14:21 ` Simon Clubley
@ 2012-12-04 14:21 ` Dmitry A. Kazakov
  2012-12-04 14:26 ` Vinzent Höfler
  2 siblings, 0 replies; 8+ messages in thread
From: Dmitry A. Kazakov @ 2012-12-04 14:21 UTC (permalink / raw)


On Tue, 4 Dec 2012 06:06:35 -0800 (PST), Hans Vlems wrote:

> This is not a real ADA language question and thus possibly off topic
> but don't be too hard on a newbie :)
> I want to use my own packages. Example:
> 
> package my_constants is
> 
>  cc_hyphen : constant character := '-';
>  cc_comma : constant character := ',';
>  cc_digit9   : constant character := '9';
> 
> end my_constants;
> 
> This file is stored as my_constants.adb (on a WIndows platform).

Should be my_constants.ads. *.adb is for bodies, *.ads for specifications.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: ada and gnat (mingw)
  2012-12-04 14:06 ada and gnat (mingw) Hans Vlems
  2012-12-04 14:21 ` Simon Clubley
  2012-12-04 14:21 ` Dmitry A. Kazakov
@ 2012-12-04 14:26 ` Vinzent Höfler
  2 siblings, 0 replies; 8+ messages in thread
From: Vinzent Höfler @ 2012-12-04 14:26 UTC (permalink / raw)


Hans Vlems wrote:

> package my_constants is
[...]

> This file is stored as my_constants.adb

This is a spec, so the extension expected is ".ads", not ".adb".

Even if those constants are to be declared privately within a body, 
there should still be a corresponding spec file for it.


Vinzent.



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

* Re: ada and gnat (mingw)
  2012-12-04 14:21 ` Simon Clubley
@ 2012-12-04 15:17   ` Hans Vlems
  2012-12-04 16:49     ` Georg Bauhaus
  2012-12-04 20:29     ` Anh Vo
  0 siblings, 2 replies; 8+ messages in thread
From: Hans Vlems @ 2012-12-04 15:17 UTC (permalink / raw)


On 4 dec, 15:21, Simon Clubley <clubley@remove_me.eisner.decus.org-
Earth.UFP> wrote:
> On 2012-12-04, Hans Vlems <hvl...@freenet.de> wrote:
>
>
>
>
>
> > This is not a real ADA language question and thus possibly off topic
> > but don't be too hard on a newbie :)
> > I want to use my own packages. Example:
>
> > package my_constants is
>
> >  cc_hyphen : constant character := '-';
> >  cc_comma : constant character := ',';
> >  cc_digit9   : constant character := '9';
>
> > end my_constants;
>
> > This file is stored as my_constants.adb (on a WIndows platform).
> > gnatmake my_constants.adb results in:
> > gnatmake: my_constants.adb:1:08: keyword "body" expected here [see
> > file name]
>
> > Inserting the reserverd word body after package on line 1 doesn't
> > help...
> > What am I doing wrong and where can I find information on how to drive
> > this compiler?
> > Hans
>
> > PS
> > Apologies for the OT post
>
> Not OT, IMHO.
>
> With GNAT, the package specification goes into a .ads file; the package
> body goes into a .adb file.
>
> (This assumes you really are defining a specification above. :-))
>
> Simon.
>
> --
> Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
> Microsoft: Bringing you 1980s technology to a 21st century world- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Thanks, that problem is now solved.
Where sould I have found that information? The mingw site is mainly
oriented towards installation issues.
ADA specific information is hard to find.
Hans



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

* Re: ada and gnat (mingw)
  2012-12-04 15:17   ` Hans Vlems
@ 2012-12-04 16:49     ` Georg Bauhaus
  2012-12-04 17:37       ` Simon Clubley
  2012-12-04 20:29     ` Anh Vo
  1 sibling, 1 reply; 8+ messages in thread
From: Georg Bauhaus @ 2012-12-04 16:49 UTC (permalink / raw)


On 04.12.12 16:17, Hans Vlems wrote:

> Thanks, that problem is now solved.
> Where sould I have found that information? The mingw site is mainly
> oriented towards installation issues.
> ADA specific information is hard to find.

Usually, distributions of GNAT or GCC include its documentation,
which has introductory material (User's Guide)
and reference material (Reference Manual) (as required
by the LRM). The relevant files' names may be gnat_ugnw.* and
gnat_rm.*, respectively. They cover these aspects. From the
section 1.2 Running a Simple Ada Program:

"This compiler is capable
of compiling programs in several languages, including Ada and C. It
assumes that you have given it an Ada program if the file extension is
either `.ads' or `.adb', and it will then call the GNAT compiler to
compile the specified file."

GNAT's gnatchop program, amongst other possibilities,
lets GNAT process Ada source text that does not follow
the .ads/.adb convention.

"1 Getting Started with GNAT" is recommended reading.




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

* Re: ada and gnat (mingw)
  2012-12-04 16:49     ` Georg Bauhaus
@ 2012-12-04 17:37       ` Simon Clubley
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Clubley @ 2012-12-04 17:37 UTC (permalink / raw)


On 2012-12-04, Georg Bauhaus <rm.dash-bauhaus@futureapps.de> wrote:
> On 04.12.12 16:17, Hans Vlems wrote:
>
>> Thanks, that problem is now solved.
>> Where sould I have found that information? The mingw site is mainly
>> oriented towards installation issues.
>> ADA specific information is hard to find.
>
> Usually, distributions of GNAT or GCC include its documentation,
> which has introductory material (User's Guide)
> and reference material (Reference Manual) (as required
> by the LRM). The relevant files' names may be gnat_ugnw.* and
> gnat_rm.*, respectively.
>

And if the mingw packager has failed to include the documentation for
a specific open source project, you can always get it from the project's
website. In the case of gcc, you want:

http://gcc.gnu.org/onlinedocs/

There are multiple versions of the documentation there so you can choose
the version which most closely matches the version of your compiler.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world



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

* Re: ada and gnat (mingw)
  2012-12-04 15:17   ` Hans Vlems
  2012-12-04 16:49     ` Georg Bauhaus
@ 2012-12-04 20:29     ` Anh Vo
  1 sibling, 0 replies; 8+ messages in thread
From: Anh Vo @ 2012-12-04 20:29 UTC (permalink / raw)


<Thanks, that problem is now solved. Where sould I have found that information? The mingw site is mainly oriented towards installation issues. ADA specific information is hard to find.>>

To save your future time and may be some headache, I strongly suggest that you use gnat-gpl-2012 (current version) instead. It can be dowloaded at  http://libre.adacore.com after a painless registration. It comes with complete documentation, examples, advanced IDE called Gnat Programming System (GPS), AUnit, GNATColl and more. With this I believe you will be no longer a newbie after a short while :-)

A. Vo




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

end of thread, other threads:[~2012-12-04 20:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-04 14:06 ada and gnat (mingw) Hans Vlems
2012-12-04 14:21 ` Simon Clubley
2012-12-04 15:17   ` Hans Vlems
2012-12-04 16:49     ` Georg Bauhaus
2012-12-04 17:37       ` Simon Clubley
2012-12-04 20:29     ` Anh Vo
2012-12-04 14:21 ` Dmitry A. Kazakov
2012-12-04 14:26 ` Vinzent Höfler

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