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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,14aa27db81ce3b40 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: How to exit an Ada program with (unix shell) error code? Reply-To: anon@anon.org (anon) References: <49ba30c9-a1e6-4346-8618-d256f87ac301@s31g2000vbp.googlegroups.com> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Thu, 14 May 2009 02:55:43 GMT NNTP-Posting-Host: 12.65.42.39 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1242269743 12.65.42.39 (Thu, 14 May 2009 02:55:43 GMT) NNTP-Posting-Date: Thu, 14 May 2009 02:55:43 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:5830 Date: 2009-05-14T02:55:43+00:00 List-Id: Well, lets see. I did answer the original poster, Adam. It just that Martin suggest that functions are not portable and that where you came in. Now, all OS's (AT&T OS port, Linux, and Windows) shell or application loaders, calls a program using the following format: Exit_Status := Application.all ( Augment_Count, Argument_List, Environment_List ) ; This is defined from the "implementation's execution environment" which RM 1.1.3 (6) states that if it is "impossible or impractical" then Ada variations are permitted. Which states that all Ada partitions that are executed under this type of OS which calls a program as a function shall return a value aka Exit_Status. The exception is where the program exits abnormally, such as an "unhanded exception" or using the two exit routines "System.OS_LIB.OS_Exit" and "System.OS_LIB.OS_Abort". Also RM 1.1.3 (12), strengths these calling conversion and the normal function type of return value. Then you have RM 10.2 (21) which states that Ada must conform to the "implementation's execution environment". By return an exit status unless it terminates abnormally since it was called as a function. 10.2 (21) A call to the main subprogram, if the partition has one. If the main subprogram has parameters, they are passed; where the actuals come from is implementation defined. What happens to the result of a main function is also implementation defined. 1.1.3 (12) Any result returned or exception propagated from a main subprogram (see 10.2) or an exported subprogram (see Annex B) to an external caller; 1.1.3 (6) Contain no variations except those explicitly permitted by this International Standard, or those that are impossible or impractical to avoid given the implementation's execution environment; Note: Hope you had a fun holiday!!! Also for Martin. Can a user-created procedure (main subprogram) be concerned as a "public parameterless library procedures. No! The reason is that the procedure is not public, it first must be bound by the binding process. 10.2 (29) An implementation may restrict the kinds of subprograms it supports as main subprograms. However, an implementation is required to support all main subprograms that are public parameterless library procedures. In , Adam Beneschan writes: >On May 8, 3:17 am, a...@anon.org (anon) wrote: > >[Note: I was out of town for a long weekend, for Mother's Day, and saw >this post just today.] > >> Now, in the case of, Ada.Command_Line, RM A.15 (21) states: >> >> 21 An alternative declaration is allowed for package Command_Line if >> different functionality is appropriate for the external execution >> environment. > >OK, I wasn't aware of this. But it doesn't help your case any. In >the post to which I was responding, you said: > >"And since there are times where the Ada.Command_Line package is >not available, there has to be a way to send a 'exit status' to the OS >in those case." > >If the OS is such that it expects programs to return an exit status, >then certainly an alternative (or omitted) declaration of >Ada.Command_Line that did not support Set_Exit_Status would not be >"appropriate for the external execution environment". (It would only >be appropriate in cases where there is no real OS, or if there's a >bare-bones OS that does not care about exit statuses.) I think the >point you're trying to make is that the language should *require* >support for parameterless functions as main programs, but you still >haven't demonstrated your point; ignoring cases where the vendor just >plain screws up by providing an inappropriate version of Command_Line, >you have not shown that there is ever a need to support main programs >of this form. > > -- Adam