Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Germann <Ulrich.Germann@gmail.com>2015-11-30 04:29:13 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-11-30 04:29:13 +0300
commit11262b0a62c3460ea3fc6c737ce105a631822398 (patch)
tree8d12a4c9357af6bdb12f83ed4f8d637b3549dd1d /moses/Parameter.cpp
parent7375d81e163d3c706302150d6bb3f07f7dda0db5 (diff)
Added switch --version to have Moses print out the code versions it was compiled with.
Diffstat (limited to 'moses/Parameter.cpp')
-rw-r--r--moses/Parameter.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/moses/Parameter.cpp b/moses/Parameter.cpp
index e06828515..baad8ec65 100644
--- a/moses/Parameter.cpp
+++ b/moses/Parameter.cpp
@@ -35,6 +35,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "util/random.hh"
#include <boost/program_options.hpp>
+#ifdef HAVE_XMLRPC_C
+#include <xmlrpc_server.h>
+#endif
using namespace std;
using namespace boost::algorithm;
@@ -53,6 +56,7 @@ Parameter::Parameter()
AddParam(main_opts,"input-file", "i", "location of the input file to be translated");
AddParam(main_opts,"verbose", "v", "verbosity level of the logging");
+ AddParam(main_opts,"version", "show version of Moses and libraries used");
AddParam(main_opts,"show-weights", "print feature weights and exit");
AddParam(main_opts,"time-out", "seconds after which is interrupted (-1=no time-out, default is -1)");
@@ -447,6 +451,35 @@ LoadParam(const string &filePath)
return LoadParam(3, (char const**) argv);
}
+/// Print out version information about the things that went into this
+/// executable.
+void show_version()
+{
+ std::cout << "\nMoses code version (git tag or commit hash):\n "
+ << MOSES_VERSION_ID << std::endl
+ << "Libraries used:" << std::endl
+ << " Boost version "
+ << BOOST_VERSION / 100000 << "." // major version
+ << BOOST_VERSION / 100 % 1000 << "." // minor version
+ << BOOST_VERSION % 100 // patch level
+ << std::endl;
+#ifdef HAVE_XMLRPC_C
+ unsigned int major, minor, point;
+ xmlrpc_server_version(&major, &minor, &point);
+ std::cout << " Xmlrpc-c version "
+ << major << "." << minor << "." << point << std::endl;
+#endif
+#ifdef HAVE_CMPH
+ // there's no easy way to determine the cmph version at compile time
+ std::cout << " CMPH (version unknown)" << std::endl;
+#endif
+
+#ifdef MMT_VERSION_ID
+ std::cout << string(20,'-')
+ << "\nMMT extras version: " << MMT_VERSION_ID << std::endl;
+#endif
+}
+
/** load all parameters from the configuration file and the command line switches */
bool
Parameter::
@@ -459,8 +492,14 @@ LoadParam(int argc, char const* xargv[])
argv[i] = xargv[i];
if (strlen(argv[i]) > 2 && argv[i][0] == '-' && argv[i][1] == '-')
++argv[i];
+ if (!strcmp(argv[i],"-version")) {
+ show_version();
+ exit(0);
+ }
}
+
+
// config file (-f) arg mandatory
string configPath;
if ( (configPath = FindParam("-f", argc, argv)) == ""