comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com (Ted Dennison)
Subject: Re: How to port exit(s) from C to Ada
Date: 16 Oct 2002 11:51:33 -0700
Date: 2002-10-16T18:51:33+00:00	[thread overview]
Message-ID: <4519e058.0210161051.3cab82ff@posting.google.com> (raw)
In-Reply-To: 3DA69C5B.A3B8F264@lml.ls.fi.upm.es

Manuel Collado <m.collado@lml.ls.fi.upm.es> 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.



      parent reply	other threads:[~2002-10-16 18:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-11  9:39 How to port exit(s) from C to Ada Manuel Collado
2002-10-16 13:20 ` Georg Bauhaus
2002-10-16 14:02 ` Preben Randhol
2002-10-16 17:45 ` Stephen Leake
2002-10-16 18:51 ` Ted Dennison [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox