Changeset 91 in dev for BasicCompiler_Common


Ignore:
Timestamp:
Apr 7, 2007, 10:07:26 PM (17 years ago)
Author:
dai_9181
Message:

ログ機構(Smoothie::Logger)を導入。
動的型情報生成において、未使用クラスの登録は行わないようにした。

Location:
BasicCompiler_Common
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Class.cpp

    r90 r91  
    150150    DestructorMemberSubIndex( 0 ),
    151151    classType( Class ),
     152    isUsing( false ),
    152153    pobj_InheritsClass( NULL ),
    153154    ppobj_Member( NULL ),
     
    192193        delete method;
    193194    }
     195}
     196
     197bool CClass::IsUsing() const
     198{
     199    return isUsing;
     200}
     201void CClass::Using(){
     202    isUsing = true;
    194203}
    195204
     
    15091518
    15101519    while( Iterator_HasNext() ){
    1511         CClass *pClass = Iterator_GetNext();
     1520        const CClass &objClass = *Iterator_GetNext();
     1521
     1522        if( !objClass.IsUsing() ){
     1523            // 未使用のクラスは無視する
     1524            continue;
     1525        }
    15121526
    15131527        sprintf( temporary
     
    15161530            , ESC_NEW
    15171531            , ""                // 名前空間 (TODO: 実装)
    1518             , pClass->name      // クラス名
     1532            , objClass.name     // クラス名
    15191533            );
    15201534
     
    15431557
    15441558    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 ){
    15481567            sprintf( temporary
    15491568                , "tempType=Search(\"%s\",\"%s\")"
    15501569                , ""                // 名前空間 (TODO: 実装)
    1551                 , pClass->name      // クラス名
     1570                , objClass.name     // クラス名
    15521571                );
    15531572
     
    15581577                , "tempType.SetBaseType(Search(\"%s\",\"%s\"))"
    15591578                , ""                                // 名前空間 (TODO: 実装)
    1560                 , pClass->pobj_InheritsClass->name  // 基底クラス名
     1579                , objClass.pobj_InheritsClass->name // 基底クラス名
    15611580                );
    15621581
     
    16191638    pCompilingClass = pUserProc->GetParentClassPtr();
    16201639    if( pCompilingClass ){
     1640        pCompilingClass->Using();
     1641
    16211642        pCompilingMethod = pCompilingClass->GetMethodInfo( pUserProc );
    16221643        if( !pCompilingMethod ){
  • BasicCompiler_Common/Class.h

    r90 r91  
    5959
    6060    //静的メンバ情報
    61     std::vector<CMember *>staticMembers;
     61    std::vector<CMember *> staticMembers;
    6262
    6363    //メソッド情報
     
    7979    ClassType classType;
    8080
     81    bool isUsing;
     82
    8183public:
    8284    //クラス名
     
    100102    CClass(const char *name);
    101103    ~CClass();
     104
     105    bool IsUsing() const;
     106    void Using();
    102107
    103108    bool IsClass() const;
     
    133138    void EnumMethod( const char *methodName, std::vector<UserProc *> &subs ) const;
    134139    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    }
    135148
    136149    //デフォルト コンストラクタ メソッドを取得
  • BasicCompiler_Common/MakeExe.cpp

    r88 r91  
    5959    int i2,i3;
    6060    char temp2[MAX_PATH];
     61
     62    //ログ用バッファを初期化
     63    Smoothie::Logger::Initialize();
    6164
    6265    //プログレスバーの設定
  • BasicCompiler_Common/Procedure.h

    r90 r91  
    126126    }
    127127
     128    string GetFullName() const
     129    {
     130        if( HasParentClass() ){
     131            return (string)GetParentClass().name + "." + GetName();
     132        }
     133
     134        return GetName();
     135    }
     136
    128137    bool IsMacro() const
    129138    {
     
    211220    DWORD beginOpAddress;
    212221    DWORD endOpAddress;
     222    int GetCodeSize() const
     223    {
     224        return endOpAddress - beginOpAddress;
     225    }
    213226
    214227    // ローカル変数
  • BasicCompiler_Common/common.h

    r90 r91  
    502502void Compile(void);
    503503
     504//Diagnose.cpp
     505void Diagnose();
     506
    504507//gc.cpp
    505508void InitGCVariables(void);
  • BasicCompiler_Common/include/Smoothie.h

    r88 r91  
    66class Smoothie{
    77public:
     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    };
    832
    933    class Lexical{
  • BasicCompiler_Common/src/Smoothie.cpp

    r88 r91  
    11#include <..\common.h>
     2
     3string Smoothie::Logger::log = "";
    24
    35BasicSource Smoothie::Lexical::source;
Note: See TracChangeset for help on using the changeset viewer.