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-7-bit X-Google-Thread: 103376,cf907209f066462e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-16 11:51:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: How to port exit(s) from C to Ada Date: 16 Oct 2002 11:51:33 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0210161051.3cab82ff@posting.google.com> References: <3DA69C5B.A3B8F264@lml.ls.fi.upm.es> NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1034794293 27370 127.0.0.1 (16 Oct 2002 18:51:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Oct 2002 18:51:33 GMT Xref: archiver1.google.com comp.lang.ada:29851 Date: 2002-10-16T18:51:33+00:00 List-Id: Manuel Collado wrote in message news:<3DA69C5B.A3B8F264@lml.ls.fi.upm.es>... > 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. ... > 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? You could always handle the "Terminate_Program" exception in the outer scope of the main program. That would work as long as you don't raise the exception in elaboration code or in any code called from the declaration section of the main routine.