!standard 10.02 (07) 97-03-19 AI95-00172/01 !class confirmation 96-11-16 !status work item 97-03-19 !status received 96-11-16 !priority High !difficulty Easy !subject Optional main subprogram? !summary 97-03-19 A main subprogram is optional -- the implementation must provide a way to create and run an active partition with no main subprogram. A main subprogram must be a subprogram -- the implementation must report an error if the programmer requests that a package be used as the main subprogram. !question 97-03-19 !response 97-03-19 The ACVC test in question is: -- LA1001F.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687 and -- F08630-91-C-0015, the U.S. Government obtained unlimited rights in the -- software and documentation contained herein. Unlimited rights are -- defined in DFAR 252.227-7013(a)(19). By making this public release, -- the Government intends to confer upon all recipients unlimited rights -- equal to those held by the Government. These rights include rights to -- use, duplicate, release or disclose the released technical data and -- computer software in whole or in part, in any manner and for any purpose -- whatsoever, and to have or permit others to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT A PACKAGE CANNOT BE NAMED AS A MAIN PROGRAM. -- HISTORY: -- JET 08/12/88 CREATED ORIGINAL TEST. -- PWN 11/30/94 ADDED A PROCEDURE TO KEEP PACKAGE BODIES LEGAL. PACKAGE LA1001F IS PROCEDURE REQUIRE_BODY; END LA1001F; WITH REPORT; USE REPORT; PRAGMA ELABORATE(REPORT); PACKAGE BODY LA1001F IS PROCEDURE REQUIRE_BODY IS BEGIN FAILED("PACKAGE WAS IMPROPERLY LINKED AND EXECUTED"); END; BEGIN TEST("LA1001F", "CHECK THAT A PACKAGE CANNOT BE NAMED AS A " & "MAIN PROGRAM"); FAILED("PACKAGE WAS IMPROPERLY LINKED AND EXECUTED"); RESULT; END LA1001F; !appendix 96-11-16 !section 10.2(07) !subject Optional main subprogram? !reference RM95-10.2(7,7.a-d,23,34.e) !from Laurent Guerby 96-10-30 !keywords main subprogram, partition !reference 96-5738.a Laurent Guerby 96-10-30>> !discussion RM95-10.2(7) states: "The user can optionally designate (in an implementation-defined manner) one subprogram as the main subprogram for the partition. [...]" Does it mean that an implementation must provide a way to bind and link a program without a main subprogram (for example giving a package or a list of units)? Note that there's an ACVC 9XBASIC L test (LA1001F) checking: -- OBJECTIVE: -- CHECK THAT A PACKAGE CANNOT BE NAMED AS A MAIN PROGRAM. An implementation must provide a script that "compile and bind" each test, so I'm wondering that if the answer to my question is yes, this test may be invalid in Ada 95 (or may need some extra precision about what is actually checked). -- Laurent Guerby , Team Ada. "Use the Source, Luke. The Source will be with you, always (GPL)." **************************************************************** !section 10.2(07) !subject Optional main subprogram? !reference RM95-10.2(7,7.a-d,23,34.e) !from Laurent Guerby 96-10-30 !keywords main subprogram, partition !reference 96-5738.a Laurent Guerby 96-10-30 !from Bob Duff !reference 96-5741.a Robert A Duff 96-10-31>> !discussion > RM95-10.2(7) states: > > "The user can optionally designate (in an implementation-defined > manner) one subprogram as the main subprogram for the partition. [...]" > > Does it mean that an implementation must provide a way to bind and > link a program without a main subprogram (for example giving a package > or a list of units)? Yes. > Note that there's an ACVC 9XBASIC L test (LA1001F) checking: > > -- OBJECTIVE: > -- CHECK THAT A PACKAGE CANNOT BE NAMED AS A MAIN PROGRAM. > > An implementation must provide a script that "compile and bind" > each test, so I'm wondering that if the answer to my question is yes, > this test may be invalid in Ada 95 (or may need some extra precision > about what is actually checked). It is up to the implementation to decide how one specifies what the main subprogram is, and whether there is one. Since the usual case is to have a main subprogram, a -no-main switch might make sense, but the RM has nothing to say about that. - Bob **************************************************************** !section 10.2(07) !subject Optional main subprogram? !reference RM95-10.2(7,7.a-d,23,34.e) !keywords main subprogram, partition !reference 96-5738.a Laurent Guerby 96-10-30 !reference 96-5741.a Robert A Duff 96-10-31 !from Keith Thompson 96-11-08 !reference 96-5754.a Keith Thompson 96-11-8>> !discussion Laurent Guerby wrote: > RM95-10.2(7) states: > > "The user can optionally designate (in an implementation-defined > manner) one subprogram as the main subprogram for the partition. [...]" > > Does it mean that an implementation must provide a way to bind and > link a program without a main subprogram (for example giving a package > or a list of units)? Bob Duff replied: > Yes. I can understand a partition not having a main subprogram, but what does it mean for a program (e.g., one consisting of a single partition) not to have a main subprogram? I know of no implementations that support this kind of thing. **************************************************************** !section 10.2(07) !subject Optional main subprogram? !reference RM95-10.2(7,7.a-d,23,34.e) !keywords main subprogram, partition !reference 96-5738.a Laurent Guerby 96-10-30 !reference 96-5741.a Robert A Duff 96-10-31 !reference 96-5754.a Keith Thompson 96-11-8 !from Bob Duff !reference 96-5757.a Robert A Duff 96-11-9>> !discussion > I can understand a partition not having a main subprogram, but what does > it mean for a program (e.g., one consisting of a single partition) not > to have a main subprogram? I know of no implementations that support > this kind of thing. Well, if an implementation doesn't support main-subprogram-less programs, then it's not a correct implementation of Ada 95. RM-10.2(7) says so, and AARM-10.2(34.e) points out that this is an extension w.r.t. Ada 83. The purpose is for certain programs that do all their work in library packages, and tasks created by library packages. (And of course, as you note, it makes sense for shared passive partitions and so forth.) In any case, the run-time semantics is described in 10.2(10-17,25). Note "if there is one" in 10.2(12). - Bob ****************************************************************