Predefined translation sequences added to ZRCola.zrcdb database
This commit is contained in:
parent
937c263d56
commit
d9527fe70f
@ -249,6 +249,8 @@ ZRCola::DBSource::DBSource()
|
||||
ZRCola::DBSource::~DBSource()
|
||||
{
|
||||
// Manually release all COM objects related to the database before we close the database.
|
||||
m_pTranslationSets1.free();
|
||||
m_comTranslationSets.free();
|
||||
m_pTranslation1.free();
|
||||
m_comTranslation.free();
|
||||
m_pCharacterGroup1.free();
|
||||
@ -317,6 +319,23 @@ bool ZRCola::DBSource::Open(LPCTSTR filename)
|
||||
wxVERIFY(SUCCEEDED(params->Append(m_pTranslation1)));
|
||||
}
|
||||
|
||||
wxASSERT_MSG(!m_comTranslationSets, wxT("ADO command already created"));
|
||||
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADOCommand, NULL, CLSCTX_ALL, IID_IADOCommand, (LPVOID*)&m_comTranslationSets)));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslationSets->put_ActiveConnection(variant(m_db))));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslationSets->put_CommandType(adCmdText)));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslationSets->put_CommandText(bstr(L"SELECT [Script] "
|
||||
L"FROM [VRS_Script2SeqScr] "
|
||||
L"WHERE [ID]=? "
|
||||
L"ORDER BY [Rank] ASC"))));
|
||||
{
|
||||
// Create and add command parameters.
|
||||
com_obj<ADOParameters> params;
|
||||
wxVERIFY(SUCCEEDED(m_comTranslationSets->get_Parameters(¶ms)));
|
||||
wxASSERT_MSG(!m_pTranslationSets1, wxT("ADO command parameter already created"));
|
||||
wxVERIFY(SUCCEEDED(m_comTranslationSets->CreateParameter(bstr(L"@ID"), adInteger, adParamInput, 0, variant(DISP_E_PARAMNOTFOUND, VT_ERROR), &m_pTranslationSets1)));
|
||||
wxVERIFY(SUCCEEDED(params->Append(m_pTranslationSets1)));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0011: Could not open database (0x%x).\n"), (LPCTSTR)filename, hr);
|
||||
@ -847,6 +866,83 @@ bool ZRCola::DBSource::GetTranslationSet(const com_obj<ADORecordset>& rs, ZRCola
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectTranlationSeqs(com_obj<ADORecordset> &rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
rs.free();
|
||||
wxCHECK(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs)), false);
|
||||
|
||||
// Open it.
|
||||
if (FAILED(rs->Open(variant(
|
||||
L"SELECT DISTINCT [ID], [Descr], [Rank] "
|
||||
L"FROM [VRS_Script2Seq] "
|
||||
L"ORDER BY [Rank], [Descr]"), variant(m_db), adOpenStatic, adLockReadOnly, adCmdText)))
|
||||
{
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0060: Error loading translation sequences from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::GetTranslationSeq(const com_obj<ADORecordset>& rs, ZRCola::DBSource::transeq& ts) const
|
||||
{
|
||||
wxASSERT_MSG(rs, wxT("recordset is empty"));
|
||||
|
||||
com_obj<ADOFields> flds;
|
||||
wxVERIFY(SUCCEEDED(rs->get_Fields(&flds)));
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"ID"), &f)));
|
||||
wxCHECK(GetValue(f, ts.seq), false);
|
||||
}
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Rank"), &f)));
|
||||
wxCHECK(GetValue(f, ts.rank), false);
|
||||
}
|
||||
|
||||
{
|
||||
com_obj<ADOField> f;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Descr"), &f)));
|
||||
wxCHECK(GetValue(f, ts.name), false);
|
||||
}
|
||||
|
||||
// Read translation sequence sets from database.
|
||||
wxVERIFY(SUCCEEDED(m_pTranslationSets1->put_Value(variant(ts.seq))));
|
||||
com_obj<ADORecordset> rs_chars;
|
||||
wxVERIFY(SUCCEEDED(::CoCreateInstance(CLSID_CADORecordset, NULL, CLSCTX_ALL, IID_IADORecordset, (LPVOID*)&rs_chars)));
|
||||
wxVERIFY(SUCCEEDED(rs_chars->put_CursorLocation(adUseClient)));
|
||||
wxVERIFY(SUCCEEDED(rs_chars->put_CursorType(adOpenForwardOnly)));
|
||||
wxVERIFY(SUCCEEDED(rs_chars->put_LockType(adLockReadOnly)));
|
||||
if (FAILED(rs_chars->Open(variant(m_comTranslationSets), variant(DISP_E_PARAMNOTFOUND, VT_ERROR)))) {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0140: Error loading character group characters from database. Please make sure the file is ZRCola.zrc compatible.\n"), m_filename.c_str());
|
||||
LogErrors();
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
ts.sets.clear();
|
||||
com_obj<ADOFields> flds;
|
||||
wxVERIFY(SUCCEEDED(rs_chars->get_Fields(&flds)));
|
||||
com_obj<ADOField> f_set;
|
||||
wxVERIFY(SUCCEEDED(flds->get_Item(variant(L"Script"), &f_set)));
|
||||
size_t n = 0;
|
||||
for (VARIANT_BOOL eof = VARIANT_TRUE; SUCCEEDED(rs_chars->get_EOF(&eof)) && !eof; rs_chars->MoveNext(), n++) {
|
||||
int set;
|
||||
wxCHECK(GetValue(f_set, set), false);
|
||||
ts.sets.push_back(set);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ZRCola::DBSource::SelectKeySequences(com_obj<ADORecordset> &rs) const
|
||||
{
|
||||
// Create a new recordset.
|
||||
|
@ -137,6 +137,18 @@ namespace ZRCola {
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Translation sequence
|
||||
///
|
||||
class transeq {
|
||||
public:
|
||||
int seq; ///< ID
|
||||
int rank; ///< Rank
|
||||
std::wstring name; ///< Name
|
||||
std::vector<int> sets; ///< Sets
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Normalization permutation set
|
||||
///
|
||||
@ -638,6 +650,29 @@ namespace ZRCola {
|
||||
///
|
||||
bool GetTranslationSet(const winstd::com_obj<ADORecordset>& rs, transet& ts) const;
|
||||
|
||||
///
|
||||
/// Returns translation sequences
|
||||
///
|
||||
/// \param[out] rs Recordset with results
|
||||
///
|
||||
/// \returns
|
||||
/// - true when query succeeds
|
||||
/// - false otherwise
|
||||
///
|
||||
bool SelectTranlationSeqs(winstd::com_obj<ADORecordset>& rs) const;
|
||||
|
||||
///
|
||||
/// Returns translation sequence data
|
||||
///
|
||||
/// \param[in] rs Recordset with results
|
||||
/// \param[out] lang Language
|
||||
///
|
||||
/// \returns
|
||||
/// - true when succeeded
|
||||
/// - false otherwise
|
||||
///
|
||||
bool GetTranslationSeq(const winstd::com_obj<ADORecordset>& rs, transeq& ts) const;
|
||||
|
||||
///
|
||||
/// Returns key sequences
|
||||
///
|
||||
@ -833,6 +868,9 @@ namespace ZRCola {
|
||||
winstd::com_obj<ADOCommand> m_comTranslation; ///< ADO Command for SelectTranslations subquery
|
||||
winstd::com_obj<ADOParameter> m_pTranslation1; ///< \c m_comTranslations parameter
|
||||
|
||||
winstd::com_obj<ADOCommand> m_comTranslationSets; ///< ADO Command for GetTranslationSeq subquery
|
||||
winstd::com_obj<ADOParameter> m_pTranslationSets1; ///< \c m_comTranslationSets parameter
|
||||
|
||||
std::set<std::wstring> m_terms_ignore; ///< Terms to ignore when comparing characters
|
||||
};
|
||||
};
|
||||
@ -841,7 +879,7 @@ namespace ZRCola {
|
||||
inline ZRCola::translation_db& operator<<(_Inout_ ZRCola::translation_db &db, _In_ const ZRCola::DBSource::translation &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set id out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.set);
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.dst.rank && rec.dst.rank <= (int)0x00007fff, wxT("destination character rank out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.dst.rank);
|
||||
@ -865,7 +903,7 @@ inline ZRCola::translation_db& operator<<(_Inout_ ZRCola::translation_db &db, _I
|
||||
inline ZRCola::transet_db& operator<<(_Inout_ ZRCola::transet_db &db, _In_ const ZRCola::DBSource::transet &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set index out of bounds"));
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.set && rec.set <= (int)0x00007fff, wxT("translation set id out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.set);
|
||||
std::wstring::size_type n = rec.src.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation set source name overflow"));
|
||||
@ -881,6 +919,28 @@ inline ZRCola::transet_db& operator<<(_Inout_ ZRCola::transet_db &db, _In_ const
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::transeq_db& operator<<(_Inout_ ZRCola::transeq_db &db, _In_ const ZRCola::DBSource::transeq &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.seq && rec.seq <= (int)0x00007fff, wxT("translation sequence id out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.seq);
|
||||
wxASSERT_MSG((int)0xffff8000 <= rec.rank && rec.rank <= (int)0x00007fff, wxT("translation rank id out of bounds"));
|
||||
db.data.push_back((unsigned __int16)rec.rank);
|
||||
std::wstring::size_type n = rec.name.length();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation sequence name overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
n += rec.sets.size();
|
||||
wxASSERT_MSG(n <= 0xffff, wxT("translation sequence sets overflow"));
|
||||
db.data.push_back((unsigned __int16)n);
|
||||
db.data.insert(db.data.end(), rec.name.cbegin(), rec.name.cend());
|
||||
db.data.insert(db.data.end(), rec.sets.cbegin(), rec.sets.cend());
|
||||
db.idxTranSeq.push_back(idx);
|
||||
db.idxRank .push_back(idx);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
|
||||
inline ZRCola::keyseq_db& operator<<(_Inout_ ZRCola::keyseq_db &db, _In_ const ZRCola::DBSource::keyseq &rec)
|
||||
{
|
||||
unsigned __int32 idx = db.data.size();
|
||||
|
@ -421,8 +421,8 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
ZRCola::transet_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxTranSet.reserve(count);
|
||||
db.data .reserve(count*4);
|
||||
db.idxTranSet.reserve((count+1));
|
||||
db.data .reserve((count+1)*4);
|
||||
|
||||
// Add (de)composing translation set to index and data.
|
||||
ts.set = 0;
|
||||
@ -496,6 +496,58 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
// Write translations to file.
|
||||
dst << ZRCola::translation_rec(db_trans);
|
||||
|
||||
{
|
||||
// Get translation sequences.
|
||||
com_obj<ADORecordset> rs;
|
||||
if (src.SelectTranlationSeqs(rs)) {
|
||||
size_t count = src.GetRecordsetCount(rs);
|
||||
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
|
||||
ZRCola::DBSource::transeq ts;
|
||||
ZRCola::transeq_db db;
|
||||
|
||||
// Preallocate memory.
|
||||
db.idxTranSeq.reserve((count+1));
|
||||
db.idxRank .reserve((count+1));
|
||||
db.data .reserve((count+1)*4);
|
||||
|
||||
// Add basic ZRCola translation sequence to index and data.
|
||||
ts.seq = 0;
|
||||
ts.rank = 0;
|
||||
ts.name = L"ZRCola (De)composition";
|
||||
ts.sets.push_back(0);
|
||||
db << ts;
|
||||
if (build_pot)
|
||||
pot.insert(ts.name);
|
||||
|
||||
// Parse translation sequences and build index and data.
|
||||
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
|
||||
// Read translation sequence from the database.
|
||||
if (src.GetTranslationSeq(rs, ts)) {
|
||||
if (build_pot)
|
||||
pot.insert(ts.name);
|
||||
|
||||
// Add translation sequence to index and data.
|
||||
db << ts;
|
||||
} else
|
||||
has_errors = true;
|
||||
}
|
||||
|
||||
// Sort indices.
|
||||
db.idxTranSeq.sort();
|
||||
db.idxRank .sort();
|
||||
|
||||
// Write translation sequences to file.
|
||||
dst << ZRCola::transeq_rec(db);
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0025: Error getting translation sequence count from database or too many translation sequences.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
} else {
|
||||
_ftprintf(stderr, wxT("%s: error ZCC0024: Error getting translation sequences from database. Please make sure the file is ZRCola.zrc compatible.\n"), (LPCTSTR)filenameIn.c_str());
|
||||
has_errors = true;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Get key sequences.
|
||||
com_obj<ADORecordset> rs;
|
||||
|
@ -33,6 +33,11 @@
|
||||
#pragma warning(disable: 4251)
|
||||
#pragma warning(disable: 4512)
|
||||
|
||||
///
|
||||
/// Custom translation sequence ID
|
||||
///
|
||||
#define ZRCOLA_TRANSEQID_CUSTOM ((ZRCola::transeqid_t)-1)
|
||||
|
||||
|
||||
namespace ZRCola {
|
||||
///
|
||||
@ -40,6 +45,11 @@ namespace ZRCola {
|
||||
///
|
||||
typedef unsigned __int16 transetid_t;
|
||||
|
||||
///
|
||||
/// Translation sequence ID
|
||||
///
|
||||
typedef unsigned __int16 transeqid_t;
|
||||
|
||||
///
|
||||
/// Translation database
|
||||
///
|
||||
@ -425,11 +435,193 @@ namespace ZRCola {
|
||||
|
||||
|
||||
typedef ZRCOLA_API stdex::idrec::record<transet_db, recordid_t, recordsize_t, ZRCOLA_RECORD_ALIGN> transet_rec;
|
||||
|
||||
|
||||
///
|
||||
/// Translation sequence database
|
||||
///
|
||||
class ZRCOLA_API transeq_db {
|
||||
public:
|
||||
#pragma pack(push)
|
||||
#pragma pack(2)
|
||||
///
|
||||
/// Translation sequence data
|
||||
///
|
||||
struct transeq {
|
||||
public:
|
||||
transeqid_t seq; ///< Translation sequence ID
|
||||
unsigned __int16 rank; ///< Translation sequence rank
|
||||
|
||||
protected:
|
||||
unsigned __int16 name_to; ///< Translation sequence name end in \c data
|
||||
unsigned __int16 sets_to; ///< Translation sequence sets end in \c data
|
||||
wchar_t data[]; ///< Translation sequence name and sets
|
||||
|
||||
private:
|
||||
inline transeq(_In_ const transeq &other);
|
||||
inline transeq& operator=(_In_ const transeq &other);
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the translation sequence
|
||||
///
|
||||
/// \param[in] seq Translation sequence ID
|
||||
/// \param[in] rank Translation sequence rank
|
||||
/// \param[in] name Translation sequence source
|
||||
/// \param[in] name_len Number of UTF-16 characters in \p src
|
||||
/// \param[in] sets Translation sequence destination
|
||||
/// \param[in] sets_len Number of UTF-16 characters in \p sets
|
||||
///
|
||||
inline transeq(
|
||||
_In_opt_ transeqid_t seq = 0,
|
||||
_In_opt_ unsigned __int16 rank = 0,
|
||||
_In_opt_z_count_(name_len) const wchar_t *name = NULL,
|
||||
_In_opt_ size_t name_len = 0,
|
||||
_In_opt_count_ (sets_len) const transetid_t *sets = NULL,
|
||||
_In_opt_ size_t sets_len = 0)
|
||||
{
|
||||
this->seq = seq;
|
||||
this->rank = rank;
|
||||
this->name_to = static_cast<unsigned __int16>(name_len);
|
||||
if (name_len) memcpy(this->data, name, sizeof(wchar_t)*name_len);
|
||||
this->sets_to = static_cast<unsigned __int16>(this->name_to + sets_len);
|
||||
if (sets_len) memcpy(this->data + this->name_to, sets, sizeof(transetid_t)*sets_len);
|
||||
}
|
||||
|
||||
inline const wchar_t* name () const { return data; };
|
||||
inline wchar_t* name () { return data; };
|
||||
inline const wchar_t* name_end() const { return data + name_to; };
|
||||
inline wchar_t* name_end() { return data + name_to; };
|
||||
inline unsigned __int16 name_len() const { return name_to; };
|
||||
|
||||
inline const transeqid_t* sets () const { return reinterpret_cast<const transeqid_t*>(data + name_to); };
|
||||
inline transeqid_t* sets () { return reinterpret_cast< transeqid_t*>(data + name_to); };
|
||||
inline const transeqid_t* sets_end() const { return reinterpret_cast<const transeqid_t*>(data + sets_to); };
|
||||
inline transeqid_t* sets_end() { return reinterpret_cast< transeqid_t*>(data + sets_to); };
|
||||
inline unsigned __int16 sets_len() const { return sets_to - name_to; };
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
///
|
||||
/// Translation sequence index
|
||||
///
|
||||
class indexTranSeq : public index<unsigned __int16, unsigned __int32, transeq>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the index
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
indexTranSeq(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, transeq>(h) {}
|
||||
|
||||
///
|
||||
/// Compares two translation sequences by ID (for searching)
|
||||
///
|
||||
/// \param[in] a Pointer to first element
|
||||
/// \param[in] b Pointer to second element
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when a < b
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare(_In_ const transeq &a, _In_ const transeq &b) const
|
||||
{
|
||||
if (a.seq < b.seq) return -1;
|
||||
else if (a.seq > b.seq) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxTranSeq; ///< Translation sequence index
|
||||
|
||||
///
|
||||
/// Rank index
|
||||
///
|
||||
class indexRank : public index<unsigned __int16, unsigned __int32, transeq>
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the index
|
||||
///
|
||||
/// \param[in] h Reference to vector holding the data
|
||||
///
|
||||
indexRank(_In_ std::vector<unsigned __int16> &h) : index<unsigned __int16, unsigned __int32, transeq>(h) {}
|
||||
|
||||
///
|
||||
/// Compares two translation sets by rank (for searching)
|
||||
///
|
||||
/// \param[in] a Pointer to first element
|
||||
/// \param[in] b Pointer to second element
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when a < b
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare(_In_ const transeq &a, _In_ const transeq &b) const
|
||||
{
|
||||
if (a.rank < b.rank) return -1;
|
||||
else if (a.rank > b.rank) return +1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
///
|
||||
/// Compares two translation sets by rank (for sorting)
|
||||
///
|
||||
/// \param[in] a Pointer to first element
|
||||
/// \param[in] b Pointer to second element
|
||||
///
|
||||
/// \returns
|
||||
/// - <0 when a < b
|
||||
/// - =0 when a == b
|
||||
/// - >0 when a > b
|
||||
///
|
||||
virtual int compare_sort(_In_ const transeq &a, _In_ const transeq &b) const
|
||||
{
|
||||
if (a.rank < b.rank) return -1;
|
||||
else if (a.rank > b.rank) return +1;
|
||||
|
||||
unsigned __int16
|
||||
a_name_len = a.name_len(),
|
||||
b_name_len = b.name_len();
|
||||
int r = _wcsncoll(a.name(), b.name(), std::min<unsigned __int16>(a_name_len, b_name_len));
|
||||
if (r != 0) return r;
|
||||
if (a_name_len < b_name_len) return -1;
|
||||
else if (a_name_len > b_name_len) return +1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
} idxRank; ///< Rank index
|
||||
|
||||
std::vector<unsigned __int16> data; ///< Translation sequence data
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs the database
|
||||
///
|
||||
inline transeq_db() : idxTranSeq(data), idxRank(data) {}
|
||||
|
||||
///
|
||||
/// Clears the database
|
||||
///
|
||||
inline void clear()
|
||||
{
|
||||
idxTranSeq.clear();
|
||||
idxRank .clear();
|
||||
data .clear();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
typedef ZRCOLA_API stdex::idrec::record<transeq_db, recordid_t, recordsize_t, ZRCOLA_RECORD_ALIGN> transeq_rec;
|
||||
};
|
||||
|
||||
|
||||
const ZRCola::recordid_t ZRCola::translation_rec::id = *(ZRCola::recordid_t*)"TRN";
|
||||
const ZRCola::recordid_t ZRCola::transet_rec ::id = *(ZRCola::recordid_t*)"TSE";
|
||||
const ZRCola::recordid_t ZRCola::transeq_rec ::id = *(ZRCola::recordid_t*)"TSQ";
|
||||
|
||||
|
||||
///
|
||||
@ -569,4 +761,77 @@ inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::transe
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Writes translation sequence database to a stream
|
||||
///
|
||||
/// \param[in] stream Output stream
|
||||
/// \param[in] db Translation sequence database
|
||||
///
|
||||
/// \returns The stream \p stream
|
||||
///
|
||||
inline std::ostream& operator <<(_In_ std::ostream& stream, _In_ const ZRCola::transeq_db &db)
|
||||
{
|
||||
// Write translation sequence index.
|
||||
if (stream.fail()) return stream;
|
||||
stream << db.idxTranSeq;
|
||||
|
||||
// Write rank index.
|
||||
if (stream.fail()) return stream;
|
||||
stream << db.idxRank;
|
||||
|
||||
// Write data count.
|
||||
auto data_count = db.data.size();
|
||||
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__)
|
||||
// 4G check
|
||||
if (data_count > 0xffffffff) {
|
||||
stream.setstate(std::ios_base::failbit);
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
if (stream.fail()) return stream;
|
||||
unsigned __int32 count = (unsigned __int32)data_count;
|
||||
stream.write((const char*)&count, sizeof(count));
|
||||
|
||||
// Write data.
|
||||
if (stream.fail()) return stream;
|
||||
stream.write((const char*)db.data.data(), sizeof(unsigned __int16)*count);
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Reads translation sequence database from a stream
|
||||
///
|
||||
/// \param[in ] stream Input stream
|
||||
/// \param[out] db Translation sequence database
|
||||
///
|
||||
/// \returns The stream \p stream
|
||||
///
|
||||
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::transeq_db &db)
|
||||
{
|
||||
// Read translation sequence index.
|
||||
stream >> db.idxTranSeq;
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
// Read rank index.
|
||||
stream >> db.idxRank;
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
// Read data count.
|
||||
unsigned __int32 count;
|
||||
stream.read((char*)&count, sizeof(count));
|
||||
if (!stream.good()) return stream;
|
||||
|
||||
if (count) {
|
||||
// Read data.
|
||||
db.data.resize(count);
|
||||
stream.read((char*)db.data.data(), sizeof(unsigned __int16)*count);
|
||||
} else
|
||||
db.data.clear();
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
Binary file not shown.
@ -34,6 +34,9 @@ msgstr ""
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "CAPITAL Case » small Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr ""
|
||||
|
||||
@ -121,6 +124,9 @@ msgstr ""
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Modern) » Greek (Old)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Old)"
|
||||
msgstr ""
|
||||
|
||||
@ -241,6 +247,30 @@ msgstr ""
|
||||
msgid "Latin BdC"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Belarusian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Bulgarian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Macedonian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Russian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Serbian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Cyrillic (Ukrainian)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Greek (modern)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latin » Greek (old)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
@ -616,6 +646,9 @@ msgstr ""
|
||||
msgid "Units"
|
||||
msgstr ""
|
||||
|
||||
msgid "ZRCola (De)composition"
|
||||
msgstr ""
|
||||
|
||||
msgid "ZRCola Composed"
|
||||
msgstr ""
|
||||
|
||||
|
@ -9,7 +9,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"X-Generator: Poedit 2.0.2\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
@ -41,6 +41,9 @@ msgstr ""
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "CAPITAL Case » small Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr ""
|
||||
|
||||
@ -133,6 +136,9 @@ msgstr "Windows Griechisch (CP 1253)"
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Modern) » Greek (Old)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Greek (Old)"
|
||||
msgstr "Windows Griechisch (CP 1253)"
|
||||
@ -255,6 +261,37 @@ msgstr ""
|
||||
msgid "Latin BdC"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Belarusian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Bulgarian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Macedonian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Russian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Serbian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Ukrainian)"
|
||||
msgstr "Windows Kyrillisch (CP 1251)"
|
||||
|
||||
msgid "Latin » Greek (modern)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Greek (old)"
|
||||
msgstr "Windows Griechisch (CP 1253)"
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
@ -647,6 +684,9 @@ msgstr ""
|
||||
msgid "Units"
|
||||
msgstr ""
|
||||
|
||||
msgid "ZRCola (De)composition"
|
||||
msgstr ""
|
||||
|
||||
msgid "ZRCola Composed"
|
||||
msgstr ""
|
||||
|
||||
|
@ -9,7 +9,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"X-Generator: Poedit 2.0.2\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
@ -40,6 +40,9 @@ msgstr "боснийский – латиница"
|
||||
msgid "CAPITAL Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "CAPITAL Case » small Case"
|
||||
msgstr ""
|
||||
|
||||
msgid "Combine"
|
||||
msgstr "Средние замещающие знаки"
|
||||
|
||||
@ -133,6 +136,9 @@ msgstr "Греческие знаки"
|
||||
msgid "Greek (Modern)"
|
||||
msgstr ""
|
||||
|
||||
msgid "Greek (Modern) » Greek (Old)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Greek (Old)"
|
||||
msgstr "Греческие знаки"
|
||||
@ -256,6 +262,37 @@ msgstr "латинский"
|
||||
msgid "Latin BdC"
|
||||
msgstr "латинский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Belarusian)"
|
||||
msgstr "белорусский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Bulgarian)"
|
||||
msgstr "белорусский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Macedonian)"
|
||||
msgstr "македонский"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Russian)"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Serbian)"
|
||||
msgstr "Кириллические знаки"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Cyrillic (Ukrainian)"
|
||||
msgstr "украинский"
|
||||
|
||||
msgid "Latin » Greek (modern)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Latin » Greek (old)"
|
||||
msgstr "Греческие знаки"
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr "латышский"
|
||||
|
||||
@ -632,6 +669,9 @@ msgstr "украинский"
|
||||
msgid "Units"
|
||||
msgstr "Единицы"
|
||||
|
||||
msgid "ZRCola (De)composition"
|
||||
msgstr ""
|
||||
|
||||
msgid "ZRCola Composed"
|
||||
msgstr ""
|
||||
|
||||
|
@ -9,7 +9,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Generator: Poedit 1.8.11\n"
|
||||
"X-Generator: Poedit 2.0.2\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
@ -40,6 +40,9 @@ msgstr "bosanščina – latinica"
|
||||
msgid "CAPITAL Case"
|
||||
msgstr "VELIKE črke"
|
||||
|
||||
msgid "CAPITAL Case » small Case"
|
||||
msgstr "VELIKE črke » male črke"
|
||||
|
||||
msgid "Combine"
|
||||
msgstr "Srednji nadomestni znaki"
|
||||
|
||||
@ -127,6 +130,9 @@ msgstr "Grški znaki"
|
||||
msgid "Greek (Modern)"
|
||||
msgstr "grščina (sodobna)"
|
||||
|
||||
msgid "Greek (Modern) » Greek (Old)"
|
||||
msgstr "grščina (sodobna) » grščina (stara)"
|
||||
|
||||
msgid "Greek (Old)"
|
||||
msgstr "grščina (stara)"
|
||||
|
||||
@ -247,6 +253,30 @@ msgstr "latinščina ALE"
|
||||
msgid "Latin BdC"
|
||||
msgstr "latinščina BdC"
|
||||
|
||||
msgid "Latin » Cyrillic (Belarusian)"
|
||||
msgstr "latinica » cirilica (beloruščina)"
|
||||
|
||||
msgid "Latin » Cyrillic (Bulgarian)"
|
||||
msgstr "latinica » cirilica (bolgarščina)"
|
||||
|
||||
msgid "Latin » Cyrillic (Macedonian)"
|
||||
msgstr "latinica » cirilica (makedonščina)"
|
||||
|
||||
msgid "Latin » Cyrillic (Russian)"
|
||||
msgstr "latinica » cirilica (ruščina)"
|
||||
|
||||
msgid "Latin » Cyrillic (Serbian)"
|
||||
msgstr "latinica » cirilica (srbščina)"
|
||||
|
||||
msgid "Latin » Cyrillic (Ukrainian)"
|
||||
msgstr "latinica » cirilica (ukrajinščina)"
|
||||
|
||||
msgid "Latin » Greek (modern)"
|
||||
msgstr "latinica » grščina (sodobna)"
|
||||
|
||||
msgid "Latin » Greek (old)"
|
||||
msgstr "latinica » grščina (stara)"
|
||||
|
||||
msgid "Latvian"
|
||||
msgstr "letonščina"
|
||||
|
||||
@ -622,6 +652,9 @@ msgstr "ukrajinščina"
|
||||
msgid "Units"
|
||||
msgstr "Enote"
|
||||
|
||||
msgid "ZRCola (De)composition"
|
||||
msgstr "ZRCola (raz-)sestavljanje"
|
||||
|
||||
msgid "ZRCola Composed"
|
||||
msgstr "ZRCola sestavljeno"
|
||||
|
||||
@ -637,6 +670,9 @@ msgstr "brez + |"
|
||||
msgid "small Case"
|
||||
msgstr "male črke"
|
||||
|
||||
#~ msgid "ZRCola Decomposed » Composed"
|
||||
#~ msgstr "ZRCola razstavljeno » sestavljeno"
|
||||
|
||||
#~ msgid "Letter b"
|
||||
#~ msgstr "Črka b"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user