Changeset 11 in dev for BasicCompiler64
- Timestamp:
- Dec 8, 2006, 3:25:27 AM (18 years ago)
- Location:
- BasicCompiler64
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler64/BasicCompiler.vcproj
r6 r11 1386 1386 > 1387 1387 </File> 1388 <File1389 RelativePath="..\BasicCompiler_Common\Variable.cpp"1390 >1391 </File>1392 1388 <Filter 1393 1389 Name="Intermediate" … … 1511 1507 <File 1512 1508 RelativePath="..\BasicCompiler_Common\Const.h" 1509 > 1510 </File> 1511 </Filter> 1512 <Filter 1513 Name="Variable" 1514 > 1515 <File 1516 RelativePath="..\BasicCompiler_Common\Variable.cpp" 1517 > 1518 </File> 1519 <File 1520 RelativePath="..\BasicCompiler_Common\Variable.h" 1513 1521 > 1514 1522 </File> -
BasicCompiler64/CParameter.cpp
r3 r11 616 616 int VarType; 617 617 LONG_PTR lpVarIndex; 618 if(!GetVarOffset(1,Parms[i2],&VarType,&RelativeVar,&lpVarIndex)) continue; 618 if(!GetVarOffsetReadOnly( 619 Parms[i2], 620 &VarType, 621 &RelativeVar, 622 &lpVarIndex)) continue; 619 623 620 624 if(DummyTypeInfo.type!=DEF_ANY){ -
BasicCompiler64/Compile_Calc.cpp
r3 r11 535 535 //変数アドレスを取得 536 536 RELATIVE_VAR VarRelativeVar; 537 if(!GetVarOffset( 538 1, 537 if(!GetVarOffsetReadWrite( 539 538 variable, 540 539 &VarType, -
BasicCompiler64/Compile_CallProc.cpp
r3 r11 187 187 RELATIVE_VAR RelativeVar; 188 188 LONG_PTR lp; 189 GetVarOffset (1,variable,&i,&RelativeVar,&lp);189 GetVarOffsetReadOnly(variable,&i,&RelativeVar,&lp); 190 190 SetVarPtrToReg(REG_RAX,&RelativeVar); 191 191 … … 408 408 else{ 409 409 RELATIVE_VAR RelativeVar; 410 if(!GetVarOffset (1,ObjectName,&i2,&RelativeVar,0)) return -1;410 if(!GetVarOffsetReadOnly(ObjectName,&i2,&RelativeVar,0)) return -1; 411 411 SetVarPtrToReg(REG_RCX,&RelativeVar); 412 412 -
BasicCompiler64/Compile_Func.cpp
r3 r11 74 74 int SubScripts[MAX_ARRAYDIM]; 75 75 RELATIVE_VAR RelativeVar; 76 if(!GetVarOffset (1,tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return;76 if(!GetVarOffsetReadOnly(tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return; 77 77 78 78 … … 147 147 RELATIVE_VAR RelativeVar; 148 148 int type; 149 if(!GetVarOffset (1,ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return;149 if(!GetVarOffsetReadOnly(ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return; 150 150 SetVarPtrToReg(REG_RCX,&RelativeVar); 151 151 … … 217 217 218 218 //変数のアドレスを取得 219 if(!GetVarOffset (1,Parameter,&type,&RelativeVar,0)) return;219 if(!GetVarOffsetReadOnly(Parameter,&type,&RelativeVar,0)) return; 220 220 221 221 SetVarPtrToReg(REG_RAX,&RelativeVar); -
BasicCompiler64/Compile_ProcOp.cpp
r3 r11 326 326 327 327 lstrcpy(LocalVar[MaxLocalVarNum].name,psi->pRealParmInfo[i3].name); 328 329 // TODO: パラメータのConst定義の指定が未完成 330 LocalVar[MaxLocalVarNum].bConst=false; 328 331 329 332 LocalVar[MaxLocalVarNum].bArray=psi->pRealParmInfo[i3].bArray; … … 736 739 temp="_System_ReturnValue"; 737 740 else temp=psi->name; 738 GetVarOffset (1,temp,&i3,&RelativeVar,&lpIndex);741 GetVarOffsetReadWrite(temp,&i3,&RelativeVar,&lpIndex); 739 742 740 743 i3=psi->ReturnType; -
BasicCompiler64/Compile_Statement.cpp
r3 r11 1179 1179 1180 1180 LONG_PTR lpIndex; 1181 RELATIVE_VAR RelativeVar; 1182 GetVarOffset(1,temporary,&type,&RelativeVar,&lpIndex); 1181 type = GetVarType(temporary, &lpIndex, 1); 1183 1182 1184 1183 sprintf(temp2,"_System_InputDataPtr[%d]=VarPtr(%s)",i4,temporary); -
BasicCompiler64/Compile_Var.cpp
r9 r11 179 179 return 1; 180 180 } 181 BOOL GetMemberOffset( BOOL bError,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){181 BOOL GetMemberOffset(bool ErrorEnabled,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){ 182 182 int i,offset; 183 183 … … 202 202 offset=GetSizeOfClassMember(pobj_c,VarName,&i); 203 203 if(i==pobj_c->iMemberNum){ 204 if( bError) SetError(103,VarName,cp);204 if(ErrorEnabled) SetError(103,VarName,cp); 205 205 return 0; 206 206 } … … 211 211 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 212 212 if(pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 213 if( bError) SetError(107,VarName,cp);213 if(ErrorEnabled) SetError(107,VarName,cp); 214 214 return 0; 215 215 } … … 218 218 if((bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)|| 219 219 pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 220 if( bError) SetError(107,VarName,cp);220 if(ErrorEnabled) SetError(107,VarName,cp); 221 221 return 0; 222 222 } 223 223 else if(bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){ 224 if( bError) SetError(108,VarName,cp);224 if(ErrorEnabled) SetError(108,VarName,cp); 225 225 return 0; 226 226 } … … 239 239 else{ 240 240 if(lpPtrOffset[0]){ 241 if( bError) SetError(16,member,cp);241 if(ErrorEnabled) SetError(16,member,cp); 242 242 return 0; 243 243 } … … 256 256 //配列オフセット 257 257 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)){ 258 if( bError) SetError(14,member,cp);258 if(ErrorEnabled) SetError(14,member,cp); 259 259 } 260 260 } … … 268 268 if(*pType==DEF_OBJECT){ 269 269 if(RefType!=DEF_OBJECT){ 270 if( bError) SetError(104,member,cp);270 if(ErrorEnabled) SetError(104,member,cp); 271 271 return 0; 272 272 } … … 278 278 //pObj[n].member 279 279 if(RefType!=DEF_OBJECT){ 280 if( bError) SetError(104,member,cp);280 if(ErrorEnabled) SetError(104,member,cp); 281 281 return 0; 282 282 } … … 291 291 //pObj->member 292 292 if(RefType!=DEF_PTR_OBJECT){ 293 if( bError) SetError(104,member,cp);293 if(ErrorEnabled) SetError(104,member,cp); 294 294 return 0; 295 295 } … … 315 315 //ppObj[n]->member 316 316 if(RefType!=DEF_PTR_OBJECT){ 317 if( bError) SetError(104,member,cp);317 if(ErrorEnabled) SetError(104,member,cp); 318 318 return 0; 319 319 } … … 329 329 } 330 330 else{ 331 if( bError) SetError(104,member,cp);331 if(ErrorEnabled) SetError(104,member,cp); 332 332 return 0; 333 333 } 334 334 } 335 335 336 if(!GetMemberOffset( bError,336 if(!GetMemberOffset(ErrorEnabled, 337 337 pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 338 338 NestMember, … … 371 371 SetReg_WholeVariable(DEF_PTR_VOID,&RelativeVar,reg); 372 372 } 373 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){373 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 374 374 extern BOOL bCompilingGlobal; 375 375 int i,RefType; … … 387 387 LONG_PTR lpIndex; 388 388 int *pSubScripts; 389 bool bConst = false; 389 390 390 391 … … 423 424 if(plpIndex) *plpIndex=lpIndex; 424 425 pSubScripts=LocalVar[i].SubScripts; 426 bConst = LocalVar[i].bConst; 425 427 426 428 goto ok; … … 463 465 464 466 pRelativeVar->dwKind=VAR_DIRECTMEM; 465 if(!GetMemberOffset( bError,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;467 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 466 468 if(plpIndex) *plpIndex=lpIndex; 467 469 return 1; … … 534 536 } 535 537 536 if( bError) SetError(3,variable,cp);538 if(ErrorEnabled) SetError(3,variable,cp); 537 539 pRelativeVar->dwKind=NON_VAR; 538 540 return 0; … … 563 565 if(plpIndex) *plpIndex=lpIndex; 564 566 pSubScripts=GlobalVar[i].SubScripts; 567 bConst = GlobalVar[i].bConst; 565 568 566 569 … … 568 571 ok: 569 572 573 if(bConst && WriteAccess){ 574 //Const定義の変数に書き込みアクセスをしようとした場合 575 SetError(61,VarName,cp); 576 } 570 577 571 578 if(array[0]==0&&pSubScripts[0]!=-1){ … … 600 607 601 608 LONG_PTR lp2; 602 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;609 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 603 610 if(plpIndex) *plpIndex=lp2; 604 611 } … … 616 623 617 624 LONG_PTR lp2; 618 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;625 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 619 626 if(plpIndex) *plpIndex=lp2; 620 627 } … … 634 641 635 642 LONG_PTR lp2; 636 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;643 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 637 644 if(plpIndex) *plpIndex=lp2; 638 645 } … … 658 665 659 666 LONG_PTR lp2; 660 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;667 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 661 668 if(plpIndex) *plpIndex=lp2; 662 669 } … … 1109 1116 lstrcpy(pVar->name,VarName); 1110 1117 pVar->fRef=0; 1111 if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;1112 else pVar->bConst = 0;1118 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1119 else pVar->bConst = false; 1113 1120 if(SubScripts[0]==-1) pVar->bArray=0; 1114 1121 else pVar->bArray=1; … … 1124 1131 1125 1132 if(InitBuf[0]){ 1133 //初期代入時のみ、書き込みアクセスを許可する 1134 bool bConstBack = pVar->bConst; 1135 pVar->bConst = false; 1136 1126 1137 int result = InitLocalVar(-pVar->offset, 1127 1138 pVar->type, … … 1136 1147 OpcodeCalc(temporary); 1137 1148 } 1149 1150 pVar->bConst = bConstBack; 1138 1151 } 1139 1152 else{ -
BasicCompiler64/NumOpe.cpp
r9 r11 423 423 424 424 RELATIVE_VAR RelativeVar; 425 if(GetVarOffset(0,term,&i2,&RelativeVar,&index_stack[sp])){ 425 if(GetVarOffset( 426 false, //エラー表示あり 427 false, //読み込み専用 428 term, 429 &i2,&RelativeVar,&index_stack[sp])){ 426 430 ////////// 427 431 // 変数 -
BasicCompiler64/Opcode.h
r9 r11 317 317 void GetWithName(char *buffer); 318 318 void SetThisPtrToReg(int reg); 319 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0);319 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0); 320 320 BOOL SetInitGlobalData(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf); 321 321 #define DIMFLAG_INITDEBUGVAR 1 -
BasicCompiler64/OperatorProc.cpp
r3 r11 325 325 int VarType; 326 326 LONG_PTR lpVarIndex; 327 if(!GetVarOffset( 328 1, 327 if(!GetVarOffsetReadOnly( 329 328 szTempVarName, 330 329 &VarType, -
BasicCompiler64/increment.cpp
r3 r11 12 12 /////////////////////////// 13 13 14 if(!GetVarOffset( 15 1, 14 if(!GetVarOffsetReadWrite( 16 15 lpszLeft, 17 16 &VarType,
Note:
See TracChangeset
for help on using the changeset viewer.