don't spew out param list if there's a genuine error

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3250 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2010-05-11 21:44:35 +00:00
parent ecee5c5089
commit f36759478b
3 changed files with 16 additions and 12 deletions

View File

@ -101,7 +101,6 @@ int main(int argc, char* argv[])
Parameter parameter;
if (!parameter.LoadParam(argc, argv))
{
parameter.Explain();
return EXIT_FAILURE;
}

View File

@ -89,7 +89,6 @@ int main(int argc, char* argv[])
Parameter parameter;
if (!parameter.LoadParam(argc, argv))
{
parameter.Explain();
return EXIT_FAILURE;
}

View File

@ -195,7 +195,8 @@ bool Parameter::LoadParam(int argc, char* argv[])
&& (configPath = FindParam("-config", argc, argv)) == "")
{
PrintCredit();
Explain();
UserMessage::Add("No configuration file was specified. Use -config or -f");
return false;
}
@ -361,7 +362,7 @@ bool Parameter::FilesExist(const string &paramName, size_t tokenizeIndex,std::ve
if (tokenizeIndex >= vec.size())
{
stringstream errorMsg("");
errorMsg << "Expected at least " << (tokenizeIndex+1) << " tokens per emtry in '"
errorMsg << "Expected at least " << (tokenizeIndex+1) << " tokens per entries in '"
<< paramName << "', but only found "
<< vec.size();
UserMessage::Add(errorMsg.str());
@ -477,6 +478,7 @@ bool Parameter::ReadConfigFile(const string &filePath )
struct Credit
{
string name, contact, currentPursuits, areaResponsibility;
int sortId;
Credit(string name, string contact, string currentPursuits, string areaResponsibility)
{
@ -484,16 +486,20 @@ struct Credit
this->contact = contact ;
this->currentPursuits = currentPursuits ;
this->areaResponsibility = areaResponsibility;
this->sortId = rand() % 1000;
}
bool operator<(const Credit &other) const
{
/*
if (areaResponsibility.size() != 0 && other.areaResponsibility.size() ==0)
return true;
if (areaResponsibility.size() == 0 && other.areaResponsibility.size() !=0)
return false;
return name < other.name;
*/
return sortId < other.sortId;
}
};
@ -502,19 +508,19 @@ std::ostream& operator<<(std::ostream &os, const Credit &credit)
{
os << credit.name;
if (credit.contact != "")
os << "\n contact: " << credit.contact;
os << "\t contact: " << credit.contact;
if (credit.currentPursuits != "")
os << "\n " << credit.currentPursuits;
os << " " << credit.currentPursuits;
if (credit.areaResponsibility != "")
os << "\n I'll answer question on: " << credit.areaResponsibility;
os << endl;
os << " I'll answer question on: " << credit.areaResponsibility;
return os;
}
void Parameter::PrintCredit()
{
vector<Credit> everyone;
srand ( time(NULL) );
everyone.push_back(Credit("Nicola Bertoldi"
, "911"
, ""
@ -565,7 +571,7 @@ void Parameter::PrintCredit()
, "ambiguous source input, confusion networks, confusing source code"));
everyone.push_back(Credit("Hieu Hoang", "http://www.hoang.co.uk/hieu/"
, "phd student at Edinburgh Uni. Original Moses developer"
, "general queries/ flames on Moses. Doing stuff on async factored translation, so anything on that as well"));
, "general queries/ flames on Moses."));
sort(everyone.begin(), everyone.end());
@ -587,8 +593,8 @@ void Parameter::PrintCredit()
<< "License along with this library; if not, write to the Free Software" << endl
<< "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA" << endl << endl
<< "***********************************************************************" << endl << endl
<< "Built on " << __DATE__ << endl << endl
<< "CREDITS" << endl << endl;
<< "Built on " << __DATE__ << " at " __TIME__ << endl << endl
<< "WHO'S FAULT IS THIS GODDAM SOFTWARE:" << endl;
ostream_iterator<Credit> out(cerr, "\n");
copy(everyone.begin(), everyone.end(), out);