Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
37196ab4f5 | |||
e96a627c55 | |||
7f2c209a06 | |||
b1a3eb23c7 | |||
35b8b389ff | |||
d8493554cd | |||
a40e730bf0 | |||
056b1c3087 | |||
7127b8ea31 | |||
82906899de | |||
566d40bd05 | |||
6a8cd1ec80 | |||
b0db806f5e | |||
439dcb35d1 | |||
ad07539cb6 | |||
a7c1481f87 | |||
c7bc2d0aa6 |
12
.gitmodules
vendored
12
.gitmodules
vendored
@ -1,21 +1,21 @@
|
||||
[submodule "lib/stdex"]
|
||||
path = lib/stdex
|
||||
url = https://github.com/Amebis/stdex.git
|
||||
url = https://git.amebis.si/Amebis/stdex.git
|
||||
[submodule "lib/WinStd"]
|
||||
path = lib/WinStd
|
||||
url = https://github.com/Amebis/WinStd.git
|
||||
url = https://git.amebis.si/Amebis/WinStd.git
|
||||
[submodule "lib/wxExtend"]
|
||||
path = lib/wxExtend
|
||||
url = https://github.com/Amebis/wxExtend.git
|
||||
url = https://git.amebis.si/Amebis/wxExtend.git
|
||||
[submodule "MSI/MSIBuild"]
|
||||
path = MSI/MSIBuild
|
||||
url = https://github.com/Amebis/MSIBuild.git
|
||||
url = https://git.amebis.si/Amebis/MSIBuild.git
|
||||
[submodule "MSI/MSICA"]
|
||||
path = MSI/MSICA
|
||||
url = https://github.com/Amebis/MSICA.git
|
||||
url = https://git.amebis.si/Amebis/MSICA.git
|
||||
[submodule "Updater"]
|
||||
path = Updater
|
||||
url = https://github.com/Amebis/Updater.git
|
||||
url = https://git.amebis.si/Amebis/Updater.git
|
||||
[submodule "lib/oatpp"]
|
||||
path = lib/oatpp
|
||||
url = https://github.com/oatpp/oatpp.git
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit d2069d779960d7760ed75d36eb144f0cc3bab6ce
|
||||
Subproject commit f989fdc827d8fa731977d1771097cf038a50e145
|
Binary file not shown.
2
Updater
2
Updater
@ -1 +1 @@
|
||||
Subproject commit 46495773c213359200e4294ddcac828a4887e5a9
|
||||
Subproject commit a98ef46c5d38dec796dcb78f48240c17f743e3af
|
@ -150,7 +150,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
dst = std::move(dst2);
|
||||
dst2.clear();
|
||||
|
||||
map.invert();
|
||||
for (auto& m : map)
|
||||
m.invert();
|
||||
m_mapping.push_back(std::move(map));
|
||||
map.clear();
|
||||
}
|
||||
@ -161,7 +162,8 @@ void wxZRColaComposerPanel::SynchronizePanels()
|
||||
dst = std::move(dst2);
|
||||
dst2.clear();
|
||||
|
||||
map.invert();
|
||||
for (auto& m : map)
|
||||
m.invert();
|
||||
m_mapping.push_back(std::move(map));
|
||||
map.clear();
|
||||
}
|
||||
@ -203,16 +205,16 @@ void wxZRColaComposerPanel::OnSourcePaint(wxPaintEvent& event)
|
||||
m_selSource.second = to;
|
||||
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = (long)m_mappingSourceHex.to_dst(from),
|
||||
m_selSourceHex.second = (long)m_mappingSourceHex.to_dst(to ));
|
||||
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, from),
|
||||
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, to ));
|
||||
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = (long)MapToDestination(from),
|
||||
m_selDestination.second = (long)MapToDestination(to ));
|
||||
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = (long)m_mappingDestinationHex.to_dst(m_selDestination.first ),
|
||||
m_selDestinationHex.second = (long)m_mappingDestinationHex.to_dst(m_selDestination.second));
|
||||
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.first ),
|
||||
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.second));
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,16 +232,16 @@ void wxZRColaComposerPanel::OnSourceHexPaint(wxPaintEvent& event)
|
||||
m_selSourceHex.second = to;
|
||||
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = (long)m_mappingSourceHex.to_src(from),
|
||||
m_selSource.second = (long)m_mappingSourceHex.to_src(to ));
|
||||
m_selSource.first = (long)stdex::dst2src<size_t>(m_mappingSourceHex, from),
|
||||
m_selSource.second = (long)stdex::dst2src<size_t>(m_mappingSourceHex, to ));
|
||||
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = (long)MapToDestination(m_selSource.first ),
|
||||
m_selDestination.second = (long)MapToDestination(m_selSource.second));
|
||||
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = (long)m_mappingDestinationHex.to_dst(m_selDestination.first ),
|
||||
m_selDestinationHex.second = (long)m_mappingDestinationHex.to_dst(m_selDestination.second));
|
||||
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.first ),
|
||||
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, m_selDestination.second));
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,16 +278,16 @@ void wxZRColaComposerPanel::OnDestinationPaint(wxPaintEvent& event)
|
||||
m_selDestination.second = to;
|
||||
|
||||
m_destinationHex->SetSelection(
|
||||
m_selDestinationHex.first = (long)m_mappingDestinationHex.to_dst(from),
|
||||
m_selDestinationHex.second = (long)m_mappingDestinationHex.to_dst(to ));
|
||||
m_selDestinationHex.first = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, from),
|
||||
m_selDestinationHex.second = (long)stdex::src2dst<size_t>(m_mappingDestinationHex, to ));
|
||||
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = (long)MapToSource(from),
|
||||
m_selSource.second = (long)MapToSource(to ));
|
||||
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = (long)m_mappingSourceHex.to_dst(m_selSource.first ),
|
||||
m_selSourceHex.second = (long)m_mappingSourceHex.to_dst(m_selSource.second));
|
||||
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.first ),
|
||||
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.second));
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,16 +305,16 @@ void wxZRColaComposerPanel::OnDestinationHexPaint(wxPaintEvent& event)
|
||||
m_selDestinationHex.second = to;
|
||||
|
||||
m_destination->SetSelection(
|
||||
m_selDestination.first = (long)m_mappingDestinationHex.to_src(from),
|
||||
m_selDestination.second = (long)m_mappingDestinationHex.to_src(to ));
|
||||
m_selDestination.first = (long)stdex::dst2src<size_t>(m_mappingDestinationHex, from),
|
||||
m_selDestination.second = (long)stdex::dst2src<size_t>(m_mappingDestinationHex, to ));
|
||||
|
||||
m_source->SetSelection(
|
||||
m_selSource.first = (long)MapToSource(m_selDestination.first ),
|
||||
m_selSource.second = (long)MapToSource(m_selDestination.second));
|
||||
|
||||
m_sourceHex->SetSelection(
|
||||
m_selSourceHex.first = (long)m_mappingSourceHex.to_dst(m_selSource.first ),
|
||||
m_selSourceHex.second = (long)m_mappingSourceHex.to_dst(m_selSource.second));
|
||||
m_selSourceHex.first = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.first ),
|
||||
m_selSourceHex.second = (long)stdex::src2dst<size_t>(m_mappingSourceHex, m_selSource.second));
|
||||
}
|
||||
}
|
||||
|
||||
@ -416,8 +418,8 @@ void wxZRColaComposerPanel::SetHexValue(wxTextCtrl *wnd, std::pair<long, long> &
|
||||
|
||||
wnd->SetValue(hex);
|
||||
wnd->SetSelection(
|
||||
range.first = (long)mapping.to_dst(from),
|
||||
range.second = (long)mapping.to_dst(to ));
|
||||
range.first = (long)stdex::src2dst<size_t>(mapping, from),
|
||||
range.second = (long)stdex::src2dst<size_t>(mapping, to ));
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ protected:
|
||||
inline size_t wxZRColaComposerPanel::MapToDestination(_In_ size_t src) const
|
||||
{
|
||||
for (auto m = m_mapping.cbegin(), m_end = m_mapping.cend(); m != m_end; ++m)
|
||||
src = m->to_dst(src);
|
||||
src = stdex::src2dst(*m, src);
|
||||
|
||||
return src;
|
||||
}
|
||||
@ -106,7 +106,7 @@ inline size_t wxZRColaComposerPanel::MapToDestination(_In_ size_t src) const
|
||||
inline size_t wxZRColaComposerPanel::MapToSource(_In_ size_t dst) const
|
||||
{
|
||||
for (auto m = m_mapping.crbegin(), m_end = m_mapping.crend(); m != m_end; ++m)
|
||||
dst = m->to_src(dst);
|
||||
dst = stdex::dst2src(*m, dst);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ namespace ZRCola {
|
||||
///
|
||||
/// Character description index key comparator
|
||||
///
|
||||
struct character_desc_idx_less : public std::binary_function<std::wstring, std::wstring, bool>
|
||||
struct character_desc_idx_less
|
||||
{
|
||||
inline bool operator()(const std::wstring& _Left, const std::wstring& _Right) const
|
||||
{
|
||||
|
@ -981,10 +981,10 @@ int _tmain(int argc, _TCHAR *argv[])
|
||||
<< "\"Content-Transfer-Encoding: 8bit\\n\"" << endl
|
||||
<< "\"X-Generator: ZRColaCompile\\n\"" << endl;
|
||||
|
||||
wstring_convert<codecvt_utf8<wchar_t>> conv;
|
||||
charset_encoder<wchar_t, char> conv(stdex::wchar_t_charset, charset_id::utf8);
|
||||
for (auto p = pot.cbegin(); p != pot.cend(); ++p) {
|
||||
// Convert UTF-16 to UTF-8 and escape.
|
||||
string t(conv.to_bytes(*p)), u;
|
||||
string t(conv.convert(*p)), u;
|
||||
for (size_t i = 0, n = t.size(); i < n; i++) {
|
||||
char c = t[i];
|
||||
switch (c) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdex/sal.hpp>
|
||||
#include <stdex/compat.hpp>
|
||||
#include <iconv.h>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<DisableSpecificWarnings>4100;4505</DisableSpecificWarnings>
|
||||
<SupportJustMyCode>false</SupportJustMyCode>
|
||||
<EnablePREfast>true</EnablePREfast>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
@ -9,7 +9,7 @@
|
||||
// Product version as a single DWORD
|
||||
// Note: Used for version comparison within C/C++ code.
|
||||
//
|
||||
#define PRODUCT_VERSION 0x02070000
|
||||
#define PRODUCT_VERSION 0x02070100
|
||||
|
||||
//
|
||||
// Product version by components
|
||||
@ -19,26 +19,26 @@
|
||||
//
|
||||
#define PRODUCT_VERSION_MAJ 2
|
||||
#define PRODUCT_VERSION_MIN 7
|
||||
#define PRODUCT_VERSION_REV 0
|
||||
#define PRODUCT_VERSION_REV 1
|
||||
#define PRODUCT_VERSION_BUILD 0
|
||||
|
||||
//
|
||||
// Human readable product version and build year for UI
|
||||
//
|
||||
#define PRODUCT_VERSION_STR "2.7"
|
||||
#define PRODUCT_BUILD_YEAR_STR "2023"
|
||||
#define PRODUCT_VERSION_STR "2.7.1"
|
||||
#define PRODUCT_BUILD_YEAR_STR "2024"
|
||||
|
||||
//
|
||||
// Numerical version presentation for ProductVersion propery in
|
||||
// MSI packages (syntax: N.N[.N[.N]])
|
||||
//
|
||||
#define PRODUCT_VERSION_INST "2.7"
|
||||
#define PRODUCT_VERSION_INST "2.7.1"
|
||||
|
||||
//
|
||||
// The product code for ProductCode property in MSI packages
|
||||
// Replace with new on every version change, regardless how minor it is.
|
||||
//
|
||||
#define PRODUCT_VERSION_GUID "{BD675AE4-7800-412A-9F89-1C213B722B16}"
|
||||
#define PRODUCT_VERSION_GUID "{9423BEC3-3159-4130-8C3E-48D5DE24D48A}"
|
||||
|
||||
//
|
||||
// The product vendor and application name for configuration keeping.
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8e323efef9b1305cddc41137bd0483f0a390e2ec
|
||||
Subproject commit 6dead076a2e48e7f561c6e72e027c48ffcbb07be
|
@ -66,7 +66,6 @@
|
||||
<ClCompile Include="..\src\common.cpp" />
|
||||
<ClCompile Include="..\src\highlight.cpp" />
|
||||
<ClCompile Include="..\src\language.cpp" />
|
||||
<ClCompile Include="..\src\mapping.cpp" />
|
||||
<ClCompile Include="..\src\pch.cpp">
|
||||
<PrecompiledHeader>Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
|
@ -14,9 +14,6 @@
|
||||
<ClCompile Include="..\src\pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\mapping.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\translate.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <stdex/compat.hpp>
|
||||
#include <stdex/mapping.hpp>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -714,57 +715,15 @@ namespace ZRCola {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Source-destination index transformation mapping
|
||||
///
|
||||
struct mapping {
|
||||
public:
|
||||
size_t src; ///< Character index in source string
|
||||
size_t dst; ///< Character index in destination string
|
||||
|
||||
inline mapping() : src(0), dst(0) {};
|
||||
inline mapping(_In_ size_t s, _In_ size_t d) : src(s), dst(d) {}
|
||||
|
||||
///
|
||||
/// Reverses source and destination indexes
|
||||
///
|
||||
inline void invert() { size_t tmp = src; src = dst; dst = tmp; }
|
||||
};
|
||||
|
||||
using mapping = stdex::mapping<size_t>;
|
||||
|
||||
///
|
||||
/// A vector for destination-source index transformation mapping
|
||||
///
|
||||
class mapping_vector : public std::vector<mapping> {
|
||||
public:
|
||||
///
|
||||
/// Transforms character index of destination to source
|
||||
///
|
||||
/// \param[in] decmp Character index in destination string
|
||||
///
|
||||
/// \returns Character index in source string
|
||||
///
|
||||
size_t to_src(_In_ size_t dst) const;
|
||||
|
||||
///
|
||||
/// Transforms source index to destination index
|
||||
///
|
||||
/// \param[in] cmp Character index in source string
|
||||
///
|
||||
/// \returns Character index in destination string
|
||||
///
|
||||
size_t to_dst(_In_ size_t src) const;
|
||||
|
||||
///
|
||||
/// Reverses source and destination indexes
|
||||
///
|
||||
inline void invert()
|
||||
{
|
||||
for (iterator i = begin(), iEnd = end(); i != iEnd; ++i)
|
||||
i->invert();
|
||||
}
|
||||
};
|
||||
using mapping_vector = std::vector<mapping>;
|
||||
|
||||
///
|
||||
/// Binary compares two strings
|
||||
|
@ -12,16 +12,6 @@ namespace ZRCola {
|
||||
class translation_db;
|
||||
}
|
||||
|
||||
///
|
||||
/// Reads translation database from a stream
|
||||
///
|
||||
/// \param[in ] stream Input stream
|
||||
/// \param[out] db Translation database
|
||||
///
|
||||
/// \returns The stream \p stream
|
||||
///
|
||||
inline std::istream& operator >>(_In_ std::istream& stream, _Out_ ZRCola::translation_db &db);
|
||||
|
||||
#include <algorithm>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
Copyright © 2015-2022 Amebis
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
|
||||
size_t ZRCola::mapping_vector::to_src(_In_ size_t dst) const
|
||||
{
|
||||
if (empty()) {
|
||||
// One-to-one mapping.
|
||||
return dst;
|
||||
}
|
||||
|
||||
for (size_type l = 0, r = size();;) {
|
||||
if (l < r) {
|
||||
size_type m = (l + r) / 2;
|
||||
const mapping &el = (*this)[m];
|
||||
|
||||
if ( dst < el.dst) r = m;
|
||||
else if (el.dst < dst) l = m + 1;
|
||||
else {
|
||||
// An exact match found.
|
||||
return el.src;
|
||||
}
|
||||
} else if (l) {
|
||||
// We found a map interval.
|
||||
const mapping &el = (*this)[l - 1];
|
||||
return el.src + (dst - el.dst);
|
||||
} else {
|
||||
// The destination character index is left of the first transformation.
|
||||
const mapping &el = (*this)[0];
|
||||
return std::min<size_t>(dst, el.src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
size_t ZRCola::mapping_vector::to_dst(_In_ size_t src) const
|
||||
{
|
||||
if (empty()) {
|
||||
// One-to-one mapping.
|
||||
return src;
|
||||
}
|
||||
|
||||
for (size_type l = 0, r = size();;) {
|
||||
if (l < r) {
|
||||
size_type m = (l + r) / 2;
|
||||
const mapping &el = (*this)[m];
|
||||
|
||||
if ( src < el.src) r = m;
|
||||
else if (el.src < src) l = m + 1;
|
||||
else {
|
||||
// An exact match found.
|
||||
return el.dst;
|
||||
}
|
||||
} else if (l) {
|
||||
// We found a map interval.
|
||||
const mapping &el = (*this)[l - 1];
|
||||
return el.dst + (src - el.src);
|
||||
} else {
|
||||
// The source character index is left of the first transformation.
|
||||
const mapping &el = (*this)[0];
|
||||
return std::min<size_t>(src, el.dst);
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
Subproject commit 1e5b0c49179c75508498c91660ae12a7866edebf
|
||||
Subproject commit 14ca5e55c8a7c8265b090e1704463c7ab42ca2ee
|
@ -1 +1 @@
|
||||
Subproject commit fedeef0beaaf9206c38026a110f56645da964803
|
||||
Subproject commit c1616b032e9597b072de6fae634ef242a6a67b1d
|
@ -1 +1 @@
|
||||
Subproject commit e3a59d1118053ed48dc15b83d17125da87c434dd
|
||||
Subproject commit 79ec08365068ab6e03b06caef13de0ce6b06fcd5
|
Loading…
x
Reference in New Issue
Block a user