[net.micro.amiga] SIGBREAKF_CTRL_C, exception handling Q's

dillon@PAVEPAWS.BERKELEY.EDU (Matt Dillon) (05/11/86)

	I am currently attempting to impliment Ctl-C in my shell, and am 
having some problems with exception handling.  (Please do not tell me
to use the provided break-checking routines, they do not do enough)

	The problem is, there are exactly 3 pages in all my manuals which
describe exception handling.


* I get my task structure w/ 		FindTask(NULL);
* I clear signals with 			SetSignal(0L, SIGBREAKF_CTRL_C)
* I set task->tc_ExceptCode to my exception handler.
* I turn on exception processing w/
				SetExcept(SIGBREAKF_CTRL_C,SIGBREAKF_CTRL_C)

my exception handling routine is:

exception()
{
	++some_global_variable;
	return (SIGBREAKF_CTRL_C);
}


(A) When I SetExcept(), I IMMEDIATELY get an exception.  Why? there are no
pending signals because I cleared the signal mask.

(B) Several things are unclear

	What should exception() return in D0? The manual says something
like 'return what was in D0 originally, which is a mask of the exceptions
which have occured'.  It isn't explicit enough.

	The Manual says that it pushes all the registers et all... so I
don't have to (thus I used a C exception handler). right?

	Can I longjump() out of the exception handler?

	Who clears the signal flag and when?  

	Who clears the exception flag and when? 


(C) There seems to be a problem

	The exception mask contains bits set (before I change anything)
sometimes, other times there is nothing.  

	The ExceptCode vector already contains something... FC2A98.  What
does this routine do (since I'm basically overiding it)?


-----------------------------
Also, I want to be able to pass a Ctl-C signal on to commands currently
being executed.  How does CLI do this?


				Thanks,

				-Matt