comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada@earthlink.net>
Subject: Re: Only one compilation unit.
Date: Fri, 15 Jun 2001 12:53:41 GMT
Date: 2001-06-15T12:53:41+00:00	[thread overview]
Message-ID: <3B29F88D.FC9B73FC@earthlink.net> (raw)
In-Reply-To: pheW6.78393$DG1.12883136@news1.rdc1.mi.home.com

McDoobie wrote:
> 
> Alright, I'm writing a small program using two procedures.
> 
> Now I'm coding both procedures within the same .adb file. When I go to
> compile the program I get an error that says "end of file expected, can
> only have one compilation unit."
> 
> Now, that only happens when writing programs with more than one procedure.
> 
> Do I have to put each different procedure in a seperate text file? Or is
> it necessary to write .ads which describe each and every procedure?
> Any help would be appreciated.
> 

You already got the basic answer to your question in the other postings,
but let me just add some info about a common Ada programming idiom.

If you're writing what might be considered a single procedure, but you
don't like doing lots of procedure nesting, you can create a package to
contain the procedures.  (This approach uses packages simply as an
encapsulation mechanism.)  At the one extreme the package could then
provide just a single visible procedure, for example:

   procedure Run;

which is then called by your main program.  On the other hand, if the
package makes visible a few key procedures, then your main program can
implement the high-level logic, orchestrating the calls to this support
package.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



  parent reply	other threads:[~2001-06-15 12:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-15  2:20 Only one compilation unit McDoobie
2001-06-15  3:05 ` James Rogers
     [not found] ` <3B297ED4.2BD6DF79@engineer.com>
2001-06-15  4:43   ` McDoobie
2001-06-15  6:50 ` tmoran
2001-06-15  9:21 ` David C. Hoos, Sr.
2001-06-15 12:53 ` Marc A. Criley [this message]
2001-07-09  9:53 ` John English
2001-07-09 13:02   ` McDoobie
2001-07-10  0:19   ` Keith Thompson
2001-07-13 19:08   ` Simon Wright
2001-07-15 11:40     ` Larry Kilgallen
2001-07-16 13:41       ` B.Gaffney
2001-07-16 15:08         ` Larry Kilgallen
2001-07-16  1:56     ` Robert Dewar
2001-07-17 18:49       ` Simon Wright
2001-07-18  7:53         ` Robert Dewar
replies disabled

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