mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
prevent string(NULL) from getting called when config file name is missing
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@39 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
37456ad0f4
commit
9b0d5e06a3
@ -64,10 +64,10 @@ am__libmoses_a_SOURCES_DIST = Arc.cpp FactorCollection.cpp Factor.cpp \
|
|||||||
HypothesisCollection.cpp HypothesisCollectionIntermediate.cpp \
|
HypothesisCollection.cpp HypothesisCollectionIntermediate.cpp \
|
||||||
Hypothesis.cpp InputFileStream.cpp LanguageModel.cpp \
|
Hypothesis.cpp InputFileStream.cpp LanguageModel.cpp \
|
||||||
LatticeEdge.cpp LatticePath.cpp Manager.cpp md5.cpp \
|
LatticeEdge.cpp LatticePath.cpp Manager.cpp md5.cpp \
|
||||||
Parameter.cpp Phrase.cpp PhraseDictionary.cpp \
|
Parameter.cpp Phrase.cpp PhraseDictionary.cpp Sentence.cpp \
|
||||||
TranslationOption.cpp Sentence.cpp StaticData.cpp \
|
StaticData.cpp TargetPhrase.cpp TranslationOption.cpp \
|
||||||
TargetPhrase.cpp Util.cpp WeightOptimization.cpp Word.cpp \
|
UserMessage.cpp Util.cpp WeightOptimization.cpp Word.cpp \
|
||||||
WordsBitmap.cpp UserMessage.cpp NGramCollection.cpp
|
WordsBitmap.cpp NGramCollection.cpp
|
||||||
@INTERNAL_LM_TRUE@am__objects_1 = NGramCollection.$(OBJEXT)
|
@INTERNAL_LM_TRUE@am__objects_1 = NGramCollection.$(OBJEXT)
|
||||||
am_libmoses_a_OBJECTS = Arc.$(OBJEXT) FactorCollection.$(OBJEXT) \
|
am_libmoses_a_OBJECTS = Arc.$(OBJEXT) FactorCollection.$(OBJEXT) \
|
||||||
Factor.$(OBJEXT) FactorTypeSet.$(OBJEXT) \
|
Factor.$(OBJEXT) FactorTypeSet.$(OBJEXT) \
|
||||||
@ -77,10 +77,11 @@ am_libmoses_a_OBJECTS = Arc.$(OBJEXT) FactorCollection.$(OBJEXT) \
|
|||||||
LanguageModel.$(OBJEXT) LatticeEdge.$(OBJEXT) \
|
LanguageModel.$(OBJEXT) LatticeEdge.$(OBJEXT) \
|
||||||
LatticePath.$(OBJEXT) Manager.$(OBJEXT) md5.$(OBJEXT) \
|
LatticePath.$(OBJEXT) Manager.$(OBJEXT) md5.$(OBJEXT) \
|
||||||
Parameter.$(OBJEXT) Phrase.$(OBJEXT) \
|
Parameter.$(OBJEXT) Phrase.$(OBJEXT) \
|
||||||
PhraseDictionary.$(OBJEXT) TranslationOption.$(OBJEXT) \
|
PhraseDictionary.$(OBJEXT) Sentence.$(OBJEXT) \
|
||||||
Sentence.$(OBJEXT) StaticData.$(OBJEXT) TargetPhrase.$(OBJEXT) \
|
StaticData.$(OBJEXT) TargetPhrase.$(OBJEXT) \
|
||||||
|
TranslationOption.$(OBJEXT) UserMessage.$(OBJEXT) \
|
||||||
Util.$(OBJEXT) WeightOptimization.$(OBJEXT) Word.$(OBJEXT) \
|
Util.$(OBJEXT) WeightOptimization.$(OBJEXT) Word.$(OBJEXT) \
|
||||||
WordsBitmap.$(OBJEXT) UserMessage.$(OBJEXT) $(am__objects_1)
|
WordsBitmap.$(OBJEXT) $(am__objects_1)
|
||||||
libmoses_a_OBJECTS = $(am_libmoses_a_OBJECTS)
|
libmoses_a_OBJECTS = $(am_libmoses_a_OBJECTS)
|
||||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
@ -178,10 +179,10 @@ libmoses_a_SOURCES = Arc.cpp FactorCollection.cpp Factor.cpp \
|
|||||||
HypothesisCollection.cpp HypothesisCollectionIntermediate.cpp \
|
HypothesisCollection.cpp HypothesisCollectionIntermediate.cpp \
|
||||||
Hypothesis.cpp InputFileStream.cpp LanguageModel.cpp \
|
Hypothesis.cpp InputFileStream.cpp LanguageModel.cpp \
|
||||||
LatticeEdge.cpp LatticePath.cpp Manager.cpp md5.cpp \
|
LatticeEdge.cpp LatticePath.cpp Manager.cpp md5.cpp \
|
||||||
Parameter.cpp Phrase.cpp PhraseDictionary.cpp \
|
Parameter.cpp Phrase.cpp PhraseDictionary.cpp Sentence.cpp \
|
||||||
TranslationOption.cpp Sentence.cpp StaticData.cpp \
|
StaticData.cpp TargetPhrase.cpp TranslationOption.cpp \
|
||||||
TargetPhrase.cpp Util.cpp WeightOptimization.cpp Word.cpp \
|
UserMessage.cpp Util.cpp WeightOptimization.cpp Word.cpp \
|
||||||
WordsBitmap.cpp UserMessage.cpp $(am__append_1)
|
WordsBitmap.cpp $(am__append_1)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -141,13 +141,23 @@ bool Parameter::FilesExist(const string ¶mName, size_t tokenizeIndex)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO arg parsing like this does not belong in the library, it belongs
|
||||||
|
// in moses-cmd
|
||||||
string Parameter::FindParam(const string ¶mSwitch, int argc, char* argv[])
|
string Parameter::FindParam(const string ¶mSwitch, int argc, char* argv[])
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < argc ; i++)
|
for (int i = 0 ; i < argc ; i++)
|
||||||
{
|
{
|
||||||
if (string(argv[i]) == paramSwitch)
|
if (string(argv[i]) == paramSwitch)
|
||||||
{
|
{
|
||||||
return argv[i+1];
|
if (i+1 < argc)
|
||||||
|
{
|
||||||
|
return argv[i+1];
|
||||||
|
} else {
|
||||||
|
stringstream errorMsg("");
|
||||||
|
errorMsg << "Option " << paramSwitch << " requires a parameter!";
|
||||||
|
UserMessage::Add(errorMsg.str());
|
||||||
|
// TODO return some sort of error, not the empty string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user