Skip to content
Snippets Groups Projects
Commit 7813811b authored by Francois Henrotte's avatar Francois Henrotte
Browse files

no spaces in Plugin fields + no fatal errors in metamodels

parent eea556f9
Branches
Tags
No related merge requests found
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#include "shapeFunctions.h" #include "shapeFunctions.h"
StringXNumber Scal2VecOptions_Number[] = { StringXNumber Scal2VecOptions_Number[] = {
{GMSH_FULLRC, "View X", NULL, -1.}, {GMSH_FULLRC, "ViewX", NULL, -1.},
{GMSH_FULLRC, "View Y", NULL, -1.}, {GMSH_FULLRC, "ViewY", NULL, -1.},
{GMSH_FULLRC, "View Z", NULL, -1.} {GMSH_FULLRC, "ViewZ", NULL, -1.}
}; };
StringXString Scal2VecOptions_String[] = { StringXString Scal2VecOptions_String[] = {
{GMSH_FULLRC, "Name NewView", NULL, "NewView"} {GMSH_FULLRC, "NameNewView", NULL, "NewView"}
}; };
extern "C" extern "C"
...@@ -27,10 +27,10 @@ extern "C" ...@@ -27,10 +27,10 @@ extern "C"
std::string GMSH_Scal2VecPlugin::getHelp() const std::string GMSH_Scal2VecPlugin::getHelp() const
{ {
return "Plugin(Scal2Vec) converts the scalar fields of 'View X', " return "Plugin(Scal2Vec) converts the scalar fields of 'ViewX', "
"'View Y' and/or 'View Z' into a vectorial field. " "'ViewY' and/or 'ViewZ' into a vectorial field. "
"The new view 'Name NewView' contains it.\n\n" "The new view 'NameNewView' contains it.\n\n"
"If the value of 'View X', 'View Y' or 'View Z' is -1, " "If the value of 'ViewX', 'ViewY' or 'ViewZ' is -1, "
"the value of the vectorial field in the corresponding direction is 0."; "the value of the vectorial field in the corresponding direction is 0.";
} }
......
...@@ -122,7 +122,7 @@ std::string localNetworkSolverClient::appendArguments(){ ...@@ -122,7 +122,7 @@ std::string localNetworkSolverClient::appendArguments(){
command.append(" " + getSocketSwitch() + " " + getName() + " %s"); command.append(" " + getSocketSwitch() + " " + getName() + " %s");
} }
else else
OLMsg::Fatal("appendArguments: Unknown Action <%s>", action.c_str()); OLMsg::Error("appendArguments: Unknown Action <%s>", action.c_str());
return command; return command;
} }
...@@ -234,7 +234,7 @@ bool localNetworkSolverClient::run() ...@@ -234,7 +234,7 @@ bool localNetworkSolverClient::run()
onelab::function p; p.fromChar(message); set(p); onelab::function p; p.fromChar(message); set(p);
} }
else else
OLMsg::Fatal("FIXME query not done for this parameter type: <%s>", OLMsg::Error("FIXME query not done for this parameter type: <%s>",
message.c_str()); message.c_str());
} }
break; break;
...@@ -328,7 +328,7 @@ bool localNetworkSolverClient::run() ...@@ -328,7 +328,7 @@ bool localNetworkSolverClient::run()
break; break;
case GmshSocket::GMSH_ERROR: case GmshSocket::GMSH_ERROR:
//OLMsg::Direct(1, "%-8.8s: %s", _name.c_str(), message.c_str()); //OLMsg::Direct(1, "%-8.8s: %s", _name.c_str(), message.c_str());
OLMsg::Fatal("%-8.8s: %s", _name.c_str(), message.c_str()); OLMsg::Error("%-8.8s: %s", _name.c_str(), message.c_str());
break; break;
case GmshSocket::GMSH_MERGE_FILE: case GmshSocket::GMSH_MERGE_FILE:
break; break;
...@@ -539,7 +539,7 @@ bool remoteClient::checkIfPresentRemote(const std::string &fileName){ ...@@ -539,7 +539,7 @@ bool remoteClient::checkIfPresentRemote(const std::string &fileName){
//std::cout << "check remote<" << cmd << ">" << std::endl; //std::cout << "check remote<" << cmd << ">" << std::endl;
fp = POPEN(cmd.c_str(), "r"); fp = POPEN(cmd.c_str(), "r");
if(fgets(cbuf, 1024, fp) == NULL){ if(fgets(cbuf, 1024, fp) == NULL){
OLMsg::Fatal("The file <%s> is not present", fileName.c_str()); OLMsg::Error("The file <%s> is not present", fileName.c_str());
PCLOSE(fp); PCLOSE(fp);
return false; return false;
} }
...@@ -567,7 +567,7 @@ bool remoteClient::syncInputFile(const std::string &wdir, const std::string &fil ...@@ -567,7 +567,7 @@ bool remoteClient::syncInputFile(const std::string &wdir, const std::string &fil
return mySystem(cmd); return mySystem(cmd);
} }
else{ else{
OLMsg::Fatal("The input file <%s> is not present", fullName.c_str()); OLMsg::Error("The input file <%s> is not present", fullName.c_str());
return false; return false;
} }
} }
...@@ -581,13 +581,13 @@ bool remoteClient::syncInputFile(const std::string &wdir, const std::string &fil ...@@ -581,13 +581,13 @@ bool remoteClient::syncInputFile(const std::string &wdir, const std::string &fil
return mySystem(cmd); return mySystem(cmd);
} }
else{ else{
OLMsg::Fatal("The input file <%s> is not present", fullName.c_str()); OLMsg::Error("The input file <%s> is not present", fullName.c_str());
return false; return false;
} }
} }
else { //should be found remote else { //should be found remote
if(!checkIfPresentRemote(fileName)){ if(!checkIfPresentRemote(fileName)){
OLMsg::Fatal("The input file <%s> is not present", fileName.c_str()); OLMsg::Error("The input file <%s> is not present", fileName.c_str());
return false; return false;
} }
else else
...@@ -625,7 +625,7 @@ void MetaModel::saveCommandLines(const std::string fileName){ ...@@ -625,7 +625,7 @@ void MetaModel::saveCommandLines(const std::string fileName){
for(citer it = _clients.begin(); it != _clients.end(); it++) for(citer it = _clients.begin(); it != _clients.end(); it++)
outfile << (*it)->toChar(); outfile << (*it)->toChar();
else else
OLMsg::Fatal("The file <%s> cannot be opened",fileNameSave.c_str()); OLMsg::Error("The file <%s> cannot be opened",fileNameSave.c_str());
outfile.close(); outfile.close();
} }
...@@ -677,7 +677,7 @@ void MetaModel::registerClient(const std::string &name, const std::string &type, ...@@ -677,7 +677,7 @@ void MetaModel::registerClient(const std::string &name, const std::string &type,
else if(!type.compare(0,6,"encaps")) else if(!type.compare(0,6,"encaps"))
c= new EncapsulatedClient(name,cmdl,getWorkingDir()); c= new EncapsulatedClient(name,cmdl,getWorkingDir());
else else
OLMsg::Fatal("Unknown client type", type.c_str()); OLMsg::Error("Unknown client type", type.c_str());
} }
else{ // remote client else{ // remote client
if(!type.compare(0,6,"interf")) if(!type.compare(0,6,"interf"))
...@@ -687,7 +687,7 @@ void MetaModel::registerClient(const std::string &name, const std::string &type, ...@@ -687,7 +687,7 @@ void MetaModel::registerClient(const std::string &name, const std::string &type,
else if(!type.compare(0,6,"encaps")) else if(!type.compare(0,6,"encaps"))
c= new RemoteEncapsulatedClient(name,cmdl,getWorkingDir(),host,rdir); c= new RemoteEncapsulatedClient(name,cmdl,getWorkingDir(),host,rdir);
else else
OLMsg::Fatal("Unknown remote client type", type.c_str()); OLMsg::Error("Unknown remote client type", type.c_str());
} }
_clients.push_back(c); _clients.push_back(c);
} }
...@@ -713,9 +713,10 @@ void InterfacedClient::analyze() { ...@@ -713,9 +713,10 @@ void InterfacedClient::analyze() {
size_t pos; size_t pos;
std::vector<std::string> choices; std::vector<std::string> choices;
setAction("check");
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(), OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(),
onelab::server::instance()->getChanged(getName())); onelab::server::instance()->getChanged(getName()));
setAction("check");
getList("InputFiles", choices); getList("InputFiles", choices);
for(unsigned int i = 0; i < choices.size(); i++){ for(unsigned int i = 0; i < choices.size(); i++){
if((pos=choices[i].find(onelabExtension)) != std::string::npos){ if((pos=choices[i].find(onelabExtension)) != std::string::npos){
...@@ -730,6 +731,7 @@ void InterfacedClient::analyze() { ...@@ -730,6 +731,7 @@ void InterfacedClient::analyze() {
void InterfacedClient::convert() { void InterfacedClient::convert() {
size_t pos; size_t pos;
std::vector<std::string> choices; std::vector<std::string> choices;
getList("InputFiles", choices); getList("InputFiles", choices);
for(unsigned int i = 0; i < choices.size(); i++){ for(unsigned int i = 0; i < choices.size(); i++){
if((pos=choices[i].find(onelabExtension)) != std::string::npos){ if((pos=choices[i].find(onelabExtension)) != std::string::npos){
...@@ -740,7 +742,7 @@ void InterfacedClient::convert() { ...@@ -740,7 +742,7 @@ void InterfacedClient::convert() {
if (outfile.is_open()) if (outfile.is_open())
convert_onefile(choices[i],outfile); convert_onefile(choices[i],outfile);
else else
OLMsg::Fatal("The file <%s> cannot be opened",ofileName.c_str()); OLMsg::Error("The file <%s> cannot be opened",ofileName.c_str());
outfile.close(); outfile.close();
} }
} }
...@@ -750,9 +752,9 @@ void InterfacedClient::compute(){ ...@@ -750,9 +752,9 @@ void InterfacedClient::compute(){
std::string cmd; std::string cmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Computes <%s>", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Computes <%s>", getName().c_str());
setAction("compute"); setAction("compute");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
...@@ -784,9 +786,9 @@ void InterfacedClient::compute(){ ...@@ -784,9 +786,9 @@ void InterfacedClient::compute(){
// NATIVE Client // NATIVE Client
void NativeClient::analyze() { void NativeClient::analyze() {
setAction("check");
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(), OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(),
onelab::server::instance()->getChanged(getName())); onelab::server::instance()->getChanged(getName()));
setAction("check");
run(); run();
} }
...@@ -794,8 +796,9 @@ void NativeClient::compute() { ...@@ -794,8 +796,9 @@ void NativeClient::compute() {
std::string cmd; std::string cmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Computes <%s>", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Computes <%s>", getName().c_str());
setAction("compute"); setAction("compute");
if(buildRmCommand(cmd)) mySystem(cmd); if(buildRmCommand(cmd)) mySystem(cmd);
...@@ -823,9 +826,10 @@ void EncapsulatedClient::analyze() { ...@@ -823,9 +826,10 @@ void EncapsulatedClient::analyze() {
size_t pos; size_t pos;
std::vector<std::string> choices; std::vector<std::string> choices;
setAction("check");
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(), OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(),
onelab::server::instance()->getChanged(getName())); onelab::server::instance()->getChanged(getName()));
setAction("check");
getList("InputFiles", choices); getList("InputFiles", choices);
for(unsigned int i = 0; i < choices.size(); i++){ for(unsigned int i = 0; i < choices.size(); i++){
if((pos=choices[i].find(onelabExtension)) != std::string::npos){ if((pos=choices[i].find(onelabExtension)) != std::string::npos){
...@@ -840,6 +844,7 @@ void EncapsulatedClient::analyze() { ...@@ -840,6 +844,7 @@ void EncapsulatedClient::analyze() {
void EncapsulatedClient::convert() { void EncapsulatedClient::convert() {
size_t pos; size_t pos;
std::vector<std::string> choices; std::vector<std::string> choices;
getList("InputFiles", choices); getList("InputFiles", choices);
for(unsigned int i = 0; i < choices.size(); i++){ for(unsigned int i = 0; i < choices.size(); i++){
if((pos=choices[i].find(onelabExtension)) != std::string::npos){ if((pos=choices[i].find(onelabExtension)) != std::string::npos){
...@@ -850,7 +855,7 @@ void EncapsulatedClient::convert() { ...@@ -850,7 +855,7 @@ void EncapsulatedClient::convert() {
if (outfile.is_open()) if (outfile.is_open())
convert_onefile(choices[i],outfile); convert_onefile(choices[i],outfile);
else else
OLMsg::Fatal("The file <%s> cannot be opened",ofileName.c_str()); OLMsg::Error("The file <%s> cannot be opened",ofileName.c_str());
outfile.close(); outfile.close();
} }
} }
...@@ -864,9 +869,9 @@ void EncapsulatedClient::compute(){ ...@@ -864,9 +869,9 @@ void EncapsulatedClient::compute(){
std::string cmd; std::string cmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Computes <%s>", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Computes <%s>", getName().c_str());
setAction("compute"); setAction("compute");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
...@@ -908,9 +913,9 @@ void RemoteInterfacedClient::compute(){ ...@@ -908,9 +913,9 @@ void RemoteInterfacedClient::compute(){
std::string cmd,rmcmd; std::string cmd,rmcmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Computes <%s>", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Computes <%s>", getName().c_str());
setAction("compute"); setAction("compute");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
...@@ -954,9 +959,9 @@ void RemoteNativeClient::analyze(){ ...@@ -954,9 +959,9 @@ void RemoteNativeClient::analyze(){
std::string cmd,rmcmd; std::string cmd,rmcmd;
std::vector<std::string> choices; std::vector<std::string> choices;
setAction("check");
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(), OLMsg::Info("Analyze <%s> changed=%d", getName().c_str(),
onelab::server::instance()->getChanged(getName())); onelab::server::instance()->getChanged(getName()));
setAction("check");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
for(unsigned int i = 0; i < choices.size(); i++) for(unsigned int i = 0; i < choices.size(); i++)
...@@ -970,8 +975,9 @@ void RemoteNativeClient::compute(){ ...@@ -970,8 +975,9 @@ void RemoteNativeClient::compute(){
std::string cmd,rmcmd; std::string cmd,rmcmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Analyze <%s> changed=%d", getName().c_str());
setAction("compute"); setAction("compute");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
...@@ -1005,9 +1011,9 @@ void RemoteEncapsulatedClient::compute(){ ...@@ -1005,9 +1011,9 @@ void RemoteEncapsulatedClient::compute(){
std::string cmd,rmcmd; std::string cmd,rmcmd;
std::vector<std::string> choices; std::vector<std::string> choices;
OLMsg::Info("Computes <%s> changed=%d", getName().c_str());
analyze(); analyze();
if(OLMsg::GetErrorNum()) return;
OLMsg::Info("Computes <%s> changed=%d", getName().c_str());
setAction("compute"); setAction("compute");
if(getList("InputFiles",choices)){ if(getList("InputFiles",choices)){
...@@ -1115,7 +1121,7 @@ bool checkIfPresent(std::string fileName){ ...@@ -1115,7 +1121,7 @@ bool checkIfPresent(std::string fileName){
if (!stat(fileName.c_str(), &buf)) if (!stat(fileName.c_str(), &buf))
return true; return true;
else{ else{
OLMsg::Fatal("The file <%s> is not present.",fileName.c_str()); OLMsg::Error("The file <%s> is not present.",fileName.c_str());
return false; return false;
} }
} }
...@@ -1169,7 +1175,7 @@ bool isPath(const std::string &in) ...@@ -1169,7 +1175,7 @@ bool isPath(const std::string &in)
{ {
size_t pos=in.find_last_not_of(" 0123456789"); size_t pos=in.find_last_not_of(" 0123456789");
if(in.compare(pos,1,"/")) if(in.compare(pos,1,"/"))
OLMsg::Fatal("The argument <%s> is not a valid path (must end with '/')",in.c_str()); OLMsg::Error("The argument <%s> is not a valid path (must end with '/')",in.c_str());
return true; return true;
} }
...@@ -1179,7 +1185,7 @@ bool isPath(const std::string &in) ...@@ -1179,7 +1185,7 @@ bool isPath(const std::string &in)
// if(col<=data[i].size()) // if(col<=data[i].size())
// column.push_back(data[i][col-1]); // column.push_back(data[i][col-1]);
// else // else
// OLMsg::Fatal("Column number (%d) out of range.",col); // OLMsg::Error("Column number (%d) out of range.",col);
// return column; // return column;
// } // }
...@@ -1189,7 +1195,7 @@ double find_in_array(int lin, int col, const std::vector <std::vector <double> > ...@@ -1189,7 +1195,7 @@ double find_in_array(int lin, int col, const std::vector <std::vector <double> >
if ( col>=0 && col<(int)data[lin].size() ) if ( col>=0 && col<(int)data[lin].size() )
return data[lin][col]; return data[lin][col];
} }
OLMsg::Fatal("The value has not been calculated: (%d,%d) out of range",lin,col); OLMsg::Error("The value has not been calculated: (%d,%d) out of range",lin,col);
return(0); return(0);
} }
......
...@@ -51,6 +51,14 @@ static int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) ...@@ -51,6 +51,14 @@ static int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#endif #endif
int OLMsg::GetErrorNum(){
return _errorCount;
}
void OLMsg::ResetErrorNum(){
_errorCount=0;
}
void OLMsg::Init(int argc, char **argv) void OLMsg::Init(int argc, char **argv)
{ {
time_t now; time_t now;
...@@ -92,12 +100,10 @@ void OLMsg::Fatal(const char *fmt, ...) ...@@ -92,12 +100,10 @@ void OLMsg::Fatal(const char *fmt, ...)
fprintf(stderr, "Fatal : %s\n", str); fprintf(stderr, "Fatal : %s\n", str);
fflush(stderr); fflush(stderr);
} }
OLMsg::SetOnelabString("MetaModel/STATUS","STOP");
//FinalizeClient(); //FinalizeClient();
//FinalizeOnelab(); FinalizeOnelab();
//delete loader; //delete loader;
//Exit(1); Exit(1);
} }
void OLMsg::Error(const char *fmt, ...) void OLMsg::Error(const char *fmt, ...)
...@@ -145,8 +151,6 @@ void OLMsg::Warning(const char *fmt, ...) ...@@ -145,8 +151,6 @@ void OLMsg::Warning(const char *fmt, ...)
} }
} }
void OLMsg::Info(const char *fmt, ...) void OLMsg::Info(const char *fmt, ...)
{ {
if(_commRank || _verbosity < 3) return; if(_commRank || _verbosity < 3) return;
......
...@@ -75,6 +75,8 @@ class OLMsg { ...@@ -75,6 +75,8 @@ class OLMsg {
/* static int GetVerbosity(){ return _verbosity; } */ /* static int GetVerbosity(){ return _verbosity; } */
/* static std::string GetLaunchDate(){ return _launchDate; } */ /* static std::string GetLaunchDate(){ return _launchDate; } */
/* static std::string GetCommandLineArgs(){ return _commandLine; } */ /* static std::string GetCommandLineArgs(){ return _commandLine; } */
static int GetErrorNum();
static void ResetErrorNum();
static void Fatal(const char *fmt, ...); static void Fatal(const char *fmt, ...);
static void Error(const char *fmt, ...); static void Error(const char *fmt, ...);
static void Warning(const char *fmt, ...); static void Warning(const char *fmt, ...);
......
...@@ -31,11 +31,11 @@ int enclosed(const std::string &in, std::vector<std::string> &arguments, ...@@ -31,11 +31,11 @@ int enclosed(const std::string &in, std::vector<std::string> &arguments,
arguments.resize(0); arguments.resize(0);
cursor=0; cursor=0;
if ( (pos=in.find("(",cursor)) == std::string::npos ) if ( (pos=in.find("(",cursor)) == std::string::npos )
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
if (pos>0){ if (pos>0){
std::cout << pos << in << std::endl; std::cout << pos << in << std::endl;
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
} }
unsigned int count=1; unsigned int count=1;
pos++; // skips '(' pos++; // skips '('
...@@ -46,18 +46,18 @@ int enclosed(const std::string &in, std::vector<std::string> &arguments, ...@@ -46,18 +46,18 @@ int enclosed(const std::string &in, std::vector<std::string> &arguments,
else if(in[pos]==',' && (count==1)) { else if(in[pos]==',' && (count==1)) {
arguments.push_back(removeBlanks(in.substr(cursor,pos-cursor))); arguments.push_back(removeBlanks(in.substr(cursor,pos-cursor)));
if(count!=1) if(count!=1)
OLMsg::Fatal("Syntax error: mismatched parenthesis <%s>",in.c_str()); OLMsg::Error("Syntax error: mismatched parenthesis <%s>",in.c_str());
cursor=pos+1; // skips ',' cursor=pos+1; // skips ','
} }
else if(in[pos]==';') else if(in[pos]==';')
OLMsg::Fatal("Syntax error: unterminated sentence <%s>",in.c_str()); OLMsg::Error("Syntax error: unterminated sentence <%s>",in.c_str());
pos++; pos++;
} while( count && (pos!=std::string::npos) ); } while( count && (pos!=std::string::npos) );
// count is 0 when the closing brace is found. // count is 0 when the closing brace is found.
if(count) if(count)
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
else else
arguments.push_back(removeBlanks(in.substr(cursor,pos-1-cursor))); arguments.push_back(removeBlanks(in.substr(cursor,pos-1-cursor)));
end=pos; end=pos;
...@@ -70,7 +70,7 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){ ...@@ -70,7 +70,7 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){
arguments.resize(0); arguments.resize(0);
cursor=0; cursor=0;
if ( (pos=in.find("(",cursor)) == std::string::npos ) if ( (pos=in.find("(",cursor)) == std::string::npos )
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
unsigned int count=1; unsigned int count=1;
pos++; // skips '(' pos++; // skips '('
...@@ -81,7 +81,7 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){ ...@@ -81,7 +81,7 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){
if( (in[pos]=='<') || (in[pos]=='=') || (in[pos]=='>') || (in[pos]=='!') ){ if( (in[pos]=='<') || (in[pos]=='=') || (in[pos]=='>') || (in[pos]=='!') ){
arguments.push_back(removeBlanks(in.substr(cursor,pos-cursor))); arguments.push_back(removeBlanks(in.substr(cursor,pos-cursor)));
if(count!=1) if(count!=1)
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
cursor=pos; cursor=pos;
if(in[pos+1]=='='){ if(in[pos+1]=='='){
arguments.push_back(in.substr(cursor,2)); arguments.push_back(in.substr(cursor,2));
...@@ -97,12 +97,12 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){ ...@@ -97,12 +97,12 @@ int extractLogic(const std::string &in, std::vector<std::string> &arguments){
// count is 0 when the closing brace is found. // count is 0 when the closing brace is found.
if(count) if(count)
OLMsg::Fatal("Syntax error: mismatched parenthesis in <%s>",in.c_str()); OLMsg::Error("Syntax error: mismatched parenthesis in <%s>",in.c_str());
else else
arguments.push_back(removeBlanks(in.substr(cursor,pos-1-cursor))); arguments.push_back(removeBlanks(in.substr(cursor,pos-1-cursor)));
if((arguments.size()!=1) && (arguments.size()!=3)) if((arguments.size()!=1) && (arguments.size()!=3))
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
return arguments.size(); return arguments.size();
} }
...@@ -112,43 +112,18 @@ int extract(const std::string &in, std::string &paramName, ...@@ -112,43 +112,18 @@ int extract(const std::string &in, std::string &paramName,
size_t pos, cursor; size_t pos, cursor;
cursor=0; cursor=0;
if ( (pos=in.find(".",cursor)) == std::string::npos ) if ( (pos=in.find(".",cursor)) == std::string::npos )
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
else else
paramName.assign(sanitize(in.substr(cursor,pos-cursor))); paramName.assign(sanitize(in.substr(cursor,pos-cursor)));
cursor = pos+1; // skips '.' cursor = pos+1; // skips '.'
if ( (pos=in.find("(",cursor)) == std::string::npos ) if ( (pos=in.find("(",cursor)) == std::string::npos )
OLMsg::Fatal("Syntax error: <%s>",in.c_str()); OLMsg::Error("Syntax error: <%s>",in.c_str());
else else
action.assign(sanitize(in.substr(cursor,pos-cursor))); action.assign(sanitize(in.substr(cursor,pos-cursor)));
cursor = pos; cursor = pos;
return enclosed(in.substr(cursor),arguments,pos); return enclosed(in.substr(cursor),arguments,pos);
} }
bool extractRange(const std::string &in, std::vector<double> &arguments){
// syntax: a:b:c or a:b#n
size_t pos, cursor;
arguments.resize(0);
cursor=0;
if ( (pos=in.find(":",cursor)) == std::string::npos )
OLMsg::Fatal("Syntax error in range <%s>",in.c_str());
else{
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
}
cursor = pos+1; // skips ':'
if ( (pos=in.find(":",cursor)) != std::string::npos ){
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
arguments.push_back(atof(in.substr(pos+1).c_str()));
}
else if ( (pos=in.find("#",cursor)) != std::string::npos ){
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
double NumStep = atof(in.substr(pos+1).c_str());
arguments.push_back((arguments[1]-arguments[0])/((NumStep==0)?1:NumStep));
}
else
OLMsg::Fatal("Syntax error in range <%s>",in.c_str());
return (arguments.size()==3);
}
std::string extractExpandPattern(const std::string& str){ std::string extractExpandPattern(const std::string& str){
size_t posa, posb; size_t posa, posb;
posa=str.find_first_of("\"\'<"); posa=str.find_first_of("\"\'<");
...@@ -158,7 +133,7 @@ std::string extractExpandPattern(const std::string& str){ ...@@ -158,7 +133,7 @@ std::string extractExpandPattern(const std::string& str){
if(posa!=std::string::npos) if(posa!=std::string::npos)
pattern.replace(posa,5,","); pattern.replace(posa,5,",");
if(pattern.size()!=3) if(pattern.size()!=3)
OLMsg::Fatal("Incorrect expand pattern <%s>", OLMsg::Error("Incorrect expand pattern <%s>",
str.c_str()); str.c_str());
return pattern; return pattern;
} }
...@@ -186,7 +161,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -186,7 +161,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
cursor = pos+olkey::getValue.length(); cursor = pos+olkey::getValue.length();
int NumArg=enclosed(line.substr(cursor),arguments,pos); int NumArg=enclosed(line.substr(cursor),arguments,pos);
if(NumArg<1) if(NumArg<1)
OLMsg::Fatal("Misformed %s statement: <%s>", OLMsg::Error("Misformed %s statement: <%s>",
olkey::getValue.c_str(),line.c_str()); olkey::getValue.c_str(),line.c_str());
std::string paramName=longName(arguments[0]); std::string paramName=longName(arguments[0]);
get(numbers,paramName); get(numbers,paramName);
...@@ -236,7 +211,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -236,7 +211,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
buff.assign(Num.str()); buff.assign(Num.str());
} }
else else
OLMsg::Fatal("Unknown action <%s> in %s statement", OLMsg::Error("Unknown action <%s> in %s statement",
action.c_str(),olkey::getValue.c_str()); action.c_str(),olkey::getValue.c_str());
} }
else if(!name.compare("range")) { else if(!name.compare("range")) {
...@@ -247,7 +222,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -247,7 +222,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
if( (stp == 0) || if( (stp == 0) ||
(min == -onelab::parameter::maxNumber()) || (min == -onelab::parameter::maxNumber()) ||
(max == onelab::parameter::maxNumber()) ) (max == onelab::parameter::maxNumber()) )
OLMsg::Fatal("Invalid range description for parameter <%s>", OLMsg::Error("Invalid range description for parameter <%s>",
paramName.c_str()); paramName.c_str());
if(!action.compare("size")) { if(!action.compare("size")) {
buff.assign(ftoa(fabs((max-min)/stp))); buff.assign(ftoa(fabs((max-min)/stp)));
...@@ -262,7 +237,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -262,7 +237,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
else if(!action.compare("expand")) { else if(!action.compare("expand")) {
} }
else else
OLMsg::Fatal("Unknown action <%s> in %s statement", OLMsg::Error("Unknown action <%s> in %s statement",
action.c_str(),olkey::getValue.c_str()); action.c_str(),olkey::getValue.c_str());
} }
} }
...@@ -272,7 +247,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -272,7 +247,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
if (strings.size()) if (strings.size())
buff.assign(strings[0].getValue()); buff.assign(strings[0].getValue());
else else
OLMsg::Fatal("resolveGetVal: unknown variable: <%s>",paramName.c_str()); OLMsg::Error("resolveGetVal: unknown variable: <%s>",paramName.c_str());
} }
line.replace(pos0,cursor+pos-pos0,buff); line.replace(pos0,cursor+pos-pos0,buff);
cursor=pos0+buff.length(); cursor=pos0+buff.length();
...@@ -284,7 +259,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -284,7 +259,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
size_t pos0=pos; size_t pos0=pos;
cursor=pos+olkey::mathex.length(); cursor=pos+olkey::mathex.length();
if(enclosed(line.substr(cursor),arguments,pos) != 1) if(enclosed(line.substr(cursor),arguments,pos) != 1)
OLMsg::Fatal("Misformed %s statement: <%s>", OLMsg::Error("Misformed %s statement: <%s>",
olkey::mathex.c_str(),line.c_str()); olkey::mathex.c_str(),line.c_str());
//std::cout << "MathEx evaluates now <"<< arguments[0]<< "> " << std::endl; //std::cout << "MathEx evaluates now <"<< arguments[0]<< "> " << std::endl;
smlib::mathex* mathExp = new smlib::mathex(); smlib::mathex* mathExp = new smlib::mathex();
...@@ -296,7 +271,7 @@ std::string localSolverClient::resolveGetVal(std::string line) { ...@@ -296,7 +271,7 @@ std::string localSolverClient::resolveGetVal(std::string line) {
// Check now wheter the line still contains OL. // Check now wheter the line still contains OL.
if ( (pos=line.find(olkey::label)) != std::string::npos) if ( (pos=line.find(olkey::label)) != std::string::npos)
OLMsg::Fatal("Unidentified onelab command in <%s>",line.c_str()); OLMsg::Error("Unidentified onelab command in <%s>",line.c_str());
return line; return line;
} }
...@@ -324,13 +299,38 @@ bool localSolverClient::resolveLogicExpr(std::vector<std::string> arguments) { ...@@ -324,13 +299,38 @@ bool localSolverClient::resolveLogicExpr(std::vector<std::string> arguments) {
else if (!arguments[1].compare("!=")) else if (!arguments[1].compare("!="))
condition = (val1!=val2); condition = (val1!=val2);
else else
OLMsg::Fatal("Unknown logical operator <%s>", arguments[1].c_str()); OLMsg::Error("Unknown logical operator <%s>", arguments[1].c_str());
} }
else else
OLMsg::Fatal("Invalid logical expression"); OLMsg::Error("Invalid logical expression");
return condition; return condition;
} }
bool extractRange(const std::string &in, std::vector<double> &arguments){
// syntax: a:b:c or a:b#n
size_t pos, cursor;
arguments.resize(0);
cursor=0;
if ( (pos=in.find(":",cursor)) == std::string::npos )
OLMsg::Error("Syntax error in range <%s>",in.c_str());
else{
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
}
cursor = pos+1; // skips ':'
if ( (pos=in.find(":",cursor)) != std::string::npos ){
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
arguments.push_back(atof(in.substr(pos+1).c_str()));
}
else if ( (pos=in.find("X",cursor)) != std::string::npos ){
arguments.push_back(atof(in.substr(cursor,pos-cursor).c_str()));
double NumStep = atof(in.substr(pos+1).c_str());
arguments.push_back((arguments[1]-arguments[0])/((NumStep==0)?1:NumStep));
}
else
OLMsg::Error("Syntax error in range <%s>",in.c_str());
return (arguments.size()==3);
}
void localSolverClient::parse_sentence(std::string line) { void localSolverClient::parse_sentence(std::string line) {
size_t pos,cursor; size_t pos,cursor;
std::string name,action,path; std::string name,action,path;
...@@ -402,7 +402,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -402,7 +402,7 @@ void localSolverClient::parse_sentence(std::string line) {
else if(!action.compare("radioButton")) { else if(!action.compare("radioButton")) {
// syntax: paramName.radioButton(val,path,label) // syntax: paramName.radioButton(val,path,label)
if(arguments[0].empty()) if(arguments[0].empty())
OLMsg::Fatal("No value given for param <%s>",name.c_str()); OLMsg::Error("No value given for param <%s>",name.c_str());
double val=atof(arguments[0].c_str()); double val=atof(arguments[0].c_str());
if((arguments.size()>1) && isPath(arguments[1])) if((arguments.size()>1) && isPath(arguments[1]))
name.assign(arguments[1] + name); name.assign(arguments[1] + name);
...@@ -429,7 +429,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -429,7 +429,7 @@ void localSolverClient::parse_sentence(std::string line) {
// set the range of an existing number // set the range of an existing number
// syntax: paramName.range({a:b:c|a:b#n|min,max,step}) // syntax: paramName.range({a:b:c|a:b#n|min,max,step})
if(arguments[0].empty()) if(arguments[0].empty())
OLMsg::Fatal("No argument given for MinMax <%s>",name.c_str()); OLMsg::Error("No argument given for MinMax <%s>",name.c_str());
name.assign(longName(name)); name.assign(longName(name));
get(numbers,name); get(numbers,name);
if(numbers.size()){ // parameter must exist if(numbers.size()){ // parameter must exist
...@@ -447,7 +447,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -447,7 +447,7 @@ void localSolverClient::parse_sentence(std::string line) {
numbers[0].setStep(atof(arguments[2].c_str())); numbers[0].setStep(atof(arguments[2].c_str()));
} }
else else
OLMsg::Fatal("Wrong number of arguments for MinMax <%s>",name.c_str()); OLMsg::Error("Wrong number of arguments for MinMax <%s>",name.c_str());
} }
set(numbers[0]); set(numbers[0]);
} }
...@@ -470,7 +470,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -470,7 +470,7 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
...@@ -499,7 +499,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -499,7 +499,7 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
...@@ -508,7 +508,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -508,7 +508,7 @@ void localSolverClient::parse_sentence(std::string line) {
get(numbers,name); get(numbers,name);
if(numbers.size()){ // parameter must exist if(numbers.size()){ // parameter must exist
if(arguments.size() % 2) if(arguments.size() % 2)
OLMsg::Fatal("Nb of labels does not match nb of choices for <%s>", OLMsg::Error("Nb of labels does not match nb of choices for <%s>",
name.c_str()); name.c_str());
std::vector<double> choices=numbers[0].getChoices(); std::vector<double> choices=numbers[0].getChoices();
for(unsigned int i = 0; i < arguments.size(); i=i+2){ for(unsigned int i = 0; i < arguments.size(); i=i+2){
...@@ -521,7 +521,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -521,7 +521,7 @@ void localSolverClient::parse_sentence(std::string line) {
set(numbers[0]); set(numbers[0]);
} }
else else
OLMsg::Fatal("The number <%s> does not exist",name.c_str()); OLMsg::Error("The number <%s> does not exist",name.c_str());
} }
else if(!action.compare("setValue")){ // force change on server else if(!action.compare("setValue")){ // force change on server
name.assign(longName(name)); name.assign(longName(name));
...@@ -543,13 +543,13 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -543,13 +543,13 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
else if(!action.compare("setVisible")){ else if(!action.compare("setVisible")){
if(arguments[0].empty()) if(arguments[0].empty())
OLMsg::Fatal("Missing argument SetVisible <%s>",name.c_str()); OLMsg::Error("Missing argument SetVisible <%s>",name.c_str());
name.assign(longName(name)); name.assign(longName(name));
get(numbers,name); get(numbers,name);
if(numbers.size()){ if(numbers.size()){
...@@ -563,13 +563,13 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -563,13 +563,13 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
else if(!action.compare("setReadOnly")){ else if(!action.compare("setReadOnly")){
if(arguments[0].empty()) if(arguments[0].empty())
OLMsg::Fatal("Missing argument SetReadOnly <%s>",name.c_str()); OLMsg::Error("Missing argument SetReadOnly <%s>",name.c_str());
name.assign(longName(name)); name.assign(longName(name));
get(numbers,name); get(numbers,name);
if(numbers.size()){ if(numbers.size()){
...@@ -583,7 +583,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -583,7 +583,7 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
...@@ -603,13 +603,13 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -603,13 +603,13 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
else if(!action.compare("setAttribute")){ else if(!action.compare("setAttribute")){
if(arguments.size() !=2 ) if(arguments.size() !=2 )
OLMsg::Fatal("SetAttribute <%s> needs two arguments %d", OLMsg::Error("SetAttribute <%s> needs two arguments %d",
name.c_str(), arguments.size()); name.c_str(), arguments.size());
name.assign(longName(name)); name.assign(longName(name));
get(numbers,name); get(numbers,name);
...@@ -625,7 +625,7 @@ void localSolverClient::parse_sentence(std::string line) { ...@@ -625,7 +625,7 @@ void localSolverClient::parse_sentence(std::string line) {
set(strings[0]); set(strings[0]);
} }
else{ else{
OLMsg::Fatal("The parameter <%s> does not exist",name.c_str()); OLMsg::Error("The parameter <%s> does not exist",name.c_str());
} }
} }
} }
...@@ -690,19 +690,19 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -690,19 +690,19 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
else if(NumArg==2) else if(NumArg==2)
modify_tags(arguments[0],arguments[1]); modify_tags(arguments[0],arguments[1]);
else else
OLMsg::Fatal("Misformed <%s> statement", olkey::deflabel.c_str()); OLMsg::Error("Misformed <%s> statement", olkey::deflabel.c_str());
} }
else if( (pos=line.find(olkey::begin)) != std::string::npos) { else if( (pos=line.find(olkey::begin)) != std::string::npos) {
// onelab.begin // onelab.begin
if (!parse_block(infile)) if (!parse_block(infile))
OLMsg::Fatal("Misformed <%s> block <%s>", OLMsg::Error("Misformed <%s> block <%s>",
olkey::begin.c_str(),olkey::end.c_str()); olkey::begin.c_str(),olkey::end.c_str());
} }
else if ( (pos=line.find(olkey::iftrue)) != std::string::npos) { else if ( (pos=line.find(olkey::iftrue)) != std::string::npos) {
// onelab.iftrue // onelab.iftrue
cursor = pos+olkey::iftrue.length(); cursor = pos+olkey::iftrue.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::iftrue.c_str(),line.c_str()); olkey::iftrue.c_str(),line.c_str());
bool condition = false; bool condition = false;
get(strings,longName(arguments[0])); get(strings,longName(arguments[0]));
...@@ -713,18 +713,18 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -713,18 +713,18 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
if (numbers.size()) if (numbers.size())
condition = (bool) numbers[0].getValue(); condition = (bool) numbers[0].getValue();
else else
OLMsg::Fatal("Unknown parameter <%s> in <%s> statement", OLMsg::Error("Unknown parameter <%s> in <%s> statement",
arguments[0].c_str(),olkey::iftrue.c_str()); arguments[0].c_str(),olkey::iftrue.c_str());
} }
if (!parse_ifstatement(infile,condition)) if (!parse_ifstatement(infile,condition))
OLMsg::Fatal("Misformed <%s> statement: <%s>", OLMsg::Error("Misformed <%s> statement: <%s>",
olkey::iftrue.c_str(),arguments[0].c_str()); olkey::iftrue.c_str(),arguments[0].c_str());
} }
else if ( (pos=line.find(olkey::ifntrue)) != std::string::npos) { else if ( (pos=line.find(olkey::ifntrue)) != std::string::npos) {
// onelab.ifntrue // onelab.ifntrue
cursor = pos+olkey::ifntrue.length(); cursor = pos+olkey::ifntrue.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::ifntrue.c_str(),line.c_str()); olkey::ifntrue.c_str(),line.c_str());
bool condition = false; bool condition = false;
get(strings,longName(arguments[0])); get(strings,longName(arguments[0]));
...@@ -735,12 +735,12 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -735,12 +735,12 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
if (numbers.size()) if (numbers.size())
condition = (bool) numbers[0].getValue(); condition = (bool) numbers[0].getValue();
else else
OLMsg::Fatal("Unknown parameter <%s> in <%s> statement", OLMsg::Error("Unknown parameter <%s> in <%s> statement",
arguments[0].c_str(),olkey::ifntrue.c_str()); arguments[0].c_str(),olkey::ifntrue.c_str());
} }
std::cout << "cond=" << condition << std::endl; std::cout << "cond=" << condition << std::endl;
if (!parse_ifstatement(infile,!condition)) if (!parse_ifstatement(infile,!condition))
OLMsg::Fatal("Misformed <%s> statement: <%s>", OLMsg::Error("Misformed <%s> statement: <%s>",
olkey::ifntrue.c_str(),arguments[0].c_str()); olkey::ifntrue.c_str(),arguments[0].c_str());
} }
else if ( (pos=line.find(olkey::ifcond)) != std::string::npos) { else if ( (pos=line.find(olkey::ifcond)) != std::string::npos) {
...@@ -749,7 +749,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -749,7 +749,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
extractLogic(line.substr(cursor),arguments); extractLogic(line.substr(cursor),arguments);
bool condition= resolveLogicExpr(arguments); bool condition= resolveLogicExpr(arguments);
if (!parse_ifstatement(infile,condition)){ if (!parse_ifstatement(infile,condition)){
OLMsg::Fatal("Misformed %s statement: <%s>", OLMsg::Error("Misformed %s statement: <%s>",
olkey::ifcond.c_str(), line.c_str()); olkey::ifcond.c_str(), line.c_str());
} }
} }
...@@ -757,7 +757,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -757,7 +757,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.include // onelab.include
cursor = pos+olkey::include.length(); cursor = pos+olkey::include.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::include.c_str(),line.c_str()); olkey::include.c_str(),line.c_str());
parse_onefile(arguments[0]); parse_onefile(arguments[0]);
} }
...@@ -765,7 +765,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -765,7 +765,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.message // onelab.message
cursor = pos+olkey::message.length(); cursor = pos+olkey::message.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::message.c_str(),line.c_str()); olkey::message.c_str(),line.c_str());
std::string msg = resolveGetVal(arguments[0]); std::string msg = resolveGetVal(arguments[0]);
OLMsg::Info("%s",msg.c_str()); OLMsg::Info("%s",msg.c_str());
...@@ -774,7 +774,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -774,7 +774,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.showParam // onelab.showParam
cursor = pos+olkey::showParam.length(); cursor = pos+olkey::showParam.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::showParam.c_str(),line.c_str()); olkey::showParam.c_str(),line.c_str());
for(unsigned int i = 0; i < arguments.size(); i++){ for(unsigned int i = 0; i < arguments.size(); i++){
std::string lname=longName(arguments[i]); std::string lname=longName(arguments[i]);
...@@ -787,7 +787,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -787,7 +787,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
if (strings.size()) if (strings.size())
msg.assign(strings[0].toChar()); msg.assign(strings[0].toChar());
else else
OLMsg::Fatal("Unknown parameter <%s> in <%s> statement", OLMsg::Error("Unknown parameter <%s> in <%s> statement",
arguments[i].c_str(),olkey::showParam.c_str()); arguments[i].c_str(),olkey::showParam.c_str());
} }
for(unsigned int j = 0; j < msg.size(); j++) for(unsigned int j = 0; j < msg.size(); j++)
...@@ -799,7 +799,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -799,7 +799,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.showGmsh // onelab.showGmsh
cursor = pos+olkey::showGmsh.length(); cursor = pos+olkey::showGmsh.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::showGmsh.c_str(),line.c_str()); olkey::showGmsh.c_str(),line.c_str());
std::string fileName=resolveGetVal(arguments[0]); std::string fileName=resolveGetVal(arguments[0]);
OLMsg::MergeFile(fileName); OLMsg::MergeFile(fileName);
...@@ -808,7 +808,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -808,7 +808,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.dump // onelab.dump
cursor = pos+olkey::dump.length(); cursor = pos+olkey::dump.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::dump.c_str(),line.c_str()); olkey::dump.c_str(),line.c_str());
onelab::server::instance()->toFile(resolveGetVal(arguments[0])); onelab::server::instance()->toFile(resolveGetVal(arguments[0]));
} }
...@@ -842,11 +842,11 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -842,11 +842,11 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// append the next line // append the next line
getline (infile,line); getline (infile,line);
if((pos=line.find_first_not_of(" \t"))==std::string::npos){ if((pos=line.find_first_not_of(" \t"))==std::string::npos){
OLMsg::Fatal("Empty line not allowed within a command <%s>", OLMsg::Error("Empty line not allowed within a command <%s>",
cmds.c_str()); cmds.c_str());
} }
else if(!line.compare(pos,olkey::comment.size(),olkey::comment)){ else if(!line.compare(pos,olkey::comment.size(),olkey::comment)){
OLMsg::Fatal("Comment lines not allowed within a command <%s>", OLMsg::Error("Comment lines not allowed within a command <%s>",
cmds.c_str()); cmds.c_str());
} }
NbLines++; // command should not span over more than 10 lines NbLines++; // command should not span over more than 10 lines
...@@ -855,7 +855,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -855,7 +855,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
break; break;
} while (infile.good() && NbLines<=10); } while (infile.good() && NbLines<=10);
if(NbLines>=10) if(NbLines>=10)
OLMsg::Fatal("Command <%s> should not span over more than 10 lines", OLMsg::Error("Command <%s> should not span over more than 10 lines",
cmds.c_str()); cmds.c_str());
parse_sentence(cmds); parse_sentence(cmds);
} }
...@@ -869,7 +869,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) { ...@@ -869,7 +869,7 @@ void localSolverClient::parse_oneline(std::string line, std::ifstream &infile) {
// onelab.getRegion: nothing to do // onelab.getRegion: nothing to do
} }
else if( (pos=line.find(olkey::label)) != std::string::npos) { else if( (pos=line.find(olkey::label)) != std::string::npos) {
OLMsg::Fatal("Unknown ONELAB keyword in <%s>",line.c_str()); OLMsg::Error("Unknown ONELAB keyword in <%s>",line.c_str());
} }
else{ else{
// not a onelab line, skip // not a onelab line, skip
...@@ -933,7 +933,7 @@ void localSolverClient::parse_onefile(std::string fileName, bool mandatory) { ...@@ -933,7 +933,7 @@ void localSolverClient::parse_onefile(std::string fileName, bool mandatory) {
} }
else else
if(mandatory) if(mandatory)
OLMsg::Fatal("The file <%s> does not exist",fullName.c_str()); OLMsg::Error("The file <%s> does not exist",fullName.c_str());
else else
OLMsg::Info("The file <%s> does not exist",fullName.c_str()); OLMsg::Info("The file <%s> does not exist",fullName.c_str());
} }
...@@ -988,7 +988,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -988,7 +988,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
else if(NumArg==2) else if(NumArg==2)
modify_tags(arguments[0],arguments[1]); modify_tags(arguments[0],arguments[1]);
else else
OLMsg::Fatal("Misformed <%s> statement", olkey::deflabel.c_str()); OLMsg::Error("Misformed <%s> statement", olkey::deflabel.c_str());
} }
else if( (pos=line.find(olkey::begin)) != std::string::npos) { else if( (pos=line.find(olkey::begin)) != std::string::npos) {
// onelab.begin // onelab.begin
...@@ -996,7 +996,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -996,7 +996,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
getline (infile,line); getline (infile,line);
if( (pos=line.find(olkey::end)) != std::string::npos) return; if( (pos=line.find(olkey::end)) != std::string::npos) return;
} }
OLMsg::Fatal("Misformed <%s> block <%s>", OLMsg::Error("Misformed <%s> block <%s>",
olkey::begin.c_str(),olkey::end.c_str()); olkey::begin.c_str(),olkey::end.c_str());
} }
else if ( (pos=line.find(olkey::iftrue)) != std::string::npos) { else if ( (pos=line.find(olkey::iftrue)) != std::string::npos) {
...@@ -1005,7 +1005,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1005,7 +1005,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
// pos=line.find_first_of(')',cursor)+1; // pos=line.find_first_of(')',cursor)+1;
// if(enclosed(line.substr(cursor,pos-cursor),arguments)<1) // if(enclosed(line.substr(cursor,pos-cursor),arguments)<1)
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::iftrue.c_str(),line.c_str()); olkey::iftrue.c_str(),line.c_str());
bool condition = false; bool condition = false;
get(strings,longName(arguments[0])); get(strings,longName(arguments[0]));
...@@ -1016,11 +1016,11 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1016,11 +1016,11 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
if (numbers.size()) if (numbers.size())
condition = (bool) numbers[0].getValue(); condition = (bool) numbers[0].getValue();
else else
OLMsg::Fatal("Unknown parameter <%s> in <%s> statement", OLMsg::Error("Unknown parameter <%s> in <%s> statement",
arguments[0].c_str(),olkey::iftrue.c_str()); arguments[0].c_str(),olkey::iftrue.c_str());
} }
if (!convert_ifstatement(infile,outfile,condition)) if (!convert_ifstatement(infile,outfile,condition))
OLMsg::Fatal("Misformed <%s> statement: %s", OLMsg::Error("Misformed <%s> statement: %s",
olkey::iftrue.c_str(),arguments[0].c_str()); olkey::iftrue.c_str(),arguments[0].c_str());
} }
else if ( (pos=line.find(olkey::ifntrue)) != std::string::npos) { else if ( (pos=line.find(olkey::ifntrue)) != std::string::npos) {
...@@ -1029,7 +1029,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1029,7 +1029,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
// pos=line.find_first_of(')',cursor)+1; // pos=line.find_first_of(')',cursor)+1;
// if(enclosed(line.substr(cursor,pos-cursor),arguments)<1) // if(enclosed(line.substr(cursor,pos-cursor),arguments)<1)
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::ifntrue.c_str(),line.c_str()); olkey::ifntrue.c_str(),line.c_str());
bool condition = false; bool condition = false;
get(strings,longName(arguments[0])); get(strings,longName(arguments[0]));
...@@ -1040,11 +1040,11 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1040,11 +1040,11 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
if (numbers.size()) if (numbers.size())
condition = (bool) numbers[0].getValue(); condition = (bool) numbers[0].getValue();
else else
OLMsg::Fatal("Unknown parameter <%s> in <%s> statement", OLMsg::Error("Unknown parameter <%s> in <%s> statement",
arguments[0].c_str(),olkey::ifntrue.c_str()); arguments[0].c_str(),olkey::ifntrue.c_str());
} }
if (!convert_ifstatement(infile,outfile,!condition)) if (!convert_ifstatement(infile,outfile,!condition))
OLMsg::Fatal("Misformed <%s> statement: %s", OLMsg::Error("Misformed <%s> statement: %s",
olkey::ifntrue.c_str(),arguments[0].c_str()); olkey::ifntrue.c_str(),arguments[0].c_str());
} }
else if ( (pos=line.find(olkey::ifcond)) != std::string::npos) { else if ( (pos=line.find(olkey::ifcond)) != std::string::npos) {
...@@ -1053,13 +1053,13 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1053,13 +1053,13 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
extractLogic(line.substr(cursor),arguments); extractLogic(line.substr(cursor),arguments);
bool condition= resolveLogicExpr(arguments); bool condition= resolveLogicExpr(arguments);
if (!convert_ifstatement(infile,outfile,condition)) if (!convert_ifstatement(infile,outfile,condition))
OLMsg::Fatal("Misformed %s statement: <%s>", line.c_str()); OLMsg::Error("Misformed %s statement: <%s>", line.c_str());
} }
else if ( (pos=line.find(olkey::include)) != std::string::npos) { else if ( (pos=line.find(olkey::include)) != std::string::npos) {
// onelab.include // onelab.include
cursor = pos+olkey::include.length(); cursor = pos+olkey::include.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::include.c_str(),line.c_str()); olkey::include.c_str(),line.c_str());
convert_onefile(arguments[0],outfile); convert_onefile(arguments[0],outfile);
} }
...@@ -1067,7 +1067,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1067,7 +1067,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
// onelab.message // onelab.message
cursor = pos+olkey::message.length(); cursor = pos+olkey::message.length();
if(enclosed(line.substr(cursor),arguments,pos)<1) if(enclosed(line.substr(cursor),arguments,pos)<1)
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::message.c_str(),line.c_str()); olkey::message.c_str(),line.c_str());
std::string msg = resolveGetVal(arguments[0]); std::string msg = resolveGetVal(arguments[0]);
OLMsg::Info("%s",msg.c_str()); OLMsg::Info("%s",msg.c_str());
...@@ -1116,14 +1116,14 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1116,14 +1116,14 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
buff.append(1,pattern[2]); buff.append(1,pattern[2]);
} }
else else
OLMsg::Fatal("Unknown %s action: <%s>", OLMsg::Error("Unknown %s action: <%s>",
olkey::getRegion.c_str(), arguments[1].c_str()); olkey::getRegion.c_str(), arguments[1].c_str());
} }
else else
OLMsg::Fatal("Unknown region: <%s>",paramName.c_str()); OLMsg::Error("Unknown region: <%s>",paramName.c_str());
} }
else else
OLMsg::Fatal("Misformed <%s> statement: (%s)", OLMsg::Error("Misformed <%s> statement: (%s)",
olkey::getRegion.c_str(),line.c_str()); olkey::getRegion.c_str(),line.c_str());
line.replace(pos0,cursor+pos-pos0,buff); line.replace(pos0,cursor+pos-pos0,buff);
cursor=pos0+buff.length(); cursor=pos0+buff.length();
...@@ -1131,7 +1131,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile, ...@@ -1131,7 +1131,7 @@ void localSolverClient::convert_oneline(std::string line, std::ifstream &infile,
outfile << line << std::endl; outfile << line << std::endl;
} }
else if ( (pos=line.find(olkey::label)) != std::string::npos){ else if ( (pos=line.find(olkey::label)) != std::string::npos){
OLMsg::Fatal("Unidentified onelab command in <%s>",line.c_str()); OLMsg::Error("Unidentified onelab command in <%s>",line.c_str());
} }
else{ else{
outfile << line << std::endl; outfile << line << std::endl;
...@@ -1151,13 +1151,13 @@ void localSolverClient::convert_onefile(std::string fileName, std::ofstream &out ...@@ -1151,13 +1151,13 @@ void localSolverClient::convert_onefile(std::string fileName, std::ofstream &out
infile.close(); infile.close();
} }
else else
OLMsg::Fatal("The file %s cannot be opened",fullName.c_str()); OLMsg::Error("The file %s cannot be opened",fullName.c_str());
} }
void localSolverClient::client_sentence(const std::string &name, void localSolverClient::client_sentence(const std::string &name,
const std::string &action, const std::string &action,
const std::vector<std::string> &arguments) { const std::vector<std::string> &arguments) {
OLMsg::Fatal("The action <%s> is unknown in this context",action.c_str()); OLMsg::Error("The action <%s> is unknown in this context",action.c_str());
} }
void MetaModel::client_sentence(const std::string &name, void MetaModel::client_sentence(const std::string &name,
...@@ -1212,7 +1212,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1212,7 +1212,7 @@ void MetaModel::client_sentence(const std::string &name,
if((c=findClientByName(name))) if((c=findClientByName(name)))
c->setWorkingDir(c->getWorkingDir()+arguments[0]); c->setWorkingDir(c->getWorkingDir()+arguments[0]);
else else
OLMsg::Fatal("Unknown client <%s>", name.c_str()); OLMsg::Error("Unknown client <%s>", name.c_str());
} }
else if(!action.compare("active")){ else if(!action.compare("active")){
localSolverClient *c; localSolverClient *c;
...@@ -1220,7 +1220,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1220,7 +1220,7 @@ void MetaModel::client_sentence(const std::string &name,
if((c=findClientByName(name))) if((c=findClientByName(name)))
c->setActive(atof( resolveGetVal(arguments[0]).c_str() )); c->setActive(atof( resolveGetVal(arguments[0]).c_str() ));
else else
OLMsg::Fatal("Unknown client <%s>", name.c_str()); OLMsg::Error("Unknown client <%s>", name.c_str());
} }
else else
OLMsg::Error("No argument for <%s.Active> statement", name.c_str()); OLMsg::Error("No argument for <%s.Active> statement", name.c_str());
...@@ -1299,7 +1299,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1299,7 +1299,7 @@ void MetaModel::client_sentence(const std::string &name,
bool changed = onelab::server::instance()->getChanged(c->getName()); bool changed = onelab::server::instance()->getChanged(c->getName());
bool started = isStarted(changed); bool started = isStarted(changed);
std::cout << c->getName() << " active=" << c->getActive() << " changed=" << changed << " started=" << started << std::endl; std::cout << c->getName() << " active=" << c->getActive() << " changed=" << changed << " started=" << started << " errors=" << OLMsg::GetErrorNum() << std::endl;
if(started) c->compute(); if(started) c->compute();
} }
} }
...@@ -1336,7 +1336,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1336,7 +1336,7 @@ void MetaModel::client_sentence(const std::string &name,
} }
} }
else else
OLMsg::Fatal("Wrong number of arguments <%d> for <%s>", OLMsg::Error("Wrong number of arguments <%d> for <%s>",
arguments.size(), action.c_str()); arguments.size(), action.c_str());
} }
// else if(!action.compare("check")){ // else if(!action.compare("check")){
...@@ -1346,7 +1346,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1346,7 +1346,7 @@ void MetaModel::client_sentence(const std::string &name,
// c->analyze(); // c->analyze();
// } // }
// else // else
// OLMsg::Fatal("Unknown client <%s>", name.c_str()); // OLMsg::Error("Unknown client <%s>", name.c_str());
// } // }
else if(!action.compare("alwaysCompute")){ else if(!action.compare("alwaysCompute")){
if(isTodo(ANALYZE)){ if(isTodo(ANALYZE)){
...@@ -1358,7 +1358,7 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1358,7 +1358,7 @@ void MetaModel::client_sentence(const std::string &name,
} }
} }
else else
OLMsg::Fatal("Unknown client <%s>", name.c_str()); OLMsg::Error("Unknown client <%s>", name.c_str());
} }
else if(!action.compare("merge")){ else if(!action.compare("merge")){
if(isTodo(COMPUTE)){ if(isTodo(COMPUTE)){
...@@ -1391,5 +1391,5 @@ void MetaModel::client_sentence(const std::string &name, ...@@ -1391,5 +1391,5 @@ void MetaModel::client_sentence(const std::string &name,
} }
} }
else else
OLMsg::Fatal("Unknown action <%s>",action.c_str()); OLMsg::Error("Unknown action <%s>",action.c_str());
} }
...@@ -13,12 +13,12 @@ void initializeMetamodel(const std::string &loaderName, onelab::client *client, ...@@ -13,12 +13,12 @@ void initializeMetamodel(const std::string &loaderName, onelab::client *client,
OLMsg::SetLoaderName(loaderName); OLMsg::SetLoaderName(loaderName);
OLMsg::SetOnelabClient(client); OLMsg::SetOnelabClient(client);
OLMsg::SetGuiWaitFunction(gui_wait_fct); OLMsg::SetGuiWaitFunction(gui_wait_fct);
} }
int metamodel(const std::string &action){ int metamodel(const std::string &action){
OLMsg::Info("Start metamodel"); OLMsg::Info("Start metamodel");
OLMsg::hasGmsh = OLMsg::GetOnelabNumber("IsMetamodel"); OLMsg::hasGmsh = OLMsg::GetOnelabNumber("IsMetamodel");
OLMsg::ResetErrorNum();
parseMode todo; parseMode todo;
if(action == "initialize") if(action == "initialize")
...@@ -30,7 +30,7 @@ int metamodel(const std::string &action){ ...@@ -30,7 +30,7 @@ int metamodel(const std::string &action){
} }
else{ else{
todo = EXIT; todo = EXIT;
OLMsg::Fatal("Unknown action <%s>", action.c_str()); OLMsg::Error("Unknown action <%s>", action.c_str());
} }
std::string modelName = OLMsg::GetOnelabString("Arguments/FileName"); std::string modelName = OLMsg::GetOnelabString("Arguments/FileName");
...@@ -60,13 +60,17 @@ int metamodel(const std::string &action){ ...@@ -60,13 +60,17 @@ int metamodel(const std::string &action){
myModel->compute(); myModel->compute();
} }
else else
OLMsg::Fatal("Main: Unknown Action <%d>", todo); OLMsg::Error("Main: Unknown Action <%d>", todo);
delete myModel; delete myModel;
int reload=OLMsg::GetOnelabNumber("Gmsh/NeedReloadGeom"); int reload=OLMsg::GetOnelabNumber("Gmsh/NeedReloadGeom");
int errors=OLMsg::GetErrorNum();
OLMsg::SetOnelabNumber("Gmsh/NeedReloadGeom",0,false); OLMsg::SetOnelabNumber("Gmsh/NeedReloadGeom",0,false);
OLMsg::Info("Leave metamodel - need reload=%d",reload); if(errors)
OLMsg::Error("Leave metamodel - %d errors",errors);
else
OLMsg::Info("Leave metamodel - need reload=%d",reload);
OLMsg::Info("=============================================="); OLMsg::Info("==============================================");
return reload; return reload;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment