Changeset 561 in dev for trunk/ab5.0/abdev


Ignore:
Timestamp:
May 5, 2008, 1:09:21 PM (17 years ago)
Author:
dai_9181
Message:

AddMemberAddDynamicMethod
・CMember→Member
・CreateMemberメソッドをCClassクラスからLexicalAnalyzerクラスへ移動した。

Location:
trunk/ab5.0/abdev
Files:
10 edited

Legend:

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

    r537 r561  
    190190    tv.item.pszText=VarData;
    191191
    192     BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
     192    BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
    193193        if(bPtr){
    194194            lstrcpy(VarName,"->");
     
    473473    }
    474474
    475     BOOST_FOREACH( CMember *pMember, pUserProc->GetParentClassPtr()->GetDynamicMembers() ){
     475    BOOST_FOREACH( Member *pMember, pUserProc->GetParentClassPtr()->GetDynamicMembers() ){
    476476        offset=pUserProc->GetParentClassPtr()->GetMemberOffset( pMember->GetName().c_str());
    477477
  • trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp

    r537 r561  
    450450    if(!GetVarFormatString(VarName,array,lpPtrOffset,NestMember,refType)) return false;
    451451
    452     const CMember *pMember = objClass.FindDynamicMember( VarName );
     452    const Member *pMember = objClass.FindDynamicMember( VarName );
    453453    if( !pMember ){
    454454        if(isErrorEnabled) compiler.errorMessenger.Output(103,VarName,cp);
  • trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp

    r537 r561  
    130130    ////////////////////////////
    131131
    132     const CMember *pMember = objClass.FindDynamicMember( VarName );
     132    const Member *pMember = objClass.FindDynamicMember( VarName );
    133133    if( !pMember )
    134134    {
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Class.h

    r560 r561  
    145145    {
    146146        // 動的メンバ
    147         BOOST_FOREACH( CMember *member, dynamicMembers )
     147        BOOST_FOREACH( Member *member, dynamicMembers )
    148148        {
    149149            delete member;
     
    151151
    152152        // 静的メンバ
    153         BOOST_FOREACH( CMember *member, staticMembers )
     153        BOOST_FOREACH( Member *member, staticMembers )
    154154        {
    155155            delete member;
     
    320320
    321321    //メンバ、メソッドの追加
    322     CMember *CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
    323     void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine );
    324     void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
     322    void AddDynamicMember( Member *pMember );
     323    void AddStaticMember( Member *pMember );
    325324
    326325    //重複チェック
     
    345344    }
    346345   
    347     const CMember *FindDynamicMember( const char *memberName ) const;
     346    const Member *FindDynamicMember( const char *memberName ) const;
    348347    bool HasDynamicMember( const char *memberName ) const
    349348    {
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h

    r560 r561  
    4444
    4545    // クラスを収集する
     46    static Member *CreateMember( const CClass &_class, Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
    4647    static void AddMethod(CClass *pobj_c, UserProc *pUserProc, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
    4748        bool isVirtual, bool isOverride, const char *interfaceName, bool isAutoGeneration, int nowLine);
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Member.h

    r524 r561  
    33class CClass;
    44
    5 class CMember : public MemberPrototype
     5class Member : public MemberPrototype
    66{
    77    std::string name;
     
    1919    template<class Archive> void serialize(Archive& ar, const unsigned int version)
    2020    {
    21         trace_for_serialize( "serializing - CMember" );
     21        trace_for_serialize( "serializing - Member" );
    2222
    2323        ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP( MemberPrototype );
     
    7171    }
    7272
    73     CMember( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter )
     73    Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter )
    7474        : MemberPrototype( accessibility )
    7575        , name( name )
     
    8181    {
    8282    }
    83     CMember::CMember(CMember &member)
     83    Member::Member(Member &member)
    8484        : MemberPrototype( member.GetAccessibility() )
    8585        , name( member.GetName() )
     
    9191        source_code_address=member.source_code_address;
    9292    }
    93     CMember()
     93    Member()
    9494    {
    9595    }
    96     ~CMember()
     96    ~Member()
    9797    {
    9898    }
    9999};
    100 typedef std::vector<CMember *> Members;
     100typedef std::vector<Member *> Members;
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Class.cpp

    r560 r561  
    185185}
    186186
    187 CMember *CClass::CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine )
    188 {
    189     extern int cp;
    190 
    191     //構文を解析
    192     char VarName[VN_SIZE];
    193     char initBuffer[VN_SIZE];
    194     char lpszConstructParameter[VN_SIZE];
    195     Subscripts subscripts;
    196     Type type;
    197     GetDimentionFormat(buffer,VarName,subscripts,type,initBuffer,lpszConstructParameter);
    198 
    199     //重複チェック
    200     if(this->DupliCheckAll(VarName)){
    201         compiler.errorMessenger.Output(15,VarName,cp);
    202     }
    203 
    204     CMember *pMember = new CMember( accessibility, VarName, type, isConst, subscripts, initBuffer, lpszConstructParameter );
    205     pMember->source_code_address = nowLine;
    206     return pMember;
    207 }
    208 void CClass::AddMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
    209     dynamicMembers.push_back(
    210         CreateMember( accessibility, isConst, isRef, buffer, nowLine )
    211     );
    212 }
    213 void CClass::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
    214     staticMembers.push_back(
    215         CreateMember( accessibility, isConst, isRef, buffer, nowLine )
    216     );
     187void CClass::AddDynamicMember( Member *pMember )
     188{
     189    dynamicMembers.push_back( pMember );
     190}
     191void CClass::AddStaticMember( Member *pMember )
     192{
     193    staticMembers.push_back( pMember );
    217194}
    218195
     
    247224
    248225    // 動的メンバ
    249     BOOST_FOREACH( CMember *pMember, dynamicMembers )
     226    BOOST_FOREACH( Member *pMember, dynamicMembers )
    250227    {
    251228        if( GetName() == pMember->GetName() )
     
    256233
    257234    // 静的メンバ
    258     BOOST_FOREACH( CMember *pMember, staticMembers ){
     235    BOOST_FOREACH( Member *pMember, staticMembers ){
    259236        if( GetName() == pMember->GetName() ){
    260237            return true;
     
    265242}
    266243
    267 const CMember *CClass::FindDynamicMember( const char *memberName ) const
     244const Member *CClass::FindDynamicMember( const char *memberName ) const
    268245{
    269246    if( this->HasSuperClass() )
    270247    {
    271248        // 基底クラスで検索
    272         const CMember *result = this->GetSuperClass().FindDynamicMember( memberName );
     249        const Member *result = this->GetSuperClass().FindDynamicMember( memberName );
    273250        if( result )
    274251        {
     
    277254    }
    278255
    279     BOOST_FOREACH( CMember *pMember, GetDynamicMembers() )
     256    BOOST_FOREACH( Member *pMember, GetDynamicMembers() )
    280257    {
    281258        if( pMember->GetName() == memberName )
     
    373350    }
    374351
    375     BOOST_FOREACH( CMember *pMember, dynamicMembers )
     352    BOOST_FOREACH( Member *pMember, dynamicMembers )
    376353    {
    377354        // メンバサイズ
     
    479456    }
    480457
    481     BOOST_FOREACH( CMember *pMember, dynamicMembers )
     458    BOOST_FOREACH( Member *pMember, dynamicMembers )
    482459    {
    483460        // メンバサイズ
     
    580557    }
    581558
    582     BOOST_FOREACH( CMember *pMember, dynamicMembers )
     559    BOOST_FOREACH( Member *pMember, dynamicMembers )
    583560    {
    584561        int tempAlignment = pMember->GetType().GetSize();
     
    761738
    762739        int i=0;
    763         BOOST_FOREACH( CMember *member, objClass.GetStaticMembers() )
     740        BOOST_FOREACH( Member *member, objClass.GetStaticMembers() )
    764741        {
    765742            if( pEnumInfo )
     
    1017994    std::string result;
    1018995
    1019     BOOST_FOREACH( const CMember *pMember, dynamicMembers )
     996    BOOST_FOREACH( const Member *pMember, dynamicMembers )
    1020997    {
    1021998        if( result.size() )
     
    10331010    std::string result;
    10341011
    1035     BOOST_FOREACH( const CMember *pMember, dynamicMembers )
     1012    BOOST_FOREACH( const Member *pMember, dynamicMembers )
    10361013    {
    10371014        if( result.size() )
     
    10491026    std::string result;
    10501027
    1051     BOOST_FOREACH( const CMember *pMember, dynamicMembers )
     1028    BOOST_FOREACH( const Member *pMember, dynamicMembers )
    10521029    {
    10531030        if( result.size() )
     
    10701047{
    10711048    const CClass &thisClass = *this;
    1072     BOOST_FOREACH( const CMember *pMember, thisClass.GetDynamicMembers() )
     1049    BOOST_FOREACH( const Member *pMember, thisClass.GetDynamicMembers() )
    10731050    {
    10741051        if( pMember->GetType().IsObject() || pMember->GetType().IsPointer() )
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/DataTable.cpp

    r524 r561  
    131131
    132132        // メンバを取得
    133         const CMember *member = objClass.FindDynamicMember( memberName );
     133        const Member *member = objClass.FindDynamicMember( memberName );
    134134
    135135        // メンバオフセットを取得
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp

    r560 r561  
    224224
    225225    bool result = true;
    226     BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
     226    BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
    227227        if(pMember->GetType().IsStruct()){
    228228            //循環参照でないかをチェック
     
    268268}
    269269
     270Member *LexicalAnalyzer::CreateMember( const CClass &_class, Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine )
     271{
     272    extern int cp;
     273
     274    //構文を解析
     275    char VarName[VN_SIZE];
     276    char initBuffer[VN_SIZE];
     277    char lpszConstructParameter[VN_SIZE];
     278    Subscripts subscripts;
     279    Type type;
     280    GetDimentionFormat(buffer,VarName,subscripts,type,initBuffer,lpszConstructParameter);
     281
     282    //重複チェック
     283    if( _class.DupliCheckAll( VarName ) ){
     284        compiler.errorMessenger.Output(15,VarName,cp);
     285    }
     286
     287    Member *pMember = new Member( accessibility, VarName, type, isConst, subscripts, initBuffer, lpszConstructParameter );
     288    pMember->source_code_address = nowLine;
     289    return pMember;
     290}
     291
    270292void LexicalAnalyzer::AddMethod(CClass *pobj_c, UserProc *pUserProc, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
    271293    bool isVirtual, bool isOverride, const char *interfaceName, bool isAutoGeneration, int nowLine)
     
    11601182                        //静的メンバを追加
    11611183                        cp=i;   //エラー用
    1162                         pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i);
     1184                        pobj_c->AddStaticMember(
     1185                            LexicalAnalyzer::CreateMember( *pobj_c, accessibility, isConst, false, temporary, i )
     1186                        );
    11631187                    }
    11641188                    else{
    11651189                        //メンバを追加
    11661190                        cp=i;   //エラー用
    1167                         pobj_c->AddMember( accessibility, isConst, false, temporary, i );
     1191                        pobj_c->AddDynamicMember(
     1192                            LexicalAnalyzer::CreateMember( *pobj_c, accessibility, isConst, false, temporary, i )
     1193                        );
    11681194
    11691195
  • trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp

    r538 r561  
    183183    ////////////////////////////
    184184
    185     const CMember *pMember = objClass.FindDynamicMember( VarName );
     185    const Member *pMember = objClass.FindDynamicMember( VarName );
    186186    if( !pMember )
    187187    {
     
    789789
    790790            int i = 0;
    791             BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
     791            BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
    792792                if(InitBuf[i]=='\0'){
    793793                    compiler.errorMessenger.Output(41,0,cp);
     
    952952
    953953            int i = 0;
    954             BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
     954            BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
    955955                if(InitBuf[i]=='\0'){
    956956                    compiler.errorMessenger.Output(41,0,cp);
Note: See TracChangeset for help on using the changeset viewer.