Changeset 91 in dev
- Timestamp:
- Apr 7, 2007, 10:07:26 PM (18 years ago)
- Files:
-
- 1 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/BasicCompiler.vcproj
r89 r91 430 430 /> 431 431 </FileConfiguration> 432 </File> 433 <File 434 RelativePath="..\BasicCompiler_Common\Diagnose.cpp" 435 > 432 436 </File> 433 437 <File -
BasicCompiler32/Compile_ProcOp.cpp
r90 r91 220 220 } 221 221 222 void CompileBufferInProcedure(UserProc *pUserProc){222 void _compile_proc(UserProc *pUserProc){ 223 223 extern char *basbuf; 224 224 extern HANDLE hHeap; … … 842 842 //ローカル変数のネーム情報は後に解放する 843 843 } 844 845 void CompileBufferInProcedure( UserProc &userProc ){ 846 if( userProc.IsUsing() == false || userProc.IsCompiled() ) return; 847 848 _compile_proc( &userProc ); 849 850 // ログを履く 851 char temporary[8192]; 852 temporary[0]=0; 853 lstrcat( temporary, "------------------------------------------------------------------\n" ); 854 sprintf( temporary + lstrlen(temporary), "【 %s のコード情報】\n", userProc.GetFullName().c_str() ); 855 sprintf( temporary + lstrlen(temporary), "code size: %d bytes\n", userProc.GetCodeSize() ); 856 lstrcat( temporary, "------------------------------------------------------------------\n" ); 857 lstrcat( temporary, "\n" ); 858 Smoothie::Logger::Put( temporary ); 859 } 844 860 void CompileLocal(){ 845 861 extern UserProc **ppSubHash; … … 852 868 pUserProc=GetSubHash("_System_InitDllGlobalVariables"); 853 869 if(pUserProc){ 854 CompileBufferInProcedure( pUserProc);870 CompileBufferInProcedure( *pUserProc ); 855 871 } 856 872 else SetError(300,NULL,cp); … … 870 886 pUserProc=ppSubHash[i2]; 871 887 while(pUserProc){ 872 CompileBufferInProcedure( pUserProc);888 CompileBufferInProcedure( *pUserProc ); 873 889 pUserProc=pUserProc->pNextData; 874 890 } … … 889 905 //_System_InitStaticLocalVariablesは一番最後にコンパイル 890 906 pSub_System_InitStaticLocalVariables->KillCompileStatus(); 891 CompileBufferInProcedure( pSub_System_InitStaticLocalVariables);907 CompileBufferInProcedure( *pSub_System_InitStaticLocalVariables ); 892 908 893 909 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル 894 910 pSub_System_Call_Destructor_of_GlobalObject->KillCompileStatus(); 895 CompileBufferInProcedure( pSub_System_Call_Destructor_of_GlobalObject);911 CompileBufferInProcedure( *pSub_System_Call_Destructor_of_GlobalObject ); 896 912 } -
BasicCompiler32/MakePeHdr.cpp
r90 r91 463 463 464 464 StepCompileProgress(); 465 466 467 468 //////////////////////////////// 469 // ここで一旦ログを取る 470 //////////////////////////////// 471 Diagnose(); 465 472 466 473 -
BasicCompiler64/BasicCompiler.vcproj
r89 r91 1289 1289 </File> 1290 1290 <File 1291 RelativePath="..\BasicCompiler_Common\Diagnose.cpp" 1292 > 1293 </File> 1294 <File 1291 1295 RelativePath="..\BasicCompiler_Common\error.cpp" 1292 1296 > -
BasicCompiler64/Compile_ProcOp.cpp
r90 r91 210 210 } 211 211 } 212 void CompileBufferInProcedure(UserProc *pUserProc){212 void _compile_proc(UserProc *pUserProc){ 213 213 extern char *basbuf; 214 214 extern HANDLE hHeap; … … 814 814 HeapDefaultFree(SynonymErrorWords); 815 815 } 816 817 void CompileBufferInProcedure( UserProc &userProc ){ 818 if( userProc.IsUsing() == false || userProc.IsCompiled() ) return; 819 820 _compile_proc( &userProc ); 821 822 // ログを履く 823 char temporary[8192]; 824 temporary[0]=0; 825 lstrcat( temporary, "------------------------------------------------------------------\n" ); 826 sprintf( temporary + lstrlen(temporary), "【 %s のコード情報】\n", userProc.GetFullName().c_str() ); 827 sprintf( temporary + lstrlen(temporary), "code size: %d bytes\n", userProc.GetCodeSize() ); 828 lstrcat( temporary, "------------------------------------------------------------------\n" ); 829 lstrcat( temporary, "\n" ); 830 Smoothie::Logger::Put( temporary ); 831 } 816 832 void CompileLocal(){ 817 833 extern UserProc **ppSubHash; … … 824 840 pUserProc=GetSubHash("_System_InitDllGlobalVariables"); 825 841 if(pUserProc){ 826 CompileBufferInProcedure( pUserProc);842 CompileBufferInProcedure( *pUserProc ); 827 843 } 828 844 else SetError(300,NULL,cp); … … 842 858 pUserProc=ppSubHash[i2]; 843 859 while(pUserProc){ 844 CompileBufferInProcedure( pUserProc);860 CompileBufferInProcedure( *pUserProc ); 845 861 pUserProc=pUserProc->pNextData; 846 862 } … … 861 877 //_System_InitStaticLocalVariablesは一番最後にコンパイル 862 878 pSub_System_InitStaticLocalVariables->KillCompileStatus(); 863 CompileBufferInProcedure( pSub_System_InitStaticLocalVariables);879 CompileBufferInProcedure( *pSub_System_InitStaticLocalVariables ); 864 880 865 881 //_System_Call_Destructor_of_GlobalObjectは一番最後にコンパイル 866 882 pSub_System_Call_Destructor_of_GlobalObject->KillCompileStatus(); 867 CompileBufferInProcedure( pSub_System_Call_Destructor_of_GlobalObject);883 CompileBufferInProcedure( *pSub_System_Call_Destructor_of_GlobalObject ); 868 884 } -
BasicCompiler64/MakePeHdr.cpp
r90 r91 436 436 //ネイティブコード生成はここまで 437 437 ////////////////////////////////////////////////////////// 438 439 440 441 //////////////////////////////// 442 // ここで一旦ログを取る 443 //////////////////////////////// 444 Diagnose(); 438 445 439 446 -
BasicCompiler_Common/Class.cpp
r90 r91 150 150 DestructorMemberSubIndex( 0 ), 151 151 classType( Class ), 152 isUsing( false ), 152 153 pobj_InheritsClass( NULL ), 153 154 ppobj_Member( NULL ), … … 192 193 delete method; 193 194 } 195 } 196 197 bool CClass::IsUsing() const 198 { 199 return isUsing; 200 } 201 void CClass::Using(){ 202 isUsing = true; 194 203 } 195 204 … … 1509 1518 1510 1519 while( Iterator_HasNext() ){ 1511 CClass *pClass = Iterator_GetNext(); 1520 const CClass &objClass = *Iterator_GetNext(); 1521 1522 if( !objClass.IsUsing() ){ 1523 // 未使用のクラスは無視する 1524 continue; 1525 } 1512 1526 1513 1527 sprintf( temporary … … 1516 1530 , ESC_NEW 1517 1531 , "" // 名前空間 (TODO: 実装) 1518 , pClass->name // クラス名1532 , objClass.name // クラス名 1519 1533 ); 1520 1534 … … 1543 1557 1544 1558 while( Iterator_HasNext() ){ 1545 CClass *pClass = Iterator_GetNext(); 1546 1547 if( pClass->pobj_InheritsClass ){ 1559 const CClass &objClass = *Iterator_GetNext(); 1560 1561 if( !objClass.IsUsing() ){ 1562 // 未使用のクラスは無視する 1563 continue; 1564 } 1565 1566 if( objClass.pobj_InheritsClass ){ 1548 1567 sprintf( temporary 1549 1568 , "tempType=Search(\"%s\",\"%s\")" 1550 1569 , "" // 名前空間 (TODO: 実装) 1551 , pClass->name // クラス名1570 , objClass.name // クラス名 1552 1571 ); 1553 1572 … … 1558 1577 , "tempType.SetBaseType(Search(\"%s\",\"%s\"))" 1559 1578 , "" // 名前空間 (TODO: 実装) 1560 , pClass->pobj_InheritsClass->name // 基底クラス名1579 , objClass.pobj_InheritsClass->name // 基底クラス名 1561 1580 ); 1562 1581 … … 1619 1638 pCompilingClass = pUserProc->GetParentClassPtr(); 1620 1639 if( pCompilingClass ){ 1640 pCompilingClass->Using(); 1641 1621 1642 pCompilingMethod = pCompilingClass->GetMethodInfo( pUserProc ); 1622 1643 if( !pCompilingMethod ){ -
BasicCompiler_Common/Class.h
r90 r91 59 59 60 60 //静的メンバ情報 61 std::vector<CMember *> staticMembers;61 std::vector<CMember *> staticMembers; 62 62 63 63 //メソッド情報 … … 79 79 ClassType classType; 80 80 81 bool isUsing; 82 81 83 public: 82 84 //クラス名 … … 100 102 CClass(const char *name); 101 103 ~CClass(); 104 105 bool IsUsing() const; 106 void Using(); 102 107 103 108 bool IsClass() const; … … 133 138 void EnumMethod( const char *methodName, std::vector<UserProc *> &subs ) const; 134 139 void EnumMethod( const BYTE idOperatorCalc, std::vector<UserProc *> &subs ) const; 140 const std::vector<CMethod *> &GetMethods() const 141 { 142 return methods; 143 } 144 const std::vector<CMethod *> &GetStaticMethods() const 145 { 146 return staticMethods; 147 } 135 148 136 149 //デフォルト コンストラクタ メソッドを取得 -
BasicCompiler_Common/MakeExe.cpp
r88 r91 59 59 int i2,i3; 60 60 char temp2[MAX_PATH]; 61 62 //ログ用バッファを初期化 63 Smoothie::Logger::Initialize(); 61 64 62 65 //プログレスバーの設定 -
BasicCompiler_Common/Procedure.h
r90 r91 126 126 } 127 127 128 string GetFullName() const 129 { 130 if( HasParentClass() ){ 131 return (string)GetParentClass().name + "." + GetName(); 132 } 133 134 return GetName(); 135 } 136 128 137 bool IsMacro() const 129 138 { … … 211 220 DWORD beginOpAddress; 212 221 DWORD endOpAddress; 222 int GetCodeSize() const 223 { 224 return endOpAddress - beginOpAddress; 225 } 213 226 214 227 // ローカル変数 -
BasicCompiler_Common/common.h
r90 r91 502 502 void Compile(void); 503 503 504 //Diagnose.cpp 505 void Diagnose(); 506 504 507 //gc.cpp 505 508 void InitGCVariables(void); -
BasicCompiler_Common/include/Smoothie.h
r88 r91 6 6 class Smoothie{ 7 7 public: 8 9 class Logger{ 10 static string log; 11 public: 12 static void Initialize(){ 13 #ifdef _DEBUG 14 log = ""; 15 16 ofstream ofs( ( (string)BasicSystemDir + "compile.log" ).c_str(), ios_base::trunc ); 17 ofs.close(); 18 #endif 19 } 20 static void Put( const string &text ){ 21 #ifdef _DEBUG 22 log += text + "\r\n"; 23 24 { 25 ofstream ofs( ( (string)BasicSystemDir + "compile.log" ).c_str(), ios_base::app ); 26 ofs << text << endl; 27 ofs.close(); 28 } 29 #endif 30 } 31 }; 8 32 9 33 class Lexical{ -
BasicCompiler_Common/src/Smoothie.cpp
r88 r91 1 1 #include <..\common.h> 2 3 string Smoothie::Logger::log = ""; 2 4 3 5 BasicSource Smoothie::Lexical::source;
Note:
See TracChangeset
for help on using the changeset viewer.