Skip to content

Commit

Permalink
0.10.9: emscripten 3.1.63
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored and ksqsf committed Jul 19, 2024
1 parent 00e91ad commit c73ea17
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 66 deletions.
4 changes: 2 additions & 2 deletions checksum
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
05e34aaf2b388a96e6a52fb941e5299f public/rime.data
1985fb80ba5768f171d0108174c98abe public/rime.js
baecfa3a5f7f5fbf2aa7837d3952747a public/rime.wasm
aa1a409d9f050280b4be5f08d2e0becd public/rime.js
b9203c3a3b8f638431a99e0f3e630e93 public/rime.wasm
2 changes: 1 addition & 1 deletion librime-lua
15 changes: 1 addition & 14 deletions librime_patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53f9d537..64dfdba1 100644
index e167e228..9df29c9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.12)
Expand Down Expand Up @@ -102,19 +102,6 @@ index bb68bcdb..4ef84beb 100644
bool page_down_cycle() const { return page_down_cycle_; }
const string& select_keys() const { return select_keys_; }
void set_select_keys(const string& keys) { select_keys_ = keys; }
diff --git a/src/rime_api.h b/src/rime_api.h
index 44b2ea3f..d106a197 100644
--- a/src/rime_api.h
+++ b/src/rime_api.h
@@ -422,6 +422,8 @@ RIME_API const char* RimeGetSyncDir(void);

RIME_API const char* RimeGetUserId(void);

