| version 1.9, 2015/10/10 11:29:46 |
version 1.10, 2016/03/31 05:27:34 |
|
|
| /* $OpenXM: OpenXM/src/k097/ki.c,v 1.8 2013/11/06 06:23:23 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/k097/ki.c,v 1.9 2015/10/10 11:29:46 takayama Exp $ */ |
| /* ki.c ( kx interpreter ) */ |
/* ki.c ( kx interpreter ) */ |
| |
|
| #include <stdio.h> |
#include <stdio.h> |
|
|
| #include <signal.h> |
#include <signal.h> |
| #include <string.h> |
#include <string.h> |
| #include <stdlib.h> |
#include <stdlib.h> |
| |
#include "mysig.h" |
| |
|
| char *getLOAD_K_PATH(); /* from d.h */ |
char *getLOAD_K_PATH(); /* from d.h */ |
| |
|
|
|
| struct object obj = OINIT; |
struct object obj = OINIT; |
| int result; |
int result; |
| extern int InSendmsg2; |
extern int InSendmsg2; |
| signal(SIGINT,SIG_IGN); /* Don't jump to ctrlC(). */ |
mysignal(SIGINT,SIG_IGN); /* Don't jump to ctrlC(). */ |
| if (p == 10) {printf("In(%d)= ",n++); return 0;} |
if (p == 10) {printf("In(%d)= ",n++); return 0;} |
| if (p == 0 && DebugCompiler) printf("sendKan[%s]\n",Kbuff); |
if (p == 0 && DebugCompiler) printf("sendKan[%s]\n",Kbuff); |
| /* printf("sendKan[%s]\n",Kbuff); */ |
/* printf("sendKan[%s]\n",Kbuff); */ |
| if (strlen(Kbuff) != 0) { |
if (strlen(Kbuff) != 0) { |
| signal(SIGINT,SIG_DFL); |
mysignal(SIGINT,SIG_DFL); |
| result = KSexecuteString(Kbuff); |
result = KSexecuteString(Kbuff); |
| /* fprintf(stderr,"r=%d ",result); */ |
/* 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); */ |
/* fprintf(stderr,"r=%d ",result); */ |
| if (result == -1) { |
if (result == -1) { |
| K00recoverFromError(); InSendmsg2 = 0; |
K00recoverFromError(); InSendmsg2 = 0; |
| fprintf(stderr,"--- Engine error or interrupt : "); |
fprintf(stderr,"--- Engine error or interrupt : "); |
| if (DebugMode) { |
if (DebugMode) { |
| signal(SIGINT,SIG_DFL); |
mysignal(SIGINT,SIG_DFL); |
| KSexecuteString("db.DebugStack setstack "); |
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(); |
obj = KSpop(); |
| signal(SIGINT,SIG_DFL); |
mysignal(SIGINT,SIG_DFL); |
| KSexecuteString("stdstack "); |
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) { |
if (obj.tag == Sdollar) { |
| fprintf(stderr,"%s\n",obj.lc.str); |
fprintf(stderr,"%s\n",obj.lc.str); |
| fprintf(stderr,"\n"); |
fprintf(stderr,"\n"); |