[BACK]Return to stackmachine.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Diff for /OpenXM/src/kan96xx/Kan/stackmachine.c between version 1.7 and 1.10

version 1.7, 2001/05/04 01:06:25 version 1.10, 2002/11/04 10:53:56
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.6 2001/01/27 05:48:46 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.9 2002/02/24 10:27:18 takayama Exp $ */
 /*   stackmachin.c */  /*   stackmachin.c */
   
 #include <stdio.h>  #include <stdio.h>
Line 14 
Line 14 
 /* #define OPERAND_STACK_SIZE  2000 */  /* #define OPERAND_STACK_SIZE  2000 */
 #define OPERAND_STACK_SIZE 30000  #define OPERAND_STACK_SIZE 30000
 #define SYSTEM_DICTIONARY_SIZE 200  #define SYSTEM_DICTIONARY_SIZE 200
 /* #define USER_DICTIONARY_SIZE   1223, 3581 */  /* #define USER_DICTIONARY_SIZE   1223, 3581, 27449 */
 #define USER_DICTIONARY_SIZE  27449  #define USER_DICTIONARY_SIZE  59359
 /* The value of USER_DICTIONARY_SIZE must be prime number, because of hashing  /* The value of USER_DICTIONARY_SIZE must be prime number, because of hashing
    method */     method */
 #define ARGV_WORK_MAX  (AGLIMIT+100)  #define ARGV_WORK_MAX  (AGLIMIT+100)
Line 736  void scanner() {
Line 736  void scanner() {
   getokenSM(INIT);    getokenSM(INIT);
   initSystemDictionary();    initSystemDictionary();
   
   #if defined(__CYGWIN__)
     if (sigsetjmp(EnvOfStackMachine,1)) {
   #else
   if (setjmp(EnvOfStackMachine)) {    if (setjmp(EnvOfStackMachine)) {
   #endif
     /* do nothing in the case of error */      /* do nothing in the case of error */
     fprintf(stderr,"An error or interrupt in reading macros, files and command strings.\n");      fprintf(stderr,"An error or interrupt in reading macros, files and command strings.\n");
     exit(10);      exit(10);
Line 796  void scanner() {
Line 800  void scanner() {
   
   
   for (;;) {    for (;;) {
   #if defined(__CYGWIN__)
       if (jval=sigsetjmp(EnvOfStackMachine,1)) {
   #else
     if (jval=setjmp(EnvOfStackMachine)) {      if (jval=setjmp(EnvOfStackMachine)) {
   #endif
       /* ***  The following does not work properly.  ****        /* ***  The following does not work properly.  ****
          if (jval == 2) {           if (jval == 2) {
          if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {           if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {
Line 808  void scanner() {
Line 816  void scanner() {
         fprintf(Fstack,"\nscanner> ");          fprintf(Fstack,"\nscanner> ");
       }        }
       KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */        KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */
         KSexecuteString(" (Computation is interrupted.) ");
       continue ;        continue ;
     } else {  }      } else {  }
     if (DebugStack >= 1) { printOperandStack(); }      if (DebugStack >= 1) { printOperandStack(); }
Line 829  void ctrlC(sig)
Line 838  void ctrlC(sig)
   
   signal(sig,SIG_IGN);    signal(sig,SIG_IGN);
   /* see 133p */    /* see 133p */
     cancelAlarm();
     if (sig == SIGALRM) {
       fprintf(stderr,"ctrlC by SIGALRM\n");
     }
   
   if (SGClock) {    if (SGClock) {
     UserCtrlC = 1;      UserCtrlC = 1;
     fprintf(stderr,"ctrl-c is locked because of gc.\n");      fprintf(stderr,"ctrl-c is locked because of gc.\n");
     signal(SIGINT,ctrlC);      signal(sig,ctrlC);  if (sig == SIGALRM) alarm((unsigned int)10);
     return;      return;
   }    }
   if (OXlock) {    if (OXlock) {
Line 846  void ctrlC(sig)
Line 859  void ctrlC(sig)
       unlockCtrlCForOx();        unlockCtrlCForOx();
     }      }
     fprintf(stderr,"ctrl-c is locked because of ox lock %d.\n",UserCtrlC);      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;      return;
   }    }
   if (ErrorMessageMode != 1) {    if (ErrorMessageMode != 1) {
Line 867  void ctrlC(sig)
Line 880  void ctrlC(sig)
   */    */
   getokenSM(INIT); /* It might fix the bug above. 1992/11/14 */    getokenSM(INIT); /* It might fix the bug above. 1992/11/14 */
   signal(SIGINT,ctrlC);    signal(SIGINT,ctrlC);
   #if defined(__CYGWIN__)
     siglongjmp(EnvOfStackMachine,2);
   #else
   longjmp(EnvOfStackMachine,2); /* returns 2 for ctrl-C */    longjmp(EnvOfStackMachine,2); /* returns 2 for ctrl-C */
   #endif
 }  }
   
 int executeToken(token)  int executeToken(token)
Line 992  errorStackmachine(str)
Line 1009  errorStackmachine(str)
   char message0[1024];    char message0[1024];
   char *message;    char *message;
   extern int ErrorMessageMode;    extern int ErrorMessageMode;
     cancelAlarm();
   if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {    if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {
     pushErrorStack(KnewErrorPacket(SerialCurrent,-1,str));      pushErrorStack(KnewErrorPacket(SerialCurrent,-1,str));
   }    }
Line 1083  KSexecuteString(s)
Line 1101  KSexecuteString(s)
   
   if (KSPushEnvMode) {    if (KSPushEnvMode) {
     *saved_EnvOfStackMachine = *EnvOfStackMachine;      *saved_EnvOfStackMachine = *EnvOfStackMachine;
   #if defined(__CYGWIN__)
       if (jval = sigsetjmp(EnvOfStackMachine,1)) {
   #else
     if (jval = setjmp(EnvOfStackMachine)) {      if (jval = setjmp(EnvOfStackMachine)) {
   #endif
       *EnvOfStackMachine = *saved_EnvOfStackMachine;        *EnvOfStackMachine = *saved_EnvOfStackMachine;
       if (jval == 2) {        if (jval == 2) {
         if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {          if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {
Line 1096  KSexecuteString(s)
Line 1118  KSexecuteString(s)
     }else{ }      }else{ }
   }else{    }else{
     if (recursive == 0) {      if (recursive == 0) {
   #if defined(__CYGWIN__)
         if (jval=sigsetjmp(EnvOfStackMachine,1)) {
   #else
       if (jval=setjmp(EnvOfStackMachine)) {        if (jval=setjmp(EnvOfStackMachine)) {
   #endif
         if (jval == 2) {          if (jval == 2) {
           if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {            if (ErrorMessageMode == 1 || ErrorMessageMode == 2) {
             pushErrorStack(KnewErrorPacket(SerialCurrent,-1,"User interrupt by ctrl-C."));              pushErrorStack(KnewErrorPacket(SerialCurrent,-1,"User interrupt by ctrl-C."));
Line 1450  struct object KSdupErrors() {
Line 1476  struct object KSdupErrors() {
   }    }
   return(rob);    return(rob);
 }  }
   
   void cancelAlarm() {
     alarm((unsigned int) 0);
     signal(SIGALRM,SIG_DFL);
   }

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>