Changeset 579 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src
- Timestamp:
- May 8, 2008, 3:27:32 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.