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:
parent
95e6dea185
commit
ead95fb0d4
@ -12,7 +12,7 @@
|
|||||||
* Last rev: *
|
* Last rev: *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: allocating space *
|
* 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
|
#ifdef SCCS
|
||||||
static char SccsId[] = "%W% %G%";
|
static char SccsId[] = "%W% %G%";
|
||||||
@ -976,7 +976,7 @@ ExtendWorkSpace(Int s)
|
|||||||
if ((CELL)ptr & MBIT) {
|
if ((CELL)ptr & MBIT) {
|
||||||
ErrorMessage = ErrorSay;
|
ErrorMessage = ErrorSay;
|
||||||
snprintf5(ErrorMessage, MAX_ERROR_MSG_SIZE,
|
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;
|
PrologMode = OldPrologMode;
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -363,6 +363,11 @@ Error (yap_error_number type, Term where, char *format,...)
|
|||||||
char *tp = tmpbuf;
|
char *tp = tmpbuf;
|
||||||
int psize = YAP_BUF_SIZE;
|
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 */
|
/* disallow recursive error handling */
|
||||||
if (PrologMode & InErrorMode) {
|
if (PrologMode & InErrorMode) {
|
||||||
/* error within error */
|
/* 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);
|
fprintf(stderr,"[ Fatal YAP Error: %s exiting.... ]\n",tmpbuf);
|
||||||
error_exit_yap (1);
|
error_exit_yap (1);
|
||||||
}
|
}
|
||||||
|
case INTERRUPT_ERROR:
|
||||||
|
{
|
||||||
|
error_exit_yap (1);
|
||||||
|
}
|
||||||
case PURE_ABORT:
|
case PURE_ABORT:
|
||||||
nt[0] = MkAtomTerm(LookupAtom(tmpbuf));
|
nt[0] = MkAtomTerm(LookupAtom(tmpbuf));
|
||||||
fun = MkFunctor(LookupAtom("abort"),2);
|
fun = MkFunctor(LookupAtom("abort"),2);
|
||||||
|
@ -1218,9 +1218,10 @@ HandleSIGINT (int sig)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
my_signal(SIGINT, HandleSIGINT);
|
my_signal(SIGINT, HandleSIGINT);
|
||||||
|
/* do this before we act */
|
||||||
#if HAVE_ISATTY
|
#if HAVE_ISATTY
|
||||||
if (!isatty(0)) {
|
if (!isatty(0)) {
|
||||||
InteractSIGINT('e');
|
Error(INTERRUPT_ERROR,MkIntTerm(SIGINT),NULL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (PrologMode & (CritMode|ConsoleGetcMode)) {
|
if (PrologMode & (CritMode|ConsoleGetcMode)) {
|
||||||
@ -1290,8 +1291,7 @@ ReceiveSignal (int s)
|
|||||||
/* These signals are not handled by WIN32 and not the Macintosh */
|
/* These signals are not handled by WIN32 and not the Macintosh */
|
||||||
case SIGQUIT:
|
case SIGQUIT:
|
||||||
case SIGKILL:
|
case SIGKILL:
|
||||||
YP_fprintf(YP_stderr, "\n\n\n[ Quit signal received ]\n\n");
|
Error(INTERRUPT_ERROR,MkIntTerm(s),NULL);
|
||||||
exit_yap (SIGKILL);
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(SIGUSR1)
|
#if defined(SIGUSR1)
|
||||||
case SIGUSR1:
|
case SIGUSR1:
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* File: Yap.h.m4 *
|
* File: Yap.h.m4 *
|
||||||
* mods: *
|
* mods: *
|
||||||
* comments: main header file for YAP *
|
* 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"
|
#include "config.h"
|
||||||
@ -437,6 +437,7 @@ typedef enum {
|
|||||||
EXISTENCE_ERROR_SOURCE_SINK,
|
EXISTENCE_ERROR_SOURCE_SINK,
|
||||||
EXISTENCE_ERROR_STREAM,
|
EXISTENCE_ERROR_STREAM,
|
||||||
INSTANTIATION_ERROR,
|
INSTANTIATION_ERROR,
|
||||||
|
INTERRUPT_ERROR,
|
||||||
OUT_OF_HEAP_ERROR,
|
OUT_OF_HEAP_ERROR,
|
||||||
OUT_OF_STACK_ERROR,
|
OUT_OF_STACK_ERROR,
|
||||||
OUT_OF_TRAIL_ERROR,
|
OUT_OF_TRAIL_ERROR,
|
||||||
|
Reference in New Issue
Block a user