Changeset 11 in dev
- Timestamp:
- Dec 8, 2006, 3:25:27 AM (18 years ago)
- Files:
-
- 29 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, -
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, -
BasicCompiler_Common/NumOpe_GetType.cpp
r7 r11 301 301 BOOL bLiteralCalculation=1; 302 302 303 double dbl;304 303 int sp; 305 304 int type[255]; -
BasicCompiler_Common/Variable.cpp
r7 r11 815 815 } 816 816 817 BOOL GetVarOffsetReadOnly(char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 818 //読み取り専用で変数へアクセス 819 return GetVarOffset( 820 true, //エラー表示有効 821 false, //書き込みアクセスは無し 822 NameBuffer, 823 pType, 824 pRelativeVar, 825 plpIndex, 826 pss); 827 } 828 BOOL GetVarOffsetReadWrite(char *NameBuffer,int *pType,RELATIVE_VAR *pRelativeVar,LONG_PTR *plpIndex,int *pss){ 829 //読み書き両用で変数へアクセス 830 return GetVarOffset( 831 true, //エラー表示有効 832 true, //書き込みアクセス 833 NameBuffer, 834 pType, 835 pRelativeVar, 836 plpIndex, 837 pss); 838 } 839 817 840 818 841 … … 1017 1040 1018 1041 lstrcpy(pVar->name,name); 1019 if(dwFlag & DIMFLAG_CONST) pVar->bConst = 1;1020 else pVar->bConst = 0;1042 if(dwFlag & DIMFLAG_CONST) pVar->bConst = true; 1043 else pVar->bConst = false; 1021 1044 if(SubScripts[0]==-1) pVar->bArray=0; 1022 1045 else pVar->bArray=1; … … 1054 1077 AllInitGlobalVarSize); 1055 1078 if(InitBuf[0]){ 1079 //初期代入時のみ、書き込みアクセスを許可する 1080 bool bConstBack = pVar->bConst; 1081 pVar->bConst = false; 1082 1056 1083 int result = SetInitGlobalData(pVar->offset, 1057 1084 pVar->type, … … 1066 1093 OpcodeCalc(temporary); 1067 1094 } 1095 1096 pVar->bConst = bConstBack; 1068 1097 } 1069 1098 -
BasicCompiler_Common/calculation.cpp
r7 r11 1299 1299 1300 1300 //変数 1301 RELATIVE_VAR RelativeVar;1302 1301 CClass *pobj_Class; 1303 if(!GetVarOffset(1,Command+i2,&type,&RelativeVar,(LONG_PTR *)&pobj_Class)){ 1302 type = GetVarType(Command+i2,(LONG_PTR *)&pobj_Class,1); 1303 if(type==-1 || type ==0){ 1304 1304 //エラー 1305 1305 return -1; -
BasicCompiler_Common/common.h
r7 r11 166 166 167 167 //定数変数かどうか 168 BOOLbConst;168 bool bConst; 169 169 170 170 BOOL bArray; … … 386 386 #include "../BasicCompiler_Common/DebugSection.h" 387 387 #include "../BasicCompiler_Common/LexicalScoping.h" 388 #include "../BasicCompiler_Common/Variable.h" 388 389 389 390 … … 413 414 SUBINFO **GetOverloadObjectSubHash(char *name,CClass *pobj_c, int *pNum); 414 415 SUBINFO **GetOverloadSubHash(char *name,int *pNum); 415 416 //Variable.cpp417 BOOL IsVariableTopChar(char c);418 BOOL IsVariableChar(char c);419 BOOL IsPtrType(int type);420 BOOL IsSignedType(int type);421 BOOL IsNaturalWholeNumberType(int type);422 BOOL IsWholeNumberType(int type);423 BOOL IsRealNumberType(int type);424 BOOL Is64Type(int type);425 int GetSignedType(int type);426 int GetUnsignedType(int type);427 int GetTypeSize(int type,LONG_PTR lpIndex);428 int GetPtrType(int type,LONG_PTR lpIndex);429 int GetTypeFixed(char *TypeName,LONG_PTR *lpNum);430 void GetOriginalTypeName(char *buffer);431 BOOL GetTypeName(int type,LONG_PTR lpIndex,char *name);432 BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,int *pRefType);433 void GetArrayElement(char *buffer,char *variable,char *array_element);434 BOOL CheckVarNameError(char *name,int NowLine);435 int JumpSubScripts(int *ss);436 void GetArrange(char *variable,char *variAnswer,int *SubScripts);437 int GetTypeFromSimpleName(char *variable);438 int GetVarType(char *NameBuffer,LONG_PTR *plpIndex,BOOL bError);439 BOOL GetDimentionFormat(char *buffer,char *VarName,int *SubScripts,TYPEINFO *pTypeInfo,char *InitBuf,char *ConstractParameter);440 BOOL GetNowStaticVarFullName(char *VarName,char *FullName);441 void AddGlobalVariable(char *name,int *SubScripts,TYPEINFO *pTypeInfo,int TypeSize,char *InitBuf,char *ConstractParameter,DWORD dwFlag);442 416 443 417 //Object.cpp -
BasicCompiler_Common/error.cpp
r4 r11 142 142 if(num==59) sprintf(msg,"マニフェスト ファイル \"%s\" の読み込みに失敗。",KeyWord); 143 143 if(num==60) lstrcpy(msg,"Staticステートメントはグローバル領域では使用できません。"); 144 if(num==61) sprintf(msg,"\"%s\" Const定義の変数には書き込めません。",KeyWord); 144 145 145 146 -
BasicCompiler_Common/gc.cpp
r5 r11 24 24 OpcodeDim(temporary,0); 25 25 26 GetVarOffset (1,"_System_gc_GlobalRoot_StartPtr",&type,&RelativeVar,&lpIndex);26 GetVarOffsetReadWrite("_System_gc_GlobalRoot_StartPtr",&type,&RelativeVar,&lpIndex); 27 27 28 28 //mov rax,ptr … … 44 44 OpcodeDim(temporary,0); 45 45 46 GetVarOffset (1,"_System_gc_GlobalRoot_Size",&type,&RelativeVar,&lpIndex);46 GetVarOffsetReadWrite("_System_gc_GlobalRoot_Size",&type,&RelativeVar,&lpIndex); 47 47 48 48 //mov rax,ptr … … 65 65 OpcodeDim(temporary,0); 66 66 67 GetVarOffset (1,"_System_gc_StackRoot_StartPtr",&type,&RelativeVar,&lpIndex);67 GetVarOffsetReadWrite("_System_gc_StackRoot_StartPtr",&type,&RelativeVar,&lpIndex); 68 68 69 69 //mov rax,rsp
Note:
See TracChangeset
for help on using the changeset viewer.