[comp.lang.ada] Exiting a simple program in Ada

tfrancis@wpi.wpi.edu (Krishan M Nainani) (06/27/89)

	Does anyone know how to exit from a simple (non-multi-tasking)
	Ada program ?

	C has the wonderful:	exit(n) statement where n is the exit status.

	In my package, I am writing a procedure which aborts the complete
	program if this procedure is called (a few variables are set before).
	Can I use the "abort" stmt in some fashion (although it is for tasks)??

Krishan Nainani.	tfrancis@wpi.wpi.edu
Thanx ahead !

leake@cme.nist.gov (Stephe Leake) (07/11/89)

you can use abort only if you know the name of the task. Since the
"main" task of an Ada program has no name, this doesn't work. You
could declare one task, and have it run the program.

A cleaner way is to define an exception; say KILL_MAIN_PROGRAM. Then
provide one exception handler for it in the top level of the main
program; raising the exception at any point "jumps" to the exception
handler, which can cleanup and exit. What variables are set, and why?
They need to be global in this instance.

--
Stephe Leake 	(301) 975-3431 		leake@cme.nbs.gov
National Institute of Standards and Technology
(formerly National Bureau of Standards)
Rm. B-124, Bldg. 220
Gaithersburg, MD  20899