Changeset 92 in dev for BasicCompiler_Common/Enum.cpp


Ignore:
Timestamp:
Apr 8, 2007, 2:07:31 AM (18 years ago)
Author:
dai_9181
Message:

列挙型クラスの自動生成コードを修正した(派生クラスでのToStringメソッドを廃止し、サイズを軽減した)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Enum.cpp

    r88 r92  
    147147        parent=ppobj_EnumParent[i];
    148148
    149         sprintf(buffer+length,"Class %s\n",parent->TypeName);
     149        sprintf(buffer+length,"Class Enum %s\n",parent->TypeName);
    150150        length+=lstrlen(buffer+length);
    151151        lstrcpy(buffer+length,"\tInherits EnumBase\n");
    152152        length+=lstrlen(buffer+length);
     153        sprintf(buffer+length,"\tSub %s(value As Long,lpszName As LPSTR)\n",parent->TypeName);
     154        length+=lstrlen(buffer+length);
     155        lstrcpy(buffer+length,"\t\tEnumBase(value,lpszName)\n");
     156        length+=lstrlen(buffer+length);
     157        lstrcpy(buffer+length,"\tEnd Sub\n");
     158        length+=lstrlen(buffer+length);
    153159        lstrcpy(buffer+length,"Public\n");
    154160        length+=lstrlen(buffer+length);
     
    156162        length+=lstrlen(buffer+length);
    157163        if(parent->iEnumMemberNum){
    158             sprintf(buffer+length,"\t\tEnumBase(%d)\n",
    159                 parent->ppobj_EnumMember[0]->m_value);
    160             length+=lstrlen(buffer+length);
    161         }
    162         lstrcpy(buffer+length,"\tEnd Sub\n");
    163         length+=lstrlen(buffer+length);
    164         sprintf(buffer+length,"\tSub %s(ByRef e As %s)\n",parent->TypeName,parent->TypeName);
    165         length+=lstrlen(buffer+length);
    166         lstrcpy(buffer+length,"\t\tEnumBase(e.m_Value)\n");
    167         length+=lstrlen(buffer+length);
    168         lstrcpy(buffer+length,"\tEnd Sub\n");
    169         length+=lstrlen(buffer+length);
    170         sprintf(buffer+length,"\tSub %s(value As Long)\n",parent->TypeName);
    171         length+=lstrlen(buffer+length);
    172         lstrcpy(buffer+length,"\t\tEnumBase(value)\n");
    173         length+=lstrlen(buffer+length);
     164            sprintf(buffer+length,"\t\tEnumBase(%d,\"%s\")\n",
     165                parent->ppobj_EnumMember[0]->m_value,
     166                parent->ppobj_EnumMember[0]->m_name);
     167            length+=lstrlen(buffer+length);
     168        }
    174169        lstrcpy(buffer+length,"\tEnd Sub\n");
    175170        length+=lstrlen(buffer+length);
     
    183178            member=parent->ppobj_EnumMember[i2];
    184179
    185             sprintf(buffer+length,"\tStatic %s As %s(%d)\n",
     180            sprintf(buffer+length,"\tStatic %s As %s(%d,\"%s\")\n",
    186181                member->m_name,
    187182                parent->TypeName,
    188                 member->m_value);
    189             length+=lstrlen(buffer+length);
    190         }
    191 
     183                member->m_value,
     184                member->m_name);
     185            length+=lstrlen(buffer+length);
     186        }
     187
     188        /*
    192189        sprintf(buffer+length,"\tOverride Function ToString() As String\n",parent->TypeName);
    193190        length+=lstrlen(buffer+length);
    194         lstrcpy(buffer+length,"\t\tSelect Case m_Value\n");
     191        lstrcpy(buffer+length,"\t\tSelect Case value\n");
    195192        length+=lstrlen(buffer+length);
    196193        for(i2=0;i2<parent->iEnumMemberNum;i2++){
     
    208205        length+=lstrlen(buffer+length);
    209206
     207       
    210208        sprintf(buffer+length,"\tSub Operator= (ByRef value As %s)\n",parent->TypeName);
    211209        length+=lstrlen(buffer+length);
     
    215213        length+=lstrlen(buffer+length);
    216214
    217         /*sprintf(buffer+length,"\tSub Operator= (ByRef value As String)\n",parent->TypeName);
     215        sprintf(buffer+length,"\tSub Operator= (ByRef value As String)\n",parent->TypeName);
    218216        length+=lstrlen(buffer+length);
    219217        lstrcpy(buffer+length,"\t\tSelect Case value\n");
     
    231229        length+=lstrlen(buffer+length);
    232230        lstrcpy(buffer+length,"\tEnd Sub\n");
     231        length+=lstrlen(buffer+length);
     232
     233        sprintf(buffer+length,"\tSub Operator= (value As Long)\n",parent->TypeName);
     234        length+=lstrlen(buffer+length);
     235        lstrcpy(buffer+length,"\t\tm_Value=value\n");
     236        length+=lstrlen(buffer+length);
     237        lstrcpy(buffer+length,"\tEnd Sub\n");
    233238        length+=lstrlen(buffer+length);*/
    234 
    235         sprintf(buffer+length,"\tSub Operator= (value As Long)\n",parent->TypeName);
    236         length+=lstrlen(buffer+length);
    237         lstrcpy(buffer+length,"\t\tm_Value=value\n");
    238         length+=lstrlen(buffer+length);
    239         lstrcpy(buffer+length,"\tEnd Sub\n");
    240         length+=lstrlen(buffer+length);
    241 
    242         sprintf(buffer+length,"\tFunction Operator== (ByRef e As %s) As Boolean\n",parent->TypeName);
    243         length+=lstrlen(buffer+length);
    244         lstrcpy(buffer+length,"\t\tReturn ( e.m_Value = m_Value )\n");
    245         length+=lstrlen(buffer+length);
    246         lstrcpy(buffer+length,"\tEnd Function\n");
    247         length+=lstrlen(buffer+length);
    248239
    249240        lstrcpy(buffer+length,"End Class\n");
     
    258249    }
    259250
     251    // ログを生成
     252    Smoothie::Logger::PutFile( "enum_generated.log", buffer );
     253
    260254    return buffer;
    261255}
Note: See TracChangeset for help on using the changeset viewer.