| version 1.32, 2005/07/03 11:08:54 |
version 1.35, 2006/02/02 04:16:49 |
|
|
| /* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.31 2005/06/16 05:07:23 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/stackmachine.c,v 1.34 2006/02/01 00:30:05 takayama Exp $ */ |
| /* stackmachin.c */ |
/* stackmachin.c */ |
| |
|
| #include <stdio.h> |
#include <stdio.h> |
| Line 89 int OXlockSaved = 0; |
|
| Line 89 int OXlockSaved = 0; |
|
| char *UD_str; |
char *UD_str; |
| int UD_attr; |
int UD_attr; |
| |
|
| |
struct object *MsgStackTraceInArrayp = NULL; |
| |
char *MsgStackTrace = NULL; |
| |
char *MsgSourceTrace = NULL; |
| |
|
| struct object * newObject() |
struct object * newObject() |
| { |
{ |
| struct object *r; |
struct object *r; |
| Line 1061 int executeToken(token) |
|
| Line 1065 int executeToken(token) |
|
| return(0); /* normal exit.*/ |
return(0); /* normal exit.*/ |
| } |
} |
| } |
} |
| if (WarningMessageMode == 1 || WarningMessageMode == 2) { |
{ |
| char tmpc[1024]; |
char tmpc[1024]; |
| if (strlen(token.token) < 900) { |
if (strlen(token.token) < 900) { |
| sprintf(tmpc,"\n%%Warning: The identifier <<%s>> is not in the system dictionary\n%% nor in the user dictionaries. Push NullObject.\n",token.token); |
sprintf(tmpc,"\n%%Warning: The identifier <<%s>> is not in the system dictionary\n%% nor in the user dictionaries. Push NullObject.\n",token.token); |
| }else {strcpy(tmpc,"Warning: identifier is not in the dictionaries.");} |
}else {strcpy(tmpc,"\n%%Warning: identifier is not in the dictionaries.\n");} |
| pushErrorStack(KnewErrorPacket(SerialCurrent,-1,tmpc)); |
if (WarningMessageMode == 1 || WarningMessageMode == 2) { |
| |
pushErrorStack(KnewErrorPacket(SerialCurrent,-1,tmpc)); |
| |
} |
| |
if (WarningMessageMode != 1) { |
| |
fprintf(Fstack,"%s",tmpc); |
| |
/*fprintf(Fstack,"(%d,%d)\n",h0,h1);*/ |
| |
} |
| |
if (Strict) { |
| |
errorStackmachine(tmpc); |
| |
} |
| |
Kpush(NullObject); |
| } |
} |
| if (WarningMessageMode != 1) { |
|
| fprintf(Fstack,"\n%%Warning: The identifier <<%s>> is not in the system dictionary\n%% nor in the user dictionaries. Push NullObject.\n",token.token); |
|
| /*fprintf(Fstack,"(%d,%d)\n",h0,h1);*/ |
|
| } |
|
| if (Strict) { |
|
| errorStackmachine("Warning: identifier is not in the dictionaries"); |
|
| } |
|
| Kpush(NullObject); |
|
| } |
} |
| } |
} |
| } else if (token.kind == EXECUTABLE_STRING) { |
} else if (token.kind == EXECUTABLE_STRING) { |
| Line 1111 errorStackmachine(str) |
|
| Line 1117 errorStackmachine(str) |
|
| extern int RestrictedMode, RestrictedMode_saved; |
extern int RestrictedMode, RestrictedMode_saved; |
| RestrictedMode = RestrictedMode_saved; |
RestrictedMode = RestrictedMode_saved; |
| cancelAlarm(); |
cancelAlarm(); |
| |
MsgStackTrace = NULL; |
| |
MsgSourceTrace = NULL; |
| if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { |
if (ErrorMessageMode == 1 || ErrorMessageMode == 2) { |
| pushErrorStack(KnewErrorPacket(SerialCurrent,-1,str)); |
pushErrorStack(KnewErrorPacket(SerialCurrent,-1,str)); |
| } |
} |
| Line 1144 errorStackmachine(str) |
|
| Line 1152 errorStackmachine(str) |
|
| fprintf(stderr,str); |
fprintf(stderr,str); |
| } |
} |
| fprintf(stderr,"\n"); |
fprintf(stderr,"\n"); |
| (void) traceShowStack(); |
MsgStackTraceInArrayp = traceNameStackToArrayp(); |
| |
MsgStackTrace = traceShowStack(); |
| |
MsgSourceTrace = traceShowScannerBuf(); |
| } |
} |
| traceClearStack(); |
traceClearStack(); |
| if (GotoP) { |
if (GotoP) { |
| Line 1389 char *KSpopBinary(int *size) { |
|
| Line 1399 char *KSpopBinary(int *size) { |
|
| return((char *)NULL); |
return((char *)NULL); |
| } |
} |
| |
|
| |
struct object KSnewObjectArray(int k) { |
| |
return newObjectArray(k); |
| |
} |
| |
|
| int pushErrorStack(struct object obj) |
int pushErrorStack(struct object obj) |
| { |
{ |
| if (CurrentOperandStack == &ErrorStack) { |
if (CurrentOperandStack == &ErrorStack) { |
| Line 1627 void traceClearStack(void) { |
|
| Line 1641 void traceClearStack(void) { |
|
| char *tracePopName(void) { |
char *tracePopName(void) { |
| if (TraceNameStackp <= 0) return (char *) NULL; |
if (TraceNameStackp <= 0) return (char *) NULL; |
| return TraceNameStack[--TraceNameStackp]; |
return TraceNameStack[--TraceNameStackp]; |
| |
} |
| |
struct object *traceNameStackToArrayp(void) { |
| |
int n,i; |
| |
struct object *op; |
| |
op = sGC_malloc(sizeof(struct object)); |
| |
n = TraceNameStackp; if (n < 0) n = 0; |
| |
*op = newObjectArray(n); |
| |
for (i=0; i<n; i++) { |
| |
putoa((*op),i, KpoString(TraceNameStack[i])); |
| |
} |
| |
return op; |
| } |
} |
| #define TRACE_MSG_SIZE 320 |
#define TRACE_MSG_SIZE 320 |
| char *traceShowStack(void) { |
char *traceShowStack(void) { |