Commit graph

1262 commits

Author SHA1 Message Date
Marc Durdin
b973bcc0d9 fix(core): include nul in context offset calculations in kmx processor
Two separate bugs addressed, with `index()` references and with
`context()` references -- both have the same root cause, of not taking
`nul` at the start of the context into account (as `nul` is not included
in the `m_miniContext` member, being a non-character). We already fixed
this issue for `if()` quite a long time ago, and some of the same
patterns can be with `m_miniContextIfLen` for example.

Fixes: #13304
Fixes: #13316
2025-02-21 17:17:19 +07:00
Marc Durdin
2b9b8eb419 chore(core): add unit tests to validate nul with index and context
Add 4 test keyboards to validate `nul` and `if` used in conjunction with
`index` and `context` and corresponding references in core unit tests.

Add a script to rebuild baseline keyboards using a copy of kmcomp.exe
16.0.138; this is setup and tested only on Windows (YMMV on WINE, etc).

Add the 4 additional baseline test keyboards to kmcmplib unit tests for
build consistency between kmcomp 16 and kmcmplib 18 (all pass).

Note: two of the new Core tests currently fail. This is expected, see
issue #13304.

Fixes: #13303
2025-02-21 13:06:29 +07:00
Marc Durdin
130e697d40
Merge pull request #13230 from keymanapp/chore/merge-master-into-web-core
chore: merge master into web-core
2025-02-14 05:30:04 +07:00
Steven R. Loomis
b54ea40770 chore(developer): update comments per review
- note that 45,46,47 are the same data and so aliased

Fixes: #11307
2025-01-30 23:13:36 -06:00
Steven R. Loomis
b741a88ca0 chore(core,developer): treat CLDR v45, 46, 46.1, 47 as 46
Fixes: #11307
2025-01-30 15:42:30 -06:00
Steven R. Loomis
2c32fb7903 chore(resources, developer,core): CLDR 46 and workaround
Fixes: #11307
- import from CLDR 46, mostly unchanged

Fixes: #12749
- workaround LDML DTD bug CLDR-18138 where base= does not imply base=cldr
2025-01-30 15:41:34 -06:00
Eberhard Beilharz
fbfa3b5cc2
feat(core): add unit tests for the WASM version of Core API
Note that this requires adding an additional `km-core-node.mjs`
module (since the tests are run with node). We can't create one that
would work for both web and node - if we do trying to load the `km-core.js`
fails with `km-core.mjs: Could not resolve import "module".`
2025-01-20 18:22:56 +01:00
Joshua Horton
0d0c339f67
Merge branch 'epic/web-core' into chore/merge-master-into-web-core 2025-01-17 11:37:51 +07:00
Eberhard Beilharz
b84b651590
Merge pull request #11397 from keymanapp/chore/linux/cicontainer
chore: Add docker images for building the different platforms
2025-01-16 12:31:29 +01:00
Eberhard Beilharz
5a0cb9bff5
Merge pull request #12823 from keymanapp/feat/web/loadkmx
feat(web): load .kmx keyboard from blob 🎼
2025-01-15 10:41:36 +01:00
Eberhard Beilharz
9c8ad2e783
fix(core): fix compile error
Compiling the tests failed in the container.
2025-01-08 17:08:57 +01:00
Eberhard Beilharz
2e5722705b
feat(web): address code review comments 2025-01-06 15:12:09 +01:00
Eberhard Beilharz
69cb2fda59
fix(core): use a specific flag for adjusting alignments
This change adds a new flag `KMX_REQUIRES_REALIGNMENT` instead of the
previous `KMX_64BIT` for the cases where we have to re-align the KMX data
at pointer boundaries. Renamed because Emscripten also needs the
re-alignment even though it's 32-bit.

Addresses code review comments.
2025-01-06 14:29:57 +01:00
Eberhard Beilharz
a072171ec8
feat(web): load .kmx keyboard from blob
This change adds the web side of loading a .kmx keyboard from a
blob. It also replaces the `CoreProcessor` class with `CoreFactory`
that allows to directly use the methods defined in WASM without
having to add another wrapper for each method.
2024-12-20 18:01:42 +01:00
Eberhard Beilharz
6bef09f68b
fix(core): work around alignment problem when using Emscripten
The data we read from the KMX file is not in places 32-bit aligned, e.g.
`dpGroupArray` will often start at a 16-bit boundary. Emscripten doesn't
like this and will abort the program if `SAFE_HEAP=1` is defined.

This change works around the problem by calling `CopyKeyboard` and thus
expanding the structure.

See #12844.
2024-12-20 18:01:41 +01:00
Meng-Heng
328687435d chore: change to https in docs 2024-12-17 15:27:07 +07:00
Eberhard Beilharz
d48acd3204
chore(web): rename type library to match target name
This change renames the type library from `km-core=-interface.d.ts`
to `keymancore.d.ts` to match the name of the target (`keymancore`)
to make it more obvious where this comes from and where/how it gets
build.
2024-12-16 18:01:09 +01:00
Eberhard Beilharz
06a8c7a867
feat(core): properly implement converting blob 2024-12-16 17:27:02 +01:00
Eberhard Beilharz
193dd77ffb
fix(core): fix build of unit tests
Without this change building unit tests fail with an error that
`--shared-memory` is disallowed.
2024-12-16 17:27:02 +01:00
Eberhard Beilharz
067c8a0a5b
chore(core): cleanup meson.build 2024-12-16 17:25:18 +01:00
Eberhard Beilharz
e069c3ad2a
chore(core): remove meson warnings for wasm builds
Replace deprecated function calls. Also add `strip` command to wasm
build defaults.
2024-12-12 19:48:13 +01:00
Eberhard Beilharz
1bedc62b57
feat(core): expose km_core_keyboard_load_from_blob to WASM 2024-12-09 16:06:31 +01:00
Steven R. Loomis
de3397b476
Merge pull request #12644 from keymanapp/fix/core/12298-get-key-list
fix(core): implement ldml_processor::get_key_list() 🙀
2024-12-09 08:14:44 -06:00
Steven R. Loomis
feba97979a fix(core): update get_key_list to account for other combinatorics
- yes, expand 'other' to all possible combinations
- use ALT  and CTRL instead of RALT,LALT and RCTRL,LCTRL in the key list (reduce expansions up to 4x)

Fixes: #12298
2024-12-06 12:24:53 -06:00
Eberhard Beilharz
8252a95f61
chore: Merge remote-tracking branch 'origin/master' into chore/merge-master-into-web-core 2024-12-06 09:12:36 +01:00
Marc Durdin
88f20d7bf7
Merge pull request #12769 from keymanapp/chore/core/12497-remove-km_core_keyboard_load
chore(core): remove `km_core_keyboard_load` API
2024-12-05 23:51:27 +01:00
Marc Durdin
e6cf6186c2 chore: Merge remote-tracking branch 'origin/epic/web-core' into chore/merge-master-into-web-core 2024-12-05 15:04:11 +07:00
Sabine
b7990d1b46 chore(core): Add link to Keyman Glossary 2024-12-05 06:27:22 +01:00
Marc Durdin
5ec2ce7863 chore: address review comments 2024-12-05 05:35:27 +07:00
Steven R. Loomis
da7c864f54 Merge remote-tracking branch 'origin/master' into fix/core/12298-get-key-list 2024-12-04 13:58:24 -06:00
Marc Durdin
4c3b2132ee chore(core): remove km_core_keyboard_load API
Fixes: #12497
2024-12-04 13:38:07 +07:00
Marc Durdin
f97a19db91 chore(core): build parameters 2024-12-02 07:21:30 +07:00
Marc Durdin
9a01ac166d chore(core): Merge branch 'master' into fix/core/12619-disable-assertions-vcwin-release-build 2024-12-01 16:17:21 +07:00
Steven R. Loomis
9e2b8d0d8c feat(core): improvements for get_key_list()
- reintroduce example keycaps

Fixes: #12298
2024-11-29 18:28:05 -06:00
Steven R. Loomis
7f3bd30961 feat(core): improvements for get_key_list()
- expand OTHER and ALT / CTRL appropriately
- add KM_CORE_MODIFIER_NONE=0
- disable test of get_key_list() for now

Fixes: #12298
2024-11-29 17:25:31 -06:00
Steven R. Loomis
d92dc175c2 chore(core): update to ldmL_test_source.cpp 2024-11-29 15:47:30 -06:00
Steven R. Loomis
29db34f252 chore(core): update to ldmL_test_source.cpp 2024-11-29 15:40:48 -06:00
Steven R. Loomis
c9643642a8 Merge remote-tracking branch 'origin/master' into fix/core/12298-get-key-list 2024-11-29 15:33:53 -06:00
Eberhard Beilharz
b8c120dd5c
Merge pull request #12721 from keymanapp/chore/core/cherry-pick/load-from-blob-api
feat(core,linux,developer,windows): implement loading KMX from blob 🍒
2024-11-29 12:40:51 +01:00
Steven R. Loomis
2d81b195f0 feat(core): update k_004_tinyshift
- add a ctrl and an other layer

Fixes: #12298
2024-11-28 12:48:32 -06:00
Marc Durdin
b0e87cb85a chore(core): update assertion unit test for release builds 2024-11-28 12:24:54 +07:00
Marc Durdin
36ddd793a5 chore(core): ifdef variables only used in assertions 2024-11-28 10:58:51 +07:00
Marc Durdin
bcecedcb04 chore(developer): ifdef variables only used in assertions 2024-11-28 10:36:13 +07:00
Marc Durdin
b9b4ad4996 chore(developer): ifdef variables only used in assertions 2024-11-28 10:27:40 +07:00
Marc Durdin
e2b8222a6b chore(developer): ifdef variables only used in assertions 2024-11-28 10:12:28 +07:00
Marc Durdin
e640caaa9c chore(core): Merge branch 'master' into fix/core/12619-disable-assertions-vcwin-release-build 2024-11-28 09:53:45 +07:00
Marc Durdin
d71cb56ca7 fix(core): rename assert() to test_assert() in unit tests
Had a real yak shave this morning with disabling assertions in release
builds in our C/C++ code. It turns out that our unit tests use
`assert()` which we intended to use from `test_assert.h`, but in some
cases `cassert` or `assert.h` had been #included after `test_assert.h`,
overriding our special `assert()` macro. The chain of includes is
somewhat hard to puzzle out -- it's often buried several levels deep.
This meant that a release build would drop all test assertions, meaning
most tests passed, unsurprisingly, as there were no assertions left to
fail ... but some tests failed with crashes because we optimized out
important lines such as `assert(some_important_function())`.

I was quite unhappy with this fragility, so I have opted to rename
`assert()` to `test_assert()` in all of our home-grown C/C++ unit tests,
which further highlighted unit tests which were only using the C/C++
`assert()` and not ours, so then had to figure out which unit test
executables needed to have `test_assert` added, and then ... then ...
discovered a bug in `test_color.h`, where we were #including
`io.h`/`unistd.h` inside a `namespace console_color {}` block, which
just happened to be the first ref to those beautiful headers, and thus
(because `#pragma once`) meant that useful little functions like
`access()` were no longer accessible to us in the global namespace.

I have also audited Every Single Call to `assert()` to verify that we do
not do Important Work inside the parentheses, and, apart from those
offending unit tests, now resolved with `test_assert()`, it looks like
all is good.

I would like to present one very well-shaved yak in this commit.

Fixes: #12619
2024-11-28 09:46:01 +07:00
Eberhard Beilharz
0958a2da23
fix(core): permanently disable logging
This change disables logging at compile time to work around #12661.
Logging can be enabled in the debugger, or by re-compiling with
`g_debug_KeymanLog` set to TRUE.

Related: #12661
Cherry-pick: #12674
2024-11-27 16:36:25 +01:00
Steven R. Loomis
c306147e6b
Merge branch 'master' into fix/core/12298-get-key-list 2024-11-27 08:59:59 -06:00
Eberhard Beilharz
3dc3f040de
feat(core): implement loading KMX from blob
- split keyboard loading into loading KMX file into blob and then
  loading the keyboard processor from the blob.
- deprecate `km_core_keyboard_load`
- move file access next to deprecated method. This is now the only place
  that loads a file in Core; unit tests have some more places that
  load files.
- introduce GTest and add unit tests for loading from blob

Cherry-picked from `epic/web-core` branch.

Cherry-Pick-Commit: 1deaa323ad
Cherry-Pick-Commit: 59019cc8b7
Cherry-Pick-Commit: bc46458368
Cherry-Pick-Commit: d06aa29956
Cherry-Pick-Commit: 1c88166f6e
Cherry-Pick-Commit: 069cd21ecd
Cherry-Pick-Commit: 052ae2ec35
Cherry-Pick-Commit: 11a2a3ba3a

Part-of: #11293
Part-of: #8093
2024-11-27 15:30:05 +01:00