comp.lang.ada
 help / color / mirror / Atom feed
From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Newbie question on child packages
Date: Wed, 09 Oct 2002 16:18:15 GMT
Date: 2002-10-09T16:18:15+00:00	[thread overview]
Message-ID: <3DA45682.7050005@worldnet.att.net> (raw)
In-Reply-To: OgYo9.40823$Oa1.39958@nwrddc02.gnilink.net

Justin Birtwell wrote:

> Hello all,
> 
> I'm trying to figure out how to create and use child packages.  Here's what
> I've got so far.
> 
> Top level, empty parent package....JB.ads
> package JB is
>     --empty
> end JB;
> 
> A child package spec called A.ads
> package JB.A is
> .........
> end JB.A;
> 
> A child package body called A.adb
> package body JB.A is
>     <code>
> end JB.A;
> 
> Here's my problem.  When I go to compile and build A I get an error from
> A.adb "file jb-A.ads not found".  I made sure to compile A.ads but I'm still
> getting the same error.  All the files are in the same folder.  Do I have to
> change the name of A.ads to JB.A.ads?  or JB-A.ads?  This seems to defeat
> the whole point of modularity and independence?
> 
> Please help.  I've read the chapters on Packages and Child packages in
> Programming Ada 95 and the documentation at
> http://www.it.bton.ac.uk/staff/je/adacraft but alas no help here.


You are encountering a GNAT file naming convention. Read the GNAT
documentation for full details.

GNAT requires the file name for a package spec or body to be related to
the actual name of the spec or body. It has well defined default rules for
this naming.

Given your package hierarchy your file names should be:

JB.ads
JB-A.ads
JB-A.adb

This does not interfere with either modularity or independence. It does
help the compiler find the files it needs to build your program. Other
compilers use a file registration scheme instead of a specific naming
convention. In practice a team will always establish a file naming
convention. Failure to do so will result in massive configuration and
maintenance issues. Given this reality, the GNAT scheme is quite
reasonable.

Jim Rogers






  parent reply	other threads:[~2002-10-09 16:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-09 15:52 Newbie question on child packages Justin Birtwell
2002-10-09 16:12 ` Matthew Heaney
2002-10-09 16:20   ` Justin Birtwell
2002-10-09 16:54     ` Matthew Heaney
2002-10-09 18:45     ` Preben Randhol
2002-10-09 16:18 ` Jim Rogers [this message]
2002-10-09 19:16   ` Simon Wright
2002-10-09 21:06     ` Stephen Leake
2002-10-11  5:00       ` Simon Wright
2002-10-09 16:43 ` tmoran
replies disabled

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