Changeset 122 in dev for BasicCompiler32
- Timestamp:
- May 13, 2007, 1:50:02 PM (18 years ago)
- Location:
- BasicCompiler32
- Files:
-
- 3 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,
Note:
See TracChangeset
for help on using the changeset viewer.