=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Kan/stackmachine.c,v retrieving revision 1.19 retrieving revision 1.23 diff -u -p -r1.19 -r1.23 --- OpenXM/src/kan96xx/Kan/stackmachine.c 2004/09/11 12:13:41 1.19 +++ OpenXM/src/kan96xx/Kan/stackmachine.c 2004/09/12 01:53:11 1.23 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.18 2004/09/05 08:08:41 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.22 2004/09/12 01:32:08 takayama Exp $ */ /* stackmachin.c */ #include @@ -221,7 +221,7 @@ int putUserDictionary(str,h0,h1,ob,dic) } r = x; if (Strict2) { - switch((dic[x]).attr) { + switch(((dic[x]).attr) & (PROTECT | ABSOLUTE_PROTECT)) { case PROTECT: r = -PROTECT; /* Protected, but we rewrite it. */ break; @@ -229,7 +229,7 @@ int putUserDictionary(str,h0,h1,ob,dic) r = -ABSOLUTE_PROTECT; /* Protected and we do not rewrite it. */ return(r); default: - (dic[x]).attr = 0; + /* (dic[x]).attr = 0; */ /* It is not necesarry, I think. */ break; } } @@ -740,11 +740,13 @@ void scanner() { struct object ob; extern int Quiet; extern void ctrlC(); - int tmp; + int tmp, status; char *tmp2; extern int ErrorMessageMode; int jval; extern int InSendmsg2; + int infixOn = 0; + struct tokens infixToken; getokenSM(INIT); initSystemDictionary(); @@ -762,14 +764,14 @@ void scanner() { } /* setup quiet mode or not */ - token.kind = EXECUTABLE_STRING; + token.kind = EXECUTABLE_STRING; token.tflag = 0; if (Quiet) { token.token = " /@@@.quiet 1 def "; }else { token.token = " /@@@.quiet 0 def "; } executeToken(token); /* execute startup commands */ - token.kind = ID; + token.kind = ID; token.tflag = 0; token.token = "exec"; token = lookupTokens(token); /* set hashing values */ tmp = findSystemDictionary(token.token); @@ -785,10 +787,10 @@ void scanner() { StartFile = (char *)sGC_malloc(sizeof(char)*(strlen(StartFile)+ 40)); sprintf(StartFile,"$%s$ run\n",tmp2); - token.kind = EXECUTABLE_STRING; + token.kind = EXECUTABLE_STRING; token.tflag = 0; token.token = StartFile; executeToken(token); /* execute startup commands */ - token.kind = ID; + token.kind = ID; token.tflag = 0; token.token = "exec"; token = lookupTokens(token); /* set hashing values */ tmp = findSystemDictionary(token.token); @@ -798,10 +800,10 @@ void scanner() { } if (StartAString) { - token.kind = EXECUTABLE_STRING; + token.kind = EXECUTABLE_STRING; token.tflag = 0; token.token = StartString; executeToken(token); /* execute startup commands */ - token.kind = ID; + token.kind = ID; token.tflag = 0; token.token = "exec"; token = lookupTokens(token); /* set hashing values */ tmp = findSystemDictionary(token.token); @@ -834,12 +836,20 @@ void scanner() { Calling_ctrlC_hook = 0; KSexecuteString(" (Computation is interrupted.) "); /* move to ctrlC-hook? */ InSendmsg2 = 0; + infixOn = 0; continue ; } else { } if (DebugStack >= 1) { printOperandStack(); } - token = getokenSM(GET); - if ((tmp=executeToken(token)) < 0) break; - /***if (tmp == 1) fprintf(stderr," --- exit --- \n");*/ + token = getokenSM(GET); + if ((status=executeToken(token)) < 0) break; + /***if (status == 1) fprintf(stderr," --- exit --- \n");*/ + /* fprintf(stderr,"token.token=%s, status=%d, infixOn=%d\n",token.token,status,infixOn); */ + if (status & STATUS_INFIX) { + infixOn = 1; infixToken = token; infixToken.tflag |= NO_DELAY; + }else if (infixOn) { + infixOn = 0; + if ((status=executeToken(infixToken)) < 0) break; + } } } @@ -915,10 +925,13 @@ int executeToken(token) int status; struct tokens *tokenArray; int i,h0,h1; + int infixOn; + struct tokens infixToken; extern int WarningMessageMode; extern int Strict; extern int InSendmsg2; + infixOn = 0; if (GotoP) { /* for goto */ if (token.kind == ID && isLiteral(token.token)) { if (strcmp(&((token.token)[1]),GotoLabel) == 0) { @@ -964,6 +977,11 @@ int executeToken(token) h1 = ((token.object.lc.op)->rc).ival; ob=findUserDictionary(token.token,h0,h1,CurrentContextp); primitive = ((token.object.rc.op)->lc).ival; + if (!(token.tflag & NO_DELAY)) { + if ((ob.tag >= 0) && (UD_attr & ATTR_INFIX)) { + tracePopName(); return STATUS_INFIX; + } + } if (ob.tag >= 0) { /* there is a definition in the user dictionary */ if (ob.tag == SexecutableArray) { @@ -972,9 +990,22 @@ int executeToken(token) size = ob.rc.ival; for (i=0; i