Changeset eea0bb


Ignore:
Timestamp:
Jan 29, 2015, 7:38:23 AM (10 years ago)
Author:
Frederik Heber <heber@…>
Children:
7e6c0d
Parents:
27e464 (diff), 7305d5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'GUI_smallchanges' into Candidate_v1.4.10

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/Actions/CommandAction/HelpAction.def

    r27e464 reea0bb  
    1818// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
    1919#define paramtypes (std::string)
    20 #define paramtokens ("actionname")
     20#define paramtokens ("help")
    2121#define paramdescriptions ("Name of an action whose option list is then given")
    2222#define paramdefaults (PARAM_DEFAULT(std::string("none")))
  • TabularUnified src/UIElements/CommandLineUI/CommandLineParser.cpp

    r27e464 reea0bb  
    147147//        std::cout << std::endl;
    148148
    149         AddOptionToParser(currentOption, (CmdParserLookup["options"]));
     149        AddOptionToParser(currentOption, (CmdParserLookup["options"]),
     150            (optioniter->first == *iter) ?
     151                true : false);
    150152
    151153        AlreadyAddedOptionNames.insert(optioniter->first);
     
    174176      ASSERT(CmdParserLookup.find(CurrentTrait.getMenuName()) != CmdParserLookup.end(),
    175177          "CommandLineParser: boost::program_options::options_description for this Action not present.");
    176       AddOptionToParser(dynamic_cast<const OptionTrait * const>(&CurrentTrait),(CmdParserLookup[CurrentTrait.getMenuName()]));
     178      AddOptionToParser(
     179          dynamic_cast<const OptionTrait * const>(&CurrentTrait),
     180          (CmdParserLookup[CurrentTrait.getMenuName()]),
     181          false);
    177182    }
    178183  }
     
    191196 * \param *currentOption pointer to Action/Option to add
    192197 * \param *OptionList program_options list to add to
    193  */
    194 void CommandLineParser::AddOptionToParser(const OptionTrait * const currentOption, po::options_description* OptionList)
     198 * \param _DefaultAsImplicit whether to add a default value as default_value or
     199 *        as implicit_value (default = option token present or not, implicit =
     200          option token present but not necessarily followed by argument)
     201 */
     202void CommandLineParser::AddOptionToParser(
     203    const OptionTrait * const currentOption,
     204    po::options_description* OptionList,
     205    const bool _DefaultAsImplicit)
    195206{
    196207  // check whether dynamic_cast in Init() suceeded
     
    212223        (currentOption->getKeyAndShortForm().c_str(),
    213224            currentOption->hasDefaultValue() ?
    214                   po::value < bool >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     225                  (_DefaultAsImplicit ?
     226                      po::value < bool >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     227                      po::value < bool >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) :
    215228                  po::value < bool >(),
    216229                  currentOption->getDescription().c_str())
     
    239252        (currentOption->getKeyAndShortForm().c_str(),
    240253            currentOption->hasDefaultValue() ?
    241                   po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     254                  (_DefaultAsImplicit ?
     255                      po::value < int >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     256                      po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) :
    242257                  po::value < int >(),
    243258                  currentOption->getDescription().c_str())
     
    257272        (currentOption->getKeyAndShortForm().c_str(),
    258273            currentOption->hasDefaultValue() ?
    259                   po::value < unsigned int >()->default_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str())) :
     274                  (_DefaultAsImplicit ?
     275                      po::value < unsigned int >()->implicit_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str())) :
     276                      po::value < unsigned int >()->default_value(boost::lexical_cast<unsigned int>(currentOption->getDefaultValue().c_str()))) :
    260277                  po::value < unsigned int >(),
    261278                  currentOption->getDescription().c_str())
     
    275292        (currentOption->getKeyAndShortForm().c_str(),
    276293            currentOption->hasDefaultValue() ?
    277                   po::value < double >()->default_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str())) :
     294                  (_DefaultAsImplicit ?
     295                      po::value < double >()->implicit_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str())) :
     296                      po::value < double >()->default_value(boost::lexical_cast<double>(currentOption->getDefaultValue().c_str()))) :
    278297                  po::value < double >(),
    279298                  currentOption->getDescription().c_str())
     
    293312        (currentOption->getKeyAndShortForm().c_str(),
    294313            currentOption->hasDefaultValue() ?
    295                   po::value < std::string >()->default_value(currentOption->getDefaultValue()) :
     314                  (_DefaultAsImplicit ?
     315                      po::value < std::string >()->implicit_value(currentOption->getDefaultValue()) :
     316                      po::value < std::string >()->default_value(currentOption->getDefaultValue())) :
    296317                  po::value < std::string >(),
    297318                  currentOption->getDescription().c_str())
     
    347368        (currentOption->getKeyAndShortForm().c_str(),
    348369            currentOption->hasDefaultValue() ?
    349                   po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     370                  (_DefaultAsImplicit ?
     371                      po::value < int >()->implicit_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str())) :
     372                      po::value < int >()->default_value(boost::lexical_cast<int>(currentOption->getDefaultValue().c_str()))) :
    350373                  po::value < int >(),
    351374                  currentOption->getDescription().c_str())
     
    383406        (currentOption->getKeyAndShortForm().c_str(),
    384407            currentOption->hasDefaultValue() ?
    385                   po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) :
     408                  (_DefaultAsImplicit ?
     409                      po::value < std::string >()->implicit_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str())) :
     410                      po::value < std::string >()->default_value(boost::lexical_cast< std::string >(currentOption->getDefaultValue().c_str()))) :
    386411                  po::value < std::string >(),
    387412                  currentOption->getDescription().c_str())
     
    438463    po::store(po::command_line_parser(argc,argv).options(cmdline_options).run(), vm);
    439464  } catch (std::exception &e) {
    440     std::cerr << "Something went wrong with parsing the command-line arguments." << std::endl;
     465    std::cerr << "Something went wrong with parsing the command-line arguments: "
     466        << e.what() << std::endl;
    441467    World::getInstance().setExitFlag(134);
    442468#ifdef HAVE_ACTION_THREAD
  • TabularUnified src/UIElements/CommandLineUI/CommandLineParser.hpp

    r27e464 reea0bb  
    9090
    9191  // adds options to the parser
    92   void AddOptionToParser(const MoleCuilder::OptionTrait * const currentOption, po::options_description* OptionList);
     92  void AddOptionToParser(
     93      const MoleCuilder::OptionTrait * const currentOption,
     94      po::options_description* OptionList,
     95      const bool _DefaultAsImplicit);
    9396
    9497  // creates a map from short forms to action tokens needed to parse command line
  • TabularUnified tests/Python/AllActions/options.dat

    r27e464 reea0bb  
    11#key    value
    2 actionname      "help"
    32add-atom        "1"
    43add-empty-boundary      "5,5,5"
     
    8887fragment-resultfile     "results.dat"
    8988grid-level      "5"
     89help    "help"
    9090id-mapping      "1"
    9191input   "test.data"
  • TabularUnified tests/regression/Options/Help/testsuite-options-help.at

    r27e464 reea0bb  
    2727AT_CHECK([fgrep "list of all available Actions" stdout], 0, [ignore], [ignore])
    2828AT_CHECK([fgrep "Usage help" stdout], 0, [ignore], [ignore])
    29 AT_CHECK([../../molecuilder --help --actionname "help"], 0, [stdout], [ignore])
     29AT_CHECK([../../molecuilder --help "help"], 0, [stdout], [ignore])
    3030AT_CHECK([fgrep "Options available for action 'help'" stdout], 0, [ignore], [ignore])
    3131
  • TabularUnified tests/regression/Potential/FitPotential/testsuite-potential-fit-potential.at

    r27e464 reea0bb  
    2121AT_SETUP([Potential - Fit morse potential to water])
    2222AT_KEYWORDS([potential parse-homologies fit-potential morse])
    23 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     23AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    2424
    2525file=length_homology.dat
     
    4747AT_SETUP([Potential - Fit harmonic potential to water])
    4848AT_KEYWORDS([potential parse-homologies fit-potential harmonic])
    49 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     49AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    5050
    5151file=harmonic_homology.dat
     
    7373AT_SETUP([Potential - Fit harmonic_angle potential to water])
    7474AT_KEYWORDS([potential parse-homologies fit-potential harmonic_angle])
    75 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     75AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    7676
    7777file=angle_homology.dat
     
    9999AT_SETUP([Potential - Fit torsion potential to butane])
    100100AT_KEYWORDS([potential parse-homologies fit-potential torsion])
    101 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     101AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    102102
    103103file=torsion_homology.dat
     
    125125AT_SETUP([Potential - Fit improper potential to ammonia])
    126126AT_KEYWORDS([potential parse-homologies fit-potential improper])
    127 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     127AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    128128
    129129file=improper_homology.dat
     
    152152AT_SETUP([Potential - Fit LJ potential to argon])
    153153AT_KEYWORDS([potential parse-homologies fit-potential lennardjones])
    154 AT_SKIP_IF([../../molecuilder --help --actionname fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
     154AT_SKIP_IF([../../molecuilder --help fit-potential; if test $? -eq 5; then /bin/true; else /bin/false; fi])
    155155
    156156file=lj_homology.dat
Note: See TracChangeset for help on using the changeset viewer.