From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,91829d2306080fa8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-09 09:18:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn12feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3DA45682.7050005@worldnet.att.net> From: Jim Rogers User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Newbie question on child packages References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 09 Oct 2002 16:18:15 GMT NNTP-Posting-Host: 12.86.36.52 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1034180295 12.86.36.52 (Wed, 09 Oct 2002 16:18:15 GMT) NNTP-Posting-Date: Wed, 09 Oct 2002 16:18:15 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:29622 Date: 2002-10-09T16:18:15+00:00 List-Id: 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 > > 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