X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=src%2Fgromacs%2Foptions%2Foptionsassigner.cpp;h=2842655c54f438b38559d32d2989383ec69d1b39;hb=bd8ff104f5c56e7040041a456a349dac48bf60d9;hp=df3f1320d89da7ddb54996b610e7c5885d30a614;hpb=d140ff68d87ca3c962308fc03dadd4d99cdd9459;p=alexxy%2Fgromacs.git diff --git a/src/gromacs/options/optionsassigner.cpp b/src/gromacs/options/optionsassigner.cpp index df3f1320d8..2842655c54 100644 --- a/src/gromacs/options/optionsassigner.cpp +++ b/src/gromacs/options/optionsassigner.cpp @@ -1,7 +1,7 @@ /* * This file is part of the GROMACS molecular simulation package. * - * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by + * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -90,8 +90,6 @@ class OptionsAssigner::Impl Options &options_; //! Recognize boolean option "name" also as "noname". bool bAcceptBooleanNoPrefix_; - //! Look for options in all sections, not just the current one. - bool bNoStrictSectioning_; /*! \brief * List of (sub)sections being assigned to. * @@ -113,8 +111,7 @@ class OptionsAssigner::Impl OptionsAssigner::Impl::Impl(Options *options) : options_(*options), bAcceptBooleanNoPrefix_(false), - bNoStrictSectioning_(false), currentOption_(NULL), - currentValueCount_(0), reverseBoolean_(false) + currentOption_(NULL), currentValueCount_(0), reverseBoolean_(false) { sectionStack_.push_back(&options_); } @@ -124,71 +121,23 @@ OptionsAssigner::Impl::findOption(const char *name) { GMX_RELEASE_ASSERT(currentOption_ == NULL, "Cannot search for another option while processing one"); - AbstractOptionStorage *option = NULL; - Options *section = NULL; - Options *root = ¤tSection(); - Options *oldRoot = NULL; - int upcount = 0; - std::deque searchList; - searchList.push_back(root); - while (option == NULL && !searchList.empty()) + const Options §ion = currentSection(); + AbstractOptionStorage *option = section.impl_->findOption(name); + if (option == NULL && bAcceptBooleanNoPrefix_) { - section = searchList.front(); - option = section->impl_->findOption(name); - if (option == NULL && bAcceptBooleanNoPrefix_) + if (name[0] == 'n' && name[1] == 'o') { - if (name[0] == 'n' && name[1] == 'o') + option = section.impl_->findOption(name + 2); + if (option != NULL && option->isBoolean()) { - option = section->impl_->findOption(name + 2); - if (option != NULL && option->isBoolean()) - { - reverseBoolean_ = true; - } - else - { - option = NULL; - } + reverseBoolean_ = true; } - } - searchList.pop_front(); - if (bNoStrictSectioning_) - { - Options::Impl::SubSectionList::const_iterator i; - for (i = section->impl_->subSections_.begin(); - i != section->impl_->subSections_.end(); ++i) + else { - if (*i != oldRoot) - { - searchList.push_back(*i); - } - } - if (searchList.empty() && root != &options_) - { - root = root->impl_->parent_; - ++upcount; - searchList.push_back(root); + option = NULL; } } } - if (bNoStrictSectioning_ && option != NULL) - { - while (upcount > 0) - { - sectionStack_.pop_back(); - --upcount; - } - std::vector sections; - while (section != ¤tSection()) - { - sections.push_back(section); - section = section->impl_->parent_; - } - while (!sections.empty()) - { - sectionStack_.push_back(sections.back()); - sections.pop_back(); - } - } return option; } @@ -210,11 +159,6 @@ void OptionsAssigner::setAcceptBooleanNoPrefix(bool bEnabled) impl_->bAcceptBooleanNoPrefix_ = bEnabled; } -void OptionsAssigner::setNoStrictSectioning(bool bEnabled) -{ - impl_->bNoStrictSectioning_ = bEnabled; -} - void OptionsAssigner::start() { impl_->options_.impl_->startSource(); @@ -297,13 +241,6 @@ void OptionsAssigner::finishSubSection() void OptionsAssigner::finish() { GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called"); - if (impl_->bNoStrictSectioning_) - { - while (impl_->inSubSection()) - { - finishSubSection(); - } - } GMX_RELEASE_ASSERT(!impl_->inSubSection(), "finishSubSection() not called"); }