Commit graph

902 commits

Author SHA1 Message Date
Steven R. Loomis
64c808c4cc feat(core): ldml marker segments: fix build errs 🙀
- remove unused function

For: #10369
2024-01-18 02:54:55 -06:00
Steven R. Loomis
2c56223f53 feat(core): ldml marker: improve segment algorithm 🙀
- easier to understand loop
- comments

For: #10369
2024-01-18 14:39:10 -06:00
Steven R. Loomis
3ccffe9430 feat(core): ldml marker: refactor, use nfd props 🙀
- split out parse_next_marker()
- use NFD safe boundaries to segment marker interaction

For: #10369
2024-01-18 13:51:40 -06:00
Marc Durdin
83f80c061a refactor(core): remove unused context APIs
Fixes #10431.

The `km_core_` prefix has been removed from internal-only functions, and
these function declarations moved to context.hpp.

The functions have not been moved from km_core_context_api.cpp at this
stage.

Rewrote the function documentation in Javadoc style comments for the
internal use functions.
2024-01-18 12:18:07 +07:00
Marc Durdin
c6acf86629
Merge pull request #10419 from keymanapp/chore/core/10410-ldml-just-say-no-to-action-queues
chore(core): ldml assert if queue functions are called 🌱
2024-01-18 14:47:04 +11:00
Marc Durdin
eece9716b7 refactor(core): additional comments 2024-01-18 10:42:18 +07:00
Marc Durdin
8b3c247520 chore(core): add surrogate pair tests to test_actions_normalize
Fixes #10424.
2024-01-18 09:48:29 +07:00
Marc Durdin
63574f8513 chore(core): add assertions to context helpers 2024-01-18 09:31:13 +07:00
Marc Durdin
b3261b8dc4 refactor(core): move context helpers to a new module
Fixes #10423.
2024-01-18 09:26:58 +07:00
Marc Durdin
3878394787 chore(core): remove todo comment 2024-01-18 08:53:55 +07:00
Marc Durdin
425ebe36b0 feat(core): synchronize app_context for non-normalizing keyboardprocessors
Fixes #10421.
2024-01-18 08:52:59 +07:00
Marc Durdin
4ab47ea435 chore(core): further debug assertions for actions_normalize 2024-01-18 08:39:53 +07:00
Marc Durdin
823120b0c4 chore(core): simplify input assumptions for actions_normalize
Per discussion in #10422, we can assume that input cached_context is
always NFD. However input actions->output may not start at a
normalization boundary, so we still need to backtrack to a normalization
boundary in order to get our NFC output. But cached_context never need
change.

This makes no change to the algorithm, but tweaks some of the unit tests
to adhere to this input assumption.

Note: we could consider adding a debug assertion that cached_context is
NFD.
2024-01-18 08:25:15 +07:00
Steven R. Loomis
7bc8831267 feat(core): updates to add_back_markers 🙀
- support out-of-order re-adding
- test for updated marker map
2024-01-17 19:04:11 -06:00
Steven R. Loomis
2e46bfea81 chore: reformat 2024-01-17 19:04:05 -06:00
Steven R. Loomis
990635eb09 feat(core): WIP attempt at cross segment markers 🙀
#10369
2024-01-17 19:03:43 -06:00
Steven R. Loomis
e4e7d9fd27
Merge branch 'feat/core/10319-escaping-you-epic-ldml' into feat/developer/10319-remove-old-escape-epic-ldml 2024-01-17 18:49:50 -06:00
Steven R. Loomis
b6a6b7e6b8 feat(core): ldml fix test case and parser 🙀
For: #10319
2024-01-17 18:32:39 -06:00
Steven R. Loomis
d08e7051cf feat(core): ldml updates per code review 🙀
- don't try to remove irregular sentinel sequences
- update test

For: #10319
2024-01-17 18:34:56 -06:00
Steven R. Loomis
763bc96739 feat(core): ldml updates per code review 🙀
- remove stray change to kmx_processevent.cpp
- fix escaping of syntax chars
- fix comment per review

