Changeset 579 in dev for trunk/ab5.0/abdev/BasicCompiler_Common
- Timestamp:
- May 8, 2008, 3:27:32 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
r578 r579 534 534 else 535 535 { 536 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( procName ); 536 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( 537 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( procName ) 538 ); 537 539 if( pConstMacro ) 538 540 { … … 843 845 ////////////// 844 846 845 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(term); 847 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( 848 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term ) 849 ); 846 850 if(i3){ 847 if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( term) ){851 if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term ) ) ){ 848 852 //リテラル文字列 849 853 goto StrLiteral; -
trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp
r570 r579 1051 1051 1052 1052 //定数と2重定義されていないる場合は抜け出す 1053 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( VarName)){1053 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( VarName ) )){ 1054 1054 return; 1055 1055 } … … 1073 1073 1074 1074 //定数と2重定義されていないかを調べる 1075 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( VarName)){1075 if(compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( VarName ) )){ 1076 1076 compiler.errorMessenger.Output(15,VarName,cp); 1077 1077 return; -
trunk/ab5.0/abdev/BasicCompiler_Common/calculation.cpp
r578 r579 498 498 //定数関数 499 499 500 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( temporary ); 500 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( 501 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( temporary ) 502 ); 501 503 if( !pConstMacro ) 502 504 { … … 663 665 ///////// 664 666 StrPtr[pnum]=0; 665 type[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(Parms); 667 type[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( 668 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( Parms ) 669 ); 666 670 if(type[pnum]){ 667 671 if(IsRealNumberType(type[pnum])){ 668 672 //実数型 669 nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(Parms); 673 nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData( 674 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( Parms ) 675 ); 670 676 } 671 677 else if(IsWholeNumberType(type[pnum])){ 672 678 //整数 673 i64nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(Parms); 679 i64nums[pnum] = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData( 680 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( Parms ) 681 ); 674 682 } 675 683 /* else if(type[pnum]==DEF_STRING){ … … 1223 1231 1224 1232 //定数 1225 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( temporary ); 1233 ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( 1234 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( temporary ) 1235 ); 1226 1236 if(pConstMacro){ 1227 1237 //マクロ関数の場合 … … 1233 1243 1234 1244 //定数 1235 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(Command+i2); 1245 i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType( 1246 ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( Command+i2 ) 1247 ); 1236 1248 if(i3==DEF_STRING) return 1; //文字列 1237 1249 if(i3) return 0; //数値 -
trunk/ab5.0/abdev/BasicCompiler_Common/include/Const.h
r578 r579 73 73 74 74 private: 75 CConst *GetObjectPtr( const std::string &name);75 CConst *GetObjectPtr( const Symbol &symbol ); 76 76 public: 77 77 78 int GetBasicType( const char *Name);79 _int64 GetWholeData( const char *Name);80 double GetDoubleData( const char *Name);81 bool IsStringPtr( const char *Name);78 int GetBasicType( const Symbol &symbol ); 79 _int64 GetWholeData( const Symbol &symbol ); 80 double GetDoubleData( const Symbol &symbol ); 81 bool IsStringPtr( const Symbol &symbol ); 82 82 }; 83 83 … … 142 142 143 143 public: 144 voidAdd( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr );145 ConstMacro *Find( const std::string&name );144 bool Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr ); 145 ConstMacro *Find( const Symbol &name ); 146 146 }; -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Const.cpp
r578 r579 36 36 } 37 37 38 CConst *Consts::GetObjectPtr( const std::string &name ){ 39 char ObjName[VN_SIZE]; //オブジェクト変数 40 char NestMember[VN_SIZE]; //入れ子メンバ 41 bool isObjectMember = SplitMemberName( name.c_str(), ObjName, NestMember ); 42 43 CConst *pConst = GetHashArrayElement( NestMember ); 38 CConst *Consts::GetObjectPtr( const Symbol &symbol ) 39 { 40 CConst *pConst = GetHashArrayElement( symbol.GetName().c_str() ); 44 41 while( pConst ) 45 42 { 46 if( pConst->IsEqualSymbol( LexicalAnalyzer::FullNameToSymbol( name )) )43 if( pConst->IsEqualSymbol( symbol ) ) 47 44 { 48 45 break; … … 55 52 56 53 57 int Consts::GetBasicType( const char *Name){58 CConst *pConst = GetObjectPtr( Name);54 int Consts::GetBasicType( const Symbol &symbol ){ 55 CConst *pConst = GetObjectPtr( symbol ); 59 56 60 57 if(!pConst) return 0; … … 62 59 return pConst->GetType().GetBasicType(); 63 60 } 64 _int64 Consts::GetWholeData( const char *Name){65 CConst *pConst = GetObjectPtr( Name);61 _int64 Consts::GetWholeData( const Symbol &symbol ){ 62 CConst *pConst = GetObjectPtr( symbol ); 66 63 67 64 if(!pConst) return 0; … … 69 66 return pConst->GetWholeData(); 70 67 } 71 double Consts::GetDoubleData( const char *Name){72 CConst *pConst = GetObjectPtr( Name);68 double Consts::GetDoubleData( const Symbol &symbol ){ 69 CConst *pConst = GetObjectPtr( symbol ); 73 70 74 71 if(!pConst) return 0; … … 76 73 return pConst->GetDoubleData(); 77 74 } 78 bool Consts::IsStringPtr( const char *Name){79 CConst *pConst = GetObjectPtr( Name);75 bool Consts::IsStringPtr( const Symbol &symbol ){ 76 CConst *pConst = GetObjectPtr( symbol ); 80 77 81 78 if(!pConst) return false; … … 87 84 88 85 // マクロ定数を追加するための関数 89 voidConstMacros::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr )86 bool ConstMacros::Add( const NamespaceScopes &namespaceScopes, const std::string &name, const char *parameterStr ) 90 87 { 91 88 std::vector<std::string> parameters; … … 94 91 if(parameterStr[i]!='(') 95 92 { 96 compiler.errorMessenger.OutputFatalError(); 97 return; 93 return false; 98 94 } 99 95 … … 101 97 int i2; 102 98 for(i++,i2=0;;i++,i2++){ 103 if(parameterStr[i]=='\0') {104 compiler.errorMessenger.Output(1,NULL,cp);105 return ;99 if(parameterStr[i]=='\0') 100 { 101 return false; 106 102 } 107 103 if(parameterStr[i]==','||parameterStr[i]==')'){ … … 112 108 if(parameterStr[i]==')'){ 113 109 i++; 114 if(parameterStr[i]!='='){ 115 extern int cp; 116 compiler.errorMessenger.Output(1,NULL,cp); 117 return; 110 if(parameterStr[i]!='=') 111 { 112 return false; 118 113 } 119 114 break; … … 129 124 lstrcpy(temporary,parameterStr+i+1); 130 125 131 Put( new ConstMacro( namespaceScopes, name, parameters, temporary ) ); 126 this->Put( new ConstMacro( namespaceScopes, name, parameters, temporary ) ); 127 128 return true; 132 129 } 133 ConstMacro *ConstMacros::Find( const std::string &name ){ 134 char ObjName[VN_SIZE]; //オブジェクト変数 135 char NestMember[VN_SIZE]; //入れ子メンバ 136 bool isObjectMember = SplitMemberName( name.c_str(), ObjName, NestMember ); 137 138 ConstMacro *pConstMacro = GetHashArrayElement( NestMember ); 130 ConstMacro *ConstMacros::Find( const Symbol &symbol ) 131 { 132 ConstMacro *pConstMacro = GetHashArrayElement( symbol.GetName().c_str() ); 139 133 while( pConstMacro ) 140 134 { 141 if( pConstMacro->IsEqualSymbol( LexicalAnalyzer::FullNameToSymbol( name )) )135 if( pConstMacro->IsEqualSymbol( symbol ) ) 142 136 { 143 137 break; -
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Const.cpp
r578 r579 179 179 // 定数マクロ 180 180 const char *params = temporary + i2; 181 constMacros.Add( namespaceScopes, name, params ); 181 if( !constMacros.Add( namespaceScopes, name, params ) ) 182 { 183 compiler.errorMessenger.Output( 1, NULL, i ); 184 } 182 185 } 183 186
Note:
See TracChangeset
for help on using the changeset viewer.