Changeset 11 in dev for BasicCompiler32
- Timestamp:
- Dec 8, 2006, 3:25:27 AM (18 years ago)
- Location:
- BasicCompiler32
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/BasicCompiler.vcproj
r3 r11 736 736 </FileConfiguration> 737 737 </File> 738 <File739 RelativePath="..\BasicCompiler_Common\Variable.cpp"740 >741 <FileConfiguration742 Name="Debug|Win32"743 >744 <Tool745 Name="VCCLCompilerTool"746 PreprocessorDefinitions=""747 />748 </FileConfiguration>749 <FileConfiguration750 Name="Release|Win32"751 >752 <Tool753 Name="VCCLCompilerTool"754 PreprocessorDefinitions=""755 />756 </FileConfiguration>757 <FileConfiguration758 Name="English_Rel|Win32"759 >760 <Tool761 Name="VCCLCompilerTool"762 PreprocessorDefinitions=""763 />764 </FileConfiguration>765 </File>766 738 <Filter 767 739 Name="Intermediate" … … 1269 1241 <File 1270 1242 RelativePath="..\BasicCompiler_Common\Const.h" 1243 > 1244 </File> 1245 </Filter> 1246 <Filter 1247 Name="Variable" 1248 > 1249 <File 1250 RelativePath="..\BasicCompiler_Common\Variable.cpp" 1251 > 1252 <FileConfiguration 1253 Name="Debug|Win32" 1254 > 1255 <Tool 1256 Name="VCCLCompilerTool" 1257 PreprocessorDefinitions="" 1258 /> 1259 </FileConfiguration> 1260 <FileConfiguration 1261 Name="Release|Win32" 1262 > 1263 <Tool 1264 Name="VCCLCompilerTool" 1265 PreprocessorDefinitions="" 1266 /> 1267 </FileConfiguration> 1268 <FileConfiguration 1269 Name="English_Rel|Win32" 1270 > 1271 <Tool 1272 Name="VCCLCompilerTool" 1273 PreprocessorDefinitions="" 1274 /> 1275 </FileConfiguration> 1276 </File> 1277 <File 1278 RelativePath="..\BasicCompiler_Common\Variable.h" 1271 1279 > 1272 1280 </File> -
BasicCompiler32/CParameter.cpp
r3 r11 556 556 int VarType; 557 557 LONG_PTR lpVarIndex; 558 if(!GetVarOffset (1,Parms[i2],&VarType,&RelativeVar,&lpVarIndex)) continue;558 if(!GetVarOffsetReadOnly(Parms[i2],&VarType,&RelativeVar,&lpVarIndex)) continue; 559 559 560 560 if(DummyTypeInfo.type!=DEF_ANY){ -
BasicCompiler32/Compile_Calc.cpp
r3 r11 516 516 517 517 //変数アドレスを取得 518 if(!GetVarOffset( 519 1, 518 if(!GetVarOffsetReadWrite( 520 519 variable, 521 520 &VarType, … … 535 534 536 535 //変数アドレスを取得 537 if(!GetVarOffset( 538 1, 536 if(!GetVarOffsetReadWrite( 539 537 variable, 540 538 &VarType, -
BasicCompiler32/Compile_CallProc.cpp
r3 r11 185 185 RELATIVE_VAR RelativeVar; 186 186 LONG_PTR lp; 187 GetVarOffset (1,variable,&i,&RelativeVar,&lp);187 GetVarOffsetReadOnly(variable,&i,&RelativeVar,&lp); 188 188 SetVarPtrToEax(&RelativeVar); 189 189 … … 382 382 383 383 RELATIVE_VAR RelativeVar; 384 if(!GetVarOffset (1,ObjectName,&i2,&RelativeVar,0)) return -1;384 if(!GetVarOffsetReadOnly(ObjectName,&i2,&RelativeVar,0)) return -1; 385 385 SetVarPtrToEax(&RelativeVar); 386 386 -
BasicCompiler32/Compile_Func.cpp
r3 r11 223 223 int SubScripts[MAX_ARRAYDIM]; 224 224 RELATIVE_VAR RelativeVar; 225 if(!GetVarOffset (1,tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return;225 if(!GetVarOffsetReadOnly(tempParm,&type,&RelativeVar,&lpIndex,SubScripts)) return; 226 226 227 227 if(type&FLAG_PTR){ … … 295 295 RELATIVE_VAR RelativeVar; 296 296 int type; 297 if(!GetVarOffset (1,ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return;297 if(!GetVarOffsetReadOnly(ObjectName,&type,&RelativeVar,(LONG_PTR *)&pobj_c)) return; 298 298 SetVarPtrToEax(&RelativeVar); 299 299 … … 375 375 376 376 //変数のアドレスを取得 377 if(!GetVarOffset (1,Parameter,&type,&RelativeVar,0)) return;377 if(!GetVarOffsetReadOnly(Parameter,&type,&RelativeVar,0)) return; 378 378 379 379 SetVarPtrToEax(&RelativeVar); -
BasicCompiler32/Compile_ProcOp.cpp
r3 r11 282 282 283 283 lstrcpy(LocalVar[MaxLocalVarNum].name,psi->pRealParmInfo[i3].name); 284 285 // TODO: パラメータのConst定義の指定が未完成 286 LocalVar[MaxLocalVarNum].bConst=false; 284 287 285 288 LocalVar[MaxLocalVarNum].bArray=psi->pRealParmInfo[i3].bArray; … … 696 699 temp="_System_ReturnValue"; 697 700 else temp=psi->name; 698 GetVarOffset (1,temp,&i3,&RelativeVar,&lpIndex);701 GetVarOffsetReadWrite(temp,&i3,&RelativeVar,&lpIndex); 699 702 700 703 i3=psi->ReturnType; -
BasicCompiler32/Compile_Statement.cpp
r3 r11 1573 1573 1574 1574 LONG_PTR lpIndex; 1575 RELATIVE_VAR RelativeVar; 1576 GetVarOffset(1,temporary,&type,&RelativeVar,&lpIndex); 1575 type = GetVarType(temporary,&lpIndex,1); 1577 1576 1578 1577 sprintf(temp2,"_System_InputDataPtr[%d]=VarPtr(%s)",i4,temporary); -
BasicCompiler32/Compile_Var.cpp
r8 r11 157 157 return 1; 158 158 } 159 BOOL GetMemberOffset( BOOL bError,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){159 BOOL GetMemberOffset(bool ErrorEnabled,CClass *pobj_c,char *member,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpNestIndex,BOOL bPrivateAccess){ 160 160 int i,offset; 161 161 … … 175 175 offset=GetSizeOfClassMember(pobj_c,VarName,&i); 176 176 if(i==pobj_c->iMemberNum){ 177 if( bError) SetError(103,VarName,cp);177 if(ErrorEnabled) SetError(103,VarName,cp); 178 178 return 0; 179 179 } … … 183 183 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 184 184 if(pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 185 if( bError) SetError(107,VarName,cp);185 if(ErrorEnabled) SetError(107,VarName,cp); 186 186 return 0; 187 187 } … … 190 190 if((bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)|| 191 191 pobj_c->ppobj_Member[i]->dwAccess==ACCESS_NON){ 192 if( bError) SetError(107,VarName,cp);192 if(ErrorEnabled) SetError(107,VarName,cp); 193 193 return 0; 194 194 } 195 195 else if(bPrivateAccess==0&&pobj_c->ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){ 196 if( bError) SetError(108,VarName,cp);196 if(ErrorEnabled) SetError(108,VarName,cp); 197 197 return 0; 198 198 } … … 211 211 else{ 212 212 if(lpPtrOffset[0]){ 213 if( bError) SetError(16,member,cp);213 if(ErrorEnabled) SetError(16,member,cp); 214 214 return 0; 215 215 } … … 227 227 //配列オフセット 228 228 if(!GetArrayOffset(pobj_c->ppobj_Member[i]->SubScripts,array,*pType,pobj_c->ppobj_Member[i]->TypeInfo.u.lpIndex)) 229 if( bError) SetError(14,member,cp);229 if(ErrorEnabled) SetError(14,member,cp); 230 230 } 231 231 else if(pobj_c->ppobj_Member[i]->SubScripts[0]!=-1){ … … 238 238 if(*pType==DEF_OBJECT){ 239 239 if(RefType!=DEF_OBJECT){ 240 if( bError) SetError(104,member,cp);240 if(ErrorEnabled) SetError(104,member,cp); 241 241 return 0; 242 242 } … … 248 248 //pObj[n].member 249 249 if(RefType!=DEF_OBJECT){ 250 if( bError) SetError(104,member,cp);250 if(ErrorEnabled) SetError(104,member,cp); 251 251 return 0; 252 252 } … … 261 261 //pObj->member 262 262 if(RefType!=DEF_PTR_OBJECT){ 263 if( bError) SetError(104,member,cp);263 if(ErrorEnabled) SetError(104,member,cp); 264 264 return 0; 265 265 } … … 287 287 //ppObj[n]->member 288 288 if(RefType!=DEF_PTR_OBJECT){ 289 if( bError) SetError(104,member,cp);289 if(ErrorEnabled) SetError(104,member,cp); 290 290 return 0; 291 291 } … … 302 302 } 303 303 else{ 304 if( bError) SetError(104,member,cp);304 if(ErrorEnabled) SetError(104,member,cp); 305 305 return 0; 306 306 } 307 307 } 308 308 309 if(!GetMemberOffset( bError,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class,309 if(!GetMemberOffset(ErrorEnabled,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class, 310 310 NestMember, 311 311 pType, … … 344 344 } 345 345 346 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){346 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 347 347 extern BOOL bCompilingGlobal; 348 348 int i,RefType; … … 360 360 LONG_PTR lpIndex; 361 361 int *pSubScripts; 362 bool bConst; 362 363 363 364 if(bCompilingGlobal==0){ … … 395 396 if(plpIndex) *plpIndex=lpIndex; 396 397 pSubScripts=LocalVar[i].SubScripts; 398 bConst = LocalVar[i].bConst; 397 399 398 400 goto ok; … … 439 441 440 442 pRelativeVar->dwKind=VAR_DIRECTMEM; 441 if(!GetMemberOffset( bError,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0;443 if(!GetMemberOffset(ErrorEnabled,pobj_CompilingClass,variable,pType,pRelativeVar,&lpIndex,1)) return 0; 442 444 if(plpIndex) *plpIndex=lpIndex; 443 445 return 1; … … 511 513 } 512 514 513 if( bError) SetError(3,variable,cp);515 if(ErrorEnabled) SetError(3,variable,cp); 514 516 pRelativeVar->dwKind=NON_VAR; 515 517 return 0; … … 540 542 if(plpIndex) *plpIndex=lpIndex; 541 543 pSubScripts=GlobalVar[i].SubScripts; 544 bConst = GlobalVar[i].bConst; 542 545 543 546 544 547 ok: 545 548 549 if(bConst && WriteAccess){ 550 //Const定義の変数に書き込みアクセスをしようとした場合 551 SetError(61,VarName,cp); 552 } 546 553 547 554 if(array[0]==0&&pSubScripts[0]!=-1){ … … 576 583 577 584 LONG_PTR lp2; 578 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;585 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 579 586 if(plpIndex) *plpIndex=lp2; 580 587 } … … 592 599 593 600 LONG_PTR lp2; 594 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;601 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 595 602 if(plpIndex) *plpIndex=lp2; 596 603 } … … 611 618 612 619 LONG_PTR lp2; 613 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;620 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 614 621 if(plpIndex) *plpIndex=lp2; 615 622 } … … 636 643 637 644 LONG_PTR lp2; 638 if(!GetMemberOffset( bError,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0;645 if(!GetMemberOffset(ErrorEnabled,(CClass *)lpIndex,member,pType,pRelativeVar,&lp2,0)) return 0; 639 646 if(plpIndex) *plpIndex=lp2; 640 647 } … … 1117 1124 lstrcpy(pVar->name,VarName); 1118 1125 pVar->fRef=0; 1119 if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;1120 else pVar->bConst = 0;1126 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1127 else pVar->bConst = false; 1121 1128 if(SubScripts[0]==-1) pVar->bArray=0; 1122 1129 else pVar->bArray=1; … … 1132 1139 1133 1140 if(InitBuf[0]){ 1141 //初期代入時のみ、書き込みアクセスを許可する 1142 bool bConstBack = pVar->bConst; 1143 pVar->bConst = false; 1144 1134 1145 int result = InitLocalVar(-pVar->offset, 1135 1146 pVar->type, … … 1144 1155 OpcodeCalc(temporary); 1145 1156 } 1157 1158 pVar->bConst = bConstBack; 1146 1159 } 1147 1160 else{ -
BasicCompiler32/NumOpe.cpp
r8 r11 375 375 376 376 RELATIVE_VAR RelativeVar; 377 if(GetVarOffset(0,term,&i2,&RelativeVar,&index_stack[sp])){ 377 if(GetVarOffset( 378 false, //エラー表示あり 379 false, //読み込み専用 380 term,&i2,&RelativeVar,&index_stack[sp])){ 378 381 ////////// 379 382 // 変数 -
BasicCompiler32/Opcode.h
r8 r11 172 172 void GetWithName(char *buffer); 173 173 void SetThisPtrToReg(int reg); 174 BOOL GetVarOffset( BOOL bError,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0);174 BOOL GetVarOffset(bool ErrorEnabled,bool WriteAccess,char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss=0); 175 175 BOOL SetInitGlobalData(int offset,int type,LONG_PTR lpIndex,int *SubScripts,char *InitBuf); 176 176 #define DIMFLAG_INITDEBUGVAR 1 -
BasicCompiler32/increment.cpp
r3 r11 235 235 /////////////////////////// 236 236 237 if(!GetVarOffset( 238 1, 237 if(!GetVarOffsetReadWrite( 239 238 lpszLeft, 240 239 &VarType,
Note:
See TracChangeset
for help on using the changeset viewer.