Changeset 113 in dev
- Timestamp:
- May 10, 2007, 12:27:41 PM (18 years ago)
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
BasicCompiler32/Compile_CallProc.cpp
r102 r113 363 363 extern BOOL bDebugCompile; 364 364 extern BOOL bDebugSupportProc; 365 if(bDebugCompile&&bDebugSupportProc==0&& pDllProc-> GetName() != "DebugBreak"){365 if(bDebugCompile&&bDebugSupportProc==0&& pDllProc->IsEqualSymbol( "DebugBreak" ) ){ 366 366 Call_DebugSys_SaveContext(); 367 367 } -
BasicCompiler_Common/Compile.cpp
r107 r113 161 161 162 162 case ESC_TYPEDEF: 163 if( UserProc::IsLocalAreaCompiling() ){ 164 // ローカル領域をコンパイルしているとき 165 SetError(65,"TypeDef",cp ); 166 } 167 163 168 //既に収集済み 164 169 break; … … 219 224 break; 220 225 case ESC_DECLARE: 226 if( UserProc::IsLocalAreaCompiling() ){ 227 // ローカル領域をコンパイルしているとき 228 SetError(65,"Declare",cp ); 229 } 221 230 break; 222 231 -
BasicCompiler_Common/DebugMiddleFile.cpp
r108 r113 139 139 i2+=sizeof(long); 140 140 for(i3=0;i3<(int)Smoothie::Meta::typeDefs.size();i3++){ 141 lstrcpy(buffer+i2,Smoothie::Meta::typeDefs[i3].GetN ewName().c_str() );141 lstrcpy(buffer+i2,Smoothie::Meta::typeDefs[i3].GetName().c_str() ); 142 142 i2+=lstrlen(buffer+i2)+1; 143 143 … … 509 509 i2+=lstrlen(buffer+i2)+1; 510 510 511 Smoothie::Meta::typeDefs.push_back( TypeDef( temp5, buffer+i2 ) ); 511 // 名前空間に未対応 512 Smoothie::Meta::typeDefs.push_back( TypeDef( NamespaceScopes(), temp5, buffer+i2 ) ); 512 513 513 514 i2+=lstrlen(buffer+i2)+1; -
BasicCompiler_Common/Procedure.cpp
r108 r113 539 539 } 540 540 541 bool DllProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const 542 { 543 if( GetName() != name ){ 544 return false; 545 } 546 return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes ); 547 } 548 bool DllProc::IsEqualSymbol( const string &fullName ) const 549 { 550 char AreaName[VN_SIZE] = ""; //オブジェクト変数 551 char NestName[VN_SIZE] = ""; //入れ子メンバ 552 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName ); 553 554 if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){ 555 return true; 556 } 557 558 if( isNest ){ 559 // 静的メンバを考慮 560 561 char AreaName2[VN_SIZE] = ""; //オブジェクト変数 562 char NestName2[VN_SIZE] = ""; //入れ子メンバ 563 bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 ); 564 lstrcat( NestName2, "." ); 565 lstrcat( NestName2, NestName ); 566 567 return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 ); 568 } 569 570 return false; 571 } 572 573 541 574 bool DllProc::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){ 542 575 int i = 0; -
BasicCompiler_Common/Procedure.h
r108 r113 311 311 ~DllProc(){} 312 312 313 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 314 bool IsEqualSymbol( const string &name ) const; 315 316 const NamespaceScopes &GetNamespaceScopes() const 317 { 318 return namespaceScopes; 319 } 320 313 321 virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine ); 314 322 -
BasicCompiler_Common/Subroutine.cpp
r112 r113 441 441 extern DllProc **ppDeclareHash; 442 442 if(ppDeclareHash[key]){ 443 DllProc *pTempProc; 444 pTempProc=ppDeclareHash[key]; 443 DllProc *pTempProc = ppDeclareHash[key]; 445 444 while(1){ 446 if( p DllProc->GetName() == pTempProc->GetName() ){445 if( pTempProc->IsEqualSymbol( pDllProc->GetNamespaceScopes(), pDllProc->GetName() ) ){ 447 446 //重複エラー 448 447 SetError(15,procName,nowLine); -
BasicCompiler_Common/TypeDef.cpp
r96 r113 2 2 3 3 4 TypeDef::TypeDef( const string &newName, const string &baseName ): 5 newName( newName ), 6 baseName( baseName ) 4 TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName ) 5 : namespaceScopes( namespaceScopes ) 6 , name( name ) 7 , baseName( baseName ) 7 8 { 8 9 if( !Type::StringToType( baseName, baseType ) ){ … … 14 15 } 15 16 17 bool TypeDef::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const 18 { 19 if( GetName() != name ){ 20 return false; 21 } 22 return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes ); 23 } 24 bool TypeDef::IsEqualSymbol( const string &fullName ) const 25 { 26 char AreaName[VN_SIZE] = ""; //オブジェクト変数 27 char NestName[VN_SIZE] = ""; //入れ子メンバ 28 bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName ); 29 30 if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){ 31 return true; 32 } 33 34 if( isNest ){ 35 // 静的メンバを考慮 36 37 char AreaName2[VN_SIZE] = ""; //オブジェクト変数 38 char NestName2[VN_SIZE] = ""; //入れ子メンバ 39 bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 ); 40 lstrcat( NestName2, "." ); 41 lstrcat( NestName2, NestName ); 42 43 return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 ); 44 } 45 46 return false; 47 } 48 49 16 50 17 51 TypeDefCollection::TypeDefCollection(){ … … 19 53 TypeDefCollection::~TypeDefCollection(){ 20 54 } 21 void TypeDefCollection::Add( const string &newName, const string &baseName ){22 TypeDef typeDef( n ewName, baseName );55 void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName ){ 56 TypeDef typeDef( namespaceScopes, name, baseName ); 23 57 this->push_back( typeDef ); 24 58 } … … 26 60 int max = (int)(*this).size(); 27 61 for( int i=0; i<max; i++ ){ 28 if( (*this)[i]. newName == typeName){62 if( (*this)[i].IsEqualSymbol( typeName ) ){ 29 63 return i; 30 64 } … … 33 67 } 34 68 35 void TypeDefCollection::Add( const string &expression, int nowLine ){69 void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine ){ 36 70 int i; 37 71 char temporary[VN_SIZE]; … … 98 132 cp = nowLine; 99 133 100 Smoothie::Meta::typeDefs.Add(temporary,pTemp);134 Add( namespaceScopes, temporary, pTemp ); 101 135 } 102 136 … … 105 139 clear(); 106 140 107 int i=-1; 141 // 名前空間管理 142 NamespaceScopes &namespaceScopes = Smoothie::Lexical::liveingNamespaceScopes; 143 namespaceScopes.clear(); 144 145 // Importsされた名前空間の管理 146 NamespaceScopesCollection &importedNamespaces = Smoothie::Meta::importedNamespaces; 147 importedNamespaces.clear(); 148 149 int i=-1, i2; 150 char temporary[VN_SIZE]; 108 151 while(1){ 152 extern char *basbuf; 153 109 154 i++; 110 155 111 extern char *basbuf; 156 if( basbuf[i] == 1 && basbuf[i+1] == ESC_NAMESPACE ){ 157 for(i+=2,i2=0;;i2++,i++){ 158 if( IsCommandDelimitation( basbuf[i] ) ){ 159 temporary[i2]=0; 160 break; 161 } 162 temporary[i2]=basbuf[i]; 163 } 164 namespaceScopes.push_back( temporary ); 165 166 continue; 167 } 168 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENDNAMESPACE ){ 169 if( namespaceScopes.size() <= 0 ){ 170 SetError(12, "End Namespace", i ); 171 } 172 else{ 173 namespaceScopes.pop_back(); 174 } 175 176 i += 2; 177 continue; 178 } 179 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPORTS ){ 180 for(i+=2,i2=0;;i2++,i++){ 181 if( IsCommandDelimitation( basbuf[i] ) ){ 182 temporary[i2]=0; 183 break; 184 } 185 temporary[i2]=basbuf[i]; 186 } 187 importedNamespaces.Imports( temporary ); 188 189 continue; 190 } 191 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){ 192 importedNamespaces.clear(); 193 continue; 194 } 195 112 196 if( basbuf[i]==1 ){ 113 197 char temporary[VN_SIZE]; … … 122 206 if(basbuf[i]=='\0') break; 123 207 } 124 Add( temporary,i);208 Add( namespaceScopes, temporary, i ); 125 209 126 210 continue; … … 136 220 if(basbuf[i]=='\0') break; 137 221 } 138 Smoothie::Meta::typeDefs.Add(temporary,"Long");222 Add( namespaceScopes, temporary, "Long" ); 139 223 } 140 224 } -
BasicCompiler_Common/TypeDef.h
r78 r113 13 13 friend TypeDefCollection; 14 14 15 string newName; 15 NamespaceScopes namespaceScopes; 16 17 string name; 16 18 string baseName; 17 19 Type baseType; 18 20 public: 19 TypeDef( const string &newName, const string &baseName );21 TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName ); 20 22 ~TypeDef(); 21 23 22 const string &GetNewName(){ 23 return newName; 24 const string &GetName() const 25 { 26 return name; 24 27 } 25 const string &GetBaseName(){ 28 const string &GetBaseName() const 29 { 26 30 return baseName; 27 31 } 28 const Type &GetBaseType(){ 32 const Type &GetBaseType() const 33 { 29 34 return baseType; 30 35 } 36 37 bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const; 38 bool IsEqualSymbol( const string &name ) const; 31 39 }; 32 40 … … 37 45 ~TypeDefCollection(); 38 46 39 void Add( const string &newName, const string &baseName );47 void Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName ); 40 48 int GetIndex( const string &typeName ) const; 41 49 42 50 private: 43 void Add( const string &expression, int nowLine );51 void Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine ); 44 52 public: 45 53 void Init(); -
BasicCompiler_Common/error.cpp
r110 r113 154 154 if(num==63) lstrcpy(msg,"名前空間が正しく閉じられていません。"); 155 155 if(num==64) sprintf(msg,"\"%s\" 無効な名前空間です。",tempKeyWord); 156 if(num==65) sprintf(msg,"ローカル領域で%sは使用できません。",tempKeyWord); 156 157 157 158 -
BasicCompiler_Common/hash.cpp
r102 r113 35 35 } 36 36 37 DllProc *GetDeclareHash(char *name){ 37 DllProc *GetDeclareHash(char *fullName){ 38 char ObjName[VN_SIZE]; //オブジェクト変数 39 char NestMember[VN_SIZE]; //入れ子メンバ 40 bool isObjectMember = SplitMemberName( fullName, ObjName, NestMember ); 41 38 42 //ハッシュ値を取得 39 43 int key; 40 key=hash_default( name);44 key=hash_default(NestMember); 41 45 42 46 //格納位置を取得 … … 45 49 pDllProc=ppDeclareHash[key]; 46 50 while(pDllProc){ 47 if( pDllProc->GetName() == name ){ 51 // TODO: Declare名前空間対応 52 if( pDllProc->IsEqualSymbol( fullName ) ){ 48 53 break; 49 54 }
Note:
See TracChangeset
for help on using the changeset viewer.