--- gforth/engine/signals.c 2006/10/21 19:22:03 1.30 +++ gforth/engine/signals.c 2007/03/25 21:30:59 1.34 @@ -1,6 +1,6 @@ /* signal handling - Copyright (C) 1995,1996,1997,1998,2000,2003 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,2000,2003,2006 Free Software Foundation, Inc. This file is part of Gforth. @@ -95,6 +95,11 @@ graceful_exit (int sig) jmp_buf throw_jmp_buf; +void throw(int code) +{ + longjmp(throw_jmp_buf,code); /* !! or use siglongjmp ? */ +} + static void signal_throw(int sig) { @@ -120,7 +125,7 @@ signal_throw(int sig) sigprocmask(SIG_SETMASK, &emptyset, NULL); } #endif - longjmp(throw_jmp_buf,code); /* !! or use siglongjmp ? */ + throw(code); } #ifdef SA_SIGINFO @@ -137,10 +142,10 @@ static void fpe_handler(int sig, siginfo switch(info->si_code) { #ifdef FPE_INTDIV - case FPE_INTDIV: code=-10; break; /* integer divide by zero */ + case FPE_INTDIV: code=BALL_DIVZERO; break; #endif #ifdef FPE_INTOVF - case FPE_INTOVF: code=-11; break; /* integer overflow */ + case FPE_INTOVF: code=BALL_RESULTRANGE; break; /* integer overflow */ #endif #ifdef FPE_FLTDIV case FPE_FLTDIV: code=-42; break; /* floating point divide by zero */ @@ -160,7 +165,7 @@ static void fpe_handler(int sig, siginfo #endif default: code=-55; break; } - longjmp(throw_jmp_buf,code); + throw(code); } @@ -193,7 +198,7 @@ static void segv_handler(int sig, siginf code=-44; else if (JUSTOVER(addr, NEXTPAGE(h->fp_stack_base+h->fp_stack_size))) code=-45; - longjmp(throw_jmp_buf,code); + throw(code); } #endif /* defined(SA_SIGINFO) */ @@ -410,9 +415,11 @@ void install_signal_handlers(void) sigstack.ss_flags=0; sas_retval=sigaltstack(&sigstack,(stack_t *)0); } +#ifdef HAS_FILE if (debug) fprintf(stderr,"sigaltstack: %s\n",strerror(sas_retval)); #endif +#endif #define DIM(X) (sizeof (X) / sizeof *(X)) /*