Changeset 138 in dev


Ignore:
Timestamp:
Jun 12, 2007, 1:57:26 AM (17 years ago)
Author:
dai_9181
Message:

Member::initializeExpressionのリファクタリング

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/Compile_Var.cpp

    r137 r138  
    714714}
    715715
    716 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,char *InitBuf){
     716bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){
    717717    extern BYTE *initGlobalBuf;
    718718    int i,i2,i3;
    719719    char temporary[VN_SIZE];
     720    char InitBuf[VN_SIZE];
     721    lstrcpy( InitBuf, lpszInitBuf );
    720722
    721723    if(InitBuf[0]=='['){
     
    851853    return true;
    852854}
    853 bool InitLocalVar(int offset,const Type &type,const int *SubScripts,char *InitBuf){
     855bool InitLocalVar(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){
    854856    int i,i2,i3;
    855857    char temporary[VN_SIZE];
     858    char InitBuf[VN_SIZE];
     859    lstrcpy( InitBuf, lpszInitBuf );
    856860
    857861    if(InitBuf[0]=='['){
     
    10611065}
    10621066
    1063 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
     1067void dim( char *VarName,int *SubScripts,Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){
    10641068    if( UserProc::IsGlobalAreaCompiling() ){
    10651069        /////////////////////////
  • BasicCompiler32/Opcode.h

    r129 r138  
    202202void SetThisPtrToReg(int reg);
    203203bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss = 0);
    204 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,char *InitBuf);
     204bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *InitBuf);
    205205#define DIMFLAG_INITDEBUGVAR            1
    206206#define DIMFLAG_NONCALL_CONSTRACTOR     2
    207207#define DIMFLAG_STATIC                  4
    208208#define DIMFLAG_CONST                   8
    209 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
     209void dim( char *VarName,int *SubScripts,Type &type, const char *InitBuf,const char *ConstractParameter,DWORD dwFlags);
    210210void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar);
    211211void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar);
  • BasicCompiler64/Compile_Var.cpp

    r137 r138  
    736736}
    737737
    738 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,char *InitBuf){
     738bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){
    739739    extern BYTE *initGlobalBuf;
    740740    int i,i2,i3;
    741741    char temporary[VN_SIZE];
     742    char InitBuf[VN_SIZE];
     743    lstrcpy( InitBuf, lpszInitBuf );
    742744
    743745    if(InitBuf[0]=='['){
     
    873875    return true;
    874876}
    875 bool InitLocalVar(int offset,const Type &type,const int *SubScripts,char *InitBuf){
     877bool InitLocalVar(int offset,const Type &type,const int *SubScripts,const char *lpszInitBuf){
    876878    int i,i2,i3;
    877879    char temporary[VN_SIZE];
     880    char InitBuf[VN_SIZE];
     881    lstrcpy( InitBuf, lpszInitBuf );
    878882
    879883    if(InitBuf[0]=='['){
     
    10471051}
    10481052
    1049 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
     1053void dim( char *VarName,int *SubScripts,Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){
    10501054    if( UserProc::IsGlobalAreaCompiling() ){
    10511055        /////////////////////////
  • BasicCompiler64/Opcode.h

    r131 r138  
    324324void SetThisPtrToReg(int reg);
    325325bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss = NULL);
    326 bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,char *InitBuf);
     326bool SetInitGlobalData(int offset,const Type &type,const int *SubScripts,const char *InitBuf);
    327327#define DIMFLAG_INITDEBUGVAR            0x01
    328328#define DIMFLAG_NONCALL_CONSTRACTOR     0x02
    329329#define DIMFLAG_STATIC                  0x04
    330330#define DIMFLAG_CONST                   0x08
    331 void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
     331void dim( char *VarName,int *SubScripts,Type &type, const char *InitBuf,const char *ConstractParameter,DWORD dwFlags);
    332332void SetVarPtrToReg(int reg,RELATIVE_VAR *pRelativeVar);
    333333bool Compile_AddGlobalRootsForGc();
  • BasicCompiler_Common/VariableOpe.cpp

    r137 r138  
    10341034
    10351035
    1036 void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag){
     1036void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlag){
    10371037    /////////////////////////
    10381038    // グローバル変数を追加
  • BasicCompiler_Common/VariableOpe.h

    r106 r138  
    3232                        char *ConstractParameter );
    3333BOOL GetNowStaticVarFullName(char *VarName,char *FullName);
    34 void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlag);
     34void AddGlobalVariable( const char *name,int *SubScripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlag);
    3535void dim(char *Parameter,DWORD dwFlags);
    3636void OpcodeDim(char *Parameter,DWORD dwFlags);
  • BasicCompiler_Common/include/Member.h

    r137 r138  
    1515    Type type;
    1616    bool isConst;
     17
     18    string initializeExpression;
     19    string constructParameter;
    1720public:
    1821    int SubScripts[MAX_ARRAYDIM];
    19 
    20     char *InitBuf;
    21     char *ConstractParameter;
    2222
    2323    int source_code_address;
     
    4242    }
    4343
     44    const string &GetInitializeExpression() const
     45    {
     46        return initializeExpression;
     47    }
     48    const string &GetConstructParameter() const
     49    {
     50        return constructParameter;
     51    }
     52
    4453    CMember( Prototype::Accessibility accessibility, const string &name, const Type &type, bool isConst )
    4554        : MemberPrototype( accessibility )
  • BasicCompiler_Common/src/Member.cpp

    r137 r138  
    1414    //構文を解析
    1515    char VarName[VN_SIZE];
    16     char init_buf[VN_SIZE];
    17     char constract_parameter[VN_SIZE];
    18     GetDimentionFormat(buffer,VarName,SubScripts,type,init_buf,constract_parameter);
     16    char initBuffer[VN_SIZE];
     17    char lpszConstructParameter[VN_SIZE];
     18    GetDimentionFormat(buffer,VarName,SubScripts,type,initBuffer,lpszConstructParameter);
    1919
    2020    //重複チェック
     
    3030
    3131    //初期データ
    32     InitBuf=(char *)HeapAlloc(hHeap,0,lstrlen(init_buf)+1);
    33     lstrcpy(InitBuf,init_buf);
     32    initializeExpression = initBuffer;
    3433
    3534    //コンストラクタ用のパラメータ
    36     ConstractParameter=(char *)HeapAlloc(hHeap,0,lstrlen(constract_parameter)+1);
    37     lstrcpy(ConstractParameter,constract_parameter);
     35    constructParameter = lpszConstructParameter;
    3836
    3937    //ソースコードの位置
     
    5351}
    5452CMember::~CMember(){
    55     if(InitBuf) HeapDefaultFree(InitBuf);
    56     if(ConstractParameter) HeapDefaultFree(ConstractParameter);
    5753}
    5854
     
    8076                member->SubScripts,
    8177                member->GetType(),
    82                 member->InitBuf,
    83                 member->ConstractParameter,
     78                member->GetInitializeExpression().c_str(),
     79                member->GetConstructParameter().c_str(),
    8480                0);
    8581
Note: See TracChangeset for help on using the changeset viewer.