Mail Archives: djgpp/1999/02/14/11:08:04
At 10:53 AM 2/14/99 +0100, you wrote:
>static void ExcHandler (int sig)
>{
> static int been_here = 0;
> static jmp_buf exc_buf;
> int i;
>
> if (been_here)
> {
> been_here = 0;
> signal (sig,SIG_DFL);
> __djgpp_exception_state_ptr = &exc_buf;
> }
> else
> {
> memcpy (&exc_buf,__djgpp_exception_state_ptr,sizeof(exc_buf));
> been_here = 1;
>
> if (sig == SIGFPE)
> {
> _clear87();
> _fpreset();
> }
> psignal (sig, "shutdown");
>
> .. do your main exc-processing here..
> }
> raise (SIGABRT);
>}
Clever. I like the been_here var to prevent endlessly looping on nested
signals.
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." -------------------------------------------------
-- B. Mandelbrot |http://surf.to/pgd.net
_____________________ ____|________ Paul Derbyshire pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|
- Raw text -