+RIME_API Bool RimeChangePage(RimeSessionId session_id, Bool backward);
+
/*! The API structure
* RimeApi is for rime v1.0+
*/
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 090a0fc0..a24cd51f 100644
--- a/tools/CMakeLists.txt
Expand Down
23 changes: 18 additions & 5 deletions opencc_patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee08591..24da933 100644
index 1acb75a..b9b49da 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -127,12 +127,23 @@ add_definitions(
@@ -152,12 +152,23 @@ add_definitions(
-DPACKAGE_NAME="${PACKAGE_NAME}"
)

Expand All @@ -27,7 +27,7 @@ index ee08591..24da933 100644
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_definitions(-O0 -g3)
endif ()
@@ -196,9 +207,6 @@ endif()
@@ -221,9 +232,6 @@ endif()
######## Subdirectories

add_subdirectory(src)
Expand All @@ -37,11 +37,24 @@ index ee08591..24da933 100644

######## Testing

diff --git a/deps/rapidjson-1.1.0/rapidjson/document.h b/deps/rapidjson-1.1.0/rapidjson/document.h
index e3e20df..ad362a6 100644
--- a/deps/rapidjson-1.1.0/rapidjson/document.h
+++ b/deps/rapidjson-1.1.0/rapidjson/document.h
@@ -322,7 +322,7 @@ struct GenericStringRef {
operator const Ch *() const { return s; }

const Ch* const s; //!< plain CharType pointer
- const SizeType length; //!< length of the string (excluding the trailing NULL terminator)
+ SizeType length; //!< length of the string (excluding the trailing NULL terminator)

private:
//! Disallow construction from non-const array
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c0a0b10..b8cdc73 100644
index 75eda02..c7bb8c5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -184,5 +184,3 @@ if (ENABLE_BENCHMARK)
@@ -204,5 +204,3 @@ if (ENABLE_BENCHMARK)
endif()

# Subdir
Expand Down
46 changes: 23 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libreservice/my-rime",
"version": "0.10.8",
"version": "0.10.9",
"files": [
"dist"
],
Expand Down Expand Up @@ -40,52 +40,52 @@
"preview": "vite preview --host"
},
"devDependencies": {
"@codemirror/language": "^6.10.1",
"@codemirror/language": "^6.10.2",
"@codemirror/legacy-modes": "^6.4.0",
"@libreservice/lazy-cache": "^0.1.2",
"@libreservice/micro-plum": "^0.2.2",
"@libreservice/micro-plum": "^0.2.3",
"@libreservice/my-widget": "^0.1.4",
"@libreservice/my-worker": "^0.4.2",
"@libreservice/wasm-code": "^0.1.5",
"@playwright/test": "^1.43.1",
"@playwright/test": "^1.45.2",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-replace": "^5.0.7",
"@types/js-yaml": "^4.0.9",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@vicons/fa": "^0.12.0",
"@vicons/fluent": "^0.12.0",
"@vicons/material": "^0.12.0",
"@vitejs/plugin-vue": "^5.0.4",
"@vitejs/plugin-vue": "^5.0.5",
"client-zip": "^2.4.5",
"emoji-regex": "^10.3.0",
"esbuild": "^0.20.2",
"eslint": "^8.56.0",
"esbuild": "^0.23.0",
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^17.4.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.25.0",
"glob": "^10.3.12",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-promise": "^6.4.0",
"eslint-plugin-vue": "^9.27.0",
"glob": "^11.0.0",
"idb": "^8.0.0",
"js-yaml": "^4.1.0",
"luaparse": "^0.3.1",
"naive-ui": "^2.38.2",
"rimraf": "^5.0.5",
"rollup": "^4.17.2",
"naive-ui": "^2.39.0",
"rimraf": "^6.0.1",
"rollup": "^4.18.1",
"rollup-plugin-esbuild": "^6.1.1",
"rppi": "^0.1.0",
"textarea-caret": "^3.1.0",
"ts-node": "^10.9.2",
"tslib": "^2.6.2",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"tslib": "^2.6.3",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"vite-plugin-pwa": "^0.20.0",
"vite-plugin-run": "0.4.1",
"vooks": "^0.2.12",
"vue": "^3.4.26",
"vue-router": "^4.3.2",
"vue-tsc": "^2.0.16"
"vue": "^3.4.32",
"vue-router": "^4.4.0",
"vue-tsc": "^2.0.26"
}
}
42 changes: 22 additions & 20 deletions wasm/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace my_rime {

enum { COMMITTED, ACCEPTED, REJECTED, UNHANDLED };

auto api = rime_get_api();

RimeTraits traits = {0};
RimeSessionId session_id;
RimeCommit commit;
Expand Down Expand Up @@ -42,14 +44,14 @@ void handler(void *context_object, RimeSessionId session_id,
if (std::string(message_value) == "success") {
deployed = true;
RimeSchemaList schemas;
RimeGetSchemaList(&schemas);
api->get_schema_list(&schemas);
for (size_t i = 0; i < schemas.size; ++i) {
boost::json::object obj;
obj["id"] = schemas.list[i].schema_id;
obj["name"] = schemas.list[i].name;
schema_array.push_back(obj);
}
RimeFreeSchemaList(&schemas);
api->free_schema_list(&schemas);
}
EM_ASM(_deployStatus(UTF8ToString($0), UTF8ToString($1)), message_value,
to_json(schema_array));
Expand All @@ -59,14 +61,14 @@ void handler(void *context_object, RimeSessionId session_id,
std::string get_schema_name(std::string schema) { return schema_name[schema]; }

void start_rime() {
RimeInitialize(&traits);
RimeSetNotificationHandler(handler, NULL);
api->initialize(&traits);
api->set_notification_handler(handler, NULL);
rime_started = true;
}

void stop_rime() {
RimeDestroySession(session_id);
RimeFinalize();
api->destroy_session(session_id);
api->finalize();
rime_started = false;
}

Expand All @@ -89,13 +91,13 @@ const char *post_process() {
if (updated_schema.size()) {
obj["updatedSchema"] = updated_schema;
}
RimeFreeCommit(&commit);
Bool has_committed = RimeGetCommit(session_id, &commit);
api->free_commit(&commit);
Bool has_committed = api->get_commit(session_id, &commit);
if (has_committed) {
obj["committed"] = commit.text;
}
RimeFreeContext(&context);
RimeGetContext(session_id, &context);
api->free_context(&context);
api->get_context(session_id, &context);
if (context.composition.length > 0) {
auto &composition = context.composition;
std::string pre_edit = composition.preedit;
Expand Down Expand Up @@ -141,15 +143,15 @@ const char *post_process() {

extern "C" {
void set_option(const char *option, int value) {
RimeSetOption(session_id, option, value);
api->set_option(session_id, option, value);
}

void init() {
RIME_STRUCT_INIT(RimeTraits, traits);
traits.shared_data_dir = "/usr/share/rime-data";
traits.user_data_dir = "/rime";
traits.app_name = "My RIME";
RimeSetup(&traits);
api->setup(&traits);
RIME_STRUCT_INIT(RimeCommit, commit);
RIME_STRUCT_INIT(RimeContext, context);
}
Expand All @@ -162,39 +164,39 @@ void set_page_size(int size) { page_size = size; }

const char *process(const char *input) {
pre_process();
RimeSimulateKeySequence(session_id, input);
api->simulate_key_sequence(session_id, input);
return post_process();
}

const char *select_candidate_on_current_page(int index) {
pre_process();
RimeSelectCandidateOnCurrentPage(session_id, index);
api->select_candidate_on_current_page(session_id, index);
return post_process();
}

const char *change_page(bool backward) {
pre_process();
RimeChangePage(session_id, backward);
api->change_page(session_id, backward);
return post_process();
}

void set_ime(const char *ime) {
if (rime_started) {
// Need to reset session when using F4 to select a schema
// not available yet.
RimeDestroySession(session_id);
api->destroy_session(session_id);
} else {
start_rime();
}
session_id = RimeCreateSession();
RimeSelectSchema(session_id, ime);
session_id = api->create_session();
api->select_schema(session_id, ime);
}

void deploy() {
stop_rime();
start_rime();
RimeStartMaintenance(true);
session_id = RimeCreateSession();
api->start_maintenance(true);
session_id = api->create_session();
}

void reset() {
Expand Down

0 comments on commit c73ea17

Please sign in to comment.