Changeset 75 in dev for BasicCompiler32/Compile_Var.cpp
- Timestamp:
- Mar 20, 2007, 4:36:16 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_Var.cpp
r73 r75 11 11 int AllLocalVarSize; 12 12 13 void SetRelativeOffset(int *pType,LONG_PTR lpIndex,RELATIVE_VAR *pRelativeVar,char *lpPtrOffset){ 14 int i2; 15 13 void SetRelativeOffset( Type &resultType, RELATIVE_VAR *pRelativeVar,const char *lpPtrOffset){ 16 14 PushLongVariable(pRelativeVar); 17 15 18 i2=NumOpe(lpPtrOffset,0,0,0); 19 ChangeTypeToLong(i2); 16 Type type; 17 NumOpe( lpPtrOffset, Type(), type ); 18 ChangeTypeToLong( type.GetBasicType() ); 20 19 21 20 //pop ebx 22 21 op_pop(REG_EBX); 23 22 24 if( PTR_LEVEL(*pType)){25 *pType = PTR_LEVEL_DOWN( *pType);26 27 i 2=GetTypeSize(*pType,lpIndex);28 if( i2>=2){23 if( resultType.PtrLevel() ){ 24 resultType.PtrLevelDown(); 25 26 int typeSize = resultType.GetSize(); 27 if(typeSize>=2){ 29 28 //imul ebx,i2 30 op_imul_RV( REG_EBX, i2);29 op_imul_RV( REG_EBX, typeSize ); 31 30 } 32 31 } … … 58 57 } 59 58 } 60 BOOL GetArrayOffset(int *SubScripts,char *array,int type,LONG_PTR lpIndex){59 bool GetArrayOffset(const int *SubScripts,char *array, const Type &type){ 61 60 extern HANDLE hHeap; 62 int i,i2,i3,i4 ,TypeSize;61 int i,i2,i3,i4; 63 62 char temporary[VN_SIZE],*pParm[MAX_PARMS]; 64 63 … … 110 109 111 110 for(i=i3-1;i>=0;i--){ 112 T YPEINFO TypeInfo;111 Type tempType; 113 112 BOOL bUseHeap; 114 TypeInfo.type=NumOpe(pParm[i],DEF_LONG,-1,&TypeInfo.u.lpIndex,&bUseHeap);115 if( TypeInfo.type==DEF_OBJECT){113 NumOpe( pParm[i], Type( DEF_LONG ), tempType, &bUseHeap ); 114 if( tempType.IsObject() ){ 116 115 //キャスト演算子のオーバーロードに対応する 117 116 CallCastOperatorProc( 118 TypeInfo.type,TypeInfo.u.lpIndex,119 bUseHeap, DEF_LONG,-1);120 TypeInfo.type=DEF_LONG;121 } 122 ChangeTypeToLong( TypeInfo.type);117 tempType, 118 bUseHeap, Type(DEF_LONG) ); 119 tempType.SetBasicType( DEF_LONG ); 120 } 121 ChangeTypeToLong( tempType.GetBasicType() ); 123 122 124 123 //pop eax … … 144 143 op_pop(REG_EAX); 145 144 146 TypeSize=GetTypeSize(type,lpIndex);147 148 145 //imul eax,TypeSize 149 146 OpBuffer[obp++]=(char)0x69; 150 147 OpBuffer[obp++]=(char)0xC0; 151 *((long *)(OpBuffer+obp)) =TypeSize;148 *((long *)(OpBuffer+obp)) = type.GetSize(); 152 149 obp+=sizeof(long); 153 150 … … 161 158 return 1; 162 159 } 163 BOOL GetMemberOffset(bool isErrorEnabled, bool isWriteAccess, CClass *pobj_c, char *member, int *pType, RELATIVE_VAR *pRelativeVar, LONG_PTR *plpNestIndex, BOOL bPrivateAccess){160 bool _member_offset(bool isErrorEnabled, bool isWriteAccess, const CClass &objClass, const char *member, RELATIVE_VAR *pRelativeVar, Type &resultType, BOOL bPrivateAccess){ 164 161 int i; 165 162 166 //クラス、配列の構成要素を解析する 163 164 ////////////////////////////////////// 165 // クラス、配列の構成要素を解析する 166 ////////////////////////////////////// 167 167 168 char VarName[VN_SIZE]; //変数名 168 169 char array[VN_SIZE]; //第1次配列 … … 171 172 CClass::RefType refType; 172 173 lstrcpy(VarName,member); 173 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,refType)) return 0; 174 if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,refType)) return false; 175 174 176 175 177 //////////////////////////// … … 177 179 //////////////////////////// 178 180 179 int offset =pobj_c->GetMemberOffset( VarName, &i );180 if(i== pobj_c->iMemberNum){181 int offset = objClass.GetMemberOffset( VarName, &i ); 182 if(i==objClass.iMemberNum){ 181 183 if(isErrorEnabled) SetError(103,VarName,cp); 182 return 0; 183 } 184 185 CMember *pMember=pobj_c->ppobj_Member[i]; 184 return false; 185 } 186 187 CMember *pMember=objClass.ppobj_Member[i]; 188 186 189 187 190 //アクセシビリティをチェック 188 if( pobj_c==pobj_CompilingClass){191 if(&objClass==pobj_CompilingClass){ 189 192 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 190 193 if(pMember->dwAccess==ACCESS_NON){ 191 194 if(isErrorEnabled) SetError(107,VarName,cp); 192 return 0;195 return false; 193 196 } 194 197 } … … 197 200 pMember->dwAccess==ACCESS_NON){ 198 201 if(isErrorEnabled) SetError(107,VarName,cp); 199 return 0;202 return false; 200 203 } 201 204 else if(bPrivateAccess==0&&pMember->dwAccess==ACCESS_PROTECTED){ 202 205 if(isErrorEnabled) SetError(108,VarName,cp); 203 return 0;206 return false; 204 207 } 205 208 } … … 209 212 if( pMember->IsConst() && //定数メンバである 210 213 isWriteAccess && //書き込みアクセスを要求されている 211 pobj_c->IsCompilingConstructor() == false //コンストラクタ コンパイル中を除く214 objClass.IsCompilingConstructor() == false //コンストラクタ コンパイル中を除く 212 215 ){ 213 216 //Const定義の変数に書き込みアクセスをしようとした場合 … … 215 218 } 216 219 217 *pType=pMember->TypeInfo.type; 218 *plpNestIndex=pMember->TypeInfo.u.lpIndex; 220 resultType = *pMember; 219 221 220 222 //ポインタ変数の場合 221 if( IsPtrType(*pType)){223 if( resultType.IsPointer() ){ 222 224 if(pMember->SubScripts[0]==-1){ 223 225 lstrcpy(lpPtrOffset,array); … … 228 230 if(lpPtrOffset[0]){ 229 231 if(isErrorEnabled) SetError(16,member,cp); 230 return 0;232 return false; 231 233 } 232 234 } … … 242 244 if(array[0]){ 243 245 //配列オフセット 244 if(!GetArrayOffset(pMember->SubScripts,array,*p Type,pMember->TypeInfo.u.lpIndex))246 if(!GetArrayOffset(pMember->SubScripts,array,*pMember)){ 245 247 if(isErrorEnabled) SetError(14,member,cp); 248 } 246 249 } 247 250 else if(pMember->SubScripts[0]!=-1){ 248 *pType|=FLAG_PTR;251 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 249 252 } 250 253 … … 252 255 //入れ子構造の場合 253 256 254 if( *pType==DEF_OBJECT || *pType==DEF_STRUCT){257 if( resultType.IsObject() || resultType.IsStruct() ){ 255 258 if( refType != CClass::Dot ){ 256 259 if(isErrorEnabled) SetError(104,member,cp); 257 return 0;258 } 259 260 if( *pType==DEF_OBJECT){260 return false; 261 } 262 263 if( resultType.IsObject() ){ 261 264 // 参照内容へのポインタを抽出 262 265 SetRelativeOffset( *pRelativeVar ); 263 266 } 264 267 } 265 else if( *pType==DEF_PTR_OBJECT||*pType==DEF_PTR_STRUCT){268 else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){ 266 269 //構造体ポインタ型メンバ変数 267 270 268 271 if(lpPtrOffset[0]){ 269 272 //pObj[n].member 270 if( ( *pType==DEF_PTR_OBJECT||*pType==DEF_PTR_STRUCT )&& refType != CClass::Dot ){ 271 if(isErrorEnabled) SetError(104,member,cp); 272 return 0; 273 if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() ) 274 && refType != CClass::Dot ){ 275 if(isErrorEnabled) SetError(104,member,cp); 276 return false; 273 277 } 274 278 275 279 //直接参照に切り替え 276 SetRelativeOffset( pType,*plpNestIndex,pRelativeVar,lpPtrOffset);280 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 277 281 pRelativeVar->dwKind=VAR_DIRECTMEM; 278 282 … … 281 285 else{ 282 286 //pObj->member 283 if( ( *pType==DEF_PTR_OBJECT||*pType==DEF_PTR_STRUCT )&& refType != CClass::Pointer ){ 284 if(isErrorEnabled) SetError(104,member,cp); 285 return 0; 287 if( ( resultType.IsObjectPtr() || resultType.IsStructPtr() ) 288 && refType != CClass::Pointer ){ 289 if(isErrorEnabled) SetError(104,member,cp); 290 return false; 286 291 } 287 292 … … 289 294 } 290 295 } 291 else if(*pType==MAKE_PTR_TYPE(DEF_OBJECT,2) || *pType==MAKE_PTR_TYPE(DEF_STRUCT,2)){ 296 else if( resultType.GetBasicType() == MAKE_PTR_TYPE(DEF_OBJECT,2) 297 || resultType.GetBasicType() == MAKE_PTR_TYPE(DEF_STRUCT,2)){ 292 298 //構造体ポインタのポインタ型メンバ変数 293 299 … … 296 302 if( refType != CClass::Pointer ){ 297 303 if(isErrorEnabled) SetError(104,member,cp); 298 return 0;304 return false; 299 305 } 300 306 301 307 //直接参照に切り替え 302 SetRelativeOffset( pType,*plpNestIndex,pRelativeVar,lpPtrOffset);308 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 303 309 pRelativeVar->dwKind=VAR_DIRECTMEM; 304 310 … … 311 317 else{ 312 318 if(isErrorEnabled) SetError(104,member,cp); 313 return 0;314 } 315 } 316 317 if(! GetMemberOffset(319 return false; 320 } 321 } 322 323 if(!_member_offset( 318 324 isErrorEnabled, 319 325 isWriteAccess, 320 pMember-> TypeInfo.u.pobj_Class,326 pMember->GetClass(), 321 327 NestMember, 322 pType,323 328 pRelativeVar, 324 plpNestIndex,325 0)) return 0;329 resultType, 330 0)) return false; 326 331 } 327 332 328 333 if(lpPtrOffset[0]){ 329 SetRelativeOffset( pType,*plpNestIndex,pRelativeVar,lpPtrOffset);334 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 330 335 pRelativeVar->dwKind=VAR_DIRECTMEM; 331 336 } 332 337 333 return 1;338 return true; 334 339 } 335 340 void GetWithName(char *buffer){ … … 355 360 } 356 361 357 BOOL GetVarOffset(bool isErrorEnabled, bool isWriteAccess, const char *NameBuffer, int *pType, RELATIVE_VAR *pRelativeVar, LONG_PTR *plpIndex, int *pss){ 358 extern BOOL bCompilingGlobal; 362 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss){ 359 363 int i; 360 LONG_PTR lpIndex;361 364 char variable[VN_SIZE],member[VN_SIZE],VarName[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE]; 362 365 … … 373 376 374 377 void *pInfo; 375 int idProc=GetProc(VarName, &pInfo);378 int idProc=GetProc(VarName,(void **)&pInfo); 376 379 377 380 if(idProc){ 378 381 pRelativeVar->dwKind=VAR_DIRECTMEM; 382 383 Type type; 379 384 380 385 … … 383 388 //////////////// 384 389 385 *pType=CallProc(idProc,pInfo,VarName,array,&lpIndex);390 CallProc(idProc,pInfo,VarName,array,type); 386 391 387 392 //戻り値をecxにコピー … … 389 394 390 395 391 LONG_PTR lp2; 392 if(!GetMemberOffset( 396 if(!_member_offset( 393 397 isErrorEnabled, 394 398 isWriteAccess, 395 (CClass *)lpIndex, 396 member,pType,pRelativeVar,&lp2,0)) return 0; 397 if(plpIndex) *plpIndex=lp2; 398 399 return 1; 399 type.GetClass(), 400 member,pRelativeVar,resultType,0)) return false; 401 402 return true; 400 403 } 401 404 } … … 405 408 GetVarFormatString(VarName,array,lpPtrOffset,member,refType); 406 409 407 int *pSubScripts; 408 bool bConst; 409 410 if(bCompilingGlobal==0){ 411 //////////////////// 410 const int *pSubScripts; 411 bool bConst = false; 412 413 414 if( UserProc::IsLocalAreaCompiling() ){ 415 ////////////////// 412 416 // ローカル変数 413 //////////////////// 414 415 for(i=MaxLocalVarNum-1;i>=0;i--){ //レキシカルスコープを考慮してバックサーチ 416 if( LocalVar[i].bLiving //現在のスコープで有効なもの 417 && LocalVar[i].ScopeLevel <= obj_LexScopes.GetNowLevel() //現在のスコープレベルを超さないもの(Returnによる解放処理中を考慮) 418 ){ 419 if(lstrcmp(VarName,LocalVar[i].name)==0) break; 420 } 421 } 422 if(i>=0){ 417 ////////////////// 418 419 const Variable *pVar = UserProc::CompilingUserProc().localVars.BackSearch( VarName ); 420 if( pVar ){ 423 421 //ポインタ変数の場合 424 if( IsPtrType(LocalVar[i].type)){425 if( LocalVar[i].SubScripts[0]==-1){422 if( pVar->IsPointer() ){ 423 if( !pVar->IsArray() ){ 426 424 lstrcpy(lpPtrOffset,array); 427 425 array[0]=0; … … 432 430 SetError(16,variable,cp); 433 431 pRelativeVar->dwKind=NON_VAR; 434 return 0;432 return false; 435 433 } 436 434 } 437 435 438 pRelativeVar->offset=- LocalVar[i].offset;436 pRelativeVar->offset=-pVar->offset; 439 437 pRelativeVar->bOffsetOffset=0; 440 if(LocalVar[i].fRef) pRelativeVar->dwKind=VAR_REFLOCAL; 438 if( pVar->IsRef() ){ 439 // 参照型 440 pRelativeVar->dwKind = VAR_REFLOCAL; 441 } 441 442 else pRelativeVar->dwKind=VAR_LOCAL; 442 *pType=LocalVar[i].type; 443 lpIndex=LocalVar[i].u.index; 444 if(plpIndex) *plpIndex=lpIndex; 445 pSubScripts=LocalVar[i].SubScripts; 446 bConst = LocalVar[i].bConst; 443 resultType = *pVar; 444 pSubScripts=pVar->GetSubScriptsPtr(); 445 bConst = pVar->IsConst(); 447 446 448 447 goto ok; … … 461 460 SetThisPtrToReg(REG_ECX); 462 461 463 *pType=DEF_OBJECT;464 462 pRelativeVar->dwKind=VAR_DIRECTMEM; 465 463 466 if(plpIndex) *plpIndex=(LONG_PTR)pobj_CompilingClass;467 return 1;464 resultType.SetType( DEF_OBJECT, pobj_CompilingClass ); 465 return true; 468 466 } 469 467 … … 500 498 501 499 pRelativeVar->dwKind=VAR_DIRECTMEM; 502 if(! GetMemberOffset(500 if(!_member_offset( 503 501 isErrorEnabled, 504 502 isWriteAccess, 505 pobj_CompilingClass,503 *pobj_CompilingClass, 506 504 variable, 507 pType,508 505 pRelativeVar, 509 &lpIndex,1)) return 0; 510 if(plpIndex) *plpIndex=lpIndex; 511 return 1; 506 resultType,1)) return false; 507 return true; 512 508 } 513 509 514 510 NonClassMember: 515 511 516 ////////////////////////// 517 // 静的ローカル変数 518 // ※"Static.Object.Method.Variable" 519 ////////////////////////// 520 521 char temporary[VN_SIZE]; 522 extern SubInfo *pCompilingSubInfo; 523 if(pCompilingSubInfo){ 524 GetNowStaticVarFullName(VarName,temporary); 525 526 for(i=0;i<MaxGlobalVarNum;i++){ 527 if(lstrcmp(temporary,GlobalVar[i].name)==0) break; 528 } 529 if(i!=MaxGlobalVarNum){ 512 { 513 const Variable *pVar; 514 515 ////////////////////////// 516 // 静的ローカル変数 517 // ※"Static.Object.Method.Variable" 518 ////////////////////////// 519 520 char temporary[VN_SIZE]; 521 if( UserProc::IsLocalAreaCompiling() ){ 522 GetNowStaticVarFullName(VarName,temporary); 523 524 pVar = globalVars.Find( temporary ); 525 if( pVar ){ 526 goto GlobalOk; 527 } 528 } 529 530 531 ////////////////////////// 532 // クラスの静的メンバ 533 ////////////////////////// 534 535 if(member[0]){ 536 lstrcpy(temporary,member); 537 538 char tempMember[VN_SIZE]; 539 char tempArray[VN_SIZE]; 540 { 541 CClass::RefType refType; 542 GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType ); 543 } 544 545 char temp2[VN_SIZE]; 546 sprintf(temp2,"%s.%s",VarName,temporary); 547 pVar = globalVars.Find( temp2 ); 548 if( pVar ){ 549 lstrcpy(member,tempMember); 550 lstrcpy(array,tempArray); 551 goto GlobalOk; 552 } 553 } 554 555 if(pobj_CompilingClass){ 556 //自身のクラスから静的メンバを参照する場合 557 char temp2[VN_SIZE]; 558 sprintf(temp2,"%s.%s",pobj_CompilingClass->name,VarName); 559 pVar = globalVars.Find( temp2 ); 560 if( pVar ){ 561 goto GlobalOk; 562 } 563 } 564 565 ///////////////////// 566 // グローバル変数 567 ///////////////////// 568 569 pVar = globalVars.BackSearch( VarName ); 570 if( pVar ){ 530 571 goto GlobalOk; 531 572 } 532 } 533 534 535 ////////////////////////// 536 // クラスの静的メンバ 537 ////////////////////////// 538 539 if(member[0]){ 540 lstrcpy(temporary,member); 541 542 char tempMember[VN_SIZE]; 543 char tempArray[VN_SIZE]; 544 { 545 CClass::RefType refType; 546 GetVarFormatString(temporary,tempArray,lpPtrOffset,tempMember, refType ); 547 } 548 549 char temp2[VN_SIZE]; 550 sprintf(temp2,"%s.%s",VarName,temporary); 551 for(i=0;i<MaxGlobalVarNum;i++){ 552 if(lstrcmp(temp2,GlobalVar[i].name)==0) break; 553 } 554 555 if(i!=MaxGlobalVarNum){ 556 lstrcpy(member,tempMember); 557 lstrcpy(array,tempArray); 558 goto GlobalOk; 559 } 560 } 561 562 if(pobj_CompilingClass){ 563 //自身のクラスから静的メンバを参照する場合 564 char temp2[VN_SIZE]; 565 sprintf(temp2,"%s.%s",pobj_CompilingClass->name,VarName); 566 for(i=0;i<MaxGlobalVarNum;i++){ 567 if(lstrcmp(temp2,GlobalVar[i].name)==0) break; 568 } 569 570 if(i!=MaxGlobalVarNum){ 571 goto GlobalOk; 572 } 573 } 574 575 576 //////////////////// 577 // グローバル変数 578 //////////////////// 579 580 for(i=MaxGlobalVarNum-1;i>=0;i--){ //レキシカルスコープを考慮してバックサーチ 581 if( GlobalVar[i].bLiving //現在のスコープで有効なもの 582 && GlobalVar[i].ScopeLevel <= obj_LexScopes.GetNowLevel() //現在のスコープレベルを超さないもの(Returnによる解放処理中を考慮) 583 ){ 584 if(lstrcmp(VarName,GlobalVar[i].name)==0) break; 585 } 586 } 587 if(i>=0){ 588 goto GlobalOk; 589 } 590 591 592 if(isErrorEnabled) SetError(3,variable,cp); 593 pRelativeVar->dwKind=NON_VAR; 594 return 0; 573 574 if(isErrorEnabled) SetError(3,variable,cp); 575 pRelativeVar->dwKind=NON_VAR; 576 return false; 577 595 578 596 579 597 580 GlobalOk: 598 599 //ポインタ変数の場合 600 if(IsPtrType(GlobalVar[i].type)){ 601 if(GlobalVar[i].SubScripts[0]==-1){ 602 lstrcpy(lpPtrOffset,array); 603 array[0]=0; 604 } 605 } 606 else{ 607 if(lpPtrOffset[0]){ 608 SetError(16,variable,cp); 609 pRelativeVar->dwKind=NON_VAR; 610 return 0; 611 } 612 } 613 614 pRelativeVar->offset=GlobalVar[i].offset; 615 pRelativeVar->bOffsetOffset=0; 616 if(GlobalVar[i].fRef){ 617 // 参照型 618 pRelativeVar->dwKind = VAR_REFGLOBAL; 619 } 620 else pRelativeVar->dwKind=VAR_GLOBAL; 621 *pType=GlobalVar[i].type; 622 lpIndex=GlobalVar[i].u.index; 623 if(plpIndex) *plpIndex=lpIndex; 624 pSubScripts=GlobalVar[i].SubScripts; 625 bConst = GlobalVar[i].bConst; 581 //ポインタ変数の場合 582 if( pVar->IsPointer() ){ 583 if( !pVar->IsArray() ){ 584 lstrcpy(lpPtrOffset,array); 585 array[0]=0; 586 } 587 } 588 else{ 589 if(lpPtrOffset[0]){ 590 SetError(16,variable,cp); 591 pRelativeVar->dwKind=NON_VAR; 592 return false; 593 } 594 } 595 596 pRelativeVar->offset=pVar->offset; 597 pRelativeVar->bOffsetOffset=0; 598 if( pVar->IsRef() ){ 599 // 参照型 600 pRelativeVar->dwKind = VAR_REFGLOBAL; 601 } 602 else pRelativeVar->dwKind=VAR_GLOBAL; 603 resultType = *pVar; 604 pSubScripts=pVar->GetSubScriptsPtr(); 605 bConst = pVar->IsConst(); 606 } 607 626 608 627 609 … … 630 612 if( bConst && isWriteAccess ){ 631 613 //Const定義の変数に書き込みアクセスをしようとした場合 632 if( *pType == DEF_OBJECT){614 if( resultType.IsObject() ){ 633 615 //オブジェクト定数 634 616 SetError(130, VarName, cp ); … … 642 624 if(array[0]==0&&pSubScripts[0]!=-1){ 643 625 //配列の先頭ポインタを示す場合 644 *pType|=FLAG_PTR;626 resultType.SetBasicType( resultType.GetBasicType() | FLAG_PTR ); 645 627 if(pss) memcpy(pss,pSubScripts,MAX_ARRAYDIM); 646 return 1;628 return true; 647 629 } 648 630 … … 655 637 } 656 638 if(array[0]){ 657 if(!GetArrayOffset(pSubScripts,array, *pType,lpIndex)){639 if(!GetArrayOffset(pSubScripts,array,resultType)){ 658 640 SetError(14,variable,cp); 659 641 pRelativeVar->dwKind=NON_VAR; 660 return 0;642 return false; 661 643 } 662 644 } 663 645 if(member[0]){ 664 if( *pType==DEF_OBJECT || *pType==DEF_STRUCT){646 if( resultType.IsObject() || resultType.IsStruct() ){ 665 647 //実態オブジェクトのメンバを参照(obj.member) 666 648 if( refType != CClass::Dot ){ 667 649 SetError(104,VarName,cp); 668 650 pRelativeVar->dwKind=NON_VAR; 669 return 0;670 } 671 672 if( *pType==DEF_OBJECT){651 return false; 652 } 653 654 if( resultType.IsObject() ){ 673 655 // 参照内容へのポインタを抽出 674 656 SetRelativeOffset( *pRelativeVar ); 675 657 } 676 658 } 677 else if( *pType==DEF_PTR_OBJECT || *pType==DEF_PTR_STRUCT){659 else if( resultType.IsObjectPtr() || resultType.IsStructPtr() ){ 678 660 //ポインタオブジェクトが示すメンバを参照 679 661 if(lpPtrOffset[0]){ … … 682 664 SetError(104,VarName,cp); 683 665 pRelativeVar->dwKind=NON_VAR; 684 return 0;666 return false; 685 667 } 686 SetRelativeOffset( pType,lpIndex,pRelativeVar,lpPtrOffset);668 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 687 669 pRelativeVar->dwKind=VAR_DIRECTMEM; 688 670 } … … 692 674 SetError(104,VarName,cp); 693 675 pRelativeVar->dwKind=NON_VAR; 694 return 0;676 return false; 695 677 } 696 678 … … 703 685 } 704 686 } 705 else if( *pType==MAKE_PTR_TYPE(DEF_OBJECT,2) || *pType==MAKE_PTR_TYPE(DEF_STRUCT,2)){687 else if( resultType.GetBasicType()==MAKE_PTR_TYPE(DEF_OBJECT,2) || resultType.GetBasicType()==MAKE_PTR_TYPE(DEF_STRUCT,2)){ 706 688 //ポインタオブジェクトが示すメンバを参照 707 689 if(lpPtrOffset[0]){ … … 710 692 SetError(104,VarName,cp); 711 693 pRelativeVar->dwKind=NON_VAR; 712 return 0;694 return false; 713 695 } 714 696 715 SetRelativeOffset( pType,lpIndex,pRelativeVar,lpPtrOffset);697 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 716 698 pRelativeVar->dwKind=VAR_DIRECTMEM; 717 699 … … 726 708 SetError(104,VarName,cp); 727 709 pRelativeVar->dwKind=NON_VAR; 728 return 0;710 return false; 729 711 } 730 712 } … … 732 714 SetError(102,VarName,cp); 733 715 pRelativeVar->dwKind=NON_VAR; 734 return 0; 735 } 736 737 LONG_PTR lp2; 738 if(!GetMemberOffset( 716 return false; 717 } 718 719 if(!_member_offset( 739 720 isErrorEnabled, 740 721 isWriteAccess, 741 (CClass *)lpIndex, 742 member,pType,pRelativeVar,&lp2,0)) return 0; 743 if(plpIndex) *plpIndex=lp2; 744 745 return 1; 722 resultType.GetClass(), 723 member,pRelativeVar,resultType,0)) return false; 724 725 return true; 746 726 } 747 727 748 728 if(lpPtrOffset[0]){ 749 SetRelativeOffset( pType,lpIndex,pRelativeVar,lpPtrOffset);729 SetRelativeOffset(resultType,pRelativeVar,lpPtrOffset); 750 730 pRelativeVar->dwKind=VAR_DIRECTMEM; 751 731 } 752 732 753 return 1;733 return true; 754 734 } 755 735 756 BOOL SetInitGlobalData(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf){736 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,char *InitBuf){ 757 737 extern BYTE *initGlobalBuf; 758 int i,i2,i3 ,TypeSize;738 int i,i2,i3; 759 739 char temporary[VN_SIZE]; 760 740 … … 763 743 InitBuf[lstrlen(InitBuf)-1]=0; 764 744 765 TypeSize=GetTypeSize(type,lpIndex);745 int typeSize = type.GetSize(); 766 746 767 747 if(SubScripts[0]!=-1){ 768 TypeSize*=JumpSubScripts(SubScripts+1);748 typeSize*=JumpSubScripts(SubScripts+1); 769 749 i=0; 770 750 i2=0; … … 776 756 i=GetOneParameter(InitBuf,i,temporary); 777 757 if(!SetInitGlobalData( 778 offset+i2* TypeSize,758 offset+i2*typeSize, 779 759 type, 780 lpIndex,781 760 SubScripts+1, 782 temporary)) return 0;761 temporary)) return false; 783 762 i2++; 784 763 if(InitBuf[i]=='\0') break; 785 764 } 786 return -1; 787 } 788 789 if(type==DEF_STRUCT){ 790 CClass *pobj_c; 791 pobj_c=(CClass *)lpIndex; 792 793 for(i=0,i2=0;i2<pobj_c->iMemberNum;i2++){ 765 return true; 766 } 767 768 if(type.IsStruct()){ 769 const CClass &objClass = type.GetClass(); 770 771 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 794 772 i=GetOneParameter(InitBuf,i,temporary); 795 773 796 i3= pobj_c->GetMemberOffset( pobj_c->ppobj_Member[i2]->name, NULL );774 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->name, NULL ); 797 775 798 776 if(!SetInitGlobalData(offset+i3, 799 pobj_c->ppobj_Member[i2]->TypeInfo.type, 800 pobj_c->ppobj_Member[i2]->TypeInfo.u.lpIndex, 801 pobj_c->ppobj_Member[i2]->SubScripts, 802 temporary)) return 0; 777 *objClass.ppobj_Member[i2], 778 objClass.ppobj_Member[i2]->SubScripts, 779 temporary)) return false; 803 780 804 781 if(InitBuf[i]=='\0') break; 805 782 } 806 if(i2+1!= pobj_c->iMemberNum){783 if(i2+1!=objClass.iMemberNum){ 807 784 SetError(41,0,cp); 808 return 0;809 } 810 return 1;785 return false; 786 } 787 return true; 811 788 } 812 789 813 790 SetError(41,0,cp); 814 return 0;791 return false; 815 792 } 816 793 … … 820 797 /////////////////////////////////////// 821 798 822 if( type == DEF_OBJECT || type == DEF_STRUCT){799 if( type.IsObject() || type.IsStruct() ){ 823 800 //オブジェクトまたは構造体の場合はありえない 824 801 SetError(300,NULL,cp); 825 return 0;802 return false; 826 803 } 827 804 828 805 if(SubScripts[0]!=-1){ 829 806 SetError(41,0,cp); 830 return 0;807 return false; 831 808 } 832 809 833 810 double dbl; 834 811 _int64 i64data; 835 int CalcType; 836 LONG_PTR lpCalcIndex; 837 CalcType=StaticCalculation(true, InitBuf,type,&i64data,&lpCalcIndex); 838 if(IsRealNumberType(CalcType)){ 812 Type calcType; 813 814 if( !StaticCalculation(false, InitBuf,type.GetBasicType(),&i64data,calcType) ){ 815 //動的データだった場合 816 return false; 817 } 818 if( calcType.IsReal() ){ 839 819 memcpy(&dbl,&i64data,sizeof(double)); 840 820 i64data=(_int64)dbl; … … 845 825 CheckDifferentType( 846 826 type, 847 lpIndex, 848 CalcType, 849 lpCalcIndex, 827 calcType, 850 828 0,0); 851 829 852 if( type==DEF_DOUBLE)830 if( type.IsDouble() ){ 853 831 *(double *)(initGlobalBuf+offset)=(double)dbl; 854 else if(type==DEF_SINGLE) 832 } 833 else if( type.IsSingle() ){ 855 834 *(float *)(initGlobalBuf+offset)=(float)dbl; 856 else if(type==DEF_INT64||type==DEF_QWORD) 835 } 836 else if( type.Is64() ){ 857 837 *(_int64 *)(initGlobalBuf+offset)=i64data; 858 else if(type==DEF_LONG||type==DEF_DWORD||IsPtrType(type)){ 859 if(type==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){ 838 } 839 else if( type.IsLong() || type.IsDWord() || type.IsPointer() ){ 840 if(type.GetBasicType()==typeOfPtrChar&&calcType.GetIndex()==LITERAL_STRING){ 860 841 //文字列定数のとき 861 842 … … 881 862 } 882 863 } 883 else if( type==DEF_INTEGER||type==DEF_WORD || (isUnicode&&type==DEF_CHAR))864 else if( type.IsWord() || type.IsInteger() ){ 884 865 *(WORD *)(initGlobalBuf+offset)=(WORD)i64data; 885 else if(type==DEF_SBYTE||type==DEF_BYTE||type==DEF_BOOLEAN || (isUnicode==false&&type==DEF_CHAR)) 866 } 867 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){ 886 868 *(BYTE *)(initGlobalBuf+offset)=(BYTE)i64data; 887 //String型が未完成 888 return 1; 869 } 870 871 return true; 889 872 } 890 BOOL InitLocalVar(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf){891 int i,i2,i3 ,TypeSize;873 bool InitLocalVar(int offset,const Type &type,const int *SubScripts,char *InitBuf){ 874 int i,i2,i3; 892 875 char temporary[VN_SIZE]; 893 876 … … 896 879 InitBuf[lstrlen(InitBuf)-1]=0; 897 880 898 TypeSize=GetTypeSize(type,lpIndex);881 int typeSize = type.GetSize(); 899 882 900 883 if(SubScripts[0]!=-1){ 901 TypeSize*=JumpSubScripts(SubScripts+1);884 typeSize*=JumpSubScripts(SubScripts+1); 902 885 i=0; 903 886 i2=0; … … 905 888 if(SubScripts[0]<i2){ 906 889 SetError(41,0,cp); 907 return 0;890 return false; 908 891 } 909 892 i=GetOneParameter(InitBuf,i,temporary); 910 893 if(!InitLocalVar( 911 offset+i2* TypeSize,894 offset+i2*typeSize, 912 895 type, 913 lpIndex,914 896 SubScripts+1, 915 temporary)) return 0;897 temporary)) return false; 916 898 i2++; 917 899 if(InitBuf[i]=='\0') break; 918 900 } 919 return -1; 920 } 921 922 if(type==DEF_STRUCT){ 923 CClass *pobj_c; 924 pobj_c=(CClass *)lpIndex; 925 926 for(i=0,i2=0;i2<pobj_c->iMemberNum;i2++){ 901 return true; 902 } 903 904 if(type.IsStruct()){ 905 const CClass &objClass = type.GetClass(); 906 907 for(i=0,i2=0;i2<objClass.iMemberNum;i2++){ 927 908 i=GetOneParameter(InitBuf,i,temporary); 928 909 929 i3 = pobj_c->GetMemberOffset( pobj_c->ppobj_Member[i2]->name, NULL );910 i3=objClass.GetMemberOffset( objClass.ppobj_Member[i2]->name, NULL ); 930 911 931 912 if(!InitLocalVar(offset+i3, 932 pobj_c->ppobj_Member[i2]->TypeInfo.type, 933 pobj_c->ppobj_Member[i2]->TypeInfo.u.lpIndex, 934 pobj_c->ppobj_Member[i2]->SubScripts, 935 temporary)) return 0; 913 *objClass.ppobj_Member[i2], 914 objClass.ppobj_Member[i2]->SubScripts, 915 temporary)) return false; 936 916 937 917 if(InitBuf[i]=='\0') break; 938 918 } 939 if(i2+1!= pobj_c->iMemberNum){919 if(i2+1!=objClass.iMemberNum){ 940 920 SetError(41,0,cp); 941 921 return 0; 942 922 } 943 return 1;923 return true; 944 924 } 945 925 946 926 SetError(41,0,cp); 947 return 0;927 return false; 948 928 } 949 929 … … 955 935 if(SubScripts[0]!=-1){ 956 936 SetError(41,0,cp); 957 return 0;937 return false; 958 938 } 959 939 960 940 double dbl; 961 941 _int64 i64data; 962 int CalcType; 963 LONG_PTR lpCalcIndex; 964 CalcType=StaticCalculation(false, InitBuf,type,&i64data,&lpCalcIndex); 965 if(!CalcType){ 942 Type calcType; 943 944 if( !StaticCalculation(false, InitBuf,type.GetBasicType(),&i64data,calcType) ){ 966 945 //動的データだった場合 967 return 0;968 } 969 if( IsRealNumberType(CalcType)){946 return false; 947 } 948 if( calcType.IsReal() ){ 970 949 memcpy(&dbl,&i64data,sizeof(double)); 971 950 i64data=(_int64)dbl; … … 976 955 CheckDifferentType( 977 956 type, 978 lpIndex, 979 CalcType, 980 lpCalcIndex, 957 calcType, 981 958 0,0); 982 959 983 if( type==DEF_DOUBLE){960 if( type.IsDouble() ){ 984 961 //mov eax,HILONG(dbl) 985 962 OpBuffer[obp++]=(char)0xB8; … … 1006 983 obp+=sizeof(long); 1007 984 } 1008 else if( type==DEF_SINGLE){985 else if( type.IsSingle() ){ 1009 986 float flt; 1010 987 flt=(float)dbl; … … 1021 998 obp+=sizeof(long); 1022 999 } 1023 else if( type==DEF_INT64||type==DEF_QWORD){1000 else if( type.Is64() ){ 1024 1001 //mov eax,HILONG(i64data) 1025 1002 OpBuffer[obp++]=(char)0xB8; … … 1046 1023 obp+=sizeof(long); 1047 1024 } 1048 else if( type==DEF_LONG||type==DEF_DWORD||IsPtrType(type)){1049 if(type ==typeOfPtrChar&&lpCalcIndex==LITERAL_STRING){1025 else if( type.IsDWord() || type.IsLong() || type.IsPointer() ){ 1026 if(type.GetBasicType()==typeOfPtrChar&&calcType.GetIndex()==LITERAL_STRING){ 1050 1027 //文字列定数のとき 1051 1028 … … 1075 1052 obp+=sizeof(long); 1076 1053 } 1077 else if( type==DEF_INTEGER||type==DEF_WORD || (isUnicode&&type==DEF_CHAR)){1054 else if( type.IsWord() || type.IsInteger() ){ 1078 1055 //mov ax,InitValue 1079 1056 OpBuffer[obp++]=(char)0x66; … … 1090 1067 obp+=sizeof(long); 1091 1068 } 1092 else if( type==DEF_SBYTE||type==DEF_BYTE||type==DEF_BOOLEAN || (isUnicode==false&&type==DEF_CHAR)){1069 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){ 1093 1070 //mov byte ptr[ebp+offset],InitValue 1094 1071 OpBuffer[obp++]=(char)0xC6; … … 1100 1077 obp+=sizeof(BYTE); 1101 1078 } 1102 //String型が未完成 1103 return 1;1079 1080 return true; 1104 1081 } 1105 1082 1106 void dim(bool isRef, char *VarName,int *SubScripts,TYPEINFO &TypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlags){ 1107 extern BOOL bCompilingGlobal; 1108 if(bCompilingGlobal){ 1083 void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){ 1084 if( UserProc::IsGlobalAreaCompiling() ){ 1109 1085 ///////////////////////// 1110 1086 // グローバル変数 1111 1087 ///////////////////////// 1112 1088 1113 AddGlobalVariable(isRef,VarName,SubScripts, &TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags);1089 AddGlobalVariable(isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags); 1114 1090 } 1115 1091 else{ … … 1118 1094 ///////////////// 1119 1095 1120 int i2,i3; 1121 1122 for(i2=0;i2<MaxLocalVarNum;i2++){ 1123 if(LocalVar[i2].bLiving&&obj_LexScopes.GetNowLevel()==LocalVar[i2].ScopeLevel){ 1124 if(lstrcmp(LocalVar[i2].name,VarName)==0){ 1125 //2重定義のエラー 1126 SetError(15,VarName,cp); 1127 return; 1128 } 1129 } 1130 } 1131 1132 LocalVar=(VARIABLE *)HeapReAlloc(hHeap,0,LocalVar,(MaxLocalVarNum+1)*sizeof(VARIABLE)); 1133 VARIABLE *pVar = &LocalVar[MaxLocalVarNum]; 1134 MaxLocalVarNum++; 1135 1136 if( isRef ){ 1137 //参照型 1138 pVar->fRef = REF_VARIABLE; 1139 TypeSize = PTR_SIZE; 1140 } 1141 else pVar->fRef=0; 1142 1143 for(i2=1,i3=0;i3<255;i3++){ 1144 //配列要素数 1145 pVar->SubScripts[i3]=SubScripts[i3]; 1146 1147 if(SubScripts[i3]==-1) break; 1148 i2*=SubScripts[i3]+1; 1149 } 1150 int VarSize=TypeSize*i2; 1151 if(VarSize%4) VarSize+=4-(VarSize%4); 1152 1153 //変数データを追加 1154 lstrcpy(pVar->name,VarName); 1155 if(dwFlags & DIMFLAG_CONST) pVar->bConst = true; 1156 else pVar->bConst = false; 1157 if(SubScripts[0]==-1) pVar->bArray=0; 1158 else pVar->bArray=1; 1159 pVar->type=TypeInfo.type; 1160 pVar->u.index=TypeInfo.u.lpIndex; 1161 AllLocalVarSize+=VarSize; 1162 pVar->offset=AllLocalVarSize; 1096 if( UserProc::CompilingUserProc().localVars.BackSearch( VarName ) ){ 1097 //2重定義のエラー 1098 SetError(15,VarName,cp); 1099 return; 1100 } 1101 1102 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false; 1103 1104 Variable *pVar = new Variable( VarName, type, isConst, isRef ); 1105 1106 if( SubScripts[0] != -1 ){ 1107 //配列あり 1108 pVar->SetArray( SubScripts ); 1109 } 1110 1111 //コンストラクタ用パラメータ 1112 pVar->paramStrForConstructor = ConstractParameter; 1163 1113 1164 1114 //レキシカルスコープ … … 1167 1117 pVar->bLiving=TRUE; 1168 1118 1119 //エラー用 1120 pVar->source_code_address=cp; 1121 1122 // 変数を追加 1123 UserProc::CompilingUserProc().localVars.push_back( pVar ); 1124 1125 //アラインメントを考慮 1126 if( pVar->IsStruct() ){ 1127 int alignment = pVar->GetClass().iAlign; 1128 if( alignment ){ 1129 if( AllLocalVarSize % alignment ){ 1130 AllLocalVarSize += alignment - (AllLocalVarSize % alignment); 1131 } 1132 } 1133 } 1134 1135 AllLocalVarSize += pVar->GetMemorySize(); 1136 pVar->offset = AllLocalVarSize; 1137 1138 //レキシカルスコープ 1139 pVar->ScopeLevel=obj_LexScopes.GetNowLevel(); 1140 pVar->ScopeStartAddress=obj_LexScopes.GetStartAddress(); 1141 pVar->bLiving=TRUE; 1142 1169 1143 if(InitBuf[0]){ 1170 1144 //初期代入時のみ、書き込みアクセスを許可する 1171 bool bConstBack = pVar->bConst; 1172 pVar->bConst = false; 1145 if( isConst ){ 1146 pVar->ConstOff(); 1147 } 1173 1148 1174 1149 int result = 0; 1175 if( pVar->type != DEF_OBJECT){1150 if( !pVar->IsObject() ){ 1176 1151 result = InitLocalVar(-pVar->offset, 1177 pVar->type, 1178 pVar->u.index, 1179 pVar->SubScripts, 1152 *pVar, 1153 pVar->GetSubScriptsPtr(), 1180 1154 InitBuf); 1181 1155 } … … 1188 1162 } 1189 1163 1190 pVar->bConst = bConstBack; 1164 if( isConst ){ 1165 pVar->ConstOn(); 1166 } 1191 1167 } 1192 1168 else{ … … 1195 1171 1196 1172 //push VarSize 1197 op_push_V( VarSize);1173 op_push_V( pVar->GetMemorySize() ); 1198 1174 1199 1175 //mov eax,ebp … … 1213 1189 OpBuffer[obp++]=(char)0xFF; 1214 1190 OpBuffer[obp++]=(char)0x15; 1215 DECLAREINFO *pdi; 1216 pdi=GetDeclareHash("FillMemory"); 1217 pdi->bUse=1; 1218 pobj_ImportAddrSchedule->add(pdi); 1191 DllProc *pDllProc = GetDeclareHash("FillMemory"); 1192 pDllProc->Using(); 1193 pobj_ImportAddrSchedule->add(pDllProc); 1219 1194 obp+=sizeof(long); 1220 1195 } … … 1222 1197 1223 1198 //New呼び出し 1224 if( TypeInfo.type==DEF_OBJECT&&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){1199 if( type.IsObject() &&(dwFlags&DIMFLAG_NONCALL_CONSTRACTOR)==0&&InitBuf[0]=='\0'){ 1225 1200 char objectSize[255]; 1226 1201 if( SubScripts[0] == -1 ){ … … 1233 1208 sprintf( objectSize, "%d", SubScripts[0] ); 1234 1209 } 1235 Operator_New( *TypeInfo.u.pobj_Class, objectSize, ConstractParameter, TypeInfo);1210 Operator_New( type.GetClass(), objectSize, ConstractParameter, type ); 1236 1211 1237 1212 //pop eax 1238 1213 op_pop( REG_EAX ); 1239 1214 1240 int type;1241 LONG_PTR lpIndex;1242 1215 RELATIVE_VAR RelativeVar; 1243 GetVarOffset( true, false, VarName, & type, &RelativeVar, &lpIndex);1216 GetVarOffset( true, false, VarName, &RelativeVar, Type() ); 1244 1217 if( RelativeVar.dwKind == VAR_DIRECTMEM ){ 1245 1218 SetError(); … … 1248 1221 } 1249 1222 1250 if( TypeInfo.type==DEF_OBJECT){1251 if( TypeInfo.u.pobj_Class->IsAbstract()){1223 if( type.IsObject() ){ 1224 if( type.GetClass().IsAbstract() ){ 1252 1225 //抽象クラスだったとき 1253 SetError(125,TypeInfo.u.pobj_Class->name,cp); 1254 } 1255 } 1256 } 1257 void dim(char *Parameter,DWORD dwFlags){ 1258 extern BOOL bCompilingGlobal; 1259 extern HANDLE hHeap; 1260 int i2; 1261 char VarName[VN_SIZE]; 1262 1263 1264 //参照型かどうか 1265 bool isRef = false; 1266 1267 i2 = 0; 1268 1269 if( Parameter[i2] == 1 && Parameter[i2+1] == ESC_BYREF ){ 1270 //参照型 1271 isRef = true; 1272 Parameter += 2; 1273 } 1274 1275 1276 if(dwFlags & DIMFLAG_CONST){ 1277 ////////////////////////////////// 1278 // 定数変数の場合を考慮 1279 ////////////////////////////////// 1280 for(;;i2++){ 1281 if(Parameter[i2] == '=' || 1282 Parameter[i2] == 1 && Parameter[i2] == ESC_AS || 1283 Parameter[i2] =='('){ 1284 VarName[i2] = 0; 1285 break; 1286 } 1287 VarName[i2] = Parameter[i2]; 1288 } 1289 1290 //定数と2重定義されていないる場合は抜け出す 1291 if(CDBConst::obj.GetType(VarName)){ 1292 return; 1293 } 1294 1295 //定数マクロとして定義されている場合は抜け出す 1296 if(GetConstHash(VarName)){ 1297 return; 1298 } 1299 } 1300 1301 1302 //構文を解析 1303 int SubScripts[MAX_ARRAYDIM]; 1304 TYPEINFO TypeInfo; 1305 char InitBuf[8192]; 1306 char ConstractParameter[VN_SIZE]; 1307 if(!GetDimentionFormat(Parameter, isRef, VarName,SubScripts,&TypeInfo,InitBuf,ConstractParameter)) 1308 return; 1309 1310 1311 //定数と2重定義されていないかを調べる 1312 if(CDBConst::obj.GetType(VarName)){ 1313 SetError(15,VarName,cp); 1314 return; 1315 } 1316 1317 //定数マクロとして定義されている場合 1318 if(GetConstHash(VarName)){ 1319 SetError(15,VarName,cp); 1320 return; 1321 } 1322 1323 1324 //タイプサイズを取得 1325 int TypeSize; 1326 TypeSize=GetTypeSize(TypeInfo.type,TypeInfo.u.lpIndex); 1327 1328 if(dwFlags&DIMFLAG_STATIC){ 1329 if(bCompilingGlobal){ 1330 SetError(60,NULL,cp); 1331 return; 1332 } 1333 1334 ///////////////////// 1335 // Static変数 1336 // ※"Static.Object.Method.Variable" 1337 ///////////////////// 1338 1339 char temporary[VN_SIZE]; 1340 GetNowStaticVarFullName(VarName,temporary); 1341 1342 dim( isRef,temporary,SubScripts,TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags ); 1343 1344 /* 1345 Note: 静的変数のコンストラクタ呼び出しは 1346 _System_InitStaticLocalVariables関数内で一括して行う 1347 */ 1348 } 1349 else{ 1350 dim( isRef,VarName,SubScripts,TypeInfo,TypeSize,InitBuf,ConstractParameter,dwFlags ); 1351 } 1352 } 1353 void OpcodeDim(char *Parameter,DWORD dwFlags){ 1354 int i,i2,i3,IsStr=0; 1355 char temporary[8192]; 1356 1357 for(i=0,i2=0;;i++,i2++){ 1358 if(Parameter[i]=='\"') IsStr^=1; 1359 if(Parameter[i]=='('&&IsStr==0){ 1360 i3=GetStringInPare(temporary+i2,Parameter+i); 1361 i+=i3-1; 1362 i2+=i3-1; 1363 continue; 1364 } 1365 if(Parameter[i]=='['&&IsStr==0){ 1366 i3=GetStringInBracket(temporary+i2,Parameter+i); 1367 i+=i3-1; 1368 i2+=i3-1; 1369 continue; 1370 } 1371 if((Parameter[i]==','&&IsStr==0)|| 1372 Parameter[i]=='\0'){ 1373 temporary[i2]=0; 1374 1375 dim(temporary,dwFlags); 1376 1377 if(Parameter[i]=='\0') break; 1378 i2=-1; 1379 continue; 1380 } 1381 temporary[i2]=Parameter[i]; 1226 SetError(125,type.GetClass().name,cp); 1227 } 1382 1228 } 1383 1229 }
Note:
See TracChangeset
for help on using the changeset viewer.