=================================================================== RCS file: /home/cvs/OpenXM/src/k097/ki.c,v retrieving revision 1.6 retrieving revision 1.12 diff -u -p -r1.6 -r1.12 --- OpenXM/src/k097/ki.c 2003/12/05 14:02:23 1.6 +++ OpenXM/src/k097/ki.c 2020/10/07 23:53:25 1.12 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/k097/ki.c,v 1.5 2003/08/22 16:08:20 ohara Exp $ */ +/* $OpenXM: OpenXM/src/k097/ki.c,v 1.11 2016/03/31 06:34:29 takayama Exp $ */ /* ki.c ( kx interpreter ) */ #include @@ -11,7 +11,12 @@ #include "gradedset.h" #include #include +#include +#include +#include "mysig.h" +#include "ki.h" + char *getLOAD_K_PATH(); /* from d.h */ #if defined(__CYGWIN__) @@ -39,34 +44,35 @@ int K00_verbose = 0; extern int DebugMode; -sendKan(int p) { +int sendKan(int p) { static int n = 2; extern int Interactive; - struct object obj; + struct object obj = OINIT; int result; extern int InSendmsg2; - signal(SIGINT,SIG_IGN); /* Don't jump to ctrlC(). */ - if (p == 10) {printf("In(%d)= ",n++); return;} + result=0; + mysignal(SIGINT,SIG_IGN); /* Don't jump to ctrlC(). */ + if (p == 10) {printf("In(%d)= ",n++); return 0;} if (p == 0 && DebugCompiler) printf("sendKan[%s]\n",Kbuff); /* printf("sendKan[%s]\n",Kbuff); */ if (strlen(Kbuff) != 0) { - signal(SIGINT,SIG_DFL); + mysignal(SIGINT,SIG_DFL); result = KSexecuteString(Kbuff); /* fprintf(stderr,"r=%d ",result); */ - signal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ + mysignal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ } /* fprintf(stderr,"r=%d ",result); */ if (result == -1) { K00recoverFromError(); InSendmsg2 = 0; fprintf(stderr,"--- Engine error or interrupt : "); if (DebugMode) { - signal(SIGINT,SIG_DFL); + mysignal(SIGINT,SIG_DFL); KSexecuteString("db.DebugStack setstack "); - signal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ + mysignal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ obj = KSpop(); - signal(SIGINT,SIG_DFL); + mysignal(SIGINT,SIG_DFL); KSexecuteString("stdstack "); - signal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ + mysignal(SIGINT,SIG_IGN); /* Reset SIGINT. Don't jump to ctrlC(). */ if (obj.tag == Sdollar) { fprintf(stderr,"%s\n",obj.lc.str); fprintf(stderr,"\n"); @@ -127,7 +133,7 @@ void *mymalloc(int n) return((void *)GC_malloc(n)); } -execFile(char *s) +int execFile(char *s) { FILE *fp; #define TMP_SIZE 1024 @@ -157,7 +163,7 @@ execFile(char *s) fprintf(stderr,"Fatal error: Cannot open the system macro %s in %s, %s, %s nor %s.\n", s,tname2,tname3,tname4,tname); exit(11); - return; + return 0; } } }