Changes to allow compile with MinGW. Macros used for sigjmp_buf (JMP_BUF), siglongjmp (LONGJMP) and sigsetjmp (SETJMP)

This commit is contained in:
sjborley 2005-05-17 21:49:07 +00:00
parent a0823f7dc7
commit 3c843de4ad
3 changed files with 16 additions and 14 deletions

View File

@ -28,13 +28,13 @@ static char * mkcname(char what, char *v1, char *v2);
* be lost, but that's no great loss.
*/
static sigjmp_buf matherrbuf;
static JMP_BUF matherrbuf;
static RETSIGTYPE
sig_matherr(void)
{
fprintf(cp_err, "Error: argument out of range for math function\n");
siglongjmp(matherrbuf, 1);
LONGJMP(matherrbuf, 1);
}
@ -221,7 +221,7 @@ doop(char what,
/* Some of the math routines generate SIGILL if the argument is
* out of range. Catch this here.
*/
if (sigsetjmp(matherrbuf, 1)) {
if (SETJMP(matherrbuf, 1)) {
return (NULL);
}
(void) signal(SIGILL, (SIGNAL_FUNCTION) sig_matherr);
@ -701,7 +701,7 @@ apply_func(struct func *func, struct pnode *arg)
/* Some of the math routines generate SIGILL if the argument is
* out of range. Catch this here.
*/
if (sigsetjmp(matherrbuf, 1)) {
if (SETJMP(matherrbuf, 1)) {
(void) signal(SIGILL, SIG_DFL);
return (NULL);
}

View File

@ -394,13 +394,13 @@ printres(char *name)
#define LOG2_PAGESIZE 8
static sigjmp_buf env;
static JMP_BUF env;
static RETSIGTYPE
fault(void)
{
signal(SIGSEGV, (SIGNAL_FUNCTION) fault); /* SysV style */
siglongjmp(env, 1);
LONGJMP(env, 1);
}
static void *
@ -414,9 +414,9 @@ baseaddr(void)
if (getenv("SPICE_NO_DATASEG_CHECK"))
return 0;
#if defined(__CYGWIN__) || defined(HAS_WINDOWS) || defined(__APPLE__)
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(HAS_WINDOWS) || defined(__APPLE__)
return 0;
#endif
#else
low = 0;
high = (char *) ((unsigned long) sbrk(0) & ~((1 << LOG2_PAGESIZE) - 1));
@ -433,13 +433,13 @@ baseaddr(void)
break;
}
if (sigsetjmp(env, 1)) {
if (SETJMP(env, 1)) {
low = at;
continue;
} else
x = *at;
if (sigsetjmp(env, 1)) {
if (SETJMP(env, 1)) {
low = at;
continue;
} else
@ -451,6 +451,8 @@ baseaddr(void)
(void) signal(SIGSEGV, (SIGNAL_FUNCTION) orig_signal);
return (void *) high;
#endif
}
# ifdef notdef

View File

@ -29,7 +29,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include <editline/readline.h>
#endif /* HAVE_BSDEDITLINE */
extern sigjmp_buf jbuf;
extern JMP_BUF jbuf;
/* The (void) signal handlers... SIGINT is the only one that gets reset (by
* cshpar) so it is global. They are ifdef BSD because of the sigmask
@ -77,7 +77,7 @@ ft_sigintr(void)
cp_resetcontrol();
/* here we jump to the start of command processing in main() after resetting everything. */
siglongjmp(jbuf, 1);
LONGJMP(jbuf, 1);
}
@ -89,7 +89,7 @@ sigfloat(int sig, int code)
fperror("Error", code);
rewind(cp_out);
(void) signal( SIGFPE, (SIGNAL_FUNCTION) sigfloat );
siglongjmp(jbuf, 1);
LONGJMP(jbuf, 1);
}
/* This should give a new prompt if cshpar is waiting for input. */
@ -111,7 +111,7 @@ sigcont(void)
{
(void) signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop);
if (cp_cwait)
siglongjmp(jbuf, 1);
LONGJMP(jbuf, 1);
}
# endif