=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/stackmachine.c,v retrieving revision 1.9 retrieving revision 1.13 diff -u -p -r1.9 -r1.13 --- OpenXM/src/kan96xx/Kan/stackmachine.c 2002/02/24 10:27:18 1.9 +++ OpenXM/src/kan96xx/Kan/stackmachine.c 2003/11/20 09:20:36 1.13 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.8 2001/12/19 23:39:53 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.12 2002/11/07 23:35:23 takayama Exp $ */ /* stackmachin.c */ #include @@ -74,6 +74,7 @@ static void pstack(void); static struct object executableStringToExecutableArray(char *str); extern int SerialCurrent; +extern int QuoteMode; int SGClock = 0; int UserCtrlC = 0; @@ -816,6 +817,7 @@ void scanner() { fprintf(Fstack,"\nscanner> "); } KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ + KSexecuteString(" (Computation is interrupted.) "); /* move to ctrlC-hook? */ continue ; } else { } if (DebugStack >= 1) { printOperandStack(); } @@ -837,11 +839,15 @@ void ctrlC(sig) signal(sig,SIG_IGN); /* see 133p */ + cancelAlarm(); + if (sig == SIGALRM) { + fprintf(stderr,"ctrlC by SIGALRM\n"); + } if (SGClock) { UserCtrlC = 1; fprintf(stderr,"ctrl-c is locked because of gc.\n"); - signal(SIGINT,ctrlC); + signal(sig,ctrlC); if (sig == SIGALRM) alarm((unsigned int)10); return; } if (OXlock) { @@ -854,7 +860,7 @@ void ctrlC(sig) unlockCtrlCForOx(); } fprintf(stderr,"ctrl-c is locked because of ox lock %d.\n",UserCtrlC); - signal(SIGINT,ctrlC); + signal(sig,ctrlC); if (sig == SIGALRM) alarm((unsigned int)10); return; } if (ErrorMessageMode != 1) { @@ -957,6 +963,9 @@ int executeToken(token) ob.lc.ival = primitive; return(executePrimitive(ob)); } else { + if (QuoteMode) { + return(DO_QUOTE); + } if (WarningMessageMode == 1 || WarningMessageMode == 2) { char tmpc[1024]; if (strlen(token.token) < 900) { @@ -1004,6 +1013,7 @@ errorStackmachine(str) char message0[1024]; char *message; extern int ErrorMessageMode; + cancelAlarm(); if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { pushErrorStack(KnewErrorPacket(SerialCurrent,-1,str)); } @@ -1108,6 +1118,8 @@ KSexecuteString(s) } recursive--; if (localCatchCtrlC) { signal(SIGINT, sigfunc); } + KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ + KSexecuteString(" (Computation is interrupted.) "); /* move to ctrlC-hook?*/ return(-1); }else{ } }else{ @@ -1124,6 +1136,8 @@ KSexecuteString(s) } recursive = 0; if (localCatchCtrlC) { signal(SIGINT, sigfunc); } + KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ + KSexecuteString(" (Computation is interrupted.) "); return(-1); }else { } } @@ -1470,4 +1484,8 @@ struct object KSdupErrors() { } return(rob); } - + +void cancelAlarm() { + alarm((unsigned int) 0); + signal(SIGALRM,SIG_DFL); +}