Changeset 122 in dev
- Timestamp:
- May 13, 2007, 1:50:02 PM (18 years ago)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Statement.cpp
r88 r122 4 4 void OpcodeOthers(char *Command){ 5 5 int i,i2; 6 char buffer[8192];7 6 UserProc *pUserProc; 8 7 8 char leftTerm[8192]; 9 int lastParePos = 0; 9 10 for(i=0;;i++){ 10 if(Command[i]=='['){ 11 i2=GetStringInBracket(buffer+i,Command+i); 11 if(Command[i]=='\"'){ 12 //ダブルクォートは不正なのでエラー扱い 13 leftTerm[i]=0; 14 SetError(3,leftTerm,cp); 15 return; 16 } 17 18 if(Command[i]=='('){ 19 lastParePos = i; 20 i2=GetStringInPare(leftTerm+i,Command+i); 12 21 i+=i2-1; 13 22 continue; 14 23 } 15 if(Command[i]==1&&Command[i+1]==ESC_PSMEM){ 16 buffer[i]=Command[i]; 17 i++; 18 buffer[i]=Command[i]; 24 if(Command[i]=='['){ 25 i2=GetStringInBracket(leftTerm+i,Command+i); 26 i+=i2-1; 19 27 continue; 20 28 } 21 if( !IsVariableChar(Command[i])){22 buffer[i]=0;29 if(Command[i]=='\0'){ 30 leftTerm[i] = 0; 23 31 break; 24 32 } 25 buffer[i]=Command[i]; 26 } 27 33 34 if( IsNumCalcMark( Command, i ) ){ 35 leftTerm[i] = 0; 36 break; 37 } 38 39 leftTerm[i]=Command[i]; 40 } 28 41 if(!( 29 IsVariableTopChar( buffer[0])||30 buffer[0]=='.'||31 ( buffer[0]==1&&buffer[1]==ESC_PSMEM)42 IsVariableTopChar(leftTerm[0])|| 43 leftTerm[0]=='.'|| 44 (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM) 32 45 )){ 33 46 SetError(1,NULL,cp); … … 36 49 37 50 38 if(Command[i]=='\0' ){51 if(Command[i]=='\0' && lastParePos == 0){ 39 52 ////////////////////////////// 40 53 // パラメータ無しのマクロ検索 … … 58 71 59 72 if(pUserProc){ 60 if( !pUserProc->IsMacro() ) SetError(10,Command,cp); 73 if( !pUserProc->IsMacro() ){ 74 SetError(10,Command,cp); 75 } 61 76 62 77 Opcode_CallProc("",pUserProc,0,"",0); … … 71 86 } 72 87 73 int idProc; 74 void *pProc; 75 idProc=GetProc(buffer,(void **)&pProc); 76 77 int i4; 78 char temp2[VN_SIZE]; 79 if(idProc){ 80 if(Command[i]!='('){ 81 SetError(10,buffer,cp); 82 return; 83 } 84 i4=GetStringInPare_RemovePare(temp2,Command+i+1); 85 86 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 87 if(Command[i+1+i4+1]!='\0') SetError(42,NULL,cp); 88 89 //////////////// 90 // 呼び出し 91 //////////////// 92 93 Type resultType; 94 CallProc(idProc,pProc,buffer,temp2,resultType); 95 88 89 Type resultType; 90 bool isLiteral; 91 BOOL bUseHeap; 92 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true ); 93 94 if( result ){ 96 95 97 96 ///////////////////// … … 110 109 FreeTempObject(REG_EBX,&resultType.GetClass()); 111 110 } 111 112 //成功 112 113 return; 113 114 } 114 115 115 116 ////////////////////////// 117 // その他は代入演算を行う 118 ////////////////////////// 119 OpcodeCalc(Command); 116 // 失敗 117 SetError(1, NULL,cp); 120 118 } 121 119 -
BasicCompiler32/NumOpe.cpp
r117 r122 227 227 return false; 228 228 } 229 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL){229 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly ){ 230 230 char parameter[VN_SIZE]; 231 231 … … 293 293 294 294 295 if(lstrcmpi(termFull,"This")==0 ){295 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){ 296 296 //Thisオブジェクト 297 297 resultType.SetType( DEF_OBJECT, pobj_CompilingClass ); … … 387 387 return true; 388 388 } 389 } 390 else if( isProcedureCallOnly ){ 391 // 関数呼び出し以外は受け付けない 392 return false; 389 393 } 390 394 -
BasicCompiler32/Opcode.h
r111 r122 102 102 //NumOpe.cpp 103 103 void PushReturnValue(int type); 104 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL, bool isProcedureCallOnly = false ); 104 105 bool NumOpe( int reg, 105 106 const char *expression, -
BasicCompiler64/Compile_Statement.cpp
r97 r122 4 4 void OpcodeOthers(char *Command){ 5 5 int i,i2; 6 char buffer[8192];7 6 UserProc *pUserProc; 8 7 8 char leftTerm[8192]; 9 int lastParePos = 0; 9 10 for(i=0;;i++){ 10 if(Command[i]=='['){ 11 i2=GetStringInBracket(buffer+i,Command+i); 11 if(Command[i]=='\"'){ 12 //ダブルクォートは不正なのでエラー扱い 13 leftTerm[i]=0; 14 SetError(3,leftTerm,cp); 15 return; 16 } 17 18 if(Command[i]=='('){ 19 lastParePos = i; 20 i2=GetStringInPare(leftTerm+i,Command+i); 12 21 i+=i2-1; 13 22 continue; 14 23 } 15 if(Command[i]==1&&Command[i+1]==ESC_PSMEM){ 16 buffer[i]=Command[i]; 17 i++; 18 buffer[i]=Command[i]; 24 if(Command[i]=='['){ 25 i2=GetStringInBracket(leftTerm+i,Command+i); 26 i+=i2-1; 19 27 continue; 20 28 } 21 if( !IsVariableChar(Command[i])){22 buffer[i]=0;29 if(Command[i]=='\0'){ 30 leftTerm[i] = 0; 23 31 break; 24 32 } 25 buffer[i]=Command[i]; 26 } 27 33 34 if( IsNumCalcMark( Command, i ) ){ 35 leftTerm[i] = 0; 36 break; 37 } 38 39 leftTerm[i]=Command[i]; 40 } 28 41 if(!( 29 IsVariableTopChar( buffer[0])||30 buffer[0]=='.'||31 ( buffer[0]==1&&buffer[1]==ESC_PSMEM)42 IsVariableTopChar(leftTerm[0])|| 43 leftTerm[0]=='.'|| 44 (leftTerm[0]==1&&leftTerm[1]==ESC_PSMEM) 32 45 )){ 33 46 SetError(1,NULL,cp); … … 36 49 37 50 38 if(Command[i]=='\0' ){51 if(Command[i]=='\0' && lastParePos == 0){ 39 52 ////////////////////////////// 40 53 // パラメータ無しのマクロ検索 … … 73 86 } 74 87 75 int idProc; 76 void *pProc; 77 idProc=GetProc(buffer,(void **)&pProc); 78 79 int i4; 80 char temp2[VN_SIZE]; 81 if(idProc){ 82 if(Command[i]!='('){ 83 SetError(10,buffer,cp); 84 return; 85 } 86 i4=GetStringInPare_RemovePare(temp2,Command+i+1); 87 88 //閉じカッコ")"に続く文字がNULLでないときはエラーにする 89 if(Command[i+1+i4+1]!='\0') SetError(42,NULL,cp); 90 91 //////////////// 92 // 呼び出し 93 //////////////// 94 95 Type resultType; 96 CallProc(idProc,pProc,buffer,temp2,resultType); 97 88 if( pobj_reg ){ 89 SetError(); 90 } 91 pobj_reg=new CRegister(REG_RAX); 92 93 Type resultType; 94 bool isLiteral; 95 BOOL bUseHeap; 96 bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true ); 97 98 delete pobj_reg; 99 pobj_reg = NULL; 100 101 if( result ){ 98 102 99 103 ///////////////////// … … 107 111 FreeTempObject(REG_R14,&resultType.GetClass()); 108 112 } 109 return; 110 } 111 112 113 ////////////////////////// 114 // その他は代入演算を行う 115 ////////////////////////// 116 OpcodeCalc(Command); 113 114 //成功 115 return; 116 } 117 118 // 失敗 119 SetError(1, NULL,cp); 117 120 } 118 121 -
BasicCompiler64/NumOpe.cpp
r117 r122 224 224 return false; 225 225 } 226 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL){226 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly ){ 227 227 char parameter[VN_SIZE]; 228 228 … … 290 290 291 291 292 if(lstrcmpi(termFull,"This")==0 ){292 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){ 293 293 //Thisオブジェクト 294 294 resultType.SetType( DEF_OBJECT, pobj_CompilingClass ); … … 386 386 return true; 387 387 } 388 } 389 else if( isProcedureCallOnly ){ 390 // 関数呼び出し以外は受け付けない 391 return false; 388 392 } 389 393 … … 775 779 ////////////////// 776 780 // 何らかの識別子 777 778 if( (string)term=="ParentArea.NamespaceEnumTest.x"){779 int test=0;780 }781 781 782 782 bool isLiteral; -
BasicCompiler64/Opcode.h
r111 r122 251 251 252 252 //NumOpe.cpp 253 bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName = NULL, bool isProcedureCallOnly = false ); 253 254 bool NumOpe( int *pReg, 254 255 const char *Command, … … 297 298 //increment.cpp 298 299 void IncDec(int idCalc, char *lpszLeft, char *lpszRight); 299 300 //calc2.cpp301 #define EXP_TYPE_NUMBER 1302 #define EXP_TYPE_EAX 2303 #define EXP_TYPE_FPU 3304 #define EXP_TYPE_VAR 4305 int NumOpEx(char *Command,double *pDbl,DWORD *pdwType,RELATIVE_VAR *pRelativeVar);306 300 307 301 //Compile_Calc_PushVar.cpp
Note:
See TracChangeset
for help on using the changeset viewer.