mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-27 03:49:57 +03:00
win32
This commit is contained in:
parent
346b2524e2
commit
a93f4691f6
@ -55,10 +55,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
@ -75,10 +75,10 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
@ -12,12 +12,16 @@ DontBhiksha::DontBhiksha(const void * /*base*/, uint64_t /*max_offset*/, uint64_
|
||||
|
||||
const uint8_t kArrayBhikshaVersion = 0;
|
||||
|
||||
void ArrayBhiksha::UpdateConfigFromBinary(int fd, Config &config) {
|
||||
void ArrayBhiksha::UpdateConfigFromBinary(FD fd, Config &config) {
|
||||
uint8_t version;
|
||||
uint8_t configured_bits;
|
||||
#ifdef WIN32
|
||||
#else
|
||||
if (read(fd, &version, 1) != 1 || read(fd, &configured_bits, 1) != 1) {
|
||||
UTIL_THROW(util::ErrnoException, "Could not read from binary file");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (version != kArrayBhikshaVersion) UTIL_THROW(FormatLoadException, "This file has sorted array compression version " << (unsigned) version << " but the code expects version " << (unsigned)kArrayBhikshaVersion);
|
||||
config.pointer_bhiksha_bits = configured_bits;
|
||||
}
|
||||
|
@ -10,13 +10,14 @@
|
||||
* Currently only used for next pointers.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "lm/model_type.hh"
|
||||
#include "lm/trie.hh"
|
||||
#include "util/bit_packing.hh"
|
||||
#include "util/sorted_uniform.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
@ -28,7 +29,7 @@ class DontBhiksha {
|
||||
public:
|
||||
static const ModelType kModelTypeAdd = static_cast<ModelType>(0);
|
||||
|
||||
static void UpdateConfigFromBinary(int /*fd*/, Config &/*config*/) {}
|
||||
static void UpdateConfigFromBinary(FD /*fd*/, Config &/*config*/) {}
|
||||
|
||||
static std::size_t Size(uint64_t /*max_offset*/, uint64_t /*max_next*/, const Config &/*config*/) { return 0; }
|
||||
|
||||
@ -62,7 +63,7 @@ class ArrayBhiksha {
|
||||
public:
|
||||
static const ModelType kModelTypeAdd = kArrayAdd;
|
||||
|
||||
static void UpdateConfigFromBinary(int fd, Config &config);
|
||||
static void UpdateConfigFromBinary(FD fd, Config &config);
|
||||
|
||||
static std::size_t Size(uint64_t max_offset, uint64_t max_next, const Config &config);
|
||||
|
||||
|
@ -10,10 +10,8 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
@ -46,10 +44,14 @@ std::size_t TotalHeaderSize(unsigned char order) {
|
||||
return Align8(sizeof(Sanity) + sizeof(FixedWidthParameters) + sizeof(uint64_t) * order);
|
||||
}
|
||||
|
||||
void ReadLoop(int fd, void *to_void, std::size_t size) {
|
||||
void ReadLoop(FD fd, void *to_void, std::size_t size) {
|
||||
uint8_t *to = static_cast<uint8_t*>(to_void);
|
||||
while (size) {
|
||||
#ifdef WIN32
|
||||
ssize_t ret;
|
||||
#else
|
||||
ssize_t ret = read(fd, to, size);
|
||||
#endif
|
||||
if (ret == -1) UTIL_THROW(util::ErrnoException, "Failed to read from binary file");
|
||||
if (ret == 0) UTIL_THROW(util::ErrnoException, "Binary file too short");
|
||||
to += ret;
|
||||
@ -74,12 +76,18 @@ void WriteHeader(void *to, const Parameters ¶ms) {
|
||||
|
||||
} // namespace
|
||||
|
||||
void SeekOrThrow(int fd, off_t off) {
|
||||
void SeekOrThrow(FD fd, off_t off) {
|
||||
#ifdef WIN32
|
||||
#else
|
||||
if ((off_t)-1 == lseek(fd, off, SEEK_SET)) UTIL_THROW(util::ErrnoException, "Seek failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
void AdvanceOrThrow(int fd, off_t off) {
|
||||
void AdvanceOrThrow(FD fd, off_t off) {
|
||||
#ifdef WIN32
|
||||
#else
|
||||
if ((off_t)-1 == lseek(fd, off, SEEK_CUR)) UTIL_THROW(util::ErrnoException, "Seek failed");
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t *SetupJustVocab(const Config &config, uint8_t order, std::size_t memory_size, Backing &backing) {
|
||||
@ -131,7 +139,7 @@ void FinishFile(const Config &config, ModelType model_type, unsigned int search_
|
||||
|
||||
namespace detail {
|
||||
|
||||
bool IsBinaryFormat(int fd) {
|
||||
bool IsBinaryFormat(FD fd) {
|
||||
const off_t size = util::SizeFile(fd);
|
||||
if (size == util::kBadSize || (size <= static_cast<off_t>(sizeof(Sanity)))) return false;
|
||||
// Try reading the header.
|
||||
@ -159,7 +167,7 @@ bool IsBinaryFormat(int fd) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void ReadHeader(int fd, Parameters &out) {
|
||||
void ReadHeader(FD fd, Parameters &out) {
|
||||
SeekOrThrow(fd, sizeof(Sanity));
|
||||
ReadLoop(fd, &out.fixed, sizeof(out.fixed));
|
||||
if (out.fixed.probing_multiplier < 1.0)
|
||||
@ -178,7 +186,7 @@ void MatchCheck(ModelType model_type, unsigned int search_version, const Paramet
|
||||
UTIL_THROW_IF(search_version != params.fixed.search_version, FormatLoadException, "The binary file has " << kModelNames[params.fixed.model_type] << " version " << params.fixed.search_version << " but this code expects " << kModelNames[params.fixed.model_type] << " version " << search_version);
|
||||
}
|
||||
|
||||
void SeekPastHeader(int fd, const Parameters ¶ms) {
|
||||
void SeekPastHeader(FD fd, const Parameters ¶ms) {
|
||||
SeekOrThrow(fd, TotalHeaderSize(params.counts.size()));
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,12 @@
|
||||
#include "util/file_piece.hh"
|
||||
#include "util/mmap.hh"
|
||||
#include "util/scoped.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
@ -53,9 +54,9 @@ struct Backing {
|
||||
util::scoped_memory search;
|
||||
};
|
||||
|
||||
void SeekOrThrow(int fd, off_t off);
|
||||
void SeekOrThrow(FD fd, off_t off);
|
||||
// Seek forward
|
||||
void AdvanceOrThrow(int fd, off_t off);
|
||||
void AdvanceOrThrow(FD fd, off_t off);
|
||||
|
||||
// Create just enough of a binary file to write vocabulary to it.
|
||||
uint8_t *SetupJustVocab(const Config &config, uint8_t order, std::size_t memory_size, Backing &backing);
|
||||
@ -68,13 +69,13 @@ void FinishFile(const Config &config, ModelType model_type, unsigned int search_
|
||||
|
||||
namespace detail {
|
||||
|
||||
bool IsBinaryFormat(int fd);
|
||||
bool IsBinaryFormat(FD fd);
|
||||
|
||||
void ReadHeader(int fd, Parameters ¶ms);
|
||||
void ReadHeader(FD fd, Parameters ¶ms);
|
||||
|
||||
void MatchCheck(ModelType model_type, unsigned int search_version, const Parameters ¶ms);
|
||||
|
||||
void SeekPastHeader(int fd, const Parameters ¶ms);
|
||||
void SeekPastHeader(FD fd, const Parameters ¶ms);
|
||||
|
||||
uint8_t *SetupBinary(const Config &config, const Parameters ¶ms, std::size_t memory_size, Backing &backing);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LM_BLANK__
|
||||
#define LM_BLANK__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
@ -87,7 +87,7 @@ void ShowSizes(const char *file, const lm::ngram::Config &config) {
|
||||
prefix = 'G';
|
||||
divide = 1 << 30;
|
||||
}
|
||||
long int length = std::max<long int>(2, lrint(ceil(log10(max_length / divide))));
|
||||
long int length = std::max<long int>(2, lrint(ceil(log10((double) max_length / (double)divide))));
|
||||
std::cout << "Memory estimate:\ntype ";
|
||||
// right align bytes.
|
||||
for (long int i = 0; i < length - 2; ++i) std::cout << ' ';
|
||||
|
@ -44,7 +44,7 @@ template <class Search, class VocabularyT> GenericModel<Search, VocabularyT>::Ge
|
||||
P::Init(begin_sentence, null_context, vocab_, search_.MiddleEnd() - search_.MiddleBegin() + 2);
|
||||
}
|
||||
|
||||
template <class Search, class VocabularyT> void GenericModel<Search, VocabularyT>::InitializeFromBinary(void *start, const Parameters ¶ms, const Config &config, int fd) {
|
||||
template <class Search, class VocabularyT> void GenericModel<Search, VocabularyT>::InitializeFromBinary(void *start, const Parameters ¶ms, const Config &config, FD fd) {
|
||||
SetupMemory(start, params.counts, config);
|
||||
vocab_.LoadedBinary(fd, config.enumerate_vocab);
|
||||
search_.LoadedBinary();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "lm/weights.hh"
|
||||
|
||||
#include "util/murmur_hash.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
@ -137,9 +138,9 @@ template <class Search, class VocabularyT> class GenericModel : public base::Mod
|
||||
unsigned char &next_use) const;
|
||||
|
||||
private:
|
||||
friend void LoadLM<>(const char *file, const Config &config, GenericModel<Search, VocabularyT> &to);
|
||||
friend void lm::ngram::LoadLM<>(const char *file, const Config &config, GenericModel<Search, VocabularyT> &to);
|
||||
|
||||
static void UpdateConfigFromBinary(int fd, const std::vector<uint64_t> &counts, Config &config) {
|
||||
static void UpdateConfigFromBinary(FD fd, const std::vector<uint64_t> &counts, Config &config) {
|
||||
AdvanceOrThrow(fd, VocabularyT::Size(counts[0], config));
|
||||
Search::UpdateConfigFromBinary(fd, counts, config);
|
||||
}
|
||||
@ -151,7 +152,7 @@ template <class Search, class VocabularyT> class GenericModel : public base::Mod
|
||||
// Appears after Size in the cc file.
|
||||
void SetupMemory(void *start, const std::vector<uint64_t> &counts, const Config &config);
|
||||
|
||||
void InitializeFromBinary(void *start, const Parameters ¶ms, const Config &config, int fd);
|
||||
void InitializeFromBinary(void *start, const Parameters ¶ms, const Config &config, FD fd);
|
||||
|
||||
void InitializeFromARPA(const char *file, const Config &config);
|
||||
|
||||
|
@ -8,14 +8,15 @@
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
float FloatSec(const struct timeval &tv) {
|
||||
return static_cast<float>(tv.tv_sec) + (static_cast<float>(tv.tv_usec) / 1000000000.0);
|
||||
}
|
||||
|
||||
void PrintUsage(const char *message) {
|
||||
#ifdef WIN32
|
||||
#else
|
||||
struct rusage usage;
|
||||
if (getrusage(RUSAGE_SELF, &usage)) {
|
||||
perror("getrusage");
|
||||
@ -23,6 +24,7 @@ void PrintUsage(const char *message) {
|
||||
}
|
||||
std::cerr << message;
|
||||
std::cerr << "user\t" << FloatSec(usage.ru_utime) << "\nsys\t" << FloatSec(usage.ru_stime) << '\n';
|
||||
#endif
|
||||
|
||||
// Linux doesn't set memory usage :-(.
|
||||
std::ifstream status("/proc/self/status", std::ios::in);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <numeric>
|
||||
#include <limits>
|
||||
|
||||
#include <unistd.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
@ -40,10 +40,13 @@ const char kSeparatelyQuantizeVersion = 2;
|
||||
|
||||
} // namespace
|
||||
|
||||
void SeparatelyQuantize::UpdateConfigFromBinary(int fd, const std::vector<uint64_t> &/*counts*/, Config &config) {
|
||||
void SeparatelyQuantize::UpdateConfigFromBinary(FD fd, const std::vector<uint64_t> &/*counts*/, Config &config) {
|
||||
char version;
|
||||
#ifdef WIN32
|
||||
#else
|
||||
if (read(fd, &version, 1) != 1 || read(fd, &config.prob_bits, 1) != 1 || read(fd, &config.backoff_bits, 1) != 1)
|
||||
UTIL_THROW(util::ErrnoException, "Failed to read header for quantization.");
|
||||
#endif
|
||||
if (version != kSeparatelyQuantizeVersion) UTIL_THROW(FormatLoadException, "This file has quantization version " << (unsigned)version << " but the code expects version " << (unsigned)kSeparatelyQuantizeVersion);
|
||||
AdvanceOrThrow(fd, -3);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -22,7 +22,7 @@ class Config;
|
||||
class DontQuantize {
|
||||
public:
|
||||
static const ModelType kModelTypeAdd = static_cast<ModelType>(0);
|
||||
static void UpdateConfigFromBinary(int, const std::vector<uint64_t> &, Config &) {}
|
||||
static void UpdateConfigFromBinary(FD, const std::vector<uint64_t> &, Config &) {}
|
||||
static std::size_t Size(uint8_t /*order*/, const Config &/*config*/) { return 0; }
|
||||
static uint8_t MiddleBits(const Config &/*config*/) { return 63; }
|
||||
static uint8_t LongestBits(const Config &/*config*/) { return 31; }
|
||||
@ -113,7 +113,7 @@ class SeparatelyQuantize {
|
||||
public:
|
||||
static const ModelType kModelTypeAdd = kQuantAdd;
|
||||
|
||||
static void UpdateConfigFromBinary(int fd, const std::vector<uint64_t> &counts, Config &config);
|
||||
static void UpdateConfigFromBinary(FD fd, const std::vector<uint64_t> &counts, Config &config);
|
||||
|
||||
static std::size_t Size(uint8_t order, const Config &config) {
|
||||
size_t longest_table = (static_cast<size_t>(1) << static_cast<size_t>(config.prob_bits)) * sizeof(float);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lm {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LM_RETURN__
|
||||
#define LM_RETURN__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lm {
|
||||
/* Structure returned by scoring routines. */
|
||||
|
@ -78,7 +78,7 @@ template <class MiddleT, class LongestT> class TemplateHashedSearch : public Has
|
||||
static const unsigned int kVersion = 0;
|
||||
|
||||
// TODO: move probing_multiplier here with next binary file format update.
|
||||
static void UpdateConfigFromBinary(int, const std::vector<uint64_t> &, Config &) {}
|
||||
static void UpdateConfigFromBinary(FD, const std::vector<uint64_t> &, Config &) {}
|
||||
|
||||
static std::size_t Size(const std::vector<uint64_t> &counts, const Config &config) {
|
||||
std::size_t ret = Unigram::Size(counts[0]);
|
||||
|
@ -24,10 +24,8 @@
|
||||
#include <limits>
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace lm {
|
||||
namespace ngram {
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "lm/weights.hh"
|
||||
|
||||
#include "util/file_piece.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -38,7 +39,7 @@ template <class Quant, class Bhiksha> class TrieSearch {
|
||||
|
||||
static const unsigned int kVersion = 1;
|
||||
|
||||
static void UpdateConfigFromBinary(int fd, const std::vector<uint64_t> &counts, Config &config) {
|
||||
static void UpdateConfigFromBinary(FD fd, const std::vector<uint64_t> &counts, Config &config) {
|
||||
Quant::UpdateConfigFromBinary(fd, counts, config);
|
||||
AdvanceOrThrow(fd, Quant::Size(counts.size(), config) + Unigram::Size(counts[0]));
|
||||
Bhiksha::UpdateConfigFromBinary(fd, config);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LM_TRIE__
|
||||
#define LM_TRIE__
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util { class FilePiece; }
|
||||
|
||||
|
@ -29,7 +29,7 @@ const uint64_t kUnknownHash = detail::HashForVocab("<unk>", 5);
|
||||
// Sadly some LMs have <UNK>.
|
||||
const uint64_t kUnknownCapHash = detail::HashForVocab("<UNK>", 5);
|
||||
|
||||
WordIndex ReadWords(int fd, EnumerateVocab *enumerate) {
|
||||
WordIndex ReadWords(FD fd, EnumerateVocab *enumerate) {
|
||||
if (!enumerate) return std::numeric_limits<WordIndex>::max();
|
||||
const std::size_t kInitialRead = 16384;
|
||||
std::string buf;
|
||||
@ -37,13 +37,21 @@ WordIndex ReadWords(int fd, EnumerateVocab *enumerate) {
|
||||
buf.resize(kInitialRead);
|
||||
WordIndex index = 0;
|
||||
while (true) {
|
||||
#ifdef WIN32
|
||||
ssize_t got;
|
||||
#else
|
||||
ssize_t got = read(fd, &buf[0], kInitialRead);
|
||||
#endif
|
||||
UTIL_THROW_IF(got == -1, util::ErrnoException, "Reading vocabulary words");
|
||||
if (got == 0) return index;
|
||||
buf.resize(got);
|
||||
while (buf[buf.size() - 1]) {
|
||||
char next_char;
|
||||
#ifdef WIN32
|
||||
ssize_t ret;
|
||||
#else
|
||||
ssize_t ret = read(fd, &next_char, 1);
|
||||
#endif
|
||||
UTIL_THROW_IF(ret == -1, util::ErrnoException, "Reading vocabulary words");
|
||||
UTIL_THROW_IF(ret == 0, FormatLoadException, "Missing null terminator on a vocab word.");
|
||||
buf.push_back(next_char);
|
||||
@ -68,9 +76,12 @@ void WriteWordsWrapper::Add(WordIndex index, const StringPiece &str) {
|
||||
buffer_.push_back(0);
|
||||
}
|
||||
|
||||
void WriteWordsWrapper::Write(int fd) {
|
||||
void WriteWordsWrapper::Write(FD fd) {
|
||||
#ifdef WIN32
|
||||
#else
|
||||
if ((off_t)-1 == lseek(fd, 0, SEEK_END))
|
||||
UTIL_THROW(util::ErrnoException, "Failed to seek in binary to vocab words");
|
||||
#endif
|
||||
util::WriteOrThrow(fd, buffer_.data(), buffer_.size());
|
||||
}
|
||||
|
||||
@ -131,7 +142,7 @@ void SortedVocabulary::FinishedLoading(ProbBackoff *reorder_vocab) {
|
||||
bound_ = end_ - begin_ + 1;
|
||||
}
|
||||
|
||||
void SortedVocabulary::LoadedBinary(int fd, EnumerateVocab *to) {
|
||||
void SortedVocabulary::LoadedBinary(FD fd, EnumerateVocab *to) {
|
||||
end_ = begin_ + *(reinterpret_cast<const uint64_t*>(begin_) - 1);
|
||||
ReadWords(fd, to);
|
||||
SetSpecial(Index("<s>"), Index("</s>"), 0);
|
||||
@ -189,7 +200,7 @@ void ProbingVocabulary::FinishedLoading(ProbBackoff * /*reorder_vocab*/) {
|
||||
SetSpecial(Index("<s>"), Index("</s>"), 0);
|
||||
}
|
||||
|
||||
void ProbingVocabulary::LoadedBinary(int fd, EnumerateVocab *to) {
|
||||
void ProbingVocabulary::LoadedBinary(FD fd, EnumerateVocab *to) {
|
||||
UTIL_THROW_IF(header_->version != kProbingVocabularyVersion, FormatLoadException, "The binary file has probing version " << header_->version << " but the code expects version " << kProbingVocabularyVersion << ". Please rerun build_binary using the same version of the code.");
|
||||
lookup_.LoadedBinary();
|
||||
ReadWords(fd, to);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "util/probing_hash_table.hh"
|
||||
#include "util/sorted_uniform.hh"
|
||||
#include "util/string_piece.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <limits>
|
||||
#include <string>
|
||||
@ -36,7 +37,7 @@ class WriteWordsWrapper : public EnumerateVocab {
|
||||
|
||||
void Add(WordIndex index, const StringPiece &str);
|
||||
|
||||
void Write(int fd);
|
||||
void Write(FD fd);
|
||||
|
||||
private:
|
||||
EnumerateVocab *inner_;
|
||||
@ -84,7 +85,7 @@ class SortedVocabulary : public base::Vocabulary {
|
||||
|
||||
bool SawUnk() const { return saw_unk_; }
|
||||
|
||||
void LoadedBinary(int fd, EnumerateVocab *to);
|
||||
void LoadedBinary(FD fd, EnumerateVocab *to);
|
||||
|
||||
private:
|
||||
uint64_t *begin_, *end_;
|
||||
@ -127,7 +128,7 @@ class ProbingVocabulary : public base::Vocabulary {
|
||||
|
||||
bool SawUnk() const { return saw_unk_; }
|
||||
|
||||
void LoadedBinary(int fd, EnumerateVocab *to);
|
||||
void LoadedBinary(FD fd, EnumerateVocab *to);
|
||||
|
||||
private:
|
||||
// std::identity is an SGI extension :-(
|
||||
|
@ -8,11 +8,13 @@
|
||||
#include <architecture/byte_order.h>
|
||||
#elif __linux__
|
||||
#include <endian.h>
|
||||
#elif WIN32
|
||||
// TODO WIN32
|
||||
#else
|
||||
#include <arpa/nameser_compat.h>
|
||||
#endif
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "util/exception.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#ifdef __GXX_RTTI
|
||||
#include <typeinfo>
|
||||
@ -68,6 +69,9 @@ ErrnoException::ErrnoException() throw() : errno_(errno) {
|
||||
buf[0] = 0;
|
||||
#ifdef sun
|
||||
const char *add = strerror(errno);
|
||||
#elif WIN32
|
||||
// TODO WIN32
|
||||
const char *add;
|
||||
#else
|
||||
const char *add = HandleStrerror(strerror_r(errno, buf, 200), buf);
|
||||
#endif
|
||||
|
@ -9,13 +9,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
scoped_fd::~scoped_fd() {
|
||||
if (fd_ != -1 && close(fd_)) {
|
||||
if (fd_ != kBadFD && close(fd_)) {
|
||||
std::cerr << "Could not close file " << fd_ << std::endl;
|
||||
std::abort();
|
||||
}
|
||||
@ -28,28 +27,46 @@ scoped_FILE::~scoped_FILE() {
|
||||
}
|
||||
}
|
||||
|
||||
int OpenReadOrThrow(const char *name) {
|
||||
int ret;
|
||||
FD OpenReadOrThrow(const char *name) {
|
||||
FD ret;
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
UTIL_THROW_IF(-1 == (ret = open(name, O_RDONLY)), ErrnoException, "while opening " << name);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CreateOrThrow(const char *name) {
|
||||
int ret;
|
||||
FD CreateOrThrow(const char *name) {
|
||||
FD ret;
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
UTIL_THROW_IF(-1 == (ret = open(name, O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR)), ErrnoException, "while creating " << name);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
off_t SizeFile(int fd) {
|
||||
off_t SizeFile(FD fd) {
|
||||
#ifdef WIN32
|
||||
return 0; // TODO WIN32
|
||||
|
||||
#else
|
||||
struct stat sb;
|
||||
if (fstat(fd, &sb) == -1 || (!sb.st_size && !S_ISREG(sb.st_mode))) return kBadSize;
|
||||
return sb.st_size;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ReadOrThrow(int fd, void *to_void, std::size_t amount) {
|
||||
void ReadOrThrow(FD fd, void *to_void, std::size_t amount) {
|
||||
uint8_t *to = static_cast<uint8_t*>(to_void);
|
||||
while (amount) {
|
||||
|
||||
#ifdef WIN32
|
||||
ssize_t ret; // TODO WIN32
|
||||
#else
|
||||
ssize_t ret = read(fd, to, amount);
|
||||
#endif
|
||||
if (ret == -1) UTIL_THROW(ErrnoException, "Reading " << amount << " from fd " << fd << " failed.");
|
||||
if (ret == 0) UTIL_THROW(Exception, "Hit EOF in fd " << fd << " but there should be " << amount << " more bytes to read.");
|
||||
amount -= ret;
|
||||
@ -57,10 +74,14 @@ void ReadOrThrow(int fd, void *to_void, std::size_t amount) {
|
||||
}
|
||||
}
|
||||
|
||||
void WriteOrThrow(int fd, const void *data_void, std::size_t size) {
|
||||
void WriteOrThrow(FD fd, const void *data_void, std::size_t size) {
|
||||
const uint8_t *data = static_cast<const uint8_t*>(data_void);
|
||||
while (size) {
|
||||
#ifdef WIN32
|
||||
ssize_t ret; // TODO WIN32
|
||||
#else
|
||||
ssize_t ret = write(fd, data, size);
|
||||
#endif
|
||||
if (ret < 1) UTIL_THROW(util::ErrnoException, "Write failed");
|
||||
data += ret;
|
||||
size -= ret;
|
||||
|
@ -2,37 +2,37 @@
|
||||
#define UTIL_FILE__
|
||||
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
namespace util {
|
||||
|
||||
class scoped_fd {
|
||||
public:
|
||||
scoped_fd() : fd_(-1) {}
|
||||
scoped_fd() : fd_(kBadFD) {}
|
||||
|
||||
explicit scoped_fd(int fd) : fd_(fd) {}
|
||||
explicit scoped_fd(FD fd) : fd_(fd) {}
|
||||
|
||||
~scoped_fd();
|
||||
|
||||
void reset(int to) {
|
||||
void reset(FD to) {
|
||||
scoped_fd other(fd_);
|
||||
fd_ = to;
|
||||
}
|
||||
|
||||
int get() const { return fd_; }
|
||||
FD get() const { return fd_; }
|
||||
|
||||
int operator*() const { return fd_; }
|
||||
FD operator*() const { return fd_; }
|
||||
|
||||
int release() {
|
||||
int ret = fd_;
|
||||
fd_ = -1;
|
||||
FD release() {
|
||||
FD ret = fd_;
|
||||
fd_ = kBadFD;
|
||||
return ret;
|
||||
}
|
||||
|
||||
operator bool() { return fd_ != -1; }
|
||||
operator bool() { return fd_ != kBadFD; }
|
||||
|
||||
private:
|
||||
int fd_;
|
||||
FD fd_;
|
||||
|
||||
scoped_fd(const scoped_fd &);
|
||||
scoped_fd &operator=(const scoped_fd &);
|
||||
@ -56,16 +56,16 @@ class scoped_FILE {
|
||||
std::FILE *file_;
|
||||
};
|
||||
|
||||
int OpenReadOrThrow(const char *name);
|
||||
FD OpenReadOrThrow(const char *name);
|
||||
|
||||
int CreateOrThrow(const char *name);
|
||||
FD CreateOrThrow(const char *name);
|
||||
|
||||
// Return value for SizeFile when it can't size properly.
|
||||
const off_t kBadSize = -1;
|
||||
off_t SizeFile(int fd);
|
||||
off_t SizeFile(FD fd);
|
||||
|
||||
void ReadOrThrow(int fd, void *to, std::size_t size);
|
||||
void WriteOrThrow(int fd, const void *data_void, std::size_t size);
|
||||
void ReadOrThrow(FD fd, void *to, std::size_t size);
|
||||
void WriteOrThrow(FD fd, const void *data_void, std::size_t size);
|
||||
|
||||
void RemoveOrThrow(const char *name);
|
||||
|
||||
|
@ -11,10 +11,6 @@
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
@ -42,7 +38,7 @@ FilePiece::FilePiece(const char *name, std::ostream *show_progress, off_t min_bu
|
||||
Initialize(name, show_progress, min_buffer);
|
||||
}
|
||||
|
||||
FilePiece::FilePiece(int fd, const char *name, std::ostream *show_progress, off_t min_buffer) :
|
||||
FilePiece::FilePiece(FD fd, const char *name, std::ostream *show_progress, off_t min_buffer) :
|
||||
file_(fd), total_size_(SizeFile(file_.get())), page_(sysconf(_SC_PAGE_SIZE)),
|
||||
progress_(total_size_ == kBadSize ? NULL : show_progress, std::string("Reading ") + name, total_size_) {
|
||||
Initialize(name, show_progress, min_buffer);
|
||||
@ -229,7 +225,11 @@ void FilePiece::MMapShift(off_t desired_begin) {
|
||||
, *file_, mapped_offset), mapped_size, scoped_memory::MMAP_ALLOCATED);
|
||||
if (data_.get() == MAP_FAILED) {
|
||||
if (desired_begin) {
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
if (((off_t)-1) == lseek(*file_, desired_begin, SEEK_SET)) UTIL_THROW(ErrnoException, "mmap failed even though it worked before. lseek failed too, so using read isn't an option either.");
|
||||
#endif
|
||||
}
|
||||
// The mmap was scheduled to end the file, but now we're going to read it.
|
||||
at_end_ = false;
|
||||
@ -254,9 +254,15 @@ void FilePiece::TransitionToRead() {
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
assert(!gz_file_);
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
gz_file_ = gzdopen(file_.get(), "r");
|
||||
UTIL_THROW_IF(!gz_file_, GZException, "zlib failed to open " << file_name_);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void FilePiece::ReadShift() {
|
||||
@ -297,7 +303,11 @@ void FilePiece::ReadShift() {
|
||||
if (read_return == -1) throw GZException(gz_file_);
|
||||
if (total_size_ != kBadSize) {
|
||||
// Just get the position, don't actually seek. Apparently this is how you do it. . .
|
||||
#ifdef WIN32
|
||||
off_t ret;
|
||||
#else
|
||||
off_t ret = lseek(file_.get(), 0, SEEK_CUR);
|
||||
#endif
|
||||
if (ret != -1) progress_.Set(ret);
|
||||
}
|
||||
#else
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "util/have.hh"
|
||||
#include "util/mmap.hh"
|
||||
#include "util/string_piece.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -35,7 +36,7 @@ class FilePiece {
|
||||
// 32 MB default.
|
||||
explicit FilePiece(const char *file, std::ostream *show_progress = NULL, off_t min_buffer = 33554432);
|
||||
// Takes ownership of fd. name is used for messages.
|
||||
explicit FilePiece(int fd, const char *name, std::ostream *show_progress = NULL, off_t min_buffer = 33554432);
|
||||
explicit FilePiece(FD fd, const char *name, std::ostream *show_progress = NULL, off_t min_buffer = 33554432);
|
||||
|
||||
~FilePiece();
|
||||
|
||||
|
190
kenlm/util/getopt.hh
Executable file
190
kenlm/util/getopt.hh
Executable file
@ -0,0 +1,190 @@
|
||||
|
||||
/* getopt.h */
|
||||
/* Declarations for getopt.
|
||||
Copyright (C) 1989-1994, 1996-1999, 2001 Free Software
|
||||
Foundation, Inc. This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute
|
||||
it and/or modify it under the terms of the GNU Lesser
|
||||
General Public License as published by the Free Software
|
||||
Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will
|
||||
be useful, but WITHOUT ANY WARRANTY; without even the
|
||||
implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General
|
||||
Public License along with the GNU C Library; if not, write
|
||||
to the Free Software Foundation, Inc., 59 Temple Place,
|
||||
Suite 330, Boston, MA 02111-1307 USA. */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _GETOPT_H
|
||||
|
||||
#ifndef __need_getopt
|
||||
# define _GETOPT_H 1
|
||||
#endif
|
||||
|
||||
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
||||
standalone, or this is the first header included in the source file.
|
||||
If we are being used with glibc, we need to include <features.h>, but
|
||||
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
||||
not defined, include <ctype.h>, which will pull in <features.h> for us
|
||||
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
||||
doesn't flood the namespace with stuff the way some other headers do.) */
|
||||
#if !defined __GNU_LIBRARY__
|
||||
# include <ctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int getopt (int argc, char *const *argv, const char *optstring);
|
||||
|
||||
/* For communication from `getopt' to the caller.
|
||||
When `getopt' finds an option that takes an argument,
|
||||
the argument value is returned here.
|
||||
Also, when `ordering' is RETURN_IN_ORDER,
|
||||
each non-option ARGV-element is returned here. */
|
||||
|
||||
extern char *optarg;
|
||||
|
||||
/* Index in ARGV of the next element to be scanned.
|
||||
This is used for communication to and from the caller
|
||||
and for communication between successive calls to `getopt'.
|
||||
|
||||
On entry to `getopt', zero means this is the first call; initialize.
|
||||
|
||||
When `getopt' returns -1, this is the index of the first of the
|
||||
non-option elements that the caller should itself scan.
|
||||
|
||||
Otherwise, `optind' communicates from one call to the next
|
||||
how much of ARGV has been scanned so far. */
|
||||
|
||||
extern int optind;
|
||||
|
||||
/* Callers store zero here to inhibit the error message `getopt' prints
|
||||
for unrecognized options. */
|
||||
|
||||
extern int opterr;
|
||||
|
||||
/* Set to an option character which was unrecognized. */
|
||||
|
||||
extern int optopt;
|
||||
|
||||
#ifndef __need_getopt
|
||||
/* Describe the long-named options requested by the application.
|
||||
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
||||
of `struct option' terminated by an element containing a name which is
|
||||
zero.
|
||||
|
||||
The field `has_arg' is:
|
||||
no_argument (or 0) if the option does not take an argument,
|
||||
required_argument (or 1) if the option requires an argument,
|
||||
optional_argument (or 2) if the option takes an optional argument.
|
||||
|
||||
If the field `flag' is not NULL, it points to a variable that is set
|
||||
to the value given in the field `val' when the option is found, but
|
||||
left unchanged if the option is not found.
|
||||
|
||||
To have a long-named option do something other than set an `int' to
|
||||
a compiled-in constant, such as set a value from `optarg', set the
|
||||
option's `flag' field to zero and its `val' field to a nonzero
|
||||
value (the equivalent single-letter option character, if there is
|
||||
one). For long options that have a zero `flag' field, `getopt'
|
||||
returns the contents of the `val' field. */
|
||||
|
||||
struct option
|
||||
{
|
||||
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
const char *name;
|
||||
# else
|
||||
char *name;
|
||||
# endif
|
||||
/* has_arg can't be an enum because some compilers complain about
|
||||
type mismatches in all the code that assumes it is an int. */
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
|
||||
/* Names for the values of the `has_arg' field of `struct option'. */
|
||||
|
||||
# define no_argument 0
|
||||
# define required_argument 1
|
||||
# define optional_argument 2
|
||||
#endif /* need getopt */
|
||||
|
||||
|
||||
/* Get definitions and prototypes for functions to process the
|
||||
arguments in ARGV (ARGC of them, minus the program name) for
|
||||
options given in OPTS.
|
||||
|
||||
Return the option character from OPTS just read. Return -1 when
|
||||
there are no more options. For unrecognized options, or options
|
||||
missing arguments, `optopt' is set to the option letter, and '?' is
|
||||
returned.
|
||||
|
||||
The OPTS string is a list of characters which are recognized option
|
||||
letters, optionally followed by colons, specifying that that letter
|
||||
takes an argument, to be placed in `optarg'.
|
||||
|
||||
If a letter in OPTS is followed by two colons, its argument is
|
||||
optional. This behavior is specific to the GNU `getopt'.
|
||||
|
||||
The argument `--' causes premature termination of argument
|
||||
scanning, explicitly telling `getopt' that there are no more
|
||||
options.
|
||||
|
||||
If OPTS begins with `--', then non-option arguments are treated as
|
||||
arguments to the option '\0'. This behavior is specific to the GNU
|
||||
`getopt'. */
|
||||
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
||||
# ifdef __GNU_LIBRARY__
|
||||
/* Many other libraries have conflicting prototypes for getopt, with
|
||||
differences in the consts, in stdlib.h. To avoid compilation
|
||||
errors, only prototype getopt for the GNU C library. */
|
||||
extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
|
||||
# else /* not __GNU_LIBRARY__ */
|
||||
//extern int getopt ();
|
||||
# endif /* __GNU_LIBRARY__ */
|
||||
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
extern int getopt_long_only (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind);
|
||||
|
||||
/* Internal only. Users should not call this directly. */
|
||||
extern int _getopt_internal (int ___argc, char *const *___argv,
|
||||
const char *__shortopts,
|
||||
const struct option *__longopts, int *__longind,
|
||||
int __long_only);
|
||||
# endif
|
||||
#else /* not __STDC__ */
|
||||
extern int getopt ();
|
||||
# ifndef __need_getopt
|
||||
extern int getopt_long ();
|
||||
extern int getopt_long_only ();
|
||||
|
||||
extern int _getopt_internal ();
|
||||
# endif
|
||||
#endif /* __STDC__ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure we later can get all the definitions and declarations. */
|
||||
#undef __need_getopt
|
||||
|
||||
#endif /* getopt.h */
|
@ -7,7 +7,7 @@
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "util/exception.hh"
|
||||
#include "util/file.hh"
|
||||
#include "util/mmap.hh"
|
||||
#include "util/portability.hh"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
namespace util {
|
||||
|
||||
@ -52,11 +52,14 @@ void scoped_memory::call_realloc(std::size_t size) {
|
||||
}
|
||||
}
|
||||
|
||||
void *MapOrThrow(std::size_t size, bool for_write, int flags, bool prefault, int fd, off_t offset) {
|
||||
void *MapOrThrow(std::size_t size, bool for_write, int flags, bool prefault, FD fd, off_t offset) {
|
||||
#ifdef MAP_POPULATE // Linux specific
|
||||
if (prefault) {
|
||||
flags |= MAP_POPULATE;
|
||||
}
|
||||
#elif WIN32
|
||||
// TODO WIN32
|
||||
|
||||
#endif
|
||||
int protect = for_write ? (PROT_READ | PROT_WRITE) : PROT_READ;
|
||||
void *ret = mmap(NULL, size, protect, flags, fd, offset);
|
||||
@ -74,7 +77,7 @@ const int kFileFlags =
|
||||
#endif
|
||||
;
|
||||
|
||||
void MapRead(LoadMethod method, int fd, off_t offset, std::size_t size, scoped_memory &out) {
|
||||
void MapRead(LoadMethod method, FD fd, off_t offset, std::size_t size, scoped_memory &out) {
|
||||
switch (method) {
|
||||
case LAZY:
|
||||
out.reset(MapOrThrow(size, false, kFileFlags, false, fd, offset), size, scoped_memory::MMAP_ALLOCATED);
|
||||
@ -91,7 +94,11 @@ void MapRead(LoadMethod method, int fd, off_t offset, std::size_t size, scoped_m
|
||||
case READ:
|
||||
out.reset(malloc(size), size, scoped_memory::MALLOC_ALLOCATED);
|
||||
if (!out.get()) UTIL_THROW(util::ErrnoException, "Allocating " << size << " bytes with malloc");
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
if (-1 == lseek(fd, offset, SEEK_SET)) UTIL_THROW(ErrnoException, "lseek to " << offset << " in fd " << fd << " failed.");
|
||||
#endif
|
||||
ReadOrThrow(fd, out.get(), size);
|
||||
break;
|
||||
}
|
||||
@ -104,12 +111,17 @@ void *MapAnonymous(std::size_t size) {
|
||||
#else
|
||||
MAP_ANON // BSD
|
||||
#endif
|
||||
| MAP_PRIVATE, false, -1, 0);
|
||||
| MAP_PRIVATE, false, kBadFD, 0);
|
||||
}
|
||||
|
||||
void *MapZeroedWrite(const char *name, std::size_t size, scoped_fd &file) {
|
||||
#ifdef WIN32
|
||||
|
||||
#else
|
||||
file.reset(open(name, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH));
|
||||
if (-1 == file.get())
|
||||
#endif
|
||||
|
||||
if (kBadFD == file.get())
|
||||
UTIL_THROW(ErrnoException, "Failed to open " << name << " for writing");
|
||||
if (-1 == ftruncate(file.get(), size))
|
||||
UTIL_THROW(ErrnoException, "ftruncate on " << name << " to " << size << " failed");
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "util/portability.hh"
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace util {
|
||||
@ -94,9 +95,9 @@ typedef enum {
|
||||
extern const int kFileFlags;
|
||||
|
||||
// Wrapper around mmap to check it worked and hide some platform macros.
|
||||
void *MapOrThrow(std::size_t size, bool for_write, int flags, bool prefault, int fd, off_t offset = 0);
|
||||
void *MapOrThrow(std::size_t size, bool for_write, int flags, bool prefault, FD fd, off_t offset = 0);
|
||||
|
||||
void MapRead(LoadMethod method, int fd, off_t offset, std::size_t size, scoped_memory &out);
|
||||
void MapRead(LoadMethod method, FD fd, off_t offset, std::size_t size, scoped_memory &out);
|
||||
|
||||
void *MapAnonymous(std::size_t size);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef UTIL_MURMUR_HASH__
|
||||
#define UTIL_MURMUR_HASH__
|
||||
#include <cstddef>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
|
74
kenlm/util/portability.cc
Normal file
74
kenlm/util/portability.cc
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "util/portability.hh"
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
int RUSAGE_SELF = 0;
|
||||
|
||||
int sysconf(int) { return 0; }
|
||||
int msync(void*, int, int) { return 0; }
|
||||
int munmap(void *, int) { return 0; }
|
||||
void *mmap(void*, int, int, int, FD, OFF_T) { return 0; }
|
||||
int write(int, const void *, int) {return 0; }
|
||||
|
||||
//FILE *popen(const char*, const char*) { return 0; }
|
||||
//int pclose(FILE *) { return 0; }
|
||||
int close(FD fd) { return 0; }
|
||||
|
||||
|
||||
// to be implemented by boost
|
||||
int mkdtemp(const char*) { return 0; }
|
||||
|
||||
// done
|
||||
long lrint(float x)
|
||||
{
|
||||
long ret = (long) x;
|
||||
return ret;
|
||||
}
|
||||
|
||||
float strtof(const char *begin, char **end)
|
||||
{
|
||||
double ret = strtod(begin, end);
|
||||
return (float) ret;
|
||||
}
|
||||
|
||||
|
||||
int ftruncate (FD hfile, unsigned int size)
|
||||
{
|
||||
unsigned int curpos;
|
||||
/*
|
||||
HANDLE hfile;
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
hfile = (HANDLE) _get_osfhandle (fd);
|
||||
*/
|
||||
curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
|
||||
if (curpos == ~0
|
||||
|| SetFilePointer (hfile, size, NULL, FILE_BEGIN) == ~0
|
||||
|| !SetEndOfFile (hfile))
|
||||
{
|
||||
int error = GetLastError ();
|
||||
switch (error)
|
||||
{
|
||||
case ERROR_INVALID_HANDLE:
|
||||
errno = EBADF;
|
||||
break;
|
||||
default:
|
||||
errno = EIO;
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
127
kenlm/util/portability.hh
Normal file
127
kenlm/util/portability.hh
Normal file
@ -0,0 +1,127 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include "util/getopt.hh"
|
||||
|
||||
#undef max
|
||||
#undef min
|
||||
|
||||
typedef HANDLE FD;
|
||||
|
||||
const FD kBadFD = INVALID_HANDLE_VALUE;
|
||||
|
||||
typedef int ssize_t;
|
||||
|
||||
#define _SC_PAGE_SIZE 1
|
||||
#define MS_SYNC 1
|
||||
|
||||
int sysconf(int);
|
||||
int msync(void*, int, int);
|
||||
int ftruncate(FD, unsigned int);
|
||||
|
||||
long lrint(float);
|
||||
|
||||
/*
|
||||
struct timeval
|
||||
{
|
||||
float tv_sec, tv_usec;
|
||||
};
|
||||
|
||||
struct rusage
|
||||
{
|
||||
timeval ru_utime, ru_stime;
|
||||
};
|
||||
*/
|
||||
|
||||
//inline int getrusage(int, struct rusage*) { return 0; }
|
||||
//extern int RUSAGE_SELF;
|
||||
|
||||
typedef __int64 OFF_T;
|
||||
//#define OFF_T __int64
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
int mkdtemp(const char*);
|
||||
int munmap(void *, int);
|
||||
void *mmap(void*, int, int, int, FD, OFF_T);
|
||||
|
||||
#define PROT_READ 1
|
||||
#define PROT_WRITE 1
|
||||
#define MAP_FAILED (void*) 0x1
|
||||
#define MAP_SHARED 1
|
||||
#define MAP_ANON 1
|
||||
#define MAP_PRIVATE 1
|
||||
#define S_IRUSR 1
|
||||
#define S_IROTH 1
|
||||
#define S_IRGRP 1
|
||||
|
||||
int write(int, const void *, int);
|
||||
#define S_IRUSR 1
|
||||
#define S_IWUSR 1
|
||||
|
||||
//const char *strerror_r(int, const char *buf, int);
|
||||
|
||||
float strtof(const char *begin, char **end);
|
||||
//FILE *popen(const char*, const char*);
|
||||
//int pclose(FILE *);
|
||||
int close(FD fd);
|
||||
|
||||
#define dup(x) _dup(x)
|
||||
#define rmdir(x) _rmdir(x)
|
||||
#define strerror_r(errNum, buffer, numberOfElements) strerror_s(buffer, numberOfElements);
|
||||
|
||||
#else // assume UNIX OS
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
typedef int FD;
|
||||
const FD kBadFD = -1;
|
||||
|
||||
typedef off_t OFF_T;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UTIL_FUNC_NAME __PRETTY_FUNCTION__
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#define UTIL_FUNC_NAME __FUNCTION__
|
||||
#else
|
||||
#define UTIL_FUNC_NAME NULL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Bit-level packing routines */
|
||||
#ifdef __APPLE__
|
||||
#include <architecture/byte_order.h>
|
||||
#elif __linux__
|
||||
#include <endian.h>
|
||||
#elif WIN32
|
||||
// nothing
|
||||
#else
|
||||
#include <arpa/nameser_compat.h>
|
||||
#endif
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace util {
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <cstddef>
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace util {
|
||||
|
||||
|
@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug-withSRILM|Win32">
|
||||
<Configuration>Debug-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release-withSRILM|Win32">
|
||||
<Configuration>Release-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -24,15 +16,6 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -45,12 +28,6 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -66,17 +43,11 @@
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\moses\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -87,7 +58,7 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
@ -98,7 +69,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\moses\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -107,7 +78,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
@ -118,53 +89,6 @@
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\moses\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)\moses\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="processLexicalTable.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug-withSRILM|Win32">
|
||||
<Configuration>Debug-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release-withSRILM|Win32">
|
||||
<Configuration>Release-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -24,15 +16,6 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -45,12 +28,6 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -66,17 +43,11 @@
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -98,7 +69,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -118,53 +89,6 @@
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalOptions>/FORCE:MULTIPLE %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="processPhraseTable.cpp" />
|
||||
</ItemGroup>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -58,7 +58,7 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
@ -69,7 +69,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -78,7 +78,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -58,7 +58,7 @@
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
@ -69,7 +69,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -78,7 +78,7 @@
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>zlib.lib;$(OutDir)moses.lib;$(OutDir)OnDiskPt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>zlib.lib;$(SolutionDir)$(Configuration)\moses.lib;$(SolutionDir)$(Configuration)\kenlm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
12
moses.sln
12
moses.sln
@ -8,8 +8,14 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses", "moses\moses.vcxproj", "{8122157A-0DE5-44FF-8E5B-024ED6ACE7AF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-chart-cmd", "moses-chart-cmd\moses-chart-cmd.vcxproj", "{C3AF5C05-D4EC-41D2-8319-D1E69B9B5820}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3} = {42D29D99-FC9A-4860-BD84-7148BEF1DBD3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "moses-cmd", "moses-cmd\moses-cmd.vcxproj", "{E2233DB1-5592-46FE-9420-E529420612FA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3} = {42D29D99-FC9A-4860-BD84-7148BEF1DBD3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OnDiskPt", "OnDiskPt\OnDiskPt.vcxproj", "{8B07671B-CBAF-4514-AFFD-CE238CD427E9}"
|
||||
EndProject
|
||||
@ -25,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "extract-rules", "scripts\tr
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "score", "scripts\training\phrase-extract\score.vcxproj", "{34AC84C7-62A1-4BBE-BCA9-4E95B2341039}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kenlm", "kenlm\kenlm.vcxproj", "{42D29D99-FC9A-4860-BD84-7148BEF1DBD3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -79,6 +87,10 @@ Global
|
||||
{34AC84C7-62A1-4BBE-BCA9-4E95B2341039}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{34AC84C7-62A1-4BBE-BCA9-4E95B2341039}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{34AC84C7-62A1-4BBE-BCA9-4E95B2341039}.Release|Win32.Build.0 = Release|Win32
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{42D29D99-FC9A-4860-BD84-7148BEF1DBD3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug-withSRILM|Win32">
|
||||
<Configuration>Debug-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release-withSRILM|Win32">
|
||||
<Configuration>Release-withSRILM</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
@ -24,15 +16,6 @@
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
@ -45,12 +28,6 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
@ -64,15 +41,11 @@
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -91,7 +64,7 @@
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>C:\Program Files\boost\boost_1_47;$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -103,40 +76,6 @@
|
||||
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;LM_INTERNAL;LM_SRI;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/moses/src;$(SolutionDir)/kenlm;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LM_INTERNAL;LM_SRI;TRACE_ENABLE;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName).lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\AlignmentInfo.cpp" />
|
||||
<ClCompile Include="src\AlignmentInfoCollection.cpp" />
|
||||
@ -201,12 +140,8 @@
|
||||
<ClCompile Include="src\PhraseDictionary.cpp" />
|
||||
<ClCompile Include="src\PhraseDictionaryMemory.cpp" />
|
||||
<ClCompile Include="src\PhraseDictionaryNode.cpp">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug-withSRILM|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release-withSRILM|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.obj</ObjectFileName>
|
||||
<XMLDocumentationFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename)1.xdc</XMLDocumentationFileName>
|
||||
</ClCompile>
|
||||
|
@ -36,7 +36,7 @@ host_triplet = @host@
|
||||
subdir = .
|
||||
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(top_srcdir)/configure TODO config.guess config.sub depcomp \
|
||||
$(top_srcdir)/configure config.guess config.sub depcomp \
|
||||
install-sh ltmain.sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/boost.m4 \
|
||||
|
103
scripts/training/compact-rule-table/aclocal.m4
vendored
103
scripts/training/compact-rule-table/aclocal.m4
vendored
@ -13,12 +13,111 @@
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
|
||||
[m4_warning([this file was generated for autoconf 2.65.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
|
||||
[m4_warning([this file was generated for autoconf 2.68.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
|
||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
|
||||
#
|
||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
|
||||
# Written by Scott James Remnant, 2004.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5 lt~obsolete.m4
|
||||
|
||||
# These exist entirely to fool aclocal when bootstrapping libtool.
|
||||
#
|
||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
|
||||
# which have later been changed to m4_define as they aren't part of the
|
||||
# exported API, or moved to Autoconf or Automake where they belong.
|
||||
#
|
||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
|
||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
|
||||
# using a macro with the same name in our local m4/libtool.m4 it'll
|
||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
|
||||
# and doesn't know about Autoconf macros at all.)
|
||||
#
|
||||
# So we provide this file, which has a silly filename so it's always
|
||||
# included after everything else. This provides aclocal with the
|
||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
|
||||
# because those macros already exist, or will be overwritten later.
|
||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
|
||||
#
|
||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
|
||||
# Yes, that means every name once taken will need to remain here until
|
||||
# we give up compatibility with versions before 1.7, at which point
|
||||
# we need to keep only those names which we still refer to.
|
||||
|
||||
# This is to help aclocal find these macros, as it can't see m4_define.
|
||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
|
||||
|
||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
|
||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
|
||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
|
||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
|
||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
|
||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
|
||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
|
||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
|
||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
|
||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
|
||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
|
||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
|
||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
|
||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
|
||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
|
||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
|
||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
|
||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
|
||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
|
||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
|
||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
|
||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
|
||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
|
||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
|
||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
|
||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
|
||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
|
||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
|
||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
|
||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
|
||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
|
||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
|
||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
|
||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
|
||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
|
||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
|
||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
|
||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
|
||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
|
||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
|
||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
|
748
scripts/training/compact-rule-table/configure
vendored
748
scripts/training/compact-rule-table/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
timestamp for config.h
|
Loading…
Reference in New Issue
Block a user