diff options
author | Andreas Sturmlechner <asturm@gentoo.org> | 2023-01-23 20:34:37 +0100 |
---|---|---|
committer | Andreas Sturmlechner <asturm@gentoo.org> | 2023-01-24 10:34:31 +0100 |
commit | cae5530b67504151ae1480ac78ebe435cd199bd1 (patch) | |
tree | 938d65d05593bac2ee6a37e369f97d09eaa962b4 /app-text/sdcv | |
parent | app-text/podofo: drop 0.9.6_p20190928-r101, 0.9.7-r1 (diff) | |
download | gentoo-cae5530b67504151ae1480ac78ebe435cd199bd1.tar.gz gentoo-cae5530b67504151ae1480ac78ebe435cd199bd1.tar.bz2 gentoo-cae5530b67504151ae1480ac78ebe435cd199bd1.zip |
app-text/sdcv: drop 0.5.3
Closes: https://bugs.gentoo.org/888464
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'app-text/sdcv')
-rw-r--r-- | app-text/sdcv/Manifest | 1 | ||||
-rw-r--r-- | app-text/sdcv/files/sdcv-synonyms-bin-search.patch | 112 | ||||
-rw-r--r-- | app-text/sdcv/sdcv-0.5.3.ebuild | 74 |
3 files changed, 0 insertions, 187 deletions
diff --git a/app-text/sdcv/Manifest b/app-text/sdcv/Manifest index 6bd392c99eb6..0425d328344b 100644 --- a/app-text/sdcv/Manifest +++ b/app-text/sdcv/Manifest @@ -1,2 +1 @@ -DIST sdcv-0.5.3.tar.gz 62105 BLAKE2B 1424510cff2fa355d17884a31f8136f4c8a7bde071f387dd8a69b1d2d6b9c8e52869cd602b27b9966725370cf128fb62b8628e735f1faa92b78f75215462804f SHA512 73a305baad74d0584912e115d3de7395c8e88745fb69b4e5f1a345061629b0d4e05898bd589e96ce07948d52ba7c508ec4ab77862c8fadca5a2f19c5244e1442 DIST sdcv-0.5.4.tar.gz 66706 BLAKE2B 9cb481f497483b502bec18765b9cbc31e8dd278e30ebd29005158a724669e171181a82c837b63016b9e88a84973831587d2b137bbbdb2290a89a73d3f0917f81 SHA512 6bae3a2c0f37ed9380f54715626efeea0df75d2525baa583c0915bba4d082d9ece40ee799a1e1bb5d36b7ccebace853653b6fab57d472a432b910f690235ee21 diff --git a/app-text/sdcv/files/sdcv-synonyms-bin-search.patch b/app-text/sdcv/files/sdcv-synonyms-bin-search.patch deleted file mode 100644 index e3583b1a5fb6..000000000000 --- a/app-text/sdcv/files/sdcv-synonyms-bin-search.patch +++ /dev/null @@ -1,112 +0,0 @@ -ommit 4ae420734990ab9f5ccc038262368256b9323f4a -Merge: b66799f 994c1c7 -Author: Evgeniy Dushistov <dushistov@mail.ru> -Date: Wed Dec 23 04:30:13 2020 +0300 - - Merge pull request #67 from doozan/master - - Use binary search for synonyms, fixes #31 - -diff --git a/src/stardict_lib.cpp b/src/stardict_lib.cpp -index 0af4304..6b1f92b 100644 ---- a/src/stardict_lib.cpp -+++ b/src/stardict_lib.cpp -@@ -833,21 +833,23 @@ bool SynFile::load(const std::string &url, gulong wc) - { - struct stat stat_buf; - if (!stat(url.c_str(), &stat_buf)) { -- MapFile syn; -- if (!syn.open(url.c_str(), stat_buf.st_size)) -+ -+ if (!synfile.open(url.c_str(), stat_buf.st_size)) - return false; -- const gchar *current = syn.begin(); -+ -+ synlist.resize(wc + 1); -+ gchar *p1 = synfile.begin(); -+ - for (unsigned long i = 0; i < wc; i++) { - // each entry in a syn-file is: - // - 0-terminated string - // 4-byte index into .dict file in network byte order -- glib::CharStr lower_string{ g_utf8_casefold(current, -1) }; -- std::string synonym{ get_impl(lower_string) }; -- current += synonym.length() + 1; -- const guint32 idx = g_ntohl(get_uint32(current)); -- current += sizeof(idx); -- synonyms[synonym] = idx; -+ -+ synlist[i] = p1; -+ p1 += strlen(p1) + 1 + 4; - } -+ synlist[wc] = p1; -+ - return true; - } else { - return false; -@@ -856,13 +858,38 @@ bool SynFile::load(const std::string &url, gulong wc) - - bool SynFile::lookup(const char *str, glong &idx) - { -- glib::CharStr lower_string{ g_utf8_casefold(str, -1) }; -- auto it = synonyms.find(get_impl(lower_string)); -- if (it != synonyms.end()) { -- idx = it->second; -- return true; -+ bool bFound = false; -+ glong iTo = synlist.size() - 2; -+ if (iTo <0) return false; -+ -+ if (stardict_strcmp(str, get_key(0)) < 0) { -+ idx = 0; -+ } else if (stardict_strcmp(str, get_key(iTo)) > 0) { -+ idx = INVALID_INDEX; -+ } else { -+ glong iThisIndex = 0; -+ glong iFrom = 0; -+ gint cmpint; -+ while (iFrom <= iTo) { -+ iThisIndex = (iFrom + iTo) / 2; -+ cmpint = stardict_strcmp(str, get_key(iThisIndex)); -+ if (cmpint > 0) -+ iFrom = iThisIndex + 1; -+ else if (cmpint < 0) -+ iTo = iThisIndex - 1; -+ else { -+ bFound = true; -+ break; -+ } -+ } -+ if (!bFound) -+ idx = iFrom; //next -+ else { -+ const gchar *key = get_key(iThisIndex); -+ idx = g_ntohl(get_uint32(key+strlen(key)+1)); -+ } - } -- return false; -+ return bFound; - } - - bool Dict::Lookup(const char *str, glong &idx) -diff --git a/src/stardict_lib.hpp b/src/stardict_lib.hpp -index a629cbe..38f76f4 100644 ---- a/src/stardict_lib.hpp -+++ b/src/stardict_lib.hpp -@@ -102,11 +102,15 @@ public: - class SynFile - { - public: -+ SynFile() {} -+ ~SynFile() {} - bool load(const std::string &url, gulong wc); - bool lookup(const char *str, glong &idx); -+ const gchar *get_key(glong idx) { return synlist[idx]; } - - private: -- std::map<std::string, gulong> synonyms; -+ MapFile synfile; -+ std::vector<gchar *> synlist; - }; - - class Dict : public DictBase diff --git a/app-text/sdcv/sdcv-0.5.3.ebuild b/app-text/sdcv/sdcv-0.5.3.ebuild deleted file mode 100644 index 8f7ae8fc46d8..000000000000 --- a/app-text/sdcv/sdcv-0.5.3.ebuild +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -PLOCALES="cs fr ru sk uk zh_CN zh_TW" -inherit cmake plocale - -DESCRIPTION="Console version of Stardict program" -HOMEPAGE="https://dushistov.github.io/sdcv/" -SRC_URI="https://github.com/Dushistov/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -KEYWORDS="amd64 x86" -IUSE="darkterm nls readline test" -RESTRICT="!test? ( test )" - -RDEPEND=" - >=dev-libs/glib-2.36 - sys-libs/zlib - readline? ( sys-libs/readline:= ) -" -DEPEND="${RDEPEND}" -BDEPEND=" - nls? ( >=sys-devel/gettext-0.14.1 ) - test? ( app-misc/jq ) -" - -PATCHES=( - "${FILESDIR}/${PN}-0.5.3-t_list.patch" - "${FILESDIR}/${PN}-t_interactive.patch" - "${FILESDIR}/${PN}-synonyms-bin-search.patch" -) - -src_prepare() { - if use darkterm; then - sed -i 's/;34m/;36m/' src/libwrapper.cpp || die - fi - - rm_loc() { - rm "po/${1}.po" || die - } - plocale_for_each_disabled_locale rm_loc - - # do not install locale-specific man pages unless asked to - if ! has uk ${LINGUAS-uk}; then - sed -ni '/share\/man\/uk/!p' CMakeLists.txt || die - fi - - cmake_src_prepare -} - -src_configure() { - local mycmakeargs=( - -DENABLE_NLS="$(usex nls)" - -DWITH_READLINE="$(usex readline)" - -DBUILD_TESTS="$(usex test ON OFF)" - ) - cmake_src_configure -} - -src_compile() { - cmake_src_compile - use nls && cmake_src_compile lang -} - -src_install() { - # with USE=nls, but empty intersection of LINGUAS and list of - # supported translations, this directory is required, see bug 583386 - mkdir -p "${BUILD_DIR}/locale" - cmake_src_install - dodoc doc/DICTFILE_FORMAT -} |