comp.lang.ada
 help / color / mirror / Atom feed
From: Manuel Collado <m.collado@lml.ls.fi.upm.es>
Subject: How to port exit(s) from C to Ada
Date: Fri, 11 Oct 2002 11:39:39 +0200
Date: 2002-10-11T11:39:39+02:00	[thread overview]
Message-ID: <3DA69C5B.A3B8F264@lml.ls.fi.upm.es> (raw)

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



             reply	other threads:[~2002-10-11  9:39 UTC|newest]

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

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