Changeset 192 in dev for trunk/jenga/src/smoothie
- Timestamp:
- Jun 26, 2007, 5:04:29 AM (17 years ago)
- Location:
- trunk/jenga/src/smoothie
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jenga/src/smoothie/Class.cpp
r190 r192 374 374 } 375 375 376 const CClass *Classes::Find( const NamespaceScopes &namespaceScopes, const string &name ) const377 {378 int key;379 key=GetHashCode(name.c_str());380 381 if( namespaceScopes.size() == 0 && name == "Object" ){382 return GetObjectClassPtr();383 }384 else if( namespaceScopes.size() == 0 && name == "String" ){385 return GetStringClassPtr();386 }387 388 if(pobj_ClassHash[key]){389 CClass *pobj_c;390 pobj_c=pobj_ClassHash[key];391 while(1){392 if( pobj_c->IsEqualSymbol( namespaceScopes, name ) ){393 //名前空間とクラス名が一致した394 return pobj_c;395 }396 397 if(pobj_c->pobj_NextClass==0) break;398 pobj_c=pobj_c->pobj_NextClass;399 }400 }401 402 // TypeDefも見る403 int index = Smoothie::GetMeta().typeDefs.GetIndex( namespaceScopes, name );404 if( index != -1 ){405 Type type = Smoothie::GetMeta().typeDefs[index].GetBaseType();406 if( type.IsObject() ){407 return &type.GetClass();408 }409 }410 411 return NULL;412 }413 376 const CClass *Classes::Find( const string &fullName ) const 414 377 { -
trunk/jenga/src/smoothie/Namespace.cpp
r186 r192 26 26 } 27 27 28 bool NamespaceScopes::IsImported() const29 {30 BOOST_FOREACH( const NamespaceScopes &namespaceScopes, Smoothie::Temp::importedNamespaces ){31 if( this->IsEqual( namespaceScopes ) ){32 return true;33 }34 }35 return false;36 }37 28 bool NamespaceScopes::IsLiving() const 38 29 { … … 104 95 lstrcpy( simpleName, fullName + lstrlen( namespaceStr ) + dotLength ); 105 96 } 106 bool NamespaceScopesCollection::Imports( const string &namespaceStr ){107 NamespaceScopes namespaceScopes( namespaceStr );108 if( !Smoothie::GetMeta().namespaceScopesCollection.IsExist( namespaceScopes ) ){109 return false;110 }111 112 this->push_back( namespaceScopes );113 114 return true;115 }116 97 bool NamespaceScopesCollection::CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection ) 117 98 { -
trunk/jenga/src/smoothie/Procedure.cpp
r186 r192 37 37 } 38 38 39 bool DllProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const40 {41 if( GetName() != name ){42 return false;43 }44 return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes );45 }46 39 bool DllProc::IsEqualSymbol( const string &fullName ) const 47 40 { -
trunk/jenga/src/smoothie/Prototype.cpp
r171 r192 2 2 #include <jenga/include/smoothie/Class.h> 3 3 4 bool Prototype::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const5 {6 if( GetName() != name ){7 return false;8 }9 10 return NamespaceScopes::IsSameArea( GetNamespaceScopes(), namespaceScopes );11 }12 4 bool Prototype::IsEqualSymbol( const Prototype &prototype ) const 13 5 { -
trunk/jenga/src/smoothie/Type.cpp
r186 r192 61 61 return false; 62 62 } 63 64 65 bool Type::StringToType( const string &typeName, Type &type ){ 66 type.index = -1; 67 68 if( typeName[0] == '*' ){ 69 if( typeName.size() >= 3 70 && typeName[1] == 1 && ( typeName[2] == ESC_FUNCTION || typeName[2] == ESC_SUB ) ){ 71 //関数ポインタ(*Function) 72 type.basicType = DEF_PTR_PROC; 73 type.index = Smoothie::GetMeta().GetProcPointers().Add( typeName ); 74 return true; 75 } 76 77 const string &nextTypeName = typeName.substr( 1 ); 78 79 if( !StringToType( nextTypeName, type ) ){ 80 return false; 81 } 82 83 type.PtrLevelUp(); 84 85 return true; 86 } 87 88 if( StringToBasicType( typeName, type.basicType ) ){ 89 // 基本型だったとき 90 return true; 91 } 92 93 94 // Object型だったとき 95 if( typeName == "Object" ){ 96 type.SetType( DEF_OBJECT, Smoothie::GetMeta().GetClasses().GetObjectClassPtr() ); 97 return true; 98 } 99 100 // String型だったとき 101 if( typeName == "String" ){ 102 type.SetType( DEF_OBJECT, Smoothie::GetMeta().GetClasses().GetStringClassPtr() ); 103 return true; 104 } 105 106 107 //////////////////// 108 // TypeDefされた型 109 //////////////////// 110 int i=Smoothie::GetMeta().typeDefs.GetIndex( typeName ); 111 if(i!=-1){ 112 type = Smoothie::GetMeta().typeDefs[i].GetBaseType(); 113 return true; 114 } 115 116 //クラス 117 const CClass *pobj_c = Smoothie::GetMeta().GetClasses().Find( typeName ); 118 if(pobj_c){ 119 type.pClass = pobj_c; 120 121 if( pobj_c->IsStructure() ){ 122 type.basicType = DEF_STRUCT; 123 } 124 else{ 125 type.basicType = DEF_OBJECT; 126 } 127 return true; 128 } 129 130 return false; 63 const char *Type::BasicTypeToCharPtr( const Type &type ) 64 { 65 for( int i=0; ; i++ ){ 66 if( basicTypeList[i] == DEF_NON ){ 67 break; 68 } 69 if( basicTypeList[i] == type.GetBasicType() ){ 70 return basicTypeNameList[i].c_str(); 71 } 72 } 73 return NULL; 131 74 } 132 75 … … 488 431 } 489 432 490 491 const string Type::ToString() const492 {493 if( PTR_LEVEL( basicType ) ){494 //ポインタレベルが1以上の場合495 Type type( *this );496 type.PtrLevelDown();497 498 return (string)"*" + type.ToString();499 }500 else if( IsObject() || IsStruct() ){501 //オブジェクトまたは構造体502 503 if( !( index == 0 || index == -1 ) ){504 if( pClass->GetNamespaceScopes().size() >= 1 )505 {506 return pClass->GetNamespaceScopes().ToString() + "." + pClass->GetName();507 }508 return pClass->GetName();509 }510 }511 else if( IsProcPtr() ){512 if( index == 0 || index == -1 ){513 return "VoidPtr";514 }515 else{516 if( Smoothie::GetMeta().GetProcPointers()[index]->ReturnType().IsNull() ){517 return "*Sub";518 }519 return "*Function";520 }521 }522 else{523 // 基本型524 525 for( int i=0; ; i++ ){526 if( basicTypeList[i] == DEF_NON ){527 break;528 }529 if( basicTypeList[i] == basicType ){530 return basicTypeNameList[i];531 }532 }533 }534 535 SmoothieException::Throw( 1 );536 537 return (string)"(null)";538 }539 540 Type Type::String(){541 return Type( DEF_OBJECT, *Smoothie::GetMeta().GetClasses().GetStringClassPtr() );542 }543 544 433 int Type::GetBasicTypeFromSimpleName( const char *variable ){ 545 434 extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum; -
trunk/jenga/src/smoothie/Variable.cpp
r174 r192 1 1 #include <jenga/include/smoothie/Smoothie.h> 2 2 #include <jenga/include/smoothie/Class.h> 3 4 bool Variable::IsEqualSymbol( const Symbol &symbol, bool isSupportStaticMember ) const5 {6 if( GetName() == symbol.GetName()7 && NamespaceScopes::IsSameArea( this->namespaceScopes, symbol.GetNamespaceScopes() ) )8 {9 return true;10 }11 12 if( isSupportStaticMember && symbol.GetNamespaceScopes().size() >= 1 )13 {14 // 静的メンバを考慮15 NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes() );16 string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName();17 namespaceScopes.pop_back();18 19 return IsEqualSymbol( Symbol( namespaceScopes, name ), false );20 }21 return false;22 }23 3 24 4
Note:
See TracChangeset
for help on using the changeset viewer.