Ignore:
Timestamp:
Mar 19, 2012, 1:59:48 AM (12 years ago)
Author:
イグトランス (egtra)
Message:

egtraブランチの内容をマージ。

Location:
trunk
Files:
20 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ab5.0/abdev

    • Property svn:ignore set to
      *.opensdf
      *.sdf
      *.suo
      *.user
      int
      ipch
      out
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24#include <algorithm>
    35#include <boost/checked_delete.hpp>
     
    777779
    778780    std::vector<const CClass *> classes;
    779     const CClass *pClass = GetHashArrayElement( symbol.GetName().c_str() );
    780     while( pClass )
    781     {
    782         if( pClass->IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) ){
     781    foreach (auto pClass, GetHashArrayElement(symbol.GetName()))
     782    {
     783        if ( pClass->IsEqualSymbol(symbol.GetNamespaceScopes(), symbol.GetName()))
     784        {
    783785            //名前空間とクラス名が一致した
    784786            classes.push_back( pClass );
    785787        }
    786         pClass = pClass->GetChainNext();
    787788    }
    788789    if( classes.size() > 0 )
    789790    {
    790791        // 複数の名前空間の中に同一のクラス名が存在する場合があるので、アクセス可能で尚且つ階層が一番深いものをチョイスする
    791         pClass = classes.front();
     792        auto pClass = classes.front();
    792793
    793794        foreach( const CClass *pTempClass, classes )
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Const.cpp

    r700 r828  
    2929CConst *Consts::GetObjectPtr( const Symbol &symbol )
    3030{
    31     CConst *pConst = GetHashArrayElement( symbol.GetName().c_str() );
    32     while( pConst )
    33     {
    34         if( pConst->IsEqualSymbol( symbol ) )
    35         {
    36             break;
    37         }
    38         pConst = pConst->GetChainNext();
    39     }
    40 
    41     return pConst;
     31    auto c = GetHashArrayElement(symbol.GetName());
     32    auto it = std::find_if(c.begin(), c.end(),
     33        [&](CConst* t) {return t->IsEqualSymbol(symbol);});
     34    return it != c.end()
     35        ? *it
     36        : nullptr;
    4237}
    4338
     
    131126ConstMacro *ConstMacros::Find( const Symbol &symbol )
    132127{
    133     ConstMacro *pConstMacro = GetHashArrayElement( symbol.GetName().c_str() );
    134     while( pConstMacro )
    135     {
    136         if( pConstMacro->IsEqualSymbol( symbol ) )
    137         {
    138             break;
    139         }
    140         pConstMacro = pConstMacro->GetChainNext();
    141     }
    142 
    143     return pConstMacro;
     128    auto c = GetHashArrayElement(symbol.GetName());
     129    auto it = std::find_if(c.begin(), c.end(),
     130        [&](ConstMacro* t) {return t->IsEqualSymbol(symbol);});
     131    return it != c.end()
     132        ? *it
     133        : nullptr;
    144134}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Interface.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35Interface::Interface( const CClass *pInterfaceClass, const Types &actualTypeParameters )
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp

    r640 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp

    r750 r828  
    3737{
    3838    // 名前空間
    39     BOOST_FOREACH( NamespaceScopes &namespaceScopes, meta.namespaceScopesCollection )
     39    foreach (NamespaceScopes const &namespaceScopes, meta.namespaceScopesCollection)
    4040    {
    4141        if( !this->namespaceScopesCollection.IsExist( namespaceScopes ) )
     
    4646
    4747    // 関数・メソッド
    48     meta.GetUserProcs().Iterator_Reset();
    49     while( meta.GetUserProcs().Iterator_HasNext() )
    50     {
    51         UserProc *pUserProc = meta.GetUserProcs().Iterator_GetNext();
     48    foreach (auto pUserProc, meta.GetUserProcs())
     49    {
    5250        if( pUserProc->IsExternal() )
    5351        {
     
    6563
    6664    // DLL関数
    67     meta.GetDllProcs().Iterator_Reset();
    68     while( meta.GetDllProcs().Iterator_HasNext() )
    69     {
    70         DllProc *pDllProc = meta.GetDllProcs().Iterator_GetNext();
     65    foreach (auto pDllProc, meta.GetDllProcs())
     66    {
    7167        if( pDllProc->IsExternal() )
    7268        {
     
    8177
    8278    // クラス
    83     meta.GetClasses().Iterator_Reset();
    84     while( meta.GetClasses().Iterator_HasNext() )
    85     {
    86         CClass *pClass = meta.GetClasses().Iterator_GetNext();
     79    foreach (auto pClass, meta.GetClasses())
     80    {
    8781        if( pClass->IsExternal() )
    8882        {
     
    132126
    133127    // グローバル定数
    134     meta.GetGlobalConsts().Iterator_Reset();
    135     while( meta.GetGlobalConsts().Iterator_HasNext() )
    136     {
    137         CConst *pConst = meta.GetGlobalConsts().Iterator_GetNext();
     128    foreach (auto pConst, meta.GetGlobalConsts())
     129    {
    138130        if( pConst->IsExternal() )
    139131        {
     
    148140
    149141    // グローバル定数マクロ
    150     meta.GetGlobalConstMacros().Iterator_Reset();
    151     while( meta.GetGlobalConstMacros().Iterator_HasNext() )
    152     {
    153         ConstMacro *pConstMacro = meta.GetGlobalConstMacros().Iterator_GetNext();
     142    foreach (auto pConstMacro, meta.GetGlobalConstMacros())
     143    {
    154144        if( pConstMacro->IsExternal() )
    155145        {
     
    200190
    201191    // デリゲート
    202     meta.GetDelegates().Iterator_Reset();
    203     while( meta.GetDelegates().Iterator_HasNext() )
    204     {
    205         Delegate *pDelegate = meta.GetDelegates().Iterator_GetNext();
     192    foreach (auto pDelegate, meta.GetDelegates())
     193    {
    206194        if( pDelegate->IsExternal() )
    207195        {
     
    218206const ::Delegate &Meta::ToDelegate( const CClass &_class )
    219207{
    220     const ::Delegate *dg = this->GetDelegates().GetHashArrayElement( _class.GetName().c_str() );
    221     while( dg )
    222     {
    223         if( dg->IsEqualSymbol( _class.GetNamespaceScopes(), _class.GetName() ) ){
     208    auto dg = this->GetDelegates().GetHashArrayElement(_class.GetName());
     209    foreach (auto t, dg)
     210    {
     211        if( t->IsEqualSymbol( _class.GetNamespaceScopes(), _class.GetName() ) ){
    224212            //名前空間とクラス名が一致した
    225             return *dg;
    226         }
    227         dg = dg->GetChainNext();
    228     }
    229 
    230     throw;
     213            return *t;
     214        }
     215    }
     216
     217    throw std::runtime_error("Meta::ToDelegate");
    231218}
    232219
     
    256243{
    257244    // 関数・メソッド
    258     this->GetUserProcs().Iterator_Init();
    259     this->GetUserProcs().Iterator_Reset();
    260     while( this->GetUserProcs().Iterator_HasNext() )
    261     {
    262         UserProc *pUserProc = this->GetUserProcs().Iterator_GetNext();
     245    foreach (auto pUserProc, this->GetUserProcs())
     246    {
    263247        pUserProc->Resolve( resolver, resolveErrors );
    264248    }
    265249
    266250    // DLL関数
    267     this->GetDllProcs().Iterator_Init();
    268     this->GetDllProcs().Iterator_Reset();
    269     while( this->GetDllProcs().Iterator_HasNext() )
    270     {
    271         DllProc *pDllProc = this->GetDllProcs().Iterator_GetNext();
     251    foreach (auto pDllProc, this->GetDllProcs())
     252    {
    272253        pDllProc->Resolve( resolver, resolveErrors );
    273254    }
    274255
    275256    // クラス
    276     this->GetClasses().Iterator_Init();
    277     this->GetClasses().Iterator_Reset();
    278     while( this->GetClasses().Iterator_HasNext() )
    279     {
    280         CClass *pClass = this->GetClasses().Iterator_GetNext();
     257    foreach (auto pClass, this->GetClasses())
     258    {
    281259        pClass->Resolve( resolver, resolveErrors );
    282260    }
     
    289267
    290268    // グローバル定数
    291     this->GetGlobalConsts().Iterator_Init();
    292     this->GetGlobalConsts().Iterator_Reset();
    293     while( this->GetGlobalConsts().Iterator_HasNext() )
    294     {
    295         CConst *pConst = this->GetGlobalConsts().Iterator_GetNext();
     269    foreach (auto pConst, this->GetGlobalConsts())
     270    {
    296271        pConst->Resolve( resolver, resolveErrors );
    297272    }
    298273
    299274    // グローバル定数マクロ
    300     this->GetGlobalConstMacros().Iterator_Init();
    301     this->GetGlobalConstMacros().Iterator_Reset();
    302     while( this->GetGlobalConstMacros().Iterator_HasNext() )
    303     {
    304         ConstMacro *pConstMacro = this->GetGlobalConstMacros().Iterator_GetNext();
     275    foreach (auto pConstMacro, this->GetGlobalConstMacros())
     276    {
    305277        pConstMacro->Resolve( resolver, resolveErrors );
    306278    }
     
    325297
    326298    // デリゲート
    327     this->GetDelegates().Iterator_Init();
    328     this->GetDelegates().Iterator_Reset();
    329     while( this->GetDelegates().Iterator_HasNext() )
    330     {
    331         Delegate *pDelegate = this->GetDelegates().Iterator_GetNext();
     299    foreach (auto pDelegate, this->GetDelegates())
     300    {
    332301        pDelegate->Resolve( resolver, resolveErrors );
    333302    }
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Method.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
     4#include <stdexcept>
    25
    36bool CMethod::Resolve( const ObjectModule &resolver, ResolveErrors &resolveErrors )
     
    7578{
    7679    // 静的メソッドがコピーコンストラトされることは想定しない
    77     throw;
     80    throw std::domain_error("静的メソッドのコピー構築に対応していない");
    7881}
    7982
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Namespace.cpp

    r736 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24#include <algorithm>
    35
     
    1618        std::string tempName = namespaceStr.substr( i, i2-i );
    1719
    18         push_back( tempName );
     20        push_back(std::move(tempName));
    1921
    2022        if( i2 == std::string::npos ){
     
    2628}
    2729
    28 NamespaceScopes NamespaceScopes::operator+ ( const NamespaceScopes &namespaceScopes ) const
     30NamespaceScopes ActiveBasic::Common::Lexical::operator +(const NamespaceScopes &lhs, const NamespaceScopes &rhs)
    2931{
    30     NamespaceScopes result;
    31     result.reserve( this->size() + namespaceScopes.size() );
    32     result = *this;
    33     result.append( namespaceScopes );
    34     return result;
     32    return NamespaceScopes(lhs) += rhs;
    3533}
    3634
  • trunk/ab5.0/abdev/ab_common/src/Lexical/NamespaceSupporter.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35using namespace ActiveBasic::Common::Lexical;
  • trunk/ab5.0/abdev/ab_common/src/Lexical/NativeCode.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35#define BREAK_EIP(checkEip)  (obp+0x00401000>=checkEip)
  • trunk/ab5.0/abdev/ab_common/src/Lexical/ObjectModule.cpp

    r750 r828  
    1 #pragma warning(disable : 4996)
     1//#pragma warning(disable : 4996)
    22
    33#include <map>
     
    2929
    3030
     31#pragma warning(push)
     32#pragma warning(disable: 4244 6011 6326)
    3133#ifdef OBJECT_MODULE_IS_NOT_BINARY
    3234#include <boost/archive/xml_oarchive.hpp>
     
    4244#include <boost/serialization/map.hpp>
    4345#include <boost/serialization/version.hpp>
    44 #include <boost/serialization/is_abstract.hpp>
    4546#include <boost/serialization/serialization.hpp>
    4647#include <boost/serialization/nvp.hpp>
    4748#include <boost/serialization/export.hpp>
     49#pragma warning(pop)
    4850
    4951#define foreach(v, c) for each (v in c)
     
    252254    return isSuccessful;
    253255}
     256
     257BOOST_CLASS_EXPORT_IMPLEMENT( DynamicMethod );
     258BOOST_CLASS_EXPORT_IMPLEMENT( StaticMethod );
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp

    r708 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35Parameter::Parameter( const std::string &varName, const Type &type, bool isRef, const std::string initValue )
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35
     
    243245
    244246    // ハッシュ値を取得
    245     UserProc *pUserProc = GetHashArrayElement( simpleName );
    246     while(pUserProc){
     247    foreach (auto pUserProc, GetHashArrayElement( simpleName ))
     248    {
    247249        if( pUserProc->IsGlobalProcedure() ){
    248250            if( pUserProc->IsEqualSymbol( localSymbol ) ){
     
    250252            }
    251253        }
    252 
    253         pUserProc=pUserProc->GetChainNext();
    254254    }
    255255}
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp

    r769 r828  
    945945    return true;
    946946}
    947 
    948 int SourceCodePosition::GetRelationalObjectModuleIndex() const
    949 {
    950     if( this->IsNothing() )
    951     {
    952         _ASSERTE( false );
    953         throw;
    954     }
    955 
    956     return relationalObjectModuleIndex;
    957 }
    958 bool SourceCodePosition::IsNothing() const
    959 {
    960     if( this->relationalObjectModuleIndex == -1 && this->pos == -1 )
    961     {
    962         return true;
    963     }
    964 
    965     if( this->relationalObjectModuleIndex == -1 || this->pos == -1 )
    966     {
    967         _ASSERTE( false );
    968         throw;
    969     }
    970 
    971     return false;
    972 }
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp

    r752 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35using namespace ActiveBasic::Common::Lexical;
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp

    r640 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35ExpandedTemplateClass::~ExpandedTemplateClass()
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
     4#include "Lexical/Type.h"
    25
    36const int Type::basicTypeList[] = {
     
    539542
    540543int Type::GetBasicTypeFromSimpleName( const char *variable ){
    541     extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum;
     544    assert(variable != nullptr);
     545    auto length = std::strlen(variable);
     546    assert(length > 0);
     547
    542548    int i;
    543549    char name[VN_SIZE];
    544550
    545551    //構造体メンバの場合を考慮
    546     for(i=lstrlen(variable);i>0;i--){
     552    for(i=length;i>0;i--){
    547553        if(variable[i]=='.'){
    548554            i++;
  • trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp

    r750 r828  
    11#include "stdafx.h"
     2#include <jenga/include/jenga.h>
     3#include <abdev/ab_common/include/ab_common.h>
    24
    35TypeDef::TypeDef( const Symbol &symbol, const std::string &baseName, const Type &baseType )
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Variable.cpp

    r640 r828  
    1212{
    1313}
     14
    1415Variable::Variable( const Variable &var )
    1516    : RelationalObjectModuleItem( var )
     
    2425{
    2526}
     27
     28Variable::Variable(Variable&& var)
     29    : RelationalObjectModuleItem(std::move(var))
     30    , type(std::move(var.type))
     31    , isConst(std::move(var.isConst))
     32    , isRef(std::move(var.isRef))
     33    , isArray(std::move(var.isArray))
     34    , subscripts(std::move(var.subscripts))
     35    , isParameter(std::move(var.isParameter))
     36    , paramStrForConstructor(std::move(var.paramStrForConstructor))
     37    , hasInitData(std::move(var.hasInitData))
     38{
     39}
     40
    2641Variable::Variable()
    2742{
     43}
     44
     45Variable& Variable::operator =(Variable&& var)
     46{
     47    RelationalObjectModuleItem::operator =(std::move(var));
     48    type = std::move(var.type);
     49    isConst = std::move(var.isConst);
     50    isRef = std::move(var.isRef);
     51    isArray = std::move(var.isArray);
     52    subscripts = std::move(var.subscripts);
     53    isParameter = std::move(var.isParameter);
     54    paramStrForConstructor = std::move(var.paramStrForConstructor);
     55    hasInitData = std::move(var.hasInitData);
     56    return *this;
    2857}
    2958
Note: See TracChangeset for help on using the changeset viewer.