#include "../BasicCompiler_Common/common.h" #ifdef _AMD64_ #include "../BasicCompiler64/opcode.h" #else #include "../BasicCompiler32/opcode.h" #endif double dbl_stack[255]; _int64 i64stack[255]; bool IsNumberTopChar(const char *buffer){ int c = buffer[0]; if('0' <= c && c <= '9') return true; if(c == '&' && (buffer[1] == 'h' || buffer[1] == 'H' || buffer[1] == 'o' || buffer[1] == 'O')) return true; return false; } bool IsNumberChar(const char c){ if('0' <= c && c <= '9') return true; if('a' <= c && c <= 'f') return true; if('A' <= c && c <= 'F') return true; if(c=='.' || c=='e'||c=='E') return true; return false; } BOOL IsJudgMark(const char *Command,int p){ if(Command[p]==1){ if(Command[p+1]==ESC_AND) return 1; if(Command[p+1]==ESC_OR) return 1; if(Command[p+1]==ESC_XOR) return 1; if(Command[p+1]==ESC_NOT) return 1; } return 0; } BOOL IsNumCalcMark(const char *Command,int p){ if(Command[p]=='^'||Command[p]=='*'||Command[p]=='/'||Command[p]=='\\'|| (Command[p]==1&&Command[p+1]==ESC_MOD)||Command[p]=='+'||Command[p]=='-'|| Command[p]=='='||Command[p]=='<'||Command[p]=='>'|| IsJudgMark(Command,p)|| (Command[p]==1&&Command[p+1]==ESC_AS)|| (Command[p]==1&&Command[p+1]==ESC_BYVAL)) return 1; return 0; } BOOL IsNumCalcMark_Back(const char *Command,int p){ if(p==0){ if(Command[p]=='^'||Command[p]=='*'||Command[p]=='/'||Command[p]=='\\'|| Command[p]=='+'||Command[p]=='-'|| Command[p]=='='||Command[p]=='<'||Command[p]=='>') return 1; } else{ if(Command[p]=='^'||Command[p]=='*'||Command[p]=='/'||Command[p]=='\\'|| (Command[p-1]==1&&Command[p]==ESC_MOD)||Command[p]=='+'||Command[p]=='-'|| Command[p]=='='||Command[p]=='<'||Command[p]=='>'|| IsJudgMark(Command,p-1)|| (Command[p-1]==1&&Command[p]==ESC_AS)) return 1; } return 0; } BOOL IsStrCalcMark(const char c){ if(c=='+'||c=='&') return 1; return 0; } BOOL IsExponent(const char *Command,int p){ int i,sw; for(i=p-2,sw=FALSE;i>=0;i--){ if(Command[i]>='0'&&Command[i]<='9') sw=TRUE; if(!((Command[i]>='0'&&Command[i]<='9')||Command[i]=='.')){ if((IsNumCalcMark(Command,i)||Command[i]=='('||Command[i]==')')&&sw) return TRUE; return FALSE; } if(i==0&&sw) return TRUE; } return FALSE; } int CompStr(char *str1,int len1,char *str2,int len2){ int i,len; if(len1(unsigned char *)str2[i]) return 1; else if((unsigned char *)str1[i]<(unsigned char *)str2[i]) return -1; } if(len1>len2) return 1; else if(len1=dbl_stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } else if(idCalc==CALC_P){ if(dbl_stack[sp-2]dbl_stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } else if(idCalc==CALC_NOTEQUAL){ if(dbl_stack[sp-2]!=dbl_stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } else if(idCalc==CALC_EQUAL){ if(dbl_stack[sp-2]==dbl_stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } //論理演算 else if(idCalc==CALC_XOR) dbl_stack[sp-2]=(double)((long)dbl_stack[sp-2]^(long)dbl_stack[sp-1]); else if(idCalc==CALC_OR) dbl_stack[sp-2]=(double)((long)dbl_stack[sp-2]|(long)dbl_stack[sp-1]); else if(idCalc==CALC_AND) dbl_stack[sp-2]=(double)((long)dbl_stack[sp-2]&(long)dbl_stack[sp-1]); //シフト演算 else if(idCalc==CALC_SHL) dbl_stack[sp-2]=(double)((DWORD)dbl_stack[sp-2]<<(DWORD)dbl_stack[sp-1]); else if(idCalc==CALC_SHR) dbl_stack[sp-2]=(double)((DWORD)dbl_stack[sp-2]>>(DWORD)dbl_stack[sp-1]); //算術演算 else if(idCalc==CALC_ADDITION) dbl_stack[sp-2]+=dbl_stack[sp-1]; else if(idCalc==CALC_SUBTRACTION) dbl_stack[sp-2]-=dbl_stack[sp-1]; else if(idCalc==CALC_MOD) dbl_stack[sp-2]=(double)((long)dbl_stack[sp-2]%(long)dbl_stack[sp-1]); else if(idCalc==CALC_PRODUCT) dbl_stack[sp-2]*=dbl_stack[sp-1]; else if(idCalc==CALC_QUOTIENT){ if(dbl_stack[sp-1]) dbl_stack[sp-2]/=dbl_stack[sp-1]; else{ //ゼロ割りエラーを検地 SetError(56,NULL,cp); } } else if(idCalc==CALC_INTQUOTIENT){ if(dbl_stack[sp-1]) dbl_stack[sp-2]=(double)(long)(dbl_stack[sp-2]/dbl_stack[sp-1]); else{ //ゼロ割りエラーを検地 SetError(56,NULL,cp); } } else if(idCalc==CALC_POWER) dbl_stack[sp-2]=pow(dbl_stack[sp-2],dbl_stack[sp-1]); } else{ /////////////// // 整数演算 /////////////// if(IsRealNumberType(type_stack[sp-2])) i64stack[sp-2]=(_int64)dbl_stack[sp-2]; if(IsRealNumberType(type_stack[sp-1])) i64stack[sp-1]=(_int64)dbl_stack[sp-1]; //比較演算 if(idCalc==CALC_PE){ if(IsSignedType(AnswerType)){ if(i64stack[sp-2]<=i64stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } else{ if(((unsigned _int64)i64stack[sp-2])<=((unsigned _int64)i64stack[sp-1])) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } AnswerType=DEF_LONG; } else if(idCalc==CALC_QE){ if(IsSignedType(AnswerType)){ if(i64stack[sp-2]>=i64stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } else{ if(((unsigned _int64)i64stack[sp-2])>=((unsigned _int64)i64stack[sp-1])) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } AnswerType=DEF_LONG; } else if(idCalc==CALC_P){ if(IsSignedType(AnswerType)){ if(i64stack[sp-2]i64stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } else{ if(((unsigned _int64)i64stack[sp-2])>((unsigned _int64)i64stack[sp-1])) i64stack[sp-2]=-1; else i64stack[sp-2]=0; } AnswerType=DEF_LONG; } else if(idCalc==CALC_NOTEQUAL){ if(i64stack[sp-2]!=i64stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } else if(idCalc==CALC_EQUAL){ if(i64stack[sp-2]==i64stack[sp-1]) i64stack[sp-2]=-1; else i64stack[sp-2]=0; AnswerType=DEF_LONG; } //論理演算 else if(idCalc==CALC_XOR) i64stack[sp-2]^=i64stack[sp-1]; else if(idCalc==CALC_OR) i64stack[sp-2]|=i64stack[sp-1]; else if(idCalc==CALC_AND) i64stack[sp-2]&=i64stack[sp-1]; //シフト演算 else if(idCalc==CALC_SHL){ i64stack[sp-2]<<=(DWORD)i64stack[sp-1]; if(IsSignedType(AnswerType)) AnswerType=DEF_LONG; else AnswerType=DEF_DWORD; } else if(idCalc==CALC_SHR){ i64stack[sp-2]>>=(DWORD)i64stack[sp-1]; if(IsSignedType(AnswerType)) AnswerType=DEF_LONG; else AnswerType=DEF_DWORD; } //算術演算 else if(idCalc==CALC_ADDITION) i64stack[sp-2]+=i64stack[sp-1]; else if(idCalc==CALC_SUBTRACTION) i64stack[sp-2]-=i64stack[sp-1]; else if(idCalc==CALC_MOD) i64stack[sp-2]%=i64stack[sp-1]; else if(idCalc==CALC_PRODUCT) i64stack[sp-2]*=i64stack[sp-1]; else if(idCalc==CALC_QUOTIENT|| idCalc==CALC_INTQUOTIENT){ if(i64stack[sp-1]) i64stack[sp-2]/=i64stack[sp-1]; else{ //ゼロ割りエラーを検地 SetError(56,NULL,cp); } } else if(idCalc==CALC_POWER) i64stack[sp-2]=(_int64)pow((double)i64stack[sp-2],(double)i64stack[sp-1]); if(IsSignedType(AnswerType)){ if(AnswerType==DEF_SBYTE&&(i64stack[sp-2]0;pnum++){ sp--; calc[pnum]=(int)stack[sp]; } break; } //論理演算子 if(Command[i]==1&&Command[i+1]==ESC_XOR) i3=CALC_XOR; else if(Command[i]==1&&Command[i+1]==ESC_OR) i3=CALC_OR; else if(Command[i]==1&&Command[i+1]==ESC_AND) i3=CALC_AND; else if(Command[i]==1&&Command[i+1]==ESC_NOT) i3=CALC_NOT; //ビット演算子(優先順位は算術演算子の後部) else if(Command[i]=='<'&&Command[i+1]=='<'){ i3=CALC_SHL; i++; } else if(Command[i]=='>'&&Command[i+1]=='>'){ i3=CALC_SHR; i++; } //比較演算子 else if(Command[i]=='<'&&Command[i+1]=='='|| Command[i]=='='&&Command[i+1]=='<'){ i3=CALC_PE; i++; } else if(Command[i]=='>'&&Command[i+1]=='='|| Command[i]=='='&&Command[i+1]=='>'){ i3=CALC_QE; i++; } else if(Command[i]=='<'&&Command[i+1]=='>'|| Command[i]=='>'&&Command[i+1]=='<'){ i3=CALC_NOTEQUAL; i++; } else if(Command[i]=='=') i3=CALC_EQUAL; else if(Command[i]=='<') i3=CALC_P; else if(Command[i]=='>') i3=CALC_Q; //算術演算子 else if(Command[i]=='+'||Command[i]=='&') i3=CALC_ADDITION; else if(Command[i]=='-'&&i2) i3=CALC_SUBTRACTION; else if(Command[i]==1&&Command[i+1]==ESC_MOD) i3=CALC_MOD; else if(Command[i]=='*') i3=CALC_PRODUCT; else if(Command[i]=='/') i3=CALC_QUOTIENT; else if(Command[i]=='\\') i3=CALC_INTQUOTIENT; else if(Command[i]=='-'&&i2==0) i3=CALC_MINUSMARK; else if(Command[i]=='^') i3=CALC_POWER; else if(Command[i]==1&&Command[i+1]==ESC_AS) i3=CALC_AS; else if(Command[i]==1&&Command[i+1]==ESC_BYVAL) i3=CALC_BYVAL; i3+=PareNum*100; if(sp){ if(stack[sp-1]>i3-3&& (!( (stack[sp-1]%100==CALC_MINUSMARK||stack[sp-1]%100==CALC_NOT)&& (i3%100==CALC_MINUSMARK||i3%100==CALC_NOT) )) ){ for(;sp>0;){ sp--; calc[pnum]=(int)stack[sp]; pnum++; if(!(stack[sp-1]>i3-3)) break; } } } stack[sp]=i3; sp++; if(Command[i]==1) i++; i2=-1; continue; } Parms[i2]=Command[i]; } int type_stack[255]; LONG_PTR index_stack[255]; int idCalc; for(i=0,sp=0;i=2;i--){ *pi64=(*pi64)+(_int64)(i64temp*temporary[i]); i64temp*=8; } } else if(temporary[1]=='h'||temporary[1]=='H'){ CharUpper(temporary+2); for(i=2;;i++){ i3=temporary[i]-0x30; if(i3<0||9=2;i--){ *pi64=(*pi64)+(_int64)(i64temp*temporary[i]); i64temp*=0x10; } } else{ SetError(12,"&",cp); return DEF_BYTE; } if(BaseType==DEF_INT64||BaseType==DEF_QWORD) return DEF_QWORD; if(((unsigned _int64)*pi64)<=UCHAR_MAX){ //符号無し8ビット整数のリテラル値 return DEF_BYTE; } else if(((unsigned _int64)*pi64)<=USHRT_MAX){ //符号無し16ビット整数のリテラル値 return DEF_WORD; } else if(((unsigned _int64)*pi64)<=UINT_MAX){ //符号無し32ビット整数のリテラル値 return DEF_DWORD; } else{ //符号無し64ビット整数のリテラル値 return DEF_QWORD; } } else if((value[0]>='0'&&value[0]<='9')||value[0]=='+'||value[0]=='-'||(value[0]=='.'&&(!IsVariableTopChar(value[1])))){ for(i=0;;i++){ if(value[i]!='-') break; } if(value[i]=='.'){ SlideString(value+i,1); value[i]='0'; } //エラーチェック bDbl=0; sw1=0; sw2=0; for(i2=i;;i2++){ if(value[i2]=='\0') break; if(value[i2]=='.') bDbl=1; if(!((value[i2]>='0'&&value[i2]<='9')||value[i2]=='.')){ if((value[i2]=='e'||value[i2]=='E')&&sw1==0){ bDbl=1; sw1=1; } else if((value[i2]=='+'||value[i2]=='-')&&sw1==1&&sw2==0) sw2=1; else{ extern BOOL bDebugRun; if(bDebugRun) return DEF_DOUBLE; SetError(3,value,cp); return DEF_DOUBLE; } } } if(bDbl){ //実数のリテラル値 if(i%2) dbl=-atof(value+i); else dbl=atof(value+i); memcpy(pi64,&dbl,sizeof(double)); if(BaseType==DEF_SINGLE) return DEF_SINGLE; return DEF_DOUBLE; } else{ *pi64=_atoi64(value+i); if(i%2) *pi64=-(*pi64); if(BaseType==DEF_INT64||BaseType==DEF_QWORD) return BaseType; if(LONG_MIN<=*pi64&&*pi64<=LONG_MAX){ //符号有り32ビット整数のリテラル値 return DEF_LONG; } else if(*pi64<=UINT_MAX){ //符号無し32ビット整数のリテラル値 return DEF_DWORD; } else{ //符号有り64ビット整数のリテラル値 return DEF_INT64; } } } extern BOOL bDebugRun; if(bDebugRun) return DEF_DOUBLE; SetError(33,NULL,cp); return DEF_DOUBLE; } #pragma optimize("", on) BOOL GetConstCalcBuffer(const char *name,const char *Parameter,char *pCalcBuffer){ extern HANDLE hHeap; int i2,i3,i4,num; char temporary[VN_SIZE]; char *pParms[MAX_PARMS]; CONSTINFO *pci; pci=GetConstHash(name); if(!pci) return 0; num=0; i2=0; while(1){ i2=GetOneParameter(Parameter,i2,temporary); pParms[num]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+1); lstrcpy(pParms[num],temporary); num++; if(Parameter[i2]=='\0') break; } if(num!=pci->ParmNum){ extern int cp; for(i2=0;i2StrValue[i2])){ temporary[i3]=0; break; } temporary[i3]=pci->StrValue[i2]; } //パラメータと照合する for(i3=0;i3ParmNum;i3++){ if(lstrcmp(pci->ppParm[i3],temporary)==0) break; } if(i3==pci->ParmNum){ //パラメータでないとき lstrcpy(pCalcBuffer+i4,temporary); i4+=lstrlen(temporary); } else{ //パラメータのとき lstrcpy(pCalcBuffer+i4,pParms[i3]); i4+=lstrlen(pParms[i3]); } //演算子をコピー for(;;i2++,i4++){ if(pci->StrValue[i2]==1){ pCalcBuffer[i4++]=pci->StrValue[i2++]; pCalcBuffer[i4]=pci->StrValue[i2]; continue; } if(IsVariableTopChar(pci->StrValue[i2])) break; pCalcBuffer[i4]=pci->StrValue[i2]; if(pci->StrValue[i2]=='\0') break; } if(pci->StrValue[i2]=='\0') break; } for(i2=0;i2StrValue){ //文字列定数 //バイト数 *pDbl=pci->DblValue; //データ memcpy(buffer,pci->StrValue,(int)pci->DblValue); if(plpIndex) *plpIndex=pci->lpIndex; return DEF_STRING; } else{ if(pci->type==DEF_INT64){ memcpy(pDbl,&pci->i64Value,sizeof(_int64)); return DEF_INT64; } if(plpIndex) *plpIndex=pci->lpIndex; *pDbl=pci->DblValue; return pci->type; } } if(plpIndex) *plpIndex=-1; return -1; } int IsStrCalculation(char *Command){ int i,i2,i3,i4,PareNum; char temporary[VN_SIZE],temp2[8192]; for(i=0,i2=0;;i++){ if(Command[i]=='('){ for(i++,PareNum=1;;i++){ if(Command[i]=='(') PareNum++; else if(Command[i]==')'){ PareNum--; if(PareNum==0) break; } } continue; } if(Command[i]=='['){ for(i++,PareNum=1;;i++){ if(Command[i]=='[') PareNum++; else if(Command[i]==']'){ PareNum--; if(PareNum==0) break; } } continue; } if(Command[i]=='\"'){ i++; while(Command[i]!='\"') i++; continue; } if(Command[i]=='\0'){ if(IsVariableTopChar(Command[i2])|| Command[i2]=='.'&&IsVariableTopChar(Command[i2+1])){ if((Command[i2]=='e'||Command[i2]=='E')&& (Command[i2+1]=='x'||Command[i2+1]=='X')&& Command[i2+2]=='\"'){ //拡張文字列 return 1; } for(i3=0;;i3++){ if(Command[i2+i3]=='('){ temporary[i3]=0; break; } temporary[i3]=Command[i2+i3]; if(Command[i2+i3]=='\0') break; } if(Command[i2+i3]=='('){ //DLL関数の場合 DllProc *pDllProc; pDllProc=GetDeclareHash(temporary); if(pDllProc){ if( pDllProc->ReturnType().IsStringClass() ){ return 1; } return 0; } //ユーザー定義関数 UserProc *pUserProc; pUserProc=GetSubHash(temporary); if(pUserProc){ if( pUserProc->ReturnType().IsStringClass() ){ return 1; } return 0; } //組み込み関数 i4=GetFunctionFromName(temporary); if(i4){ //組み込み関数は文字列を返さない return 0; } //定数 CONSTINFO *pci; pci=GetConstHash(temporary); if(pci){ if(pci->ParmNum){ //マクロ関数の場合 GetStringInPare_RemovePare(temporary,Command+i2+i3+1); GetConstCalcBuffer(pci->name,temporary,temp2); return IsStrCalculation(temp2); } if(pci->type==DEF_STRING) return 1; else return 0; } } //定数 i3 = CDBConst::obj.GetBasicType(Command+i2); if(i3==DEF_STRING) return 1; //文字列 if(i3) return 0; //数値 //変数 Type varType; if( !GetVarType(Command+i2,varType,1) ){ //エラー return -1; } if( varType.IsStringClass() ){ return 1; } } else if(Command[i2]=='\"') return 1; break; } if(IsNumCalcMark(Command,i)||IsStrCalcMark(Command[i])){ if(IsStrCalcMark(Command[i])){ //&H、&O表記の場合を考慮 if(i==0) continue; if(IsNumCalcMark(Command,i-1)) continue; if(Command[i+1]=='(') break; i2=i+1; continue; } break; } } return 0; } BYTE GetCalcId(const char *Command,int *pi){ *pi=0; if(Command[0]==1) *pi=1; //論理演算子 if(Command[0]==1&&Command[1]==ESC_XOR) return CALC_XOR; else if(Command[0]==1&&Command[1]==ESC_OR) return CALC_OR; else if(Command[0]==1&&Command[1]==ESC_AND) return CALC_AND; else if(Command[0]==1&&Command[1]==ESC_NOT) return CALC_NOT; //ビット演算子(優先順位は算術演算子の後部) else if(Command[0]=='<'&&Command[1]=='<'){ *pi=1; return CALC_SHL; } else if(Command[0]=='>'&&Command[1]=='>'){ *pi=1; return CALC_SHR; } //比較演算子 else if(Command[0]=='<'&&Command[1]=='='|| Command[0]=='='&&Command[1]=='<'){ *pi=1; return CALC_PE; } else if(Command[0]=='>'&&Command[1]=='='|| Command[0]=='='&&Command[1]=='>'){ *pi=1; return CALC_QE; } else if(Command[0]=='<'&&Command[1]=='>'|| Command[0]=='>'&&Command[1]=='<'){ *pi=1; return CALC_NOTEQUAL; } else if(Command[0]=='=') return CALC_EQUAL; else if(Command[0]=='<') return CALC_P; else if(Command[0]=='>') return CALC_Q; //算術演算子 else if(Command[0]=='+') return CALC_ADDITION; else if(Command[0]=='-') return CALC_SUBTRACTION; else if(Command[0]=='&') return CALC_STRPLUS; else if(Command[0]==1&&Command[1]==ESC_MOD) return CALC_MOD; else if(Command[0]=='*') return CALC_PRODUCT; else if(Command[0]=='/') return CALC_QUOTIENT; else if(Command[0]=='\\') return CALC_INTQUOTIENT; else if(Command[0]=='^') return CALC_POWER; else if(Command[0]==1&&Command[1]==ESC_AS) return CALC_AS; else if(Command[0]==1&&Command[1]==ESC_BYVAL) return CALC_BYVAL; return 0; } BOOL GetNumOpeElements(const char *Command,int *pnum, char *values[255],long calc[255],long stack[255]){ extern int cp; extern HANDLE hHeap; int i,i2,i3,i4,PareNum,sp; char temporary[1024]; for(i=0,i2=0,sp=0,*pnum=0,PareNum=0;;i++,i2++){ if(Command[i]=='\"'){ temporary[i2]=Command[i]; for(i++,i2++;;i++,i2++){ temporary[i2]=Command[i]; if(Command[i]=='\"') break; } continue; } else if(Command[i]=='['){ i3=GetStringInBracket(temporary+i2,Command+i); i+=i3-1; i2+=i3-1; continue; } else if(Command[i]=='('){ if(i==0){ PareNum++; i2=-1; continue; } else if(IsNumCalcMark_Back(Command,i-1)||Command[i-1]=='('){ PareNum++; i2=-1; continue; } else{ //配列変数の場合を考慮 i3=GetStringInPare(temporary+i2,Command+i); i+=i3-1; i2+=i3-1; continue; } } else if(Command[i]==')'){ PareNum--; i2--; continue; } else if(IsNumCalcMark(Command,i)||(Command[i]=='&'&&i2!=0)){ if((Command[i]=='+'||Command[i]=='-')&&(Command[i-1]=='e'||Command[i-1]=='E')){ if(IsExponent(Command,i)){ temporary[i2]=Command[i]; continue; } } temporary[i2]=0; if((stack[sp-1]%100)==CALC_AS&&Command[i]=='*'){ for(i3=0;i3i3-3&& (!( (stack[sp-1]%100==CALC_MINUSMARK || stack[sp-1]%100==CALC_NOT || stack[sp-1]%100==CALC_POWER)&& (i3%100==CALC_MINUSMARK || i3%100==CALC_NOT) )) ){ for(;sp>0;){ sp--; calc[*pnum]=stack[sp]; values[*pnum]=0; (*pnum)++; if(!(stack[sp-1]>i3-3)) break; } } } stack[sp]=i3; sp++; i2=-1; continue; } temporary[i2]=Command[i]; if(Command[i]=='\0'){ calc[*pnum]=0; values[*pnum]=(char *)HeapAlloc(hHeap,0,lstrlen(temporary)+255); lstrcpy(values[*pnum],temporary); (*pnum)++; for(;sp>0;(*pnum)++){ sp--; calc[*pnum]=stack[sp]; values[*pnum]=0; } break; } } calc[*pnum]=0; return 1; }