=================================================================== RCS file: /home/cvs/OpenXM/src/k097/ki.c,v retrieving revision 1.1.1.1 retrieving revision 1.6 diff -u -p -r1.1.1.1 -r1.6 --- OpenXM/src/k097/ki.c 1999/10/08 02:12:15 1.1.1.1 +++ OpenXM/src/k097/ki.c 2003/12/05 14:02:23 1.6 @@ -1,3 +1,4 @@ +/* $OpenXM: OpenXM/src/k097/ki.c,v 1.5 2003/08/22 16:08:20 ohara Exp $ */ /* ki.c ( kx interpreter ) */ #include @@ -13,11 +14,21 @@ char *getLOAD_K_PATH(); /* from d.h */ +#if defined(__CYGWIN__) +#define JMP_BUF sigjmp_buf +#define SETJMP(env) sigsetjmp(env,1) +#define LONGJMP(env,p) siglongjmp(env,p) +#else +#define JMP_BUF jmp_buf +#define SETJMP(env) setjmp(env) +#define LONGJMP(env,p) longjmp(env,p) +#endif + #ifdef CALLASIR #include "ak0.h" #endif -extern jmp_buf KCenvOfParser; +extern JMP_BUF KCenvOfParser; char Ktmp[10240]; int Ksize = 10240; @@ -33,8 +44,9 @@ sendKan(int p) { extern int Interactive; struct object obj; int result; + extern int InSendmsg2; signal(SIGINT,SIG_IGN); /* Don't jump to ctrlC(). */ - if (p == 10) {printf("In(%d)=",n++); return;} + if (p == 10) {printf("In(%d)= ",n++); return;} if (p == 0 && DebugCompiler) printf("sendKan[%s]\n",Kbuff); /* printf("sendKan[%s]\n",Kbuff); */ if (strlen(Kbuff) != 0) { @@ -45,7 +57,7 @@ sendKan(int p) { } /* fprintf(stderr,"r=%d ",result); */ if (result == -1) { - K00recoverFromError(); + K00recoverFromError(); InSendmsg2 = 0; fprintf(stderr,"--- Engine error or interrupt : "); if (DebugMode) { signal(SIGINT,SIG_DFL); @@ -66,7 +78,8 @@ sendKan(int p) { } #define AFO #ifdef AFO - if (setjmp(KCenvOfParser)) { + if (SETJMP(KCenvOfParser)) { + InSendmsg2=0; fprintf(stderr,"Error: Goto the top level.\n"); parseAfile(stdin); KCparse(); @@ -75,7 +88,7 @@ sendKan(int p) { /* However, it should be rewrited in a future. */ }else{ /* fprintf(stderr,"setjmp\n"); */ } #endif - if (p == 0 && Interactive) printf("In(%d)=",n++); + if (p == 0 && Interactive) printf("In(%d)= ",n++); Kpt=0; Kbuff[0] = '\0'; } @@ -87,7 +100,7 @@ char *s; if (strlen(s)+Kpt >= Ksize) { Ksize = Ksize*2; t = (char *)GC_malloc(sizeof(char)*Ksize); - if (t == (char *)NULL) { fprintf(stderr,"No memory."); exit();} + if (t == (char *)NULL) { fprintf(stderr,"No memory."); exit(1);} strcpy(t,Kbuff); Kbuff = t; } strcpy(&(Kbuff[Kpt]),s);