comp.lang.ada
 help / color / mirror / Atom feed
* Exiting a simple program in Ada
@ 1989-06-27 16:08 Krishan M Nainani
  1989-07-11 14:03 ` Stephe Leake
  0 siblings, 1 reply; 2+ messages in thread
From: Krishan M Nainani @ 1989-06-27 16:08 UTC (permalink / raw)



	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 !

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Exiting a simple program in Ada
  1989-06-27 16:08 Exiting a simple program in Ada Krishan M Nainani
@ 1989-07-11 14:03 ` Stephe Leake
  0 siblings, 0 replies; 2+ messages in thread
From: Stephe Leake @ 1989-07-11 14:03 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1989-07-11 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-06-27 16:08 Exiting a simple program in Ada Krishan M Nainani
1989-07-11 14:03 ` Stephe Leake

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