fix warnings;

improve SIGINT handling if !isastty


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@651 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-10-23 20:55:37 +00:00
parent 95e6dea185
commit ead95fb0d4
4 changed files with 17 additions and 7 deletions

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.25 2002-10-21 22:14:28 vsc Exp $ *
* version:$Id: alloc.c,v 1.26 2002-10-23 20:55:36 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -976,7 +976,7 @@ ExtendWorkSpace(Int s)
if ((CELL)ptr & MBIT) {
ErrorMessage = ErrorSay;
snprintf5(ErrorMessage, MAX_ERROR_MSG_SIZE,
"memory at %p conflicts with MBIT %lx", ptr, MBIT);
"memory at %p conflicts with MBIT %lx", ptr, (unsigned long)MBIT);
PrologMode = OldPrologMode;
return(FALSE);
}

View File

@ -362,7 +362,12 @@ Error (yap_error_number type, Term where, char *format,...)
int serious;
char *tp = tmpbuf;
int psize = YAP_BUF_SIZE;
if (type == INTERRUPT_ERROR) {
fprintf(stderr,"[ YAP exiting: cannot handle signal %d ]\n",
(int)IntOfTerm(where));
exit_yap(1);
}
/* disallow recursive error handling */
if (PrologMode & InErrorMode) {
/* error within error */
@ -454,6 +459,10 @@ Error (yap_error_number type, Term where, char *format,...)
fprintf(stderr,"[ Fatal YAP Error: %s exiting.... ]\n",tmpbuf);
error_exit_yap (1);
}
case INTERRUPT_ERROR:
{
error_exit_yap (1);
}
case PURE_ABORT:
nt[0] = MkAtomTerm(LookupAtom(tmpbuf));
fun = MkFunctor(LookupAtom("abort"),2);

View File

@ -1218,9 +1218,10 @@ HandleSIGINT (int sig)
#endif
{
my_signal(SIGINT, HandleSIGINT);
/* do this before we act */
#if HAVE_ISATTY
if (!isatty(0)) {
InteractSIGINT('e');
Error(INTERRUPT_ERROR,MkIntTerm(SIGINT),NULL);
}
#endif
if (PrologMode & (CritMode|ConsoleGetcMode)) {
@ -1290,8 +1291,7 @@ ReceiveSignal (int s)
/* These signals are not handled by WIN32 and not the Macintosh */
case SIGQUIT:
case SIGKILL:
YP_fprintf(YP_stderr, "\n\n\n[ Quit signal received ]\n\n");
exit_yap (SIGKILL);
Error(INTERRUPT_ERROR,MkIntTerm(s),NULL);
#endif
#if defined(SIGUSR1)
case SIGUSR1:

View File

@ -10,7 +10,7 @@
* File: Yap.h.m4 *
* mods: *
* comments: main header file for YAP *
* version: $Id: Yap.h.m4,v 1.34 2002-10-21 22:14:29 vsc Exp $ *
* version: $Id: Yap.h.m4,v 1.35 2002-10-23 20:55:37 vsc Exp $ *
*************************************************************************/
#include "config.h"
@ -437,6 +437,7 @@ typedef enum {
EXISTENCE_ERROR_SOURCE_SINK,
EXISTENCE_ERROR_STREAM,
INSTANTIATION_ERROR,
INTERRUPT_ERROR,
OUT_OF_HEAP_ERROR,
OUT_OF_STACK_ERROR,
OUT_OF_TRAIL_ERROR,