Changeset 183 in dev for trunk/abdev/BasicCompiler32
- Timestamp:
- Jun 24, 2007, 6:50:40 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler32
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/BasicCompiler.vcproj
r167 r183 75 75 <Tool 76 76 Name="VCLinkerTool" 77 AdditionalDependencies="comctl32.lib psapi.lib commond.lib "77 AdditionalDependencies="comctl32.lib psapi.lib commond.lib smoothied.lib" 78 78 OutputFile="../ActiveBasic/BasicCompiler32.exe" 79 79 LinkIncremental="2" … … 177 177 <Tool 178 178 Name="VCLinkerTool" 179 AdditionalDependencies="comctl32.lib psapi.lib common.lib "179 AdditionalDependencies="comctl32.lib psapi.lib common.lib smoothie.lib" 180 180 OutputFile="../ActiveBasic/BasicCompiler32.exe" 181 181 LinkIncremental="1" … … 581 581 > 582 582 <File 583 RelativePath="..\BasicCompiler_Common\DataTable.cpp"584 >585 </File>586 <File587 RelativePath="..\BasicCompiler_Common\LoopRefCheck.cpp"588 >589 <FileConfiguration590 Name="Debug|Win32"591 >592 <Tool593 Name="VCCLCompilerTool"594 PreprocessorDefinitions=""595 />596 </FileConfiguration>597 <FileConfiguration598 Name="Release|Win32"599 >600 <Tool601 Name="VCCLCompilerTool"602 PreprocessorDefinitions=""603 />604 </FileConfiguration>605 </File>606 <File607 583 RelativePath="..\BasicCompiler_Common\NonVolatile.cpp" 608 584 > … … 751 727 > 752 728 <File 753 RelativePath="..\BasicCompiler_Common\Class.cpp"754 >755 <FileConfiguration756 Name="Debug|Win32"757 >758 <Tool759 Name="VCCLCompilerTool"760 PreprocessorDefinitions=""761 />762 </FileConfiguration>763 <FileConfiguration764 Name="Release|Win32"765 >766 <Tool767 Name="VCCLCompilerTool"768 PreprocessorDefinitions=""769 />770 </FileConfiguration>771 </File>772 <File773 RelativePath="..\BasicCompiler_Common\Class.h"774 >775 </File>776 <File777 729 RelativePath="..\BasicCompiler_Common\Enum.cpp" 778 730 > … … 824 776 <File 825 777 RelativePath="..\BasicCompiler_Common\PESchedule.h" 826 >827 </File>828 </Filter>829 <Filter830 Name="LexicalScoping"831 >832 <File833 RelativePath="..\BasicCompiler_Common\LexicalScoping.cpp"834 >835 <FileConfiguration836 Name="Debug|Win32"837 >838 <Tool839 Name="VCCLCompilerTool"840 PreprocessorDefinitions=""841 />842 </FileConfiguration>843 <FileConfiguration844 Name="Release|Win32"845 >846 <Tool847 Name="VCCLCompilerTool"848 PreprocessorDefinitions=""849 />850 </FileConfiguration>851 </File>852 <File853 RelativePath="..\BasicCompiler_Common\LexicalScoping.h"854 778 > 855 779 </File> … … 1325 1249 </Filter> 1326 1250 <Filter 1327 Name="Common Classes" 1328 > 1329 <File 1330 RelativePath="..\BasicCompiler_Common\src\Smoothie.cpp" 1331 > 1332 </File> 1333 <Filter 1334 Name="Meta Parts" 1335 > 1336 <File 1337 RelativePath="..\BasicCompiler_Common\src\Member.cpp" 1338 > 1339 </File> 1340 <File 1341 RelativePath="..\BasicCompiler_Common\src\Method.cpp" 1342 > 1343 </File> 1344 <File 1345 RelativePath="..\BasicCompiler_Common\src\Namespace.cpp" 1346 > 1347 </File> 1348 <File 1349 RelativePath="..\BasicCompiler_Common\Procedure.cpp" 1350 > 1351 </File> 1352 <File 1353 RelativePath="..\BasicCompiler_Common\src\Prototype.cpp" 1354 > 1355 </File> 1356 <File 1357 RelativePath="..\BasicCompiler_Common\src\Symbol.cpp" 1358 > 1359 </File> 1360 <File 1361 RelativePath="..\BasicCompiler_Common\Type.cpp" 1362 > 1363 </File> 1364 <File 1365 RelativePath="..\BasicCompiler_Common\TypeDef.cpp" 1366 > 1367 <FileConfiguration 1368 Name="Debug|Win32" 1369 > 1370 <Tool 1371 Name="VCCLCompilerTool" 1372 PreprocessorDefinitions="" 1373 /> 1374 </FileConfiguration> 1375 <FileConfiguration 1376 Name="Release|Win32" 1377 > 1378 <Tool 1379 Name="VCCLCompilerTool" 1380 PreprocessorDefinitions="" 1381 /> 1382 </FileConfiguration> 1383 </File> 1384 <File 1385 RelativePath="..\BasicCompiler_Common\Variable.cpp" 1386 > 1387 </File> 1388 </Filter> 1389 <Filter 1390 Name="Lexical Parts" 1391 > 1392 <File 1393 RelativePath="..\BasicCompiler_Common\src\Source.cpp" 1394 > 1395 </File> 1396 </Filter> 1397 <Filter 1398 Name="Operation Statements" 1399 > 1400 <File 1401 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1402 > 1403 </File> 1404 </Filter> 1405 <Filter 1406 Name="Application Classes" 1407 > 1408 <File 1409 RelativePath="..\BasicCompiler_Common\src\Program.cpp" 1410 > 1411 </File> 1412 </Filter> 1251 Name="Application Classes" 1252 > 1253 <File 1254 RelativePath="..\BasicCompiler_Common\src\ClassImpl.cpp" 1255 > 1256 </File> 1257 <File 1258 RelativePath="..\BasicCompiler_Common\src\CodeGenerator.cpp" 1259 > 1260 </File> 1261 <File 1262 RelativePath="..\BasicCompiler_Common\src\Compiler.cpp" 1263 > 1264 </File> 1265 <File 1266 RelativePath="..\BasicCompiler_Common\src\DataTable.cpp" 1267 > 1268 </File> 1269 <File 1270 RelativePath="..\BasicCompiler_Common\src\Exception.cpp" 1271 > 1272 </File> 1273 <File 1274 RelativePath="..\BasicCompiler_Common\src\LexicalScopingImpl.cpp" 1275 > 1276 </File> 1277 <File 1278 RelativePath="..\BasicCompiler_Common\src\ProcedureImpl.cpp" 1279 > 1280 </File> 1281 <File 1282 RelativePath="..\BasicCompiler_Common\src\Program.cpp" 1283 > 1284 </File> 1285 <File 1286 RelativePath="..\BasicCompiler_Common\src\SmoothieImpl.cpp" 1287 > 1288 </File> 1413 1289 </Filter> 1414 1290 </Filter> … … 1437 1313 > 1438 1314 </File> 1315 <File 1316 RelativePath="..\BasicCompiler_Common\include\option.h" 1317 > 1318 </File> 1439 1319 <Filter 1440 1320 Name="言語対応文字列" … … 1461 1341 > 1462 1342 <File 1343 RelativePath="..\BasicCompiler_Common\include\ClassImpl.h" 1344 > 1345 </File> 1346 <File 1347 RelativePath="..\BasicCompiler_Common\include\CodeGenerator.h" 1348 > 1349 </File> 1350 <File 1351 RelativePath="..\BasicCompiler_Common\include\Compiler.h" 1352 > 1353 </File> 1354 <File 1355 RelativePath="..\BasicCompiler_Common\include\DataTable.h" 1356 > 1357 </File> 1358 <File 1359 RelativePath="..\BasicCompiler_Common\include\Exception.h" 1360 > 1361 </File> 1362 <File 1363 RelativePath="..\BasicCompiler_Common\include\LexicalScopingImpl.h" 1364 > 1365 </File> 1366 <File 1367 RelativePath="..\BasicCompiler_Common\include\ProcedureImpl.h" 1368 > 1369 </File> 1370 <File 1463 1371 RelativePath="..\BasicCompiler_Common\include\Program.h" 1464 1372 > 1465 1373 </File> 1466 </Filter>1467 <Filter1468 Name="Common Classes"1469 >1470 <File1471 RelativePath="..\BasicCompiler_Common\include\option.h"1472 >1473 </File>1474 <File1475 RelativePath="..\BasicCompiler_Common\include\Smoothie.h"1476 >1477 </File>1478 <Filter1479 Name="Meta Parts"1480 >1481 <File1482 RelativePath="..\BasicCompiler_Common\include\Namespace.h"1483 >1484 </File>1485 <File1486 RelativePath="..\BasicCompiler_Common\Parameter.h"1487 >1488 </File>1489 <File1490 RelativePath="..\BasicCompiler_Common\Procedure.h"1491 >1492 </File>1493 <File1494 RelativePath="..\BasicCompiler_Common\include\Symbol.h"1495 >1496 </File>1497 <File1498 RelativePath="..\BasicCompiler_Common\Type.h"1499 >1500 </File>1501 <File1502 RelativePath="..\BasicCompiler_Common\TypeDef.h"1503 >1504 </File>1505 <File1506 RelativePath="..\BasicCompiler_Common\Variable.h"1507 >1508 </File>1509 <Filter1510 Name="Prototype"1511 >1512 <File1513 RelativePath="..\BasicCompiler_Common\include\Member.h"1514 >1515 </File>1516 <File1517 RelativePath="..\BasicCompiler_Common\include\Method.h"1518 >1519 </File>1520 <File1521 RelativePath="..\BasicCompiler_Common\include\Prototype.h"1522 >1523 </File>1524 </Filter>1525 </Filter>1526 <Filter1527 Name="Lexical Parts"1528 >1529 <File1530 RelativePath="..\BasicCompiler_Common\include\Source.h"1531 >1532 </File>1533 </Filter>1534 <Filter1535 Name="Operation Statements"1536 >1537 <File1538 RelativePath="..\BasicCompiler_Common\include\Exception.h"1539 >1540 </File>1541 </Filter>1542 <Filter1543 Name="Module"1544 >1545 <File1546 RelativePath="..\BasicCompiler_Common\include\ObjectModule.h"1547 >1548 </File>1549 </Filter>1550 1374 </Filter> 1551 1375 </Filter> -
trunk/abdev/BasicCompiler32/Compile_Calc.cpp
r179 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 1 4 #include "../BasicCompiler_Common/common.h" 2 5 #include "Opcode.h" … … 78 81 //符号あり 79 82 80 if(OldType==DEF_INTEGER || ( isUnicode&&OldType==DEF_CHAR)){83 if(OldType==DEF_INTEGER || (Smoothie::IsUnicode()&&OldType==DEF_CHAR)){ 81 84 //pop eax 82 85 op_pop(REG_EAX); … … 90 93 op_push(REG_EAX); 91 94 } 92 else if(OldType==DEF_SBYTE || ( isUnicode==false&&OldType==DEF_CHAR)){95 else if(OldType==DEF_SBYTE || (Smoothie::IsUnicode()==false&&OldType==DEF_CHAR)){ 93 96 //pop eax 94 97 op_pop(REG_EAX); … … 170 173 //符号あり 171 174 172 if(OldType==DEF_INTEGER || ( isUnicode&&OldType==DEF_CHAR)){175 if(OldType==DEF_INTEGER || (Smoothie::IsUnicode()&&OldType==DEF_CHAR)){ 173 176 //pop eax 174 177 op_pop(REG_EAX); … … 182 185 op_push(REG_EAX); 183 186 } 184 else if(OldType==DEF_SBYTE || ( isUnicode==false&&OldType==DEF_CHAR)){187 else if(OldType==DEF_SBYTE || (Smoothie::IsUnicode()==false&&OldType==DEF_CHAR)){ 185 188 //pop eax 186 189 op_pop(REG_EAX); … … 304 307 if(OldType==DEF_BOOLEAN|| 305 308 OldType==DEF_BYTE|| 306 OldType==DEF_WORD||OldType==DEF_INTEGER || ( isUnicode&&OldType==DEF_CHAR)) return;307 else if(OldType==DEF_SBYTE || ( isUnicode==false&&OldType==DEF_CHAR)){309 OldType==DEF_WORD||OldType==DEF_INTEGER || (Smoothie::IsUnicode()&&OldType==DEF_CHAR)) return; 310 else if(OldType==DEF_SBYTE || (Smoothie::IsUnicode()==false&&OldType==DEF_CHAR)){ 308 311 //pop eax 309 312 op_pop(REG_EAX); … … 334 337 void ChangeTypeToByte(int OldType){ 335 338 //現在のスタックの内容をbyte型に変換する 336 if(OldType==DEF_BYTE||OldType==DEF_SBYTE || ( isUnicode==false&&OldType==DEF_CHAR)) return;339 if(OldType==DEF_BYTE||OldType==DEF_SBYTE || (Smoothie::IsUnicode()==false&&OldType==DEF_CHAR)) return; 337 340 338 341 ChangeTypeToLong(OldType); … … 619 622 620 623 621 if( varType.IsObject() && Smoothie:: meta.blittableTypes.IsExist( calcType ) ){624 if( varType.IsObject() && Smoothie::GetMeta().blittableTypes.IsExist( calcType ) ){ 622 625 // Blittable型をオブジェクトとして扱う 623 626 vector<UserProc *> userProcs; 624 Smoothie:: meta.blittableTypes.GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs );627 Smoothie::GetMeta().blittableTypes.GetClass( calcType ).GetStaticMethods().Enum( "_Create", userProcs ); 625 628 if( userProcs.size() != 1 ){ 626 629 SetError(); -
trunk/abdev/BasicCompiler32/Compile_CallProc.cpp
r137 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 119 121 if(lstrcmpi(ObjectName,"Super")==0){ 120 122 //クラスメンバ関数内から基底クラスの呼び出し 121 pobj_c= pobj_CompilingClass;123 pobj_c=Smoothie::Temp::pCompilingClass; 122 124 } 123 125 else{ … … 127 129 pobj_c = &varType.GetClass(); 128 130 if( NATURAL_TYPE( varType.GetBasicType() ) != DEF_OBJECT ){ 129 pobj_c= pobj_DBClass->Find(ObjectName);131 pobj_c=Smoothie::GetMeta().GetClasses().Find(ObjectName); 130 132 if( pobj_c ){ 131 133 isStatic = true; … … 144 146 else{ 145 147 //クラスメンバ関数内から同一クラスのメンバ関数の呼び出し 146 pobj_c= pobj_CompilingClass;148 pobj_c=Smoothie::Temp::pCompilingClass; 147 149 } 148 150 } … … 173 175 if(ObjectName[0]){ 174 176 //外部からの呼び出し 175 if(pobj_c== pobj_CompilingClass){177 if(pobj_c==Smoothie::Temp::pCompilingClass){ 176 178 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 177 179 if( pMethod->IsNoneAccess() ){ -
trunk/abdev/BasicCompiler32/Compile_Func.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 176 178 tempParm=temp2; 177 179 178 type.SetType( DEF_OBJECT, pobj_DBClass->GetStringClassPtr() );180 type.SetType( DEF_OBJECT, Smoothie::GetMeta().GetClasses().GetStringClassPtr() ); 179 181 } 180 182 … … 228 230 229 231 //オーバーロードを解決 230 pUserProc=OverloadSolution(name,subs,Smoothie:: meta.procPointers[ProcPtr_BaseIndex]->Params(), Type() );232 pUserProc=OverloadSolution(name,subs,Smoothie::GetMeta().GetProcPointers()[ProcPtr_BaseIndex]->Params(), Type() ); 231 233 232 234 if(!pUserProc){ … … 280 282 SetThisPtrToReg(REG_RCX); 281 283 282 pobj_c= pobj_CompilingClass;284 pobj_c=Smoothie::Temp::pCompilingClass; 283 285 } 284 286 -
trunk/abdev/BasicCompiler32/Compile_ProcOp.cpp
r143 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <Program.h> 5 #include <LexicalScopingImpl.h> 6 #include <ClassImpl.h> 7 1 8 #include "../BasicCompiler_Common/common.h" 2 9 #include "Opcode.h" … … 48 55 49 56 //クラスに属する静的メンバを定義 50 CMember::InitStaticMember();57 Smoothie::GetMeta().GetClasses().InitStaticMember(); 51 58 52 59 GetGlobalDataForDll(); … … 61 68 //静的ローカルオブジェクトのコンストラクタ呼び出し 62 69 63 foreach( Variable *pVar, globalVars ){70 BOOST_FOREACH( Variable *pVar, globalVars ){ 64 71 if(memicmp(pVar->GetName().c_str(),"Static%",7)==0){ 65 72 //コンストラクタ呼び出し … … 87 94 UserProc::CompileStartForGlobalArea(); 88 95 89 obj_LexScopes.CallDestructorsOfScopeEnd();96 GetLexicalScopes().CallDestructorsOfScopeEnd(); 90 97 91 98 UserProc::CompileStartForUserProc( pBackUserProc ); … … 217 224 && userProc.GetParentClass().GetName() == "_System_TypeBase" ){ 218 225 219 pobj_DBClass->Compile_System_InitializeUserTypes();226 Smoothie::GetMeta().GetClasses().Compile_System_InitializeUserTypes(); 220 227 } 221 228 else if( userProc.GetName() == "RegisterGlobalRoots" … … 263 270 264 271 //コンパイル中の関数が属するクラス 265 pobj_CompilingClass=pUserProc->GetParentClassPtr();272 Smoothie::Temp::pCompilingClass=pUserProc->GetParentClassPtr(); 266 273 267 274 //コンパイルスタートをクラス管理クラスに追加 268 pobj_DBClass->StartCompile( pUserProc );275 Smoothie::GetMeta().GetClasses().StartCompile( pUserProc ); 269 276 270 277 //コンパイル中の関数 … … 272 279 273 280 // コンパイル中の関数が属する名前空間 274 Smoothie:: Lexical::liveingNamespaceScopes = pUserProc->GetNamespaceScopes();281 Smoothie::Temp::liveingNamespaceScopes = pUserProc->GetNamespaceScopes(); 275 282 276 283 // コンパイル中の関数でImportsされている名前空間 … … 335 342 336 343 //レキシカルスコープ情報 337 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();338 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();344 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 345 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 339 346 pVar->bLiving=TRUE; 340 347 … … 450 457 } 451 458 452 if( pobj_CompilingClass){453 if( pUserProc->GetName() == pobj_CompilingClass->GetName() ){459 if(Smoothie::Temp::pCompilingClass){ 460 if( pUserProc->GetName() == Smoothie::Temp::pCompilingClass->GetName() ){ 454 461 //////////////////////////////////// 455 462 // コンストラクタをコンパイルするとき … … 457 464 458 465 //コンストラクタのコンパイル開始を通知 459 pobj_CompilingClass->NotifyStartConstructorCompile();466 Smoothie::Temp::pCompilingClass->NotifyStartConstructorCompile(); 460 467 461 468 //基底クラスかどうかの識別 462 469 //(継承元がインターフェイスの場合も基底クラスと見なす) 463 470 BOOL bThisIsSuperClass; 464 if( pobj_CompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1;465 else if( pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){471 if(Smoothie::Temp::pCompilingClass->pobj_InheritsClass==0) bThisIsSuperClass=1; 472 else if( Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod() == NULL ){ 466 473 //インターフェイスを継承したときはコンストラクタを持たない 467 474 bThisIsSuperClass=1; … … 482 489 temporary[i4]=basbuf[i3]; 483 490 } 484 if( pobj_CompilingClass->pobj_InheritsClass->GetName() == temporary ){491 if( Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetName() == temporary ){ 485 492 //基底クラスのコンストラクタを呼び出す 486 493 cp=i3; … … 499 506 Type dummyType; 500 507 CallProc( PROC_DEFAULT 501 , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc502 , pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str()508 , Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc 509 , Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc->GetName().c_str() 503 510 , temporary 504 511 , dummyType ); … … 507 514 //基底クラスのコンストラクタを暗黙的に呼び出す 508 515 Opcode_CallProc("", 509 pobj_CompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc,516 Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetConstructorMethod()->pUserProc, 510 517 0, 511 518 "", … … 515 522 516 523 //仮想関数テーブルを初期化 517 if( pobj_CompilingClass->IsExistVirtualFunctions()518 && ! pobj_CompilingClass->IsAbstract() ){524 if( Smoothie::Temp::pCompilingClass->IsExistVirtualFunctions() 525 && !Smoothie::Temp::pCompilingClass->IsAbstract() ){ 519 526 //関数テーブルに値をセット 520 int offset = (int) pobj_CompilingClass->GetVtblGlobalOffset();527 int offset = (int)Smoothie::Temp::pCompilingClass->GetVtblGlobalOffset(); 521 528 522 529 //mov eax,offset … … 538 545 539 546 //デストラクタのコンパイル開始を通知 540 pobj_CompilingClass->NotifyStartDestructorCompile();547 Smoothie::Temp::pCompilingClass->NotifyStartDestructorCompile(); 541 548 } 542 549 } … … 564 571 ////////////////////////////////////////// 565 572 566 if( pobj_CompilingClass ){567 568 if( pobj_CompilingClass->IsCompilingConstructor() ){573 if( Smoothie::Temp::pCompilingClass ){ 574 575 if( Smoothie::Temp::pCompilingClass->IsCompilingConstructor() ){ 569 576 // コンストラクタをコンパイルしていたとき 570 577 571 578 // コンストラクタのコンパイルが完了したことを通知 572 pobj_CompilingClass->NotifyFinishConstructorCompile();579 Smoothie::Temp::pCompilingClass->NotifyFinishConstructorCompile(); 573 580 } 574 581 else if( pUserProc->IsDestructor() ){ … … 578 585 579 586 // デストラクタのコンパイルが完了したことを通知 580 pobj_CompilingClass->NotifyFinishDestructorCompile();581 582 if( pobj_CompilingClass->pobj_InheritsClass){587 Smoothie::Temp::pCompilingClass->NotifyFinishDestructorCompile(); 588 589 if(Smoothie::Temp::pCompilingClass->pobj_InheritsClass){ 583 590 /* サブクラスのデストラクタをコンパイルしているときは、 584 591 基底クラスのデストラクタを呼び出す */ 585 592 586 const CMethod *method = pobj_CompilingClass->pobj_InheritsClass->GetDestructorMethod();593 const CMethod *method = Smoothie::Temp::pCompilingClass->pobj_InheritsClass->GetDestructorMethod(); 587 594 if( method ){ 588 595 Opcode_CallProc("", … … 627 634 628 635 //ローカルオブジェクトの解放処理 629 obj_LexScopes.CallDestructorsOfScopeEnd();636 GetLexicalScopes().CallDestructorsOfScopeEnd(); 630 637 631 638 //プロシージャ抜け出しスケジュール(Exit Sub/Function) … … 702 709 obp+=sizeof(long); 703 710 } 704 else if(i3==DEF_INTEGER||i3==DEF_WORD || ( isUnicode&&i3==DEF_CHAR)){711 else if(i3==DEF_INTEGER||i3==DEF_WORD || (Smoothie::IsUnicode()&&i3==DEF_CHAR)){ 705 712 //xor eax,eax(eaxを0に初期化する) 706 713 op_zero_reg(REG_EAX); … … 714 721 obp+=sizeof(long); 715 722 } 716 else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || ( isUnicode==false&&i3==DEF_CHAR)){723 else if(i3==DEF_SBYTE||i3==DEF_BYTE||i3==DEF_BOOLEAN || (Smoothie::IsUnicode()==false&&i3==DEF_CHAR)){ 717 724 //xor eax,eax(eaxを0に初期化する) 718 725 op_zero_reg(REG_EAX); … … 732 739 } 733 740 HeapDefaultFree(pLocalVarAddrSchedule); 734 foreach( Variable *pVar, pUserProc->localVars ){741 BOOST_FOREACH( Variable *pVar, pUserProc->localVars ){ 735 742 //後にデバッグで利用する 736 743 pVar->offset = AllLocalVarSize - pVar->offset; -
trunk/abdev/BasicCompiler32/Compile_Set_Var.cpp
r121 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 #include "Opcode.h" … … 213 215 } 214 216 void ExtendTypeTo32(int type,int reg){ 215 if(type==DEF_INTEGER || ( isUnicode&&type==DEF_CHAR)){217 if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 216 218 //movsx reg32,reg16 217 219 op_movsx_R32R16(reg,reg); … … 221 223 op_and_RV(reg,(int)0x0000FFFF); 222 224 } 223 else if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){225 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 224 226 //movsx reg32,reg8 225 227 op_movsx_R32R8(reg,reg); … … 231 233 } 232 234 void ExtendTypeTo16(int type,int reg){ 233 if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){235 if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 234 236 //movsx reg16,reg8 235 237 op_movsx_R16R8(reg,reg); -
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r142 r183 1 #include <jenga/include/smoothie/LexicalAnalysis.h> 2 3 #include <LexicalScopingImpl.h> 4 #include <Compiler.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 #include "Opcode.h" … … 274 279 275 280 //レキシカルスコープをレベルアップ 276 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );281 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF ); 277 282 278 283 i2=CompileBuffer(ESC_ENDIF,0); 279 284 280 285 //レキシカルスコープをレベルダウン 281 obj_LexScopes.End();286 GetLexicalScopes().End(); 282 287 283 288 … … 299 304 300 305 //レキシカルスコープをレベルアップ 301 obj_LexScopes.Start( obp, SCOPE_TYPE_IF );306 GetLexicalScopes().Start( obp, SCOPE_TYPE_IF ); 302 307 303 308 CompileBuffer(ESC_ENDIF,0); 304 309 305 310 //レキシカルスコープをレベルダウン 306 obj_LexScopes.End();311 GetLexicalScopes().End(); 307 312 308 313 … … 525 530 526 531 //レキシカルスコープをレベルアップ 527 obj_LexScopes.Start( obp, SCOPE_TYPE_WHILE );532 GetLexicalScopes().Start( obp, SCOPE_TYPE_WHILE ); 528 533 529 534 //While内をコンパイル 530 535 CompileBuffer(0,COM_WEND); 531 536 532 obj_LexScopes.CallDestructorsOfScopeEnd();537 GetLexicalScopes().CallDestructorsOfScopeEnd(); 533 538 534 539 if( i3 == -1 ){ … … 542 547 543 548 //レキシカルスコープをレベルダウン 544 obj_LexScopes.End();549 GetLexicalScopes().End(); 545 550 546 551 *((long *)(OpBuffer+je_schedule-sizeof(long)))=obp-je_schedule; //jeジャンプ先のオフセット値 … … 660 665 661 666 //レキシカルスコープをレベルアップ 662 obj_LexScopes.Start( obp, SCOPE_TYPE_FOR );667 GetLexicalScopes().Start( obp, SCOPE_TYPE_FOR ); 663 668 664 669 //For内をコンパイル 665 670 CompileBuffer(0,COM_NEXT); 666 671 667 obj_LexScopes.CallDestructorsOfScopeEnd();672 GetLexicalScopes().CallDestructorsOfScopeEnd(); 668 673 669 674 if(szNextVariable[0]){ … … 679 684 680 685 //レキシカルスコープをレベルダウン 681 obj_LexScopes.End();686 GetLexicalScopes().End(); 682 687 683 688 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jeジャンプ先のオフセット値 … … 700 705 701 706 //レキシカルスコープをレベルアップ 702 obj_LexScopes.Start( obp, SCOPE_TYPE_DO );707 GetLexicalScopes().Start( obp, SCOPE_TYPE_DO ); 703 708 704 709 //Do内をコンパイル 705 710 CompileBuffer(0,COM_LOOP); 706 711 707 obj_LexScopes.CallDestructorsOfScopeEnd();712 GetLexicalScopes().CallDestructorsOfScopeEnd(); 708 713 709 714 extern char *basbuf; … … 908 913 909 914 //レキシカルスコープをレベルダウン 910 obj_LexScopes.End();915 GetLexicalScopes().End(); 911 916 912 917 *((long *)(OpBuffer+je_schedule))=obp-(je_schedule+sizeof(long)); //jmpジャンプ先のオフセット値 … … 942 947 943 948 //未解放のローカルオブジェクトのデストラクタを呼び出す 944 obj_LexScopes.CallDestructorsOfReturn();949 GetLexicalScopes().CallDestructorsOfReturn(); 945 950 946 951 //jmp ...(End Sub/Function) … … 1217 1222 1218 1223 //レキシカルスコープをレベルアップ 1219 obj_LexScopes.Start( obp, SCOPE_TYPE_SELECT );1224 GetLexicalScopes().Start( obp, SCOPE_TYPE_SELECT ); 1220 1225 1221 1226 //Select Case内をコンパイル … … 1234 1239 1235 1240 //レキシカルスコープをレベルダウン 1236 obj_LexScopes.End();1241 GetLexicalScopes().End(); 1237 1242 1238 1243 pCaseSchedule=temp_pCaseSchedule; -
trunk/abdev/BasicCompiler32/Compile_Var.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <LexicalScopingImpl.h> 5 #include <CodeGenerator.h> 6 #include <Compiler.h> 7 1 8 #include "../BasicCompiler_Common/common.h" 2 9 #include "Opcode.h" … … 187 194 188 195 //アクセシビリティをチェック 189 if(&objClass== pobj_CompilingClass){196 if(&objClass==Smoothie::Temp::pCompilingClass){ 190 197 //同一クラスオブジェクトの場合はプライベートアクセスを容認する 191 198 if(pMember->IsNoneAccess()){ … … 360 367 // 名前空間を分離 361 368 char namespaceStr[VN_SIZE]="", simpleName[VN_SIZE]; 362 Smoothie:: meta.namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName );369 Smoothie::GetMeta().namespaceScopesCollection.SplitNamespace( variable, namespaceStr, simpleName ); 363 370 364 371 // 先頭オブジェクトまたはクラス名と入れ子メンバに分割 … … 417 424 } 418 425 419 if( pobj_CompilingClass){426 if(Smoothie::Temp::pCompilingClass){ 420 427 ////////////////////// 421 428 // クラスメンバの参照 … … 430 437 pRelativeVar->dwKind=VAR_DIRECTMEM; 431 438 432 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );439 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 433 440 return true; 434 441 } … … 443 450 444 451 bool isFound = false; 445 BOOST_FOREACH( CMember *pMember, pobj_CompilingClass->GetDynamicMembers() ){452 BOOST_FOREACH( CMember *pMember, Smoothie::Temp::pCompilingClass->GetDynamicMembers() ){ 446 453 if( pMember->GetName() == VarName ){ 447 454 isFound = true; … … 454 461 //Const修飾子のメソッド内でメンバ書き込みアクセスが発生したとき 455 462 //(コンストラクタ、デストラクタ内を除く) 456 const CMethod *pMethod = pobj_DBClass->GetNowCompilingMethodInfo();463 const CMethod *pMethod = Smoothie::GetMeta().GetClasses().GetNowCompilingMethodInfo(); 457 464 if( isWriteAccess && 458 465 pMethod->IsConst() && 459 pobj_CompilingClass->IsCompilingConstructor() == false &&460 pobj_CompilingClass->IsCompilingDestructor() == false466 Smoothie::Temp::pCompilingClass->IsCompilingConstructor() == false && 467 Smoothie::Temp::pCompilingClass->IsCompilingDestructor() == false 461 468 ){ 462 469 SetError(131, NULL, cp ); … … 473 480 isErrorEnabled, 474 481 isWriteAccess, 475 * pobj_CompilingClass,482 *Smoothie::Temp::pCompilingClass, 476 483 variable, 477 484 pRelativeVar, … … 517 524 } 518 525 519 int typeDefIndex = Smoothie:: meta.typeDefs.GetIndex( VarName );526 int typeDefIndex = Smoothie::GetMeta().typeDefs.GetIndex( VarName ); 520 527 if( typeDefIndex != -1 ){ 521 528 // TypeDef後の型名だったとき 522 lstrcpy( VarName, Smoothie:: meta.typeDefs[typeDefIndex].GetBaseName().c_str() );529 lstrcpy( VarName, Smoothie::GetMeta().typeDefs[typeDefIndex].GetBaseName().c_str() ); 523 530 } 524 531 … … 533 540 } 534 541 535 if( pobj_CompilingClass){542 if(Smoothie::Temp::pCompilingClass){ 536 543 //自身のクラスから静的メンバを参照する場合 537 544 char temp2[VN_SIZE]; 538 sprintf(temp2,"%s.%s", pobj_CompilingClass->GetName().c_str(),VarName);545 sprintf(temp2,"%s.%s",Smoothie::Temp::pCompilingClass->GetName().c_str(),VarName); 539 546 pVar = globalVars.Find( Symbol( temp2 ) ); 540 547 if( pVar ){ … … 825 832 char *temp; 826 833 temp=(char *)i64data; 827 i2= dataTable.AddString(temp,lstrlen(temp));834 i2=Compiler::GetNativeCode().GetDataTable().AddString(temp,lstrlen(temp)); 828 835 HeapDefaultFree(temp); 829 836 … … 1015 1022 char *temp; 1016 1023 temp=(char *)i64data; 1017 i2= dataTable.AddString(temp,lstrlen(temp));1024 i2=Compiler::GetNativeCode().GetDataTable().AddString(temp,lstrlen(temp)); 1018 1025 HeapDefaultFree(temp); 1019 1026 … … 1099 1106 1100 1107 //レキシカルスコープ 1101 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();1102 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();1108 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 1109 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 1103 1110 pVar->bLiving=TRUE; 1104 1111 … … 1134 1141 1135 1142 //レキシカルスコープ 1136 pVar->ScopeLevel= obj_LexScopes.GetNowLevel();1137 pVar->ScopeStartAddress= obj_LexScopes.GetStartAddress();1143 pVar->ScopeLevel=GetLexicalScopes().GetNowLevel(); 1144 pVar->ScopeStartAddress=GetLexicalScopes().GetStartAddress(); 1138 1145 pVar->bLiving=TRUE; 1139 1146 -
trunk/abdev/BasicCompiler32/MakePeHdr.cpp
r165 r183 1 1 #include <jenga/include/common/Environment.h> 2 3 #include <jenga/include/smoothie/Smoothie.h> 4 5 #include <LexicalScopingImpl.h> 6 #include <ClassImpl.h> 7 #include <Compiler.h> 2 8 3 9 #include "../BasicCompiler_Common/common.h" … … 134 140 ////////////////// 135 141 // データテーブル 136 dataTable.Init();142 Compiler::GetNativeCode().GetDataTable().Init(); 137 143 if(bDebugCompile){ 138 dataTable.Add( (long)0x00000002 );144 Compiler::GetNativeCode().GetDataTable().Add( (long)0x00000002 ); 139 145 } 140 146 … … 160 166 161 167 //関数ポインタ情報を初期化 162 Smoothie:: meta.procPointers.clear();168 Smoothie::GetMeta().GetProcPointers().clear(); 163 169 164 170 // 名前空間情報を取得 165 171 NamespaceScopesCollection::CollectNamespaces( 166 172 Smoothie::Lexical::source.GetBuffer(), 167 Smoothie:: meta.namespaceScopesCollection173 Smoothie::GetMeta().namespaceScopesCollection 168 174 ); 169 175 … … 171 177 // GetSubInfo関数の中で参照されるオブジェクト名を事前に取得する。 172 178 // ※オブジェクトの内容までは取得しない 173 pobj_DBClass=new Classes(); 174 pobj_DBClass->InitNames(); 179 Smoothie::GetMeta().GetClasses().CollectClassesForNameOnly( Smoothie::Lexical::source ); 175 180 176 181 //TypeDef情報を初期化 177 Smoothie:: meta.typeDefs.Init();182 Smoothie::GetMeta().typeDefs.Init(); 178 183 179 184 //定数情報を取得 … … 181 186 182 187 //サブルーチン(ユーザー定義、DLL関数)の識別子、アドレスを取得 183 pobj_CompilingClass=0;188 Smoothie::Temp::pCompilingClass=0; 184 189 GetSubInfo(); 185 190 186 191 //クラス情報を取得(※注 - GetSubInfoの後に呼び出す) 187 pobj_DBClass->GetAllClassInfo();192 Smoothie::GetMeta().GetClasses().GetAllClassInfo(); 188 193 189 194 //コードと行番号の関係 … … 336 341 337 342 //レキシカルスコープ情報を初期化 338 obj_LexScopes.Init(obp);343 GetLexicalScopes().Init(obp); 339 344 340 345 … … 360 365 if(!bDll){ 361 366 // 名前空間が初期化されているかをチェック 362 if( Smoothie:: Lexical::liveingNamespaceScopes.size() ){367 if( Smoothie::Temp::liveingNamespaceScopes.size() ){ 363 368 SetError(); 364 369 } … … 405 410 406 411 //クラスに属する静的メンバを定義 407 CMember::InitStaticMember();412 Smoothie::GetMeta().GetClasses().InitStaticMember(); 408 413 409 414 //グローバル実行領域をコンパイル開始 … … 460 465 461 466 // 名前空間が正しく閉じられているかをチェック 462 if( Smoothie:: Lexical::liveingNamespaceScopes.size() ){467 if( Smoothie::Temp::liveingNamespaceScopes.size() ){ 463 468 SetError(63,NULL,-1); 464 469 } … … 792 797 //(デバッグ情報で利用される) 793 798 extern int AllInitGlobalVarSize; 794 foreach( Variable *pVar, globalVars ){799 BOOST_FOREACH( Variable *pVar, globalVars ){ 795 800 if(pVar->offset&0x80000000){ 796 801 pVar->offset=(pVar->offset&0x7FFFFFFF)+AllInitGlobalVarSize; … … 874 879 875 880 //データセクションのファイル上のサイズ 876 if( dataTable.GetSize()%FILE_ALIGNMENT) FileSize_DataSection=dataTable.GetSize()+(FILE_ALIGNMENT-dataTable.GetSize()%FILE_ALIGNMENT);877 else FileSize_DataSection= dataTable.GetSize();881 if(Compiler::GetNativeCode().GetDataTable().GetSize()%FILE_ALIGNMENT) FileSize_DataSection=Compiler::GetNativeCode().GetDataTable().GetSize()+(FILE_ALIGNMENT-Compiler::GetNativeCode().GetDataTable().GetSize()%FILE_ALIGNMENT); 882 else FileSize_DataSection=Compiler::GetNativeCode().GetDataTable().GetSize(); 878 883 if(FileSize_DataSection) bUse_DataSection=1; 879 884 else bUse_DataSection=0; … … 1066 1071 //////////////////////////////////////// 1067 1072 //仮想関数データテーブルスケジュール 1068 pobj_DBClass->ActionVtblSchedule(ImageBase,MemPos_CodeSection);1073 Smoothie::GetMeta().GetClasses().ActionVtblSchedule(ImageBase,MemPos_CodeSection); 1069 1074 1070 1075 … … 1601 1606 if(bUse_DataSection){ 1602 1607 //データ テーブル 1603 WriteFile(hFile, dataTable.GetPtr(),dataTable.GetSize(),(DWORD *)&i2,NULL);1608 WriteFile(hFile,Compiler::GetNativeCode().GetDataTable().GetPtr(),Compiler::GetNativeCode().GetDataTable().GetSize(),(DWORD *)&i2,NULL); 1604 1609 i+=i2; 1605 1610 } … … 1713 1718 1714 1719 //クラスに関するメモリを解放 1715 delete pobj_DBClass; 1716 pobj_DBClass=0; 1720 Smoothie::GetMeta().GetClasses().Clear(); 1717 1721 } -
trunk/abdev/BasicCompiler32/NumOpe.cpp
r159 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 #include <jenga/include/smoothie/LexicalAnalysis.h> 3 4 #include <Compiler.h> 5 1 6 #include "../BasicCompiler_Common/common.h" 2 7 #include "Opcode.h" … … 39 44 op_push(REG_EAX); 40 45 } 41 else if(type==DEF_INTEGER || ( isUnicode&&type==DEF_CHAR)){46 else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 42 47 //movsx ebx,ax 43 48 OpBuffer[obp++]=(char)0x0F; … … 48 53 op_push(REG_EBX); 49 54 } 50 else if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){55 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 51 56 //movsx ebx,al 52 57 OpBuffer[obp++]=(char)0x0F; … … 77 82 SetStringQuotes( parameter ); 78 83 79 Operator_New( * pobj_DBClass->GetStringClassPtr(), "", parameter, Type( DEF_OBJECT, *pobj_DBClass->GetStringClassPtr() ) );84 Operator_New( *Smoothie::GetMeta().GetClasses().GetStringClassPtr(), "", parameter, Type( DEF_OBJECT, *Smoothie::GetMeta().GetClasses().GetStringClassPtr() ) ); 80 85 81 86 free( parameter ); … … 244 249 char member[VN_SIZE]; 245 250 CClass::RefType refType; 246 if( SplitMemberName( termFull, termLeft, member, refType ) ){251 if( CClass::SplitName( termFull, termLeft, member, refType ) ){ 247 252 /////////////////////////////////////////////////////////////////// 248 253 // オブジェクトとメンバに分解できるとき … … 256 261 Type leftType; 257 262 if( GetTermType( termLeft, leftType, isLiteral, &isClassName ) ){ 258 if( isClassName == false && Smoothie:: meta.blittableTypes.IsExist( leftType ) ){263 if( isClassName == false && Smoothie::GetMeta().blittableTypes.IsExist( leftType ) ){ 259 264 // 左側のオブジェクト部分がBlittable型のとき 260 265 … … 262 267 lstrcpy( temporary, termLeft ); 263 268 sprintf( termLeft, "%s(%s)", 264 Smoothie:: meta.blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(),269 Smoothie::GetMeta().blittableTypes.Find( leftType ).GetCreateStaticMethodFullName().c_str(), 265 270 temporary ); 266 271 } … … 291 296 292 297 if( pIsClassName ){ 293 if( pobj_DBClass->Find( termFull ) ){298 if( Smoothie::GetMeta().GetClasses().Find( termFull ) ){ 294 299 *pIsClassName = true; 295 300 return true; … … 307 312 if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){ 308 313 //Thisオブジェクト 309 resultType.SetType( DEF_OBJECT, pobj_CompilingClass );314 resultType.SetType( DEF_OBJECT, Smoothie::Temp::pCompilingClass ); 310 315 311 316 SetThisPtrToReg( useReg ); … … 588 593 } 589 594 590 i2 = dataTable.AddBinary( binary, num * tempBaseType.GetSize() );595 i2 = Compiler::GetNativeCode().GetDataTable().AddBinary( binary, num * tempBaseType.GetSize() ); 591 596 592 597 //mov eax,i2 … … 735 740 736 741 type_stack[sp]=DEF_OBJECT; 737 index_stack[sp]=(LONG_PTR) pobj_DBClass->GetStringClassPtr();742 index_stack[sp]=(LONG_PTR)Smoothie::GetMeta().GetClasses().GetStringClassPtr(); 738 743 bLiteralCalculation=0; 739 744 … … 746 751 bLiteralCalculation=0; 747 752 748 i2= dataTable.AddString(term,i3);753 i2=Compiler::GetNativeCode().GetDataTable().AddString(term,i3); 749 754 750 755 //push DataSize … … 833 838 } 834 839 else{ 835 index_stack[sp] = (LONG_PTR) pobj_DBClass->GetObjectClassPtr();840 index_stack[sp] = (LONG_PTR)Smoothie::GetMeta().GetClasses().GetObjectClassPtr(); 836 841 } 837 842 -
trunk/abdev/BasicCompiler32/NumOpe_TypeOperation.cpp
r67 r183 1 #include <jenga/include/smoothie/Smoothie.h> 2 3 #include <Compiler.h> 4 1 5 #include "../BasicCompiler_Common/common.h" 2 6 #include "Opcode.h" … … 51 55 op_push(REG_EAX); 52 56 } 53 else if(type==DEF_INTEGER || ( isUnicode&&type==DEF_CHAR)){57 else if(type==DEF_INTEGER || (Smoothie::IsUnicode()&&type==DEF_CHAR)){ 54 58 //pop eax 55 59 op_pop(REG_EAX); … … 75 79 op_push(REG_EAX); 76 80 } 77 else if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){81 else if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 78 82 //pop eax 79 83 op_pop(REG_EAX); … … 101 105 } 102 106 void ExtendStackTo16(int type){ 103 if(type==DEF_SBYTE || ( isUnicode==false&&type==DEF_CHAR)){107 if(type==DEF_SBYTE || (Smoothie::IsUnicode()==false&&type==DEF_CHAR)){ 104 108 //pop eax 105 109 op_pop(REG_EAX);
Note:
See TracChangeset
for help on using the changeset viewer.