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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47d9200cdb11d571,start X-Google-Attributes: gid103376,public From: "W. Wesley Groleau (Wes)" Subject: Re: Procedures and Functions Date: 1996/09/04 Message-ID: <9609041330.AA04703@most>#1/1 X-Deja-AN: 178644732 sender: Ada programming language comments: To: cnegron@motown.lmco.com mailer: Elm [revision: 70.85] newsgroups: comp.lang.ada negron" at sep 4, 96 8: 03 am Date: 1996-09-04T00:00:00+00:00 List-Id: :> "with Text_Io; use Text_Io; :> procedure one is :> function one (...)return stuff is separate; :> procedure two(...) is separatoe; :> begin :> ... :> end one :> begin :> ... :> end two" :> :> This bears no relation to correct Ada syntax. I suspect you should not :> be using subunits at all at this stage of understanding. If you saw half of the silliness R. Dewar has to put up with (including at least one class-A screw-up from me) you'd be impressed with how nice he is on the net. I'll try to help a little, but what you really need is gnatinfo.txt AND a good beginner's book on Ada. If you've done a lot of programming in other languages, I suggest "Ada as a Second Language" Also, since this is an Ada question and not a gnat question, I'm transplanting the thread to the comp.lang.ada newsgroup. If you don't have Usenet news, I'll tell you (by e-mail) how you can still participate (also by e-mail). So here's lesson one: A procedure, function, package, or task can be defined in three ways. Two of these ways only identify the item (and its parameters, for subprograms). For functions, these are like this: -- function specification: function One ( Parameter : Parameter_Type ) return Result_Type; -- function stub: function One ( Parameter : Parameter_Type ) return Result_Type is separate; -- function body: function One ( Parameter : Parameter_Type ) return Result_Type is begin ...... Note that all three are identical up to the "is" or ";" GNAT wants only one compilation unit per file. A spec or a body can be a compilation unit, or a spec, a stub, or a body can be BETWEEN the "is" and "begin" of another body. A stub and a body for the same routine can NOT be in the same area. A stub can not be a compilation unit, but it indicates that the body IS a _separate_ compilation unit. You'll have to check your book or one of the on-line tutorials for other details. --------------------------------------------------------------------------- W. Wesley Groleau (Wes) Office: 219-429-4923 Hughes Defense Communications (MS 10-40) Home: 219-471-7206 Fort Wayne, IN 46808 (Unix): wwgrol@pseserv3.fw.hac.com ---------------------------------------------------------------------------