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 X-Google-Thread: 103376,cf907209f066462e,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-16 05:48:23 PST Message-ID: <3DA69C5B.A3B8F264@lml.ls.fi.upm.es> Date: Fri, 11 Oct 2002 11:39:39 +0200 From: Manuel Collado X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: How to port exit(s) from C to Ada Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 138.100.10.20 X-Trace: 11 Oct 2002 11:37:01 +0100, 138.100.10.20 Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.59.214.20!news-ge.switch.ch!news.rediris.es!news-2.rediris.es!138.100.251.9.MISMATCH!news.upm.es!138.100.10.20 Xref: archiver1.google.com comp.lang.ada:29838 Date: 2002-10-11T11:39:39+02:00 List-Id: We are porting some legacy code from Modula2 + C to Ada. A basic library module contains a procedure 'Terminate(status)' that forces termination of the main program and returns a 'status' to the calling process. It is implemented via the 'exit(status)' C system call. I vould like to implement it in pure Ada. So far I'm aware of Ada.Command_Line.Set_Exit_Status (Code : in Exit_Status); [LRM]: If the external execution environment supports returning an exit status from a program, then Set_Exit_Status sets Code as the status. Normal termination of a program returns as the exit status the value most recently set by Set_Exit_Status, or, if no such value has been set, then the value Success. If a program terminates abnormally, the status set by Set_Exit_Status is ignored, and an implementation�defined exit status value is set. To terminate immediately, I can raise a user-defined unhandled exception, but it would imply an abnormal termination, so the specified exit status would be ingnored. Is there a way to reproduce the behaviour of the 'exit(status)' C-call in pure Ada, without calling it as a foreign procedure? Thanks, -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado