Commit graph

1032 commits

Author SHA1 Message Date
Marc Durdin
ec5a83a3fa
Merge pull request #7204 from keymanapp/feat/core/ldml-transform-table-specs-and-constants
feat(core): ldml keyboard transform elements 🙀
2022-09-07 11:28:42 +10:00
Marc Durdin
2e7aef39e7
Merge pull request #7197 from keymanapp/chore/core/section-order
chore(core): order sections according to binary format 🙀
2022-09-07 11:27:54 +10:00
Marc Durdin
5e1d898527
Merge pull request #7196 from keymanapp/feat/core/ldml-name-section
feat(core): add 'name' section 🙀
2022-09-07 11:27:46 +10:00
Marc Durdin
f1b2be168f
Merge pull request #7193 from keymanapp/chore/core/kmxplus-zero-length-string
chore(core): define zero length string vs null string for kmxplus 🙀
2022-09-07 11:27:30 +10:00
Marc Durdin
8678a0d35b chore(core): mark unused parameters 2022-09-07 10:36:35 +10:00
Marc Durdin
5104914672 feat(core): add km_kbp_event API endpoint
Adds infrastructure required to support caps lock control on keyboard
activation per #5822.

Keyboardprocessor implementation is currently a stub, and engines will
need corresponding updates to support the new API.
2022-09-07 10:24:01 +10:00
Marc Durdin
690290bdfe
chore(core): add comment for KMXPLUS_STR
Co-authored-by: Steven R. Loomis <srl295@gmail.com>
2022-09-07 08:14:23 +10:00
Marc Durdin
8e5ce35f4d feat(developer): kmldmlc compiler and tests for transforms
Adds compilers and minimal unit tests for transform sections bksp,
finl, ordr, and tran, and cleans up problems in the corresponding
builders.

Adds a utility script for building test fixtures for manual analysis:
  ./build.sh build-fixtures

Refactors constants to give us design-time type safety once more.
2022-09-06 10:15:31 +10:00
Marc Durdin
9f5f8e976e feat(core): ldml keyboard transform elements
Adds definitions for LDML keyboard transform elements `transforms`,
`backspaces`, and `reorders`, and the binary format sections `bksp`,
`elem`, `finl`, `ordr`, and `tran`.

Minimally updates the compiler so that it will build, but no other
changes to the compiler.

Compiler and Typescript updates to support building these sections will
come in the next PR.
2022-09-05 13:11:51 +10:00
Marc Durdin
0222ed308a chore: remove extra files 2022-09-04 06:14:53 +10:00
Marc Durdin
ea6bd8f09f chore(core): order sections according to binary format
Just reorders all work around the various sections to match the binary
format order -- that is, 'sect' first, then all other sections
alphabetically.

This also means the compiler now emits the sections in the expected
order.

No other changes to functionality.
2022-09-04 06:10:34 +10:00
Marc Durdin
b17805df3a feat(core): add 'name' section
Updates compiler, headers and documentation for the 'name' section,
which will always be present as the LDML keyboard spec requires at least
one name in the `<names>` element.
2022-09-04 05:45:43 +10:00
Marc Durdin
a274a44979 chore(core): wrap text on C7043_ldml.md 2022-09-03 06:12:36 +10:00
Marc Durdin
aef38f12df chore(core): define zero length string vs null string for kmxplus 2022-09-03 06:11:24 +10:00
Marc Durdin
702db90a71 feat(core): add version field to meta
Also adds semver package for validating the version field.
2022-09-02 14:13:10 +10:00
Marc Durdin
d141274aed chore(core): update hextobin files with new format 2022-09-02 14:06:26 +10:00
Steven R. Loomis
f3f498e923 fix(core): fix validators 🙀
- copy over asserts from 'old' code

#7136
2022-08-31 17:37:55 -05:00
Steven R. Loomis
3684cc43d0 fix(core): fix validators 🙀
yes, a kmxplus file does not start with a 'sect' !

#7136
2022-08-31 17:37:55 -05:00
Steven R. Loomis
90be01385b chore(core): split out validators 🙀
#7136
2022-08-31 17:37:55 -05:00
Marc Durdin
696ae9964d
Merge pull request #7153 from keymanapp/refactor/developer/kmldmlc-pure-functional-section-compilers
refactor(developer): each section compiler is a pure function 🙀
2022-08-30 19:04:05 -05:00
Steven R. Loomis
bef0013bf8 feat(core): set -DDEBUG for debug 🙀
- set -DDEBUG for 'debug' meson builds
- default KXPLUS_DEBUG  to 1 for -DDEBUG

#7136
2022-08-30 11:49:22 -05:00
Marc Durdin
91283464ca
Merge pull request #7150 from keymanapp/chore/merge-master-feature-ldml
chore: merge master into feature-ldml 🙀
2022-08-29 20:52:44 -05:00
Marc Durdin
db11553c9a refactor(developer): each section compiler is a pure function
Well, almost. There are still callback side-effects for messages. These
may in future be returned as an array as well, eliminating the need for
a message callback.

But restructures each section compiler so that it is self-contained and
responsible only for writing its own section. Also tightens up the types
for the sections constants.

Last, but not least, moves responsibility for writing the output .kmx
out of compiler.ts and into its callers -- removing one dependency from
the compiler. Reading input files still needs to be done in the
compiler, as there may be multiple input files with `<import>` that we
cannot know about until we start parsing xml.
2022-08-30 11:13:11 +10:00
Steven R. Loomis
f03abf2ea5
Update core/src/ldml/ldml_processor.cpp
Co-authored-by: Marc Durdin <marc@durdin.net>
2022-08-29 17:23:17 -05:00
Steven R. Loomis
46d7c96823 fix(core): ldml: fix validator 🙀
- allow keys section to exactly fit in data size, as in #7140
2022-08-29 17:16:45 -05:00
Steven R. Loomis
8c65dea9b3
Merge pull request #7132 from keymanapp/feat/core/5015-fileread
feat(core): ldml: improve file reading/validation 🙀
2022-08-29 16:45:56 -05:00
Steven R. Loomis
c03ab40d5d feat(core): ldml: update spec per code review
#7043
2022-08-29 16:41:39 -05:00
Steven R. Loomis
1c7188f9fd
Apply suggestions from code review
Co-authored-by: Marc Durdin <marc@durdin.net>
2022-08-29 16:41:12 -05:00
Marc Durdin
655c872dc8 chore: Merge branch 'master' into chore/merge-master-feature-ldml 2022-08-30 06:31:04 +10:00
Marc Durdin
9edabec297 chore(core): emcc off path for linux 2022-08-30 06:20:48 +10:00
Marc Durdin
895ce930a0
Merge pull request #6993 from keymanapp/chore/core/rename-json-source
chore(core): rename json.hpp to jsonpp.hpp 🛩
2022-08-29 14:48:32 -05:00
Marc Durdin
a72146e42d feat(developer): unit test framework for kmldmlc 2022-08-29 17:21:05 +10:00
Marc Durdin
670229937a chore: move hextobin to common 2022-08-29 15:07:43 +10:00
Marc Durdin
10b875da57 chore(core): chmod build.sh 2022-08-29 07:47:49 +10:00
Marc Durdin
3d08348256 feat(core): hextobin tool
The hextobin tool is used to help us construct invalid .kmx files
without having to either hack these into the compiler, or write them
with a hex editor. It feels a little bit of overkill, but this makes it
easy to (a) work with our intended file structures, and (b) review any
changes to these invalid keyboard tests.

Note: I did do a cursory search for a hex2bin or hextobin that we could
easily use but did not find a good simple cross-platform tool that we
could consume (`xxd -r` would work but AFAICT constrains our format to a
dump which is much harder to work with and read -- I wanted to be able
to annotate with file structures.)

For an example, see ik_000_null_invalid.txt.

This means that building the invalid keyboards for tests requires node,
but that should be fine given we need node to build the valid keyboards
anyway.

I've put hextobin under core/tools but it could just as well live under
common/tools in the future, if we find it useful for other project unit
tests.
2022-08-29 06:21:16 +10:00
Marc Durdin
9945055c00 chore(core): move and re-enable invalid ldml keyboard tests 2022-08-28 05:10:21 +10:00
Marc Durdin
0057b7d95c chore(core): emcc off path for linux 2022-08-27 14:53:06 +10:00
Marc Durdin
bc02ba984a chore(core): skip ldml keyboard tests if node not available 2022-08-27 08:47:34 +10:00
Steven R. Loomis
791d253528 feat(core): ldml: improve reading 🙀
- read keys into a std::map instead of on the fly
- remove retention of entire kmx file
- remove some functions from kmx_plus.h

#5015
2022-08-26 16:47:20 -05:00
Steven R. Loomis
3de77cda92 feat(core): ldml: improve reading 🙀
- read keys into a std::map instead of on the fly
- no longer retain copy of entire KMX file in read
2022-08-26 16:43:27 -05:00
Steven R. Loomis
892492a634 feat(core): ldml: improve validation 🙀
- clearer asserts
- validate length of data

#5015
2022-08-26 15:45:48 -05:00
Marc Durdin
44d7d5ca88 chore(core): always build deps 2022-08-27 06:23:33 +10:00
Steven R. Loomis
aeeae1c4f4 feat(core): ldml: improve read side 🙀
- don't reparse structs each time
- move validation into constructor
2022-08-26 13:15:05 -05:00
Marc Durdin
3ff5c4c46e chore(core): fix typo 2022-08-26 15:58:25 +10:00
Marc Durdin
a3b1a96960 chore(core): disable failing tests for now 2022-08-26 15:48:19 +10:00
Marc Durdin
4820f99503 chore(core): also build keyman-version as a prereq 2022-08-26 15:41:44 +10:00
Marc Durdin
daf6a7970e feat(core): use kmldmlc to build test keyboards
Removes .kmx from repo and builds them from the source .xml files using
kmldmlc (building that if necessary also with a poor fella's dependency
check for now), and generally a lot of cleanup of the meson.build files
for the ldml tests.

Moves keyboards to a subfolder of the ldml unit test folder to keep them
neat and tidy and avoid embedding huge files into ldml.js for test of
WASM.

Note: 000_null_keyboard and 002_null_invalid do build successfully, but
the core ldml keyboardprocessor currently fails on them, because they
are missing keys and vkey sections.
2022-08-26 15:12:38 +10:00
Marc Durdin
9756c28102 chore(developer): Merge branch 'feature-ldml' into feat/developer/ldml-compiler-kmxplus-builder 2022-08-26 05:17:05 +10:00
Marc Durdin
144025e29f
Merge pull request #7113 from keymanapp/revert-7112-revert-7110-feat/developer/ldml-constants-ts-module
feat(core): turn @keymanapp/ldml-keyboard-constants into a module 🙀
2022-08-25 14:13:41 -05:00
Steven R. Loomis
4c5f60ae22
Merge pull request #7125 from keymanapp/feat/core/7043-repadding 2022-08-25 13:54:59 -05:00