Changeset 637 in dev for trunk


Ignore:
Timestamp:
Jun 11, 2008, 10:10:26 PM (16 years ago)
Author:
dai_9181
Message:

リンカの依存関係解決モジュールを製作中

Location:
trunk/ab5.0/abdev
Files:
1 added
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/BreakPoint.cpp

    r636 r637  
    104104            int i3;
    105105            for(i3=0;i3<(int)oldSourceLines.size()-1;i3++){
    106                 if(oldSourceLines[i3].GetSourceCodePos()==tempCp) break;
     106                if(oldSourceLines[i3].GetSourceCodePosition().GetPos()==tempCp) break;
    107107            }
    108108            if(i3==oldSourceLines.size()-1){
  • trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp

    r636 r637  
    747747            }
    748748
    749             compiler.codeGenerator.NextSourceLine( compiler.GetCurrentRelationalObjectModuleIndexForSource() );
     749            compiler.codeGenerator.NextSourceLine( SourceCodePosition( compiler.GetCurrentRelationalObjectModuleIndexForSource(), cp ) );
    750750
    751751            if(Command[0]==1){
  • trunk/ab5.0/abdev/BasicCompiler_Common/Debug.cpp

    r636 r637  
    121121            int i3;
    122122            for(i3=0;i3<(int)oldSourceLines.size()-1;i3++){
    123                 if(oldSourceLines[i3].GetSourceCodePos()==tempCp) break;
     123                if(oldSourceLines[i3].GetSourceCodePosition().GetPos()==tempCp) break;
    124124            }
    125125            if(i3==oldSourceLines.size()-1){
  • trunk/ab5.0/abdev/BasicCompiler_Common/DebugMiddleFile.cpp

    r636 r637  
    141141    BOOST_FOREACH( const SourceLine &sourceLine, oldSourceLines )
    142142    {
    143         *(long *)(buffer+i2) = sourceLine.GetLineNum();
    144         i2+=sizeof(long);
    145 
    146143        *(long *)(buffer+i2) = sourceLine.GetNativeCodePos();
    147144        i2+=sizeof(long);
    148145
    149         *(long *)(buffer+i2) = sourceLine.GetRelationalObjectModuleIndex();
    150         i2+=sizeof(long);
    151 
    152         *(long *)(buffer+i2) = sourceLine.GetSourceCodePos();
    153         i2+=sizeof(long);
    154 
    155146        *(long *)(buffer+i2) = sourceLine.GetCodeType();
     147        i2+=sizeof(long);
     148
     149        *(long *)(buffer+i2) = sourceLine.GetSourceCodePosition().GetRelationalObjectModuleIndex();
     150        i2+=sizeof(long);
     151
     152        *(long *)(buffer+i2) = sourceLine.GetSourceCodePosition().GetPos();
    156153        i2+=sizeof(long);
    157154
     
    245242    i2+=sizeof(long);
    246243    for(i3=0;i3<maxLineInfoNum;i3++){
    247         int lineNum = *(long *)(buffer+i2);
    248         i2+=sizeof(long);
    249 
    250244        int nativeCodePos = *(long *)(buffer+i2);
    251245        i2+=sizeof(long);
    252246
    253         int sourceIndex = *(long *)(buffer+i2);
     247        DWORD sourceLineType = *(DWORD *)(buffer+i2);
     248        i2+=sizeof(long);
     249
     250        int relationalObjectModuleIndex = *(long *)(buffer+i2);
    254251        i2+=sizeof(long);
    255252
    256253        int sourceCodePos = *(long *)(buffer+i2);
    257         i2+=sizeof(long);
    258 
    259         DWORD sourceLineType = *(DWORD *)(buffer+i2);
    260254        i2+=sizeof(long);
    261255
    262256        _oldSourceLines.push_back(
    263257            SourceLine(
    264                 lineNum,
    265258                nativeCodePos,
    266                 sourceIndex,
    267                 sourceCodePos,
    268                 sourceLineType
     259                sourceLineType,
     260                SourceCodePosition( relationalObjectModuleIndex, sourceCodePos )
    269261            )
    270262        );
  • trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp

    r636 r637  
    620620        else
    621621        {
    622             pobj_dti->lpdwCp[i3]=oldSourceLines[i2].GetSourceCodePos();
    623             pobj_dti->relationalObjectModuleIndexes[i3]=oldSourceLines[i2].GetRelationalObjectModuleIndex();
     622            pobj_dti->lpdwCp[i3]=oldSourceLines[i2].GetSourceCodePosition().GetPos();
     623            pobj_dti->relationalObjectModuleIndexes[i3]=oldSourceLines[i2].GetSourceCodePosition().GetRelationalObjectModuleIndex();
    624624        }
    625625    }
  • trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp

    r632 r637  
    962962
    963963    Variable *pVar = new Variable(
    964         compiler.GetNamespaceSupporter().GetLivingNamespaceScopes(),
    965         name,
     964        Symbol( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes(), name ),
    966965        type,
    967966        isConst,
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/CodeGenerator.h

    r597 r637  
    241241    }
    242242
    243     void NextSourceLine( int currentSourceIndex )
    244     {
    245         extern int cp;
    246         pNativeCode->NextSourceLine( currentSourceIndex, cp );
     243    void NextSourceLine( const SourceCodePosition &sourceCodePosition )
     244    {
     245        pNativeCode->NextSourceLine( sourceCodePosition );
    247246    }
    248247
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp

    r636 r637  
    5050
    5151        // メタ情報
    52         this->GetObjectModule().StaticLink( *pStaticLibrary );
     52        this->GetObjectModule().StaticLink( *pStaticLibrary, this->IsSll() );
    5353    }
    5454}
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp

    r632 r637  
    117117
    118118            //クラスを追加
    119             CClass *pClass = new CClass( namespaceScopes, importedNamespaces, temporary );
     119            CClass *pClass = new CClass( Symbol( namespaceScopes, temporary ), importedNamespaces );
    120120            if( classes.IsExist( pClass ) )
    121121            {
     
    575575        //関数ハッシュへ登録
    576576        UserProc *pUserProc = new UserProc(
    577             NamespaceScopes(),
     577            Symbol( NamespaceScopes(), methodName ),
    578578            NamespaceScopesCollection(),
    579             methodName,
    580579            Procedure::Function,
    581580            false,
     
    14341433    // クラスをコピー
    14351434    CClass *pNewClass = new CClass(
    1436         _class.GetNamespaceScopes(),
     1435        _class,
    14371436        _class.GetImportedNamespaces(),
    1438         _class.GetName(),
    14391437        _class.GetClassType(),
    14401438        _class.GetFormalGenericTypes(),
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Const.cpp

    r600 r637  
    7474
    7575        //定数を追加
    76         consts.Add( namespaceScopes, temporary, NextValue);
     76        consts.Add( Symbol( namespaceScopes, temporary ), NextValue);
    7777    }
    7878}
     
    178178                    if( StaticCalculation(false, expression, 0, &i64data, resultType) )
    179179                    {
    180                         consts.Add( namespaceScopes, name, i64data, resultType );
     180                        consts.Add( Symbol( namespaceScopes, name ), i64data, resultType );
    181181                    }
    182182                }
     
    185185                    // 定数マクロ
    186186                    const char *params = temporary + i2;
    187                     if( !constMacros.Add( namespaceScopes, name, params ) )
     187                    if( !constMacros.Add( Symbol( namespaceScopes, name ), params ) )
    188188                    {
    189189                        compiler.errorMessenger.Output( 1, NULL, i );
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Delegate.cpp

    r625 r637  
    115115            }
    116116
    117             delegates.Put( new Delegate( namespaceScopes, importedNamespaces, name, procKind, paramStr, returnTypeName, nowLine ) );
     117            delegates.Put( new Delegate( Symbol( namespaceScopes, name ), importedNamespaces, procKind, paramStr, returnTypeName, nowLine ) );
    118118        }
    119119    }
     
    131131        const Delegate &dg = *delegates.Iterator_GetNext();
    132132
    133         if( !dg.isTargetObjectModule )
     133        if( dg.IsExternal() )
    134134        {
    135135            // 静的リンクライブラリの場合は飛ばす(既にインスタンスが定義済みであるため)
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp

    r632 r637  
    156156
    157157    //ソースコードの位置
    158     userProc.SetSourceCodePosition( SourceCodePosition( compiler.GetObjectModule().GetName(), nowLine ) );
     158    userProc.SetSourceCodePosition( SourceCodePosition( compiler.GetCurrentRelationalObjectModuleIndexForSource(), nowLine ) );
    159159
    160160    //パラメータ
     
    286286
    287287    //ソースコードの位置
    288     pProc->SetSourceCodePosition( SourceCodePosition( compiler.GetObjectModule().GetName(), nowLine ) );
     288    pProc->SetSourceCodePosition( SourceCodePosition( compiler.GetCurrentRelationalObjectModuleIndexForSource(), nowLine ) );
    289289
    290290    //パラメータ
     
    615615    }
    616616
    617     UserProc *pUserProc = new UserProc( namespaceScopes, importedNamespaces, temporary, kind, isMacro, isCdecl, isExport );
     617    UserProc *pUserProc = new UserProc( Symbol( namespaceScopes, temporary ), importedNamespaces, kind, isMacro, isCdecl, isExport );
    618618    pUserProc->SetParentClass( pobj_c );
    619619
     
    737737
    738738    // オブジェクトを生成
    739     DllProc *pDllProc = new DllProc( namespaceScopes, procName, kind, isCdecl, dllFileName, alias );
     739    DllProc *pDllProc = new DllProc( Symbol( namespaceScopes, procName ), kind, isCdecl, dllFileName, alias );
    740740
    741741    // パラメータを解析
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_TypeDef.cpp

    r546 r637  
    7575    typeDefs.push_back(
    7676        TypeDef(
    77             namespaceScopes,
    78             temporary,
     77            Symbol( namespaceScopes, temporary ),
    7978            pTemp,
    8079            baseType
     
    176175                typeDefs.push_back(
    177176                    TypeDef(
    178                         namespaceScopes,
    179                         temporary,
     177                        Symbol( namespaceScopes, temporary ),
    180178                        "Long",
    181179                        baseType
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/ProcedureGenerator.cpp

    r589 r637  
    2121    while(classes.Iterator_HasNext()){
    2222        CClass &objClass = *classes.Iterator_GetNext();
    23         if( objClass.isTargetObjectModule == false )
     23        if( objClass.IsExternal() )
    2424        {
    2525            // 静的リンクライブラリの場合は飛ばす(既にインスタンスが定義済みであるため)
  • trunk/ab5.0/abdev/ab_common/ab_common.vcproj

    r632 r637  
    530530                </File>
    531531                <File
     532                    RelativePath=".\include\Lexical\RelationalObjectModuleItem.h"
     533                    >
     534                </File>
     535                <File
    532536                    RelativePath=".\include\Lexical\Source.h"
    533537                    >
  • trunk/ab5.0/abdev/ab_common/include/Environment.h

    r608 r637  
    2727{
    2828    static std::string rootPath;
     29    static bool isRemoveExternal;
    2930public:
    3031    static void SetAbdevRootPath( const std::string &rootPath );
     
    3839
    3940    static const std::string GetCompilerExePath( Platform::EnumType platform );
     41
     42    static bool IsRemoveExternal()
     43    {
     44        return isRemoveExternal;
     45    }
     46    static void SetRemoveExternalMark( bool isRemoveExternalMark )
     47    {
     48        Environment::isRemoveExternal = isRemoveExternalMark;
     49    }
    4050};
    4151
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h

    r632 r637  
    1818
    1919public:
    20     ClassPrototype( const NamespaceScopes &namespaceScopes, const std::string &name )
    21         : Prototype( namespaceScopes, name )
     20    ClassPrototype( const Symbol &symbol )
     21        : Prototype( symbol )
    2222        , DynamicMethodsPrototype()
    2323    {
     
    9292
    9393        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( ClassPrototype );
     94
     95        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     96        {
     97            if( this->IsExternal() )
     98            {
     99                this->NeedResolve();
     100                return;
     101            }
     102        }
     103
    94104        ar & BOOST_SERIALIZATION_NVP( classType );
    95105        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
     
    112122public:
    113123
    114     CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name );
    115     CClass( const NamespaceScopes &namespaceScopes,
     124    CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces );
     125    CClass( const Symbol &symbol,
    116126        const NamespaceScopesCollection &importedNamespaces,
    117         const std::string &name, ClassType classType,
     127        ClassType classType,
    118128        const GenericTypes &formalGenericTypes,
    119129        const Types &superClassActualTypeParameters,
     
    455465    std::string GetStaticDefiningStringAsMemberOffsets() const;
    456466    void GetReferenceOffsetsInitializeBuffer( std::string &referenceOffsetsBuffer, int &numOfReference, int baseOffset = 0 ) const;
     467
     468    virtual bool Resolve();
    457469};
    458470
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Const.h

    r603 r637  
    22
    33//定数
    4 class CConst : public Symbol, public Jenga::Common::ObjectInHashmap<CConst>
     4class CConst
     5    : public RelationalObjectModuleItem
     6    , public Jenga::Common::ObjectInHashmap<CConst>
    57{
    68    Type type;
     
    1416        trace_for_serialize( "serializing - CConst" );
    1517
    16         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     18        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
     19
     20        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     21        {
     22            if( this->IsExternal() )
     23            {
     24                this->NeedResolve();
     25                return;
     26            }
     27        }
     28
    1729        ar & BOOST_SERIALIZATION_NVP( type );
    1830        ar & BOOST_SERIALIZATION_NVP( i64data );
     
    2032
    2133public:
    22     CConst( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &newType, _int64 i64data)
    23         : Symbol( namespaceScopes, name )
     34    CConst( const Symbol &symbol, const Type &newType, _int64 i64data)
     35        : RelationalObjectModuleItem( symbol )
    2436        , type( newType )
    2537        , i64data( i64data )
    2638    {
    2739    }
    28     CConst( const NamespaceScopes &namespaceScopes, const std::string &name, int value)
    29         : Symbol( namespaceScopes, name )
     40    CConst( const Symbol &symbol, int value)
     41        : RelationalObjectModuleItem( symbol )
    3042        , type( Type(DEF_LONG) )
    3143        , i64data( value )
     
    5365    }
    5466    double GetDoubleData();
     67
     68    virtual bool Resolve();
    5569};
    5670class Consts : public Jenga::Common::Hashmap<CConst>
     
    6983public:
    7084
    71     void Add( const NamespaceScopes &namespaceScopes, const std::string &name, _int64 i64data, const Type &type );
    72     void Add( const NamespaceScopes &namespaceScopes, const std::string &name, int value);
     85    void Add( const Symbol &symbol, _int64 i64data, const Type &type );
     86    void Add( const Symbol &symbol, int value);
    7387
    7488private:
     
    8397
    8498//定数マクロ
    85 class ConstMacro : public Symbol, public Jenga::Common::ObjectInHashmap<ConstMacro>
     99class ConstMacro
     100    : public RelationalObjectModuleItem
     101    , public Jenga::Common::ObjectInHashmap<ConstMacro>
    86102{
    87103    std::vector<std::string> parameters;
     
    95111        trace_for_serialize( "serializing - ConstMacro" );
    96112
    97         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     113        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
     114
     115        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     116        {
     117            if( this->IsExternal() )
     118            {
     119                this->NeedResolve();
     120                return;
     121            }
     122        }
     123
    98124        ar & BOOST_SERIALIZATION_NVP( parameters );
    99125        ar & BOOST_SERIALIZATION_NVP( expression );
     
    101127
    102128public:
    103     ConstMacro( const NamespaceScopes &namespaceScopes, const std::string &name, const std::vector<std::string> &parameters, const std::string &expression )
    104         : Symbol( namespaceScopes, name )
     129    ConstMacro( const Symbol &symbol, const std::vector<std::string> &parameters, const std::string &expression )
     130        : RelationalObjectModuleItem( symbol )
    105131        , parameters( parameters )
    106132        , expression( expression )
     
    127153        return expression;
    128154    }
     155
     156    virtual bool Resolve();
    129157};
    130 class ConstMacros : public Jenga::Common::Hashmap<ConstMacro>
     158class ConstMacros
     159    : public Jenga::Common::Hashmap<ConstMacro>
    131160{
    132161    // XMLシリアライズ用
     
    142171
    143172public:
    144     bool Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );
     173    bool Add( const Symbol &symbol, const char *parameterStr );
    145174    ConstMacro *Find( const Symbol &name );
    146175};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/DataTable.h

    r603 r637  
    149149
    150150    void ResetDataSectionBaseOffset( long dataSectionBaseOffset );
     151
     152    void Resolve();
    151153};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Delegate.h

    r603 r637  
    2222
    2323        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
     24
     25        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     26        {
     27            if( this->IsExternal() )
     28            {
     29                this->NeedResolve();
     30                return;
     31            }
     32        }
     33
    2434        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
    2535        ar & BOOST_SERIALIZATION_NVP( dynamicParams );
     
    2737
    2838public:
    29     Delegate( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex )
    30         : Procedure( namespaceScopes, name, procKind, false )
     39    Delegate( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Procedure::Kind procKind, const char *paramStr, const std::string &returnTypeName, int sourceIndex )
     40        : Procedure( symbol, procKind, false )
    3141        , importedNamespaces( importedNamespaces )
    3242        , paramStr( paramStr )
     
    8191    */
    8292    bool IsSimilar( const Delegate &dgt ) const;
     93
     94    virtual bool Resolve();
    8395};
    8496typedef Jenga::Common::Hashmap<Delegate> Delegates;
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Meta.h

    r636 r637  
    157157
    158158    const CClass *FindClassSupportedTypeDef( const Symbol &symbol );
     159
     160    void Resolve();
    159161};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/NativeCode.h

    r636 r637  
    123123class SourceLine
    124124{
    125     int lineNum;
    126125    long nativeCodePos;
    127     int relationalObjectModuleIndex;
    128     long sourceCodePos;
    129126    DWORD codeType;
     127    SourceCodePosition sourceCodePosition;
    130128
    131129    // XMLシリアライズ用
     
    136134        trace_for_serialize( "serializing - SourceLine" );
    137135
    138         ar & BOOST_SERIALIZATION_NVP( lineNum );
    139136        ar & BOOST_SERIALIZATION_NVP( nativeCodePos );
    140         ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleIndex );
    141         ar & BOOST_SERIALIZATION_NVP( sourceCodePos );
    142137        ar & BOOST_SERIALIZATION_NVP( codeType );
    143     }
    144 
    145 public:
    146     SourceLine( int lineNum, int nativeCodePos, int relationalObjectModuleIndex, int sourceCodePos, DWORD codeType )
    147         : lineNum( lineNum )
    148         , nativeCodePos( nativeCodePos )
    149         , relationalObjectModuleIndex( relationalObjectModuleIndex )
    150         , sourceCodePos( sourceCodePos )
     138        ar & BOOST_SERIALIZATION_NVP( sourceCodePosition );
     139    }
     140
     141public:
     142    SourceLine( int nativeCodePos, DWORD codeType, const SourceCodePosition &sourceCodePosition )
     143        : nativeCodePos( nativeCodePos )
    151144        , codeType( codeType )
     145        , sourceCodePosition( sourceCodePosition )
    152146    {
    153147    }
     
    156150    }
    157151
    158     int GetLineNum() const
    159     {
    160         return lineNum;
    161     }
    162152    long GetNativeCodePos() const
    163153    {
    164154        return nativeCodePos;
    165155    }
    166     int GetRelationalObjectModuleIndex() const
    167     {
    168         return relationalObjectModuleIndex;
    169     }
    170     void SetRelationalObjectModuleIndex( int relationalObjectModuleIndex )
    171     {
    172         this->relationalObjectModuleIndex = relationalObjectModuleIndex;
    173     }
    174     long GetSourceCodePos() const
    175     {
    176         return sourceCodePos;
    177     }
    178     void SetSourceCodePos( int sourceCodePos )
    179     {
    180         this->sourceCodePos = sourceCodePos;
    181     }
    182156    DWORD GetCodeType() const
    183157    {
    184158        return codeType;
     159    }
     160    const SourceCodePosition &GetSourceCodePosition() const
     161    {
     162        return sourceCodePosition;
     163    }
     164    SourceCodePosition &GetSourceCodePosition()
     165    {
     166        return sourceCodePosition;
     167    }
     168    void SetSourceCodePosition( const SourceCodePosition &sourceCodePosition )
     169    {
     170        this->sourceCodePosition = sourceCodePosition;
    185171    }
    186172    bool IsInSystemProc() const
     
    256242        return sourceLines;
    257243    }
    258     void NextSourceLine( int currentSourceIndex, int nowLine );
     244    void NextSourceLine( const SourceCodePosition &sourceCodePosition );
    259245
    260246    void ResetDataSectionBaseOffset( long dataSectionBaseOffset );
    261     void ResetSourceIndexes( const std::vector<int> &relationTable );
     247    void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable );
     248
     249    void Resolve();
    262250};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h

    r636 r637  
    4343
    4444public:
    45     void StaticLink( ObjectModule &objectModule );
    4645
    4746    const std::string &GetName() const
     
    6261    }
    6362
     63    // 静的リンクを行う
     64    void StaticLink( ObjectModule &objectModule, bool isSll );
     65
     66    // 依存関係の解決を行う
     67    void Resolve();
     68
    6469    // 下記の関連になるようなテーブルを取得する
    6570    // 要素 = 古いインデックス、値 = 新しいインデックス
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h

    r632 r637  
    11#pragma once
    22
    3 class Procedure : public Symbol
     3class Procedure
     4    : public RelationalObjectModuleItem
    45{
    56public:
     
    3536        trace_for_serialize( "serializing - Procedure" );
    3637
    37         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     38        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
    3839        ar & BOOST_SERIALIZATION_NVP( kind );
    3940        ar & BOOST_SERIALIZATION_NVP( isCdecl );
     
    4546
    4647public:
    47     Procedure( const NamespaceScopes &namespaceScopes, const std::string &name, Kind kind, bool isCdecl )
    48         : Symbol( namespaceScopes, name )
     48    Procedure( const Symbol &symbol, Kind kind, bool isCdecl )
     49        : RelationalObjectModuleItem( symbol )
    4950        , kind( kind )
    5051        , isCdecl( isCdecl )
     
    9192        this->sourceCodePosition = sourceCodePosition;
    9293    }
     94    virtual void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable );
    9395
    9496    const Parameters &Params() const
     
    156158
    157159        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
     160
     161        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     162        {
     163            if( this->IsExternal() )
     164            {
     165                this->NeedResolve();
     166                return;
     167            }
     168        }
     169
    158170        ar & BOOST_SERIALIZATION_NVP( _paramStr );
    159171        ar & BOOST_SERIALIZATION_NVP( importedNamespaces );
     
    178190public:
    179191
    180     UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport );
     192    UserProc( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Kind kind, bool isMacro, bool isCdecl, bool isExport );
    181193    UserProc( const UserProc &userProc, const CClass *pParentClass );
    182194    UserProc();
     
    206218    }
    207219
     220    virtual void ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable );
     221
    208222    /*!
    209223    @brief  オーバーライド用に関数同士が等しいかどうかをチェックする
     
    360374    const CMethod &GetMethod() const;
    361375
     376    virtual bool Resolve();
    362377
    363378    static const UserProc *pGlobalProc;
     
    389404};
    390405
    391 class DllProc : public Procedure, public Jenga::Common::ObjectInHashmap<DllProc>
     406class DllProc
     407    : public Procedure
     408    , public Jenga::Common::ObjectInHashmap<DllProc>
    392409{
    393410    std::string dllFileName;
     
    403420
    404421        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Procedure );
     422
     423        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     424        {
     425            if( this->IsExternal() )
     426            {
     427                this->NeedResolve();
     428                return;
     429            }
     430        }
     431
    405432        ar & BOOST_SERIALIZATION_NVP( dllFileName );
    406433        ar & BOOST_SERIALIZATION_NVP( alias );
     
    409436
    410437public:
    411     DllProc( const NamespaceScopes &namespaceScopes, const std::string &name, Kind kind, bool isCdecl, const std::string &dllFileName, const std::string &alias )
    412         : Procedure( namespaceScopes, name, kind, isCdecl )
     438    DllProc( const Symbol &symbol, Kind kind, bool isCdecl, const std::string &dllFileName, const std::string &alias )
     439        : Procedure( symbol, kind, isCdecl )
    413440        , dllFileName( dllFileName )
    414441        , alias( alias )
     
    454481        return lookupAddress;
    455482    }
     483
     484    virtual bool Resolve();
    456485};
    457486class DllProcs : public Jenga::Common::Hashmap<DllProc>
     
    469498};
    470499
    471 class ProcPointer : public Procedure
     500class ProcPointer
     501    : public Procedure
    472502{
    473503    // XMLシリアライズ用
     
    483513public:
    484514    ProcPointer( Kind kind )
    485         : Procedure( NamespaceScopes(), std::string(), kind, false )
     515        : Procedure( Symbol( NamespaceScopes(), std::string() ), kind, false )
    486516    {
    487517    }
     
    489519    {
    490520    }
    491     ~ProcPointer(){}
     521    ~ProcPointer()
     522    {
     523    }
     524
     525    virtual bool Resolve();
    492526};
    493527
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Prototype.h

    r540 r637  
    44
    55
    6 class Prototype : public Symbol
     6class Prototype
     7    : public RelationalObjectModuleItem
    78{
    89public:
     
    2324    template<class Archive> void serialize(Archive& ar, const unsigned int version)
    2425    {
    25         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     26        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
    2627        ar & BOOST_SERIALIZATION_NVP( isUsing );
    2728    }
     
    3031public:
    3132
    32     Prototype( const NamespaceScopes &namespaceScopes, const std::string &name )
    33         : Symbol( namespaceScopes, name )
     33    Prototype( const Symbol &symbol )
     34        : RelationalObjectModuleItem( symbol )
    3435        , isUsing( false )
    3536    {
    3637    }
    3738    Prototype()
    38         : Symbol()
    3939    {
    4040    }
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h

    r636 r637  
    265265class SourceCodePosition
    266266{
    267     std::string objectModuleName;
     267    int relationalObjectModuleIndex;
    268268    int pos;
    269269
     
    273273    template<class Archive> void serialize(Archive& ar, const unsigned int version)
    274274    {
    275         trace_for_serialize( "serializing - IncludedFilesRelation" );
    276 
    277         ar & BOOST_SERIALIZATION_NVP( objectModuleName );
     275        ar & BOOST_SERIALIZATION_NVP( relationalObjectModuleIndex );
    278276        ar & BOOST_SERIALIZATION_NVP( pos );
    279277    }
    280278
    281279public:
    282     SourceCodePosition( const std::string &objectModuleName, int pos )
    283         : objectModuleName( objectModuleName )
     280    SourceCodePosition( int relationalObjectModuleIndex, int pos )
     281        : relationalObjectModuleIndex( relationalObjectModuleIndex )
    284282        , pos( pos )
    285283    {
    286284    }
    287285    SourceCodePosition()
    288         : pos( -1 )
    289     {
    290     }
    291 
    292     const std::string &GetObjectModuleName() const
    293     {
    294         return objectModuleName;
     286        : relationalObjectModuleIndex( -1 )
     287        , pos( -1 )
     288    {
     289    }
     290
     291    int GetRelationalObjectModuleIndex() const;
     292    void SetRelationalObjectModuleIndex( int relationalObjectModuleIndex )
     293    {
     294        this->relationalObjectModuleIndex = relationalObjectModuleIndex;
    295295    }
    296296    int GetPos() const
     
    298298        return pos;
    299299    }
    300 };
     300    void SetPos( int pos )
     301    {
     302        this->pos = pos;
     303    }
     304
     305    bool IsNothing() const;
     306};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Symbol.h

    r603 r637  
    3838
    3939public:
    40     bool isTargetObjectModule;
    4140    Symbol( const NamespaceScopes &namespaceScopes, const std::string &name )
    4241        : namespaceScopes( namespaceScopes )
    4342        , name( name )
    44         , isTargetObjectModule( true )
    4543    {
    4644    }
     
    4846        : namespaceScopes( symbol.namespaceScopes )
    4947        , name( symbol.name )
    50         , isTargetObjectModule( true )
    5148    {
    5249    }
    5350    Symbol()
    54         : isTargetObjectModule( true )
    5551    {
    5652    }
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h

    r632 r637  
    318318
    319319public:
    320     bool isTargetObjectModule;
    321320    BlittableType( const Type &basicType, CClass *pClass )
    322321        : basicType( basicType )
    323322        , pClass( pClass )
    324         , isTargetObjectModule( true )
    325323    {
    326324    }
    327325    BlittableType()
    328         : isTargetObjectModule( true )
    329326    {
    330327    }
  • trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h

    r632 r637  
    33class TypeDefCollection;
    44
    5 class TypeDef : public Symbol
     5class TypeDef
     6    : public RelationalObjectModuleItem
    67{
    78    friend TypeDefCollection;
     
    1718        trace_for_serialize( "serializing - TypeDef" );
    1819
    19         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     20        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
     21
     22        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     23        {
     24            if( this->IsExternal() )
     25            {
     26                this->NeedResolve();
     27                return;
     28            }
     29        }
     30
    2031        ar & BOOST_SERIALIZATION_NVP( baseName );
    2132        ar & BOOST_SERIALIZATION_NVP( baseType );
     
    2334
    2435public:
    25     TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType );
     36    TypeDef( const Symbol &symbol, const std::string &baseName, const Type &baseType );
    2637    TypeDef()
    2738    {
     
    3950        return baseType;
    4051    }
     52
     53    virtual bool Resolve();
    4154};
    4255
     
    5871    ~TypeDefCollection();
    5972
    60     void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine );
     73    void Add( const Symbol &symbol, const std::string &baseName, int nowLine );
    6174    const TypeDef *Find( const Symbol &symbol ) const;
    6275};
  • trunk/ab5.0/abdev/ab_common/include/Lexical/Variable.h

    r603 r637  
    11#pragma once
    22
    3 class Variable : public Symbol
     3class Variable
     4    : public RelationalObjectModuleItem
    45{
    56    Type type;
     
    3637        trace_for_serialize( "serializing - Variable" );
    3738
    38         ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( Symbol );
     39        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( RelationalObjectModuleItem );
     40
     41        if( ActiveBasic::Common::Environment::IsRemoveExternal() )
     42        {
     43            if( this->IsExternal() )
     44            {
     45                this->NeedResolve();
     46                return;
     47            }
     48        }
     49
    3950        ar & BOOST_SERIALIZATION_NVP( type );
    4051        ar & BOOST_SERIALIZATION_NVP( isConst );
     
    5364public:
    5465    Variable( const Symbol &symbol, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData );
    55     Variable( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData );
    5666    Variable( const Variable &var );
    5767    Variable();
     
    165175    }
    166176
     177    virtual bool Resolve();
     178
    167179
    168180    bool isLiving;
  • trunk/ab5.0/abdev/ab_common/include/ab_common.h

    r632 r637  
    88#include "Lexical/NamespaceSupporter.h"
    99#include "Lexical/Symbol.h"
     10#include "Lexical/RelationalObjectModuleItem.h"
    1011#include "Lexical/Prototype.h"
    1112#include "Lexical/TypeMisc.h"
     
    1314using namespace ActiveBasic::Common::Lexical;
    1415
     16#include "Lexical/Source.h"
    1517#include "Lexical/NativeCode.h"
    16 #include "Lexical/Source.h"
    1718#include "Lexical/Type.h"
    1819#include "Lexical/Method.h"
  • trunk/ab5.0/abdev/ab_common/src/Environment.cpp

    r517 r637  
    22
    33std::string ActiveBasic::Common::Environment::rootPath;
     4bool ActiveBasic::Common::Environment::isRemoveExternal = false;
    45
    56using namespace ActiveBasic::Common;
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp

    r636 r637  
    22
    33
    4 CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name )
    5     : ClassPrototype( namespaceScopes, name )
     4CClass::CClass( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces )
     5    : ClassPrototype( symbol )
    66    , importedNamespaces( importedNamespaces )
    77    , classType( Class )
     
    2121}
    2222
    23 CClass::CClass( const NamespaceScopes &namespaceScopes,
     23CClass::CClass(
     24    const Symbol &symbol,
    2425    const NamespaceScopesCollection &importedNamespaces,
    25     const std::string &name,
    2626    ClassType classType,
    2727    const GenericTypes &formalGenericTypes,
     
    3131    int vtblNum,
    3232    int fixedAlignment )
    33     : ClassPrototype( namespaceScopes, name )
     33    : ClassPrototype( symbol )
    3434    , importedNamespaces( importedNamespaces )
    3535    , classType( classType )
     
    868868    }
    869869}
     870
     871bool CClass::Resolve()
     872{
     873    // TODO: Resolve
     874    return true;
     875}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp

    r603 r637  
    77}
    88
    9 void Consts::Add( const NamespaceScopes &namespaceScopes, const std::string &name, _int64 i64data, const Type &type )
     9bool CConst::Resolve()
    1010{
    11     CConst *newconst = new CConst(namespaceScopes, name, type, i64data);
     11    // TODO: Resolve
     12    return true;
     13}
     14
     15void Consts::Add( const Symbol &symbol, _int64 i64data, const Type &type )
     16{
     17    CConst *newconst = new CConst( symbol, type, i64data );
    1218
    1319    //ハッシュリストに追加
    1420    Put( newconst );
    1521}
    16 void Consts::Add(const NamespaceScopes &namespaceScopes, const std::string &name, int value){
    17     CConst *newconst = new CConst( namespaceScopes, name, value);
     22void Consts::Add(const Symbol &symbol, int value){
     23    CConst *newconst = new CConst( symbol, value);
    1824
    1925    //ハッシュリストに追加
     
    7278}
    7379
     80bool ConstMacro::Resolve()
     81{
     82    // TODO: Resolve
     83    return true;
     84}
     85
    7486// マクロ定数を追加するための関数
    75 bool ConstMacros::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr )
     87bool ConstMacros::Add( const Symbol &symbol, const char *parameterStr )
    7688{
    7789    std::vector<std::string> parameters;
     
    113125    lstrcpy(temporary,parameterStr+i+1);
    114126
    115     this->Put( new ConstMacro( namespaceScopes, name, parameters, temporary ) );
     127    this->Put( new ConstMacro( symbol, parameters, temporary ) );
    116128
    117129    return true;
  • trunk/ab5.0/abdev/ab_common/src/Lexical/DataTable.cpp

    r603 r637  
    7777    }
    7878}
     79
     80void DataTable::Resolve()
     81{
     82    // TODO: Resolve
     83}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Delegate.cpp

    r603 r637  
    1818    return false;
    1919}
     20
     21bool Delegate::Resolve()
     22{
     23    // TODO: Resolve
     24    return true;
     25}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp

    r636 r637  
    5050    {
    5151        UserProc *pUserProc = meta.GetUserProcs().Iterator_GetNext();
    52         pUserProc->isTargetObjectModule = false;
     52        if( pUserProc->IsExternal() )
     53        {
     54            // 外部参照の場合は取り込まない
     55            continue;
     56        }
     57
     58        pUserProc->ResetRelationalObjectModuleIndex( relationTable );
    5359
    5460        pUserProc->GetNativeCode().ResetDataSectionBaseOffset( dataSectionBaseOffset );
    55         pUserProc->GetNativeCode().ResetSourceIndexes( relationTable );
    5661
    5762        this->userProcs.Put( pUserProc );
     
    6469    {
    6570        DllProc *pDllProc = meta.GetDllProcs().Iterator_GetNext();
    66         pDllProc->isTargetObjectModule = false;
     71        if( pDllProc->IsExternal() )
     72        {
     73            // 外部参照の場合は取り込まない
     74            continue;
     75        }
     76
     77        pDllProc->ResetRelationalObjectModuleIndex( relationTable );
    6778        this->dllProcs.Put( pDllProc );
    6879    }
     
    7485    {
    7586        CClass *pClass = meta.GetClasses().Iterator_GetNext();
    76         pClass->isTargetObjectModule = false;
     87        if( pClass->IsExternal() )
     88        {
     89            // 外部参照の場合は取り込まない
     90            continue;
     91        }
     92
     93        pClass->ResetRelationalObjectModuleIndex( relationTable );
    7794        pClass->Readed();
    7895        this->GetClasses().Put( pClass );
     
    84101    BOOST_FOREACH( Variable *pVar, meta.globalVars )
    85102    {
     103        if( pVar->IsExternal() )
     104        {
     105            // 外部参照の場合は取り込まない
     106            continue;
     107        }
     108
    86109        // 基底スコープレベルのグローバル変数の生存値をオンにする
    87110        if( pVar->GetScopeLevel() == 0 )
     
    99122        }
    100123
    101         pVar->isTargetObjectModule = false;
     124        pVar->ResetRelationalObjectModuleIndex( relationTable );
    102125        this->globalVars.Add( pVar, isResetOffsetAddress );
    103126    }
     
    113136    {
    114137        CConst *pConst = meta.GetGlobalConsts().Iterator_GetNext();
    115         pConst->isTargetObjectModule = false;
     138        if( pConst->IsExternal() )
     139        {
     140            // 外部参照の場合は取り込まない
     141            continue;
     142        }
     143
     144        pConst->ResetRelationalObjectModuleIndex( relationTable );
    116145        this->GetGlobalConsts().Put( pConst );
    117146    }
     
    123152    {
    124153        ConstMacro *pConstMacro = meta.GetGlobalConstMacros().Iterator_GetNext();
    125         pConstMacro->isTargetObjectModule = false;
     154        if( pConstMacro->IsExternal() )
     155        {
     156            // 外部参照の場合は取り込まない
     157            continue;
     158        }
     159
     160        pConstMacro->ResetRelationalObjectModuleIndex( relationTable );
    126161        this->GetGlobalConstMacros().Put( pConstMacro );
    127162    }
     
    131166    BOOST_FOREACH( BlittableType &blittableType, meta.blittableTypes )
    132167    {
    133         blittableType.isTargetObjectModule = false;
     168        // TODO: coreモジュール以外でもBlittable型用のクラスモジュールを定義できるようにすべき
    134169        this->blittableTypes.push_back( blittableType );
    135170    }
     
    139174    BOOST_FOREACH( TypeDef &typeDef, meta.typeDefs )
    140175    {
    141         typeDef.isTargetObjectModule = false;
     176        if( typeDef.IsExternal() )
     177        {
     178            // 外部参照の場合は取り込まない
     179            continue;
     180        }
     181
     182        typeDef.ResetRelationalObjectModuleIndex( relationTable );
    142183        this->typeDefs.push_back( typeDef );
    143184    }
     
    147188    BOOST_FOREACH( ProcPointer *pProcPointer, meta.procPointers )
    148189    {
    149         pProcPointer->isTargetObjectModule = false;
     190        if( pProcPointer->IsExternal() )
     191        {
     192            // 外部参照の場合は取り込まない
     193            continue;
     194        }
     195
     196        pProcPointer->ResetRelationalObjectModuleIndex( relationTable );
    150197        this->procPointers.push_back( pProcPointer );
    151198    }
     
    157204    {
    158205        Delegate *pDelegate = meta.GetDelegates().Iterator_GetNext();
    159         pDelegate->isTargetObjectModule = false;
     206        if( pDelegate->IsExternal() )
     207        {
     208            // 外部参照の場合は取り込まない
     209            continue;
     210        }
     211
     212        pDelegate->ResetRelationalObjectModuleIndex( relationTable );
    160213        this->GetDelegates().Put( pDelegate );
    161214    }
     
    199252    return NULL;
    200253}
     254
     255void Meta::Resolve()
     256{
     257    // 関数・メソッド
     258    this->GetUserProcs().Iterator_Init();
     259    this->GetUserProcs().Iterator_Reset();
     260    while( this->GetUserProcs().Iterator_HasNext() )
     261    {
     262        UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext();
     263        pUserProc->Resolve();
     264    }
     265
     266    // DLL関数
     267    this->GetDllProcs().Iterator_Init();
     268    this->GetDllProcs().Iterator_Reset();
     269    while( this->GetDllProcs().Iterator_HasNext() )
     270    {
     271        DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext();
     272        pDllProc->Resolve();
     273    }
     274
     275    // クラス
     276    this->GetClasses().Iterator_Init();
     277    this->GetClasses().Iterator_Reset();
     278    while( this->GetClasses().Iterator_HasNext() )
     279    {
     280        CClass *pClass = this->GetClasses().Iterator_GetNext();
     281        pClass->Resolve();
     282    }
     283
     284    // グローバル変数
     285    BOOST_FOREACH( Variable *pVar, globalVars )
     286    {
     287        pVar->Resolve();
     288    }
     289
     290    // グローバル定数
     291    this->GetGlobalConsts().Iterator_Init();
     292    this->GetGlobalConsts().Iterator_Reset();
     293    while( this->GetGlobalConsts().Iterator_HasNext() )
     294    {
     295        CConst *pConst = this->GetGlobalConsts().Iterator_GetNext();
     296        pConst->Resolve();
     297    }
     298
     299    // グローバル定数マクロ
     300    this->GetGlobalConstMacros().Iterator_Init();
     301    this->GetGlobalConstMacros().Iterator_Reset();
     302    while( this->GetGlobalConstMacros().Iterator_HasNext() )
     303    {
     304        ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext();
     305        pConstMacro->Resolve();
     306    }
     307
     308    // TypeDef
     309    BOOST_FOREACH( TypeDef &typeDef, typeDefs )
     310    {
     311        typeDef.Resolve();
     312    }
     313
     314    // 関数ポインタ
     315    BOOST_FOREACH( ProcPointer *pProcPointer, procPointers )
     316    {
     317        pProcPointer->Resolve();
     318    }
     319
     320    // デリゲート
     321    this->GetDelegates().Iterator_Init();
     322    this->GetDelegates().Iterator_Reset();
     323    while( this->GetDelegates().Iterator_HasNext() )
     324    {
     325        Delegate *pDelegate = this->GetDelegates().Iterator_GetNext();
     326        pDelegate->Resolve();
     327    }
     328}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp

    r636 r637  
    4343        this->sourceLines.push_back(
    4444            SourceLine(
    45                 sourceLine.GetLineNum(),
    4645                baseOffset + sourceLine.GetNativeCodePos(),
    47                 sourceLine.GetRelationalObjectModuleIndex(),    // TODO: 複数libの取り込みを想定できていない(ソースコード行番号とネイティブコード位置の対応情報の追加は静的リンクが完了した後に行うべき)
    48                 sourceLine.GetSourceCodePos(),
    49                 sourceLine.GetCodeType()
     46                sourceLine.GetCodeType(),
     47                sourceLine.GetSourceCodePosition()
    5048            )
    5149        );
     
    106104}
    107105
    108 void NativeCode::NextSourceLine( int currentSourceIndex, int nowLine )
     106void NativeCode::NextSourceLine( const SourceCodePosition &sourceCodePosition )
    109107{
    110108    if( sourceLines.size() )
     
    112110        if( sourceLines.back().GetNativeCodePos() == GetSize() )
    113111        {
    114             sourceLines.back().SetSourceCodePos( nowLine );
     112            sourceLines.back().SetSourceCodePosition( sourceCodePosition );
    115113            return;
    116114        }
     
    130128    sourceLines.push_back(
    131129        SourceLine(
    132             (long)sourceLines.size(),
    133130            GetSize(),
    134             currentSourceIndex,
    135             nowLine,
    136             sourceLineType
     131            sourceLineType,
     132            sourceCodePosition
    137133        )
    138134    );
     
    152148    }
    153149}
    154 void NativeCode::ResetSourceIndexes( const std::vector<int> &relationTable )
     150void NativeCode::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable )
    155151{
    156152    BOOST_FOREACH( SourceLine &sourceLine, sourceLines )
    157153    {
    158         sourceLine.SetRelationalObjectModuleIndex( relationTable[sourceLine.GetRelationalObjectModuleIndex()] );
     154        sourceLine.GetSourceCodePosition().SetRelationalObjectModuleIndex(
     155            relationTable[sourceLine.GetSourceCodePosition().GetRelationalObjectModuleIndex()]
     156        );
    159157    }
    160158}
     159
     160void NativeCode::Resolve()
     161{
     162    // TODO: Resolve
     163}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp

    r636 r637  
    5656
    5757
    58 void ObjectModule::StaticLink( ObjectModule &objectModule )
     58void ObjectModule::StaticLink( ObjectModule &objectModule, bool isSll )
    5959{
    6060    const std::vector<int> relationTable = this->GetRelationTable( objectModule.relationalObjectModuleNames );
     
    6565    meta.StaticLink( objectModule.meta, dataSectionBaseOffset, relationTable );
    6666
    67     // グローバル ネイティブコードを結合
    68     objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset );
    69     objectModule.globalNativeCode.ResetSourceIndexes( relationTable );
    70     globalNativeCode.PutEx( objectModule.globalNativeCode );
    71 
    72     // データテーブルを結合
    73     objectModule.dataTable.ResetDataSectionBaseOffset( dataSectionBaseOffset );
    74     dataTable.Add( objectModule.dataTable );
     67    if( !isSll )
     68    {
     69        // グローバル ネイティブコードを結合
     70        objectModule.globalNativeCode.ResetDataSectionBaseOffset( dataSectionBaseOffset );
     71        objectModule.globalNativeCode.ResetRelationalObjectModuleIndex( relationTable );
     72        globalNativeCode.PutEx( objectModule.globalNativeCode );
     73
     74        // データテーブルを結合
     75        objectModule.dataTable.ResetDataSectionBaseOffset( dataSectionBaseOffset );
     76        dataTable.Add( objectModule.dataTable );
     77    }
     78
     79    // 依存関係を解決
     80    this->Resolve();
    7581
    7682    // TODO: basbufがいらなくなったら消す
    7783    extern char *basbuf;
    7884    basbuf = this->source.GetBuffer();
     85}
     86
     87void ObjectModule::Resolve()
     88{
     89    this->meta.Resolve();
     90
     91    // グローバルネイティブコードを解決(スケジュールを解決する)
     92    this->globalNativeCode.Resolve();
     93
     94    // データテーブルを解決(スケジュールを解決する)
     95    this->dataTable.Resolve();
    7996}
    8097
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp

    r632 r637  
    11#include "stdafx.h"
    22
     3
     4void Procedure::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable )
     5{
     6    RelationalObjectModuleItem::ResetRelationalObjectModuleIndex( relationTable );
     7
     8    if( !this->sourceCodePosition.IsNothing() )
     9    {
     10        this->sourceCodePosition.SetRelationalObjectModuleIndex( relationTable[this->sourceCodePosition.GetRelationalObjectModuleIndex()] );
     11    }
     12}
     13
     14void UserProc::ResetRelationalObjectModuleIndex( const std::vector<int> &relationTable )
     15{
     16    Procedure::ResetRelationalObjectModuleIndex( relationTable );
     17
     18    this->GetNativeCode().ResetRelationalObjectModuleIndex( relationTable );
     19}
     20
    321int id_base = 0;
    422
    5 UserProc::UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )
    6     : Procedure( namespaceScopes, name, kind, isCdecl )
     23UserProc::UserProc( const Symbol &symbol, const NamespaceScopesCollection &importedNamespaces, Kind kind, bool isMacro, bool isCdecl, bool isExport )
     24    : Procedure( symbol, kind, isCdecl )
    725    , importedNamespaces( importedNamespaces )
    826    , pParentClass( NULL )
     
    139157}
    140158
     159bool UserProc::Resolve()
     160{
     161    // TODO: Resolve
     162    return true;
     163}
     164
    141165const UserProc *UserProc::pGlobalProc = NULL;
    142166
     
    161185}
    162186
     187bool DllProc::Resolve()
     188{
     189    // TODO: Resolve
     190    return true;
     191}
     192
     193bool ProcPointer::Resolve()
     194{
     195    // TODO: Resolve
     196    return true;
     197}
     198
    163199void ProcPointers::Clear()
    164200{
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp

    r635 r637  
    941941    return 1;
    942942}
     943
     944int SourceCodePosition::GetRelationalObjectModuleIndex() const
     945{
     946    if( this->IsNothing() )
     947    {
     948        _ASSERTE( false );
     949        throw;
     950    }
     951
     952    return relationalObjectModuleIndex;
     953}
     954bool SourceCodePosition::IsNothing() const
     955{
     956    if( this->relationalObjectModuleIndex == -1 && this->pos == -1 )
     957    {
     958        return true;
     959    }
     960
     961    if( this->relationalObjectModuleIndex == -1 || this->pos == -1 )
     962    {
     963        _ASSERTE( false );
     964        throw;
     965    }
     966
     967    return false;
     968}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp

    r632 r637  
    11#include "stdafx.h"
    22
    3 TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType )
    4     : Symbol( namespaceScopes, name )
     3TypeDef::TypeDef( const Symbol &symbol, const std::string &baseName, const Type &baseType )
     4    : RelationalObjectModuleItem( symbol )
    55    , baseName( baseName )
    66    , baseType( baseType )
    77{
     8}
     9
     10bool TypeDef::Resolve()
     11{
     12    // TODO: Resolve
     13    return true;
    814}
    915
     
    1218TypeDefCollection::~TypeDefCollection(){
    1319}
    14 void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine ){
    15     TypeDef typeDef( namespaceScopes, name, baseName, nowLine );
     20void TypeDefCollection::Add( const Symbol &symbol, const std::string &baseName, int nowLine ){
     21    TypeDef typeDef( symbol, baseName, nowLine );
    1622    this->push_back( typeDef );
    1723}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Variable.cpp

    r603 r637  
    22
    33Variable::Variable( const Symbol &symbol, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData )
    4     : Symbol( symbol )
    5     , type( type )
    6     , isConst( isConst )
    7     , isRef( isRef )
    8     , isArray( false )
    9     , isParameter( false)
    10     , paramStrForConstructor( paramStrForConstructor )
    11     , hasInitData( hasInitData )
    12 {
    13 }
    14 Variable::Variable( const NamespaceScopes &namespaceScopes, const std::string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData )
    15     : Symbol( namespaceScopes, name )
     4    : RelationalObjectModuleItem( symbol )
    165    , type( type )
    176    , isConst( isConst )
     
    2413}
    2514Variable::Variable( const Variable &var )
    26     : Symbol( var )
     15    : RelationalObjectModuleItem( var )
    2716    , type( var.type )
    2817    , isConst( var.isConst )
     
    3726Variable::Variable()
    3827{
     28}
     29
     30bool Variable::Resolve()
     31{
     32    // TODO: Resolve
     33    return true;
    3934}
    4035
  • trunk/ab5.0/abdev/abdev/src/MainFrame.cpp

    r629 r637  
    12281228        }
    12291229
     1230        // SLLオプション
     1231        if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Sll )
     1232        {
     1233            lstrcat(temporary," /static_library");
     1234        }
     1235
    12301236        //Unicodeオプション
    12311237        if(projectInfo.dwOption & PJ_OP_UNICODE) lstrcat(temporary," /unicode");
     
    13401346        {
    13411347            lstrcat(temporary," /dll");
     1348        }
     1349
     1350        // SLLオプション
     1351        if( projectInfo.GetModuleType() == ActiveBasic::Common::TargetModuleType::Sll )
     1352        {
     1353            lstrcat(temporary," /static_library");
    13421354        }
    13431355
  • trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp

    r636 r637  
    328328    }
    329329
    330     char *backupBasbuf = NULL;
    331     int backupCurrentRelationalObjectModuleIndexForSource = compiler.GetCurrentRelationalObjectModuleIndexForSource();
    332 
    333330    if( !pUserProc->IsAutoGeneration() )
    334331    {
    335         // テンプレート展開がされている場合、対象のソースコードが現在のオブジェクトモジュールではない場合がある
    336         if( compiler.staticLibraries[compiler.GetCurrentRelationalObjectModuleIndexForSource()]->GetName() != pUserProc->GetSourceCodePosition().GetObjectModuleName() )
    337         {
    338             for( int i=0; i<static_cast<int>(compiler.staticLibraries.size()); i++ )
    339             {
    340                 const ObjectModule *pObjectModule = compiler.staticLibraries[i];
    341 
    342                 if( pObjectModule->GetName() == pUserProc->GetSourceCodePosition().GetObjectModuleName() )
    343                 {
    344                     compiler.SetCurrentRelationalObjectModuleIndexForSource( i );
    345                     basbuf = const_cast<char *>(compiler.GetCurrentSource().GetBuffer());
    346                 }
    347             }
    348         }
     332        // 対象のソースコードを含むオブジェクトモジュールのインデックスを指定する
     333        // ※テンプレート展開がされている場合、対象のソースコードが現在のオブジェクトモジュールではない場合がある
     334        compiler.SetCurrentRelationalObjectModuleIndexForSource( pUserProc->GetSourceCodePosition().GetRelationalObjectModuleIndex() );
     335        basbuf = const_cast<char *>(compiler.GetCurrentSource().GetBuffer());
    349336
    350337        cp=pUserProc->GetSourceCodePosition().GetPos();
  • trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp

    r636 r637  
    510510    {
    511511        // 静的リンクライブラリ
     512
     513        // 外部参照をlibから取り除く
     514        ActiveBasic::Common::Environment::SetRemoveExternalMark( true );
    512515
    513516        // 格納先ディレクトリを作る
Note: See TracChangeset for help on using the changeset viewer.