Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
build:
runs-on: ubuntu-24.04
env:
EMSCRIPTEN_VERSION: '4.0.20'
EMSCRIPTEN_VERSION: '4.0.22'
steps:
- uses: actions/checkout@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion libchewing
Submodule libchewing updated 97 files
+1 −0 .github/ISSUE_TEMPLATE/release-checklist.md
+9 −5 .github/workflows/ci.yml
+4 −0 .gitmodules
+25 −9 CMakeLists.txt
+162 −155 Cargo.lock
+15 −4 Cargo.toml
+52 −0 NEWS
+2 −2 README.md
+6 −5 capi/Cargo.toml
+1 −5 capi/cbindgen.toml
+806 −14 capi/include/chewing.h
+1,241 −231 capi/src/io.rs
+93 −830 capi/src/lib.rs
+71 −67 capi/src/logger.rs
+15 −4 capi/src/public.rs
+7 −0 capi/src/symbols-elf.map
+3 −0 capi/src/symbols-mach_o.map
+3 −0 capi/src/symbols-msvc.def
+4 −4 capi/src/version.rs
+8 −6 capi/tests/test-user-dictionary.rs
+1 −0 data
+0 −61 data/CMakeLists.txt
+0 −7,009 data/mini.src
+0 −26,146 data/phone.cin
+0 −44,089 data/phone.cin-CNS11643-complete.patch
+0 −1 data/svnrev
+0 −26 data/swkb.dat
+0 −13 data/symbols.dat
+0 −160,203 data/tsi.src
+0 −26,097 data/word.src
+9 −1 doc/CMakeLists.txt
+1 −1 doc/chewing-cli-info.1
+6 −9 doc/chewing-cli-init-database.1
+2 −2 doc/chewing-cli.1
+4 −4 fuzzer/Cargo.toml
+1 −1 fuzzer/src/bin/fuzzer.rs
+3 −3 fuzzer/src/bin/trieloader.rs
+1 −0 rustfmt.toml
+401 −362 src/conversion/chewing.rs
+3 −4 src/conversion/fuzzy.rs
+15 −42 src/conversion/mod.rs
+85 −84 src/conversion/simple.rs
+54 −73 src/dictionary/layered.rs
+73 −82 src/dictionary/loader.rs
+46 −70 src/dictionary/mod.rs
+42 −42 src/dictionary/sqlite.rs
+1 −1 src/dictionary/trie.asn1
+56 −42 src/dictionary/trie.rs
+37 −53 src/dictionary/trie_buf.rs
+2 −4 src/dictionary/uhash.rs
+2 −1 src/editor/abbrev.rs
+6 −6 src/editor/composition_editor.rs
+61 −21 src/editor/estimate.rs
+0 −47 src/editor/keyboard/colemak.rs
+0 −47 src/editor/keyboard/colemak_dh_ansi.rs
+0 −47 src/editor/keyboard/colemak_dh_orth.rs
+0 −47 src/editor/keyboard/dvorak.rs
+0 −25 src/editor/keyboard/dvorak_on_qwerty.rs
+0 −416 src/editor/keyboard/mod.rs
+0 −47 src/editor/keyboard/qgmlwy.rs
+0 −47 src/editor/keyboard/qwerty.rs
+0 −47 src/editor/keyboard/workman.rs
+587 −321 src/editor/mod.rs
+40 −37 src/editor/selection/phrase.rs
+1 −2 src/editor/selection/symbol.rs
+39 −41 src/editor/zhuyin_layout/dc26.rs
+56 −55 src/editor/zhuyin_layout/et.rs
+41 −39 src/editor/zhuyin_layout/et26.rs
+56 −55 src/editor/zhuyin_layout/ginyieh.rs
+56 −58 src/editor/zhuyin_layout/hsu.rs
+56 −55 src/editor/zhuyin_layout/ibm.rs
+3 −6 src/editor/zhuyin_layout/mod.rs
+48 −48 src/editor/zhuyin_layout/pinyin.rs
+56 −55 src/editor/zhuyin_layout/standard.rs
+283 −0 src/input.rs
+136 −0 src/input/keycode.rs
+856 −0 src/input/keymap.rs
+231 −0 src/input/keysym.rs
+14 −8 src/lib.rs
+122 −29 src/path.rs
+2 −3 src/zhuyin/bopomofo.rs
+6 −6 src/zhuyin/mod.rs
+0 −45 src/zhuyin/syllable.rs
+16 −1 tests/CMakeLists.txt
+140 −21 tests/test-bopomofo.c
+33 −19 tests/test-config.c
+3 −3 tests/test-keyboardless.c
+1 −0 tests/test-logger.c
+4 −4 tests/test-regression.c
+10 −1 tests/test-symbol.c
+3 −3 tests/test-userphrase.c
+1 −1 tests/testhelper/Cargo.toml
+8 −3 tools/Cargo.toml
+26 −4 tools/src/dump.rs
+0 −3 tools/src/flags.rs
+15 −10 tools/src/info.rs
+87 −39 tools/src/init_database.rs
2 changes: 1 addition & 1 deletion librime
48 changes: 28 additions & 20 deletions patches/libchewing.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1465dfb..ecc58d8 100644
index d1f1aa2..b707706 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,8 +71,17 @@ if(NOT Corrosion_FOUND)
@@ -75,7 +75,17 @@ corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES chewing_capi)
if(BUILD_TESTING)
corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES chewing_testhelper)
endif()

corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES chewing_capi)
-corrosion_import_crate(MANIFEST_PATH Cargo.toml CRATES chewing_testhelper)
+if (EMSCRIPTEN)
+ corrosion_add_target_rustflags(chewing_capi -C panic=unwind)
+ set(CARGO_FEATURES "")
Expand All @@ -21,9 +20,9 @@ index 1465dfb..ecc58d8 100644

if(WITH_SQLITE3)
corrosion_set_features(chewing_capi FEATURES sqlite)
@@ -158,8 +167,9 @@ set(ALL_INC
${INC_DIR}/mod_aux.h
)
@@ -168,8 +178,9 @@ if(NOT USE_SYSTEM_CHEWING_CLI)
set(CHEWING_CLI $<TARGET_FILE:chewing-cli>)
endif()

-add_subdirectory(doc)
+if (NOT EMSCRIPTEN)
Expand All @@ -32,7 +31,7 @@ index 1465dfb..ecc58d8 100644
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
@@ -176,7 +186,7 @@ target_include_directories(libchewing
@@ -183,7 +194,7 @@ target_include_directories(libchewing
)

corrosion_set_env_vars(chewing_capi
Expand All @@ -41,7 +40,7 @@ index 1465dfb..ecc58d8 100644
)
target_link_libraries(libchewing PRIVATE chewing_capi)
target_link_libraries(chewing_capi INTERFACE ${SQLite3_LIBRARIES})
@@ -227,13 +237,12 @@ endif()
@@ -234,12 +245,13 @@ endif()
install(FILES ${ALL_INC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/chewing)
install(FILES ${PROJECT_BINARY_DIR}/chewing.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
Expand All @@ -52,51 +51,60 @@ index 1465dfb..ecc58d8 100644
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+if(NOT EMSCRIPTEN)
install(
FILES
${PROJECT_BINARY_DIR}/data/dict/chewing/tsi.dat
@@ -249,7 +261,7 @@ install(
DESTINATION
${CMAKE_INSTALL_DATADIR}/libchewing
)
-install(IMPORTED_RUNTIME_ARTIFACTS chewing-cli DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif()

# generate CMake Config files
include(CMakePackageConfigHelpers)
diff --git a/Cargo.toml b/Cargo.toml
index 9d7b4f2..557bb18 100644
index fccb102..9022072 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,6 +28,7 @@ tempfile = { workspace = true }
[features]
default = []
@@ -30,6 +30,7 @@ default = []
sqlite = ["dep:rusqlite"]
sqlite-bundled = ["sqlite", "rusqlite/bundled"]
log = ["tracing/log"]
+threading = []

[workspace]
members = ["capi", "fuzzer", "tests/testhelper", "tools"]
diff --git a/src/dictionary/trie_buf.rs b/src/dictionary/trie_buf.rs
index dd51478..c2a8f34 100644
index 933e0ba..5a844fe 100644
--- a/src/dictionary/trie_buf.rs
+++ b/src/dictionary/trie_buf.rs
@@ -217,6 +217,7 @@ impl TrieBuf {
@@ -209,6 +209,7 @@ impl TrieBuf {

pub(crate) fn sync(&mut self) -> Result<(), UpdateDictionaryError> {
info!("Synchronize dictionary from disk...");
+ #[cfg(feature = "threading")] {
if let Some(join_handle) = self.join_handle.take() {
if !join_handle.is_finished() {
info!("Aborted. Wait until previous sync is finished.");
@@ -246,6 +247,7 @@ impl TrieBuf {
@@ -238,6 +239,7 @@ impl TrieBuf {
self.trie = Some(Trie::open(self.path().unwrap())?);
}
}
+ }
Ok(())
}

@@ -266,6 +268,7 @@ impl TrieBuf {
@@ -258,6 +260,7 @@ impl TrieBuf {
join_handle: None,
dirty: false,
};
+ #[cfg(feature = "threading")] {
self.join_handle = Some(thread::spawn(move || {
let mut builder = TrieBuilder::new();
info!("Saving snapshot...");
@@ -281,6 +284,30 @@ impl TrieBuf {
@@ -273,6 +276,30 @@ impl TrieBuf {
info!(" Done");
Ok(())
}));
Expand Down Expand Up @@ -127,7 +135,7 @@ index dd51478..c2a8f34 100644
self.dirty = false;
}
}
@@ -376,10 +403,12 @@ impl Drop for TrieBuf {
@@ -357,10 +384,12 @@ impl Drop for TrieBuf {
fn drop(&mut self) {
let _ = self.sync();
let _ = self.flush();
Expand Down
2 changes: 1 addition & 1 deletion scripts/boost.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from common import CMakeBuilder, MACOS_ARCH, PLATFORM, cache, ensure, sed

version = '1.89.0'
version = '1.90.0'

boost_dir = f'boost-{version}'
boost_tar = f'{boost_dir}-cmake.tar.xz'
Expand Down