For: #10319
2024-01-17 18:05:28 -06:00
Steven R. Loomis
792329fba0
chore(core): tag unused args 2024-01-17 17:30:48 -06:00
Steven R. Loomis
f484615450 chore(core): ldml don't use queue action functions 🌱 2024-01-17 16:16:56 -06:00
Marc Durdin
39f081391e chore(core): dedup set_context_from_string 2024-01-17 13:05:11 +07:00
Marc Durdin
7218f93ca9 chore(core): test typos 2024-01-17 12:07:38 +07:00
Marc Durdin
40f0839a4a chore(core): remove bogus test_color.h inclusion 2024-01-17 11:03:42 +07:00
Marc Durdin
671973baab refactor(core): split context API from Core primary API
Relates to #9999.
Fixes #10384.

The context API endpoints should no longer be considered as part of the
standard Core API. The only consumers that have a need to access these
APIs are the IMX integration in Engine for Windows, and the Keyman
Developer Debugger.

These symbols are currently used by Developer:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()`
* `km_core_context_set()`
* `km_core_context_clear()`

These symbols are currently used by Windows IMX:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_context_items_dispose()`
* `km_core_context_item_list_size()`
* `km_core_state_get_intermediate_context()`

The following functions and symbols are moving to
keyman_core_api_context.h:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()` function
* `km_core_state_get_intermediate_context()` function
* `km_core_context_set()` function
* `km_core_context_clear()` function
* `km_core_context_get()` function
* `km_core_context_items_from_utf16()` function
* `km_core_context_items_from_utf8()` function
* `km_core_context_items_to_utf8()` function
* `km_core_context_items_to_utf16()` function
* `km_core_context_items_to_utf32()` function
* `km_core_context_items_dispose()` function
* `km_core_context_length()` function
* `km_core_context_append()` function
* `km_core_context_shrink()` function
* `km_core_context_item_list_size()` function
2024-01-17 14:44:25 +11:00
Marc Durdin
e6096a267c feat(core): action output normalization
Fixes #9999.

Note TODO items:
- [ ] Renormalize cached_context across action boundary. Blocked by #10369.
- [ ] Add extra tests for surrogate pairs
- [ ] Move set_context_from_string into helper module
- [ ] if we don't apply normalization, we still need to fixup the
      app_context, to keep it coherent with cached_context (or at least
      we need to verify that app_context is never used in this
      situation)
2024-01-17 10:41:00 +07:00
Marc Durdin
e39affe93b feat(core): infrastructure for normalization of output
Relates to #9999.

Establishes functions, unit test sources, normalization entry point and
an effectively no-op unit test for normalization support.
2024-01-16 13:46:46 +07:00
Marc Durdin
e5c2525241 refactor(core): split context API from Core primary API
Relates to #9999.
Fixes #10384.

The context API endpoints should no longer be considered as part of the
standard Core API. The only consumers that have a need to access these
APIs are the IMX integration in Engine for Windows, and the Keyman
Developer Debugger.

These symbols are currently used by Developer:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()`
* `km_core_context_set()`
* `km_core_context_clear()`

These symbols are currently used by Windows IMX:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_context_items_dispose()`
* `km_core_context_item_list_size()`
* `km_core_state_get_intermediate_context()`

The following functions and symbols are moving to
keyman_core_api_context.h:
* `km_core_context` struct
* `km_core_context_type` enum
* `km_core_context_item` struct
* `KM_CORE_CONTEXT_ITEM_END` macro
* `km_core_state_context()` function
* `km_core_state_get_intermediate_context()` function
* `km_core_context_set()` function
* `km_core_context_clear()` function
* `km_core_context_get()` function
* `km_core_context_items_from_utf16()` function
* `km_core_context_items_from_utf8()` function
* `km_core_context_items_to_utf8()` function
* `km_core_context_items_to_utf16()` function
* `km_core_context_items_to_utf32()` function
* `km_core_context_items_dispose()` function
* `km_core_context_length()` function
* `km_core_context_append()` function
* `km_core_context_shrink()` function
* `km_core_context_item_list_size()` function
2024-01-16 12:04:41 +07:00
Marc Durdin
a97237b6a6
Merge pull request #10382 from keymanapp/feat/core/9999-normalization-of-context
feat(core): normalize input context 🌱
2024-01-16 13:39:16 +11:00
Marc Durdin
707f711440
Merge pull request #10377 from keymanapp/feat/core/10365-context-debug
feat(core): add `km_core_state_context_debug` API 🌱
2024-01-16 13:38:40 +11:00
Steven R. Loomis
eb39bba374 chore(developer,core): change sample and test files to use \u{…} 🙀
- #10389 will require this, but at least change the test files

#10319
2024-01-15 17:27:41 -06:00
Marc Durdin
0878ee3b56 feat(core): seed Keyman Core normalization
Relates to #9999
2024-01-16 06:21:38 +07:00
Marc Durdin
8abab53988 chore(core): Merge branch 'feat/core/10365-context-debug' into feat/core/9999-normalization-of-context
Note: shifted minor changes from action_api.cpp to new
state_context_api.cpp.
2024-01-16 06:16:45 +07:00
Marc Durdin
bd870de672
chore: Apply suggestions from code review
Co-authored-by: Steven R. Loomis <srl295@gmail.com>
2024-01-16 10:01:35 +11:00
Marc Durdin
ba3290de75 chore(core): Merge branch 'master' into feat/core/10365-context-debug
Note: resolved merge conflict with action_api.cpp by shifting new code
into state_context_api.cpp.
2024-01-16 05:46:36 +07:00
Steven R. Loomis
c0928e1835
Merge branch 'master' into feat/core/10319-escaping-you-epic-ldml 2024-01-15 16:45:38 -06:00
Steven R. Loomis
ab67061843 feat(core): 32 bit escapades 🙀
- improved test code and marker parsing

#10319
2024-01-15 14:07:19 -06:00
Marc Durdin
84785fdd9a chore(core): wasm linker flags 2024-01-15 13:23:29 +07:00
Marc Durdin
932ad9d1df chore(core): add unit test deps for wasm 2024-01-15 12:50:41 +07:00
Marc Durdin
bd46fb271b feat(core): unit tests need to set both app context and cached context 2024-01-15 12:34:00 +07:00
Marc Durdin
036c32af1f feat(core): normalize input context
First half of #9999.

Adds support for normalization (to NFD) of input app context into the
cached context. The keyboard processor will work with the NFD cached
context.

Adds unit tests for the normalization as part of the LDML keyboard
processor test suite.

TODO:
* Comparing modified cached context to app context to determine the
  transform required to send to the app
* Handling illegal unicode and unpaired surrogates on input context
2024-01-15 11:50:16 +07:00
Marc Durdin
cd69405960 feat(core): add app_context and failing tests
Adds the application context member of state and a corresponding,
failing unit test, which starts the process of verifying the handling
of the application context.
2024-01-15 11:50:15 +07:00
Marc Durdin
9868de5abc
Merge branch 'master' into feat/core/10365-context-debug 2024-01-15 12:06:03 +11:00
Marc Durdin
bafe43315c
chore: Update core/src/km_core_state_api.cpp 2024-01-15 12:05:42 +11:00
Marc Durdin
32ee4bc386 fix(core): typedef enum 2024-01-15 08:00:32 +07:00
Marc Durdin
bfb26eaf64 feat(core): adds km_core_state_context_debug
Fixes #10365.

Adds a `km_core_state_context_debug` function that returns a km_core_cp
string containing the current cached or intermediate context. The
function must be used only for debug logging purposes -- the string is
not intended to parsed for other purposes and the format may change in
the future.

This commit adds the function and corresponding unit tests. Subsequent
commits will update existing context debug functions in various engines
to use this API endpoint instead.
2024-01-15 07:19:31 +07:00
Steven R. Loomis
c5d0e0525e feat(developer): 32 bit escapades 🙀
- escaping working, matching not yet

#10319
2024-01-13 12:55:51 -06:00
Eberhard Beilharz
141b85814e
refactor(core): Move km_core_state_context_* tests to separate file
It was fairly surprising to have the unit tests for
`km_core_state_context_*` methods in `action_api.cpp`, so this change
moves them to a separate file.
2024-01-12 15:34:32 +01:00
Eberhard Beilharz
67cf76362d
Merge pull request #10354 from keymanapp/refactor/linux/10212_set-context
refactor(linux): Use `km_core_state_context_set_if_needed`
2024-01-12 08:54:21 +01:00