diff --git a/Common/onelab.h b/Common/onelab.h index 7c25c56178a0cb64865113d74d70e58ae4f005c4..d7a731256f2411772dca8c0a71c6db874a216e67 100644 --- a/Common/onelab.h +++ b/Common/onelab.h @@ -275,8 +275,8 @@ namespace onelab{ class number : public parameter{ private: double _value, _min, _max, _step; - // when in a loop, indicates current index in the vector _choices; is -1 - // when not in a loop + // when in a loop, indicates current index in the vector _choices; + // is -1 when not in a loop int _index; std::vector<double> _choices; std::map<double, std::string> _valueLabels; @@ -284,7 +284,7 @@ namespace onelab{ number(const std::string &name="", double value=0., const std::string &label="", const std::string &help="") : parameter(name, label, help), _value(value), - _min(-maxNumber()), _max(maxNumber()), _step(0.), _index(0) {} + _min(-maxNumber()), _max(maxNumber()), _step(0.), _index(-1) {} void setValue(double value){ _value = value; } void setMin(double min){ _min = min; } void setMax(double max){ _max = max; } diff --git a/Common/onelabUtils.cpp b/Common/onelabUtils.cpp index d523329737581339918ac032ae53788d5c47d83c..6e159132ab3f0ba23142dd23bdc8db1e52c45ea5 100644 --- a/Common/onelabUtils.cpp +++ b/Common/onelabUtils.cpp @@ -149,6 +149,7 @@ namespace onelabUtils { bool incrementLoop(const std::string &level) { + // called at the end of the do{...} while(incrementLoops); bool recompute = false, loop = false; std::vector<onelab::number> numbers; onelab::server::instance()->get(numbers); @@ -171,7 +172,7 @@ namespace onelabUtils { int j = numbers[i].getIndex() + 1; double val = numbers[i].getValue() + numbers[i].getStep(); if(numbers[i].getMax() != onelab::parameter::maxNumber() && - val < numbers[i].getMax()){ + val <= numbers[i].getMax()){ numbers[i].setValue(val); numbers[i].setIndex(j); onelab::server::instance()->set(numbers[i]); @@ -180,13 +181,13 @@ namespace onelabUtils { recompute = true; } else - numbers[i].setIndex(numbers[i].getMax()); + numbers[i].setIndex(numbers[i].getMax());// FIXME makes sense? } else if(numbers[i].getStep() < 0){ int j = numbers[i].getIndex() + 1; double val = numbers[i].getValue() + numbers[i].getStep(); if(numbers[i].getMin() != -onelab::parameter::maxNumber() && - val > numbers[i].getMin()){ + val >= numbers[i].getMin()){ numbers[i].setValue(val); numbers[i].setIndex(j); onelab::server::instance()->set(numbers[i]); @@ -195,7 +196,7 @@ namespace onelabUtils { recompute = true; } else - numbers[i].setIndex(numbers[i].getMin()); + numbers[i].setIndex(numbers[i].getMin()); // FIXME makes sense? } } } diff --git a/contrib/onelab/OnelabParser.cpp b/contrib/onelab/OnelabParser.cpp index db7f7bc9d3a284959b5ab3544294d6e1faf1ed99..eb344b5bb2798224512ac3ff6fd28e47169be721 100644 --- a/contrib/onelab/OnelabParser.cpp +++ b/contrib/onelab/OnelabParser.cpp @@ -52,11 +52,11 @@ bool MetaModel::findCommandLine(const std::string &client, const std::string &ho if(name == client){ if( (host.empty() && (rhost != "localhost" )) || (host.size() && (rhost == host)) ) { - OLMsg::SetOnelabString(name + "/CommandLine", cmdl); + OLMsg::SetOnelabString(name + "/CommandLine", cmdl, false); if(rhost.compare("localhost")){ - OLMsg::SetOnelabString(name + "/HostName", rhost); + OLMsg::SetOnelabString(name + "/HostName", rhost, false); if(rdir.size()) - OLMsg::SetOnelabString(name + "/RemoteDir", rdir); + OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false); } //std::cout << "FHF found cmdl: " << cmdl << "," << rhost << std::endl; return true; @@ -1423,6 +1423,7 @@ void MetaModel::client_sentence(const std::string &name, onelab::string str; str.setName(name + "/CommandLine"); str.setKind("file"); + str.setVisible(true); str.setAttribute("Highlight","Ivory"); set(str); OLMsg::Error("No commandline found for client <%s>", @@ -1448,34 +1449,40 @@ void MetaModel::client_sentence(const std::string &name, if(arguments.size()>=3) OLMsg::Warning("Unused arguments for client <%s>", name.c_str()); - if(host.empty()){ + if(host.size()){ + OLMsg::SetOnelabString(name + "/HostName", host, false); + if(rdir.size()) + OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false); + } + else{ std::string in = OLMsg::GetOnelabString(name + "/HostName"); if(in.size()){ std::vector<std::string> split = SplitOLHostName(in); host = split[0]; rdir = split[1]; - OLMsg::SetOnelabString(name + "/HostName", host); + OLMsg::SetOnelabString(name + "/HostName", host, false); if(rdir.size()) - OLMsg::SetOnelabString(name + "/RemoteDir", rdir); - } - } - if(!findCommandLine(name,host)){ - if(OLMsg::hasGmsh){ - onelab::string str; - str.setName(name + "/HostName"); - str.setAttribute("Highlight","Ivory"); - set(str); - OLMsg::Error("No hostname found for remote client <%s>",name.c_str()); + OLMsg::SetOnelabString(name + "/RemoteDir", rdir, false); } - else{ // asks the user in console mode - std::cout << "\nONELAB: Enter remote host for <" << name << "> (name@host:dir)" << std::endl; - std::string in; - std::getline (std::cin,in); - if(in.size()){ - std::vector<std::string> split = SplitOLHostName(in); - OLMsg::SetOnelabString(name + "/HostName", split[0]); - if(split[1].size()) - OLMsg::SetOnelabString(name + "/RemoteDir", split[1]); + if(!findCommandLine(name,host)){ + if(OLMsg::hasGmsh){ + onelab::string str; + str.setName(name + "/HostName"); + str.setVisible(true); + str.setAttribute("Highlight","Ivory"); + set(str); + OLMsg::Error("No hostname found for remote client <%s>",name.c_str()); + } + else{ // asks the user in console mode + std::cout << "\nONELAB: Enter remote host for <" << name << "> (name@host:dir)" << std::endl; + std::string in; + std::getline (std::cin,in); + if(in.size()){ + std::vector<std::string> split = SplitOLHostName(in); + OLMsg::SetOnelabString(name + "/HostName", split[0], false); + if(split[1].size()) + OLMsg::SetOnelabString(name + "/RemoteDir", split[1], false); + } } } }