Commit graph

1808 commits

Author SHA1 Message Date
Steven R. Loomis
9f9589b095 feat(developer): fix e2e test 🙀
- re-enable e2e
- fix basic.txt to match

tools (hextobin):
- support diff(block1,block2,divisor)
- document the comma rule

For: #7377
2023-06-08 13:29:15 -05:00
Steven R. Loomis
c4e050e1f9 chore(developer): boost code coverage 🙀
- delete a file which is unused - ordr
- delete a file that was moved to common/web/types - pattern-parser
- update other lines to increase coverage

#7377
2023-06-07 14:14:41 -05:00
Steven R. Loomis
b705f5430f feat(developer): temporarily skip e2e test 🙀
For: #7377
2023-06-06 10:19:03 -05:00
Steven R. Loomis
8548b0fd33 Merge remote-tracking branch 'upstream/master' into feat/developer-7377-transform-format-epic-ldml3 2023-06-06 09:45:21 -05:00
Steven R. Loomis
70fcea815a feat(developer): tran support 🙀
- tran builder

For: #7377
2023-06-05 19:18:59 -05:00
Steven R. Loomis
115e68b753 feat(developer): tran support 🙀
- test fixups, for dependencies

For: #7377
2023-06-05 18:54:10 -05:00
Marc Durdin
18a3ef36bc chore(developer): ensure kmcmplib messages are all UTF-8
Fixes #8887.
2023-06-05 15:46:40 +07:00
Marc Durdin
e96cd3af11
Merge pull request #8915 from keymanapp/chore/developer/8888-long-line-test
chore(developer): verify long lines compile correctly
2023-06-04 21:15:46 +10:00
Steven R. Loomis
2054eeb703 feat(developer): tran support 🙀
- support regex format for sets and unicodeSets
- support mapFrom and mapTo detection

For: #7377
2023-06-02 18:31:25 -05:00
Steven R. Loomis
4b81137a61 feat(developer): section dependencies 🙀
- fix test helper for dependencies
- moved VariableParser and MarkerParser into common

For: #7377
2023-06-02 16:58:39 -05:00
Steven R. Loomis
5d0d0746b5 feat(developer): section dependencies 🙀
- fix test helper for dependencies

For: #7377
2023-06-02 16:26:47 -05:00
Steven R. Loomis
dfe89e5425 feat(developer): messages 🙀
- fix message bug

For: #7377
2023-06-02 15:19:14 -05:00
Steven R. Loomis
9b177b2f00 feat(developer): section dependencies 🙀
- make explicit section dependencies, add a test

For: #7377
2023-06-02 15:19:00 -05:00
Marc Durdin
16675ef46b
chore: extend from test options in e2e test 2023-06-02 18:54:42 +10:00
Marc Durdin
0ec5c08b26 chore(common): move const url to class prop
We still have cjs modules that rely on the ldml-keyboard-xml-reader, and
this meant that an exported const was being calculated with an invalid
meta url, which crashed the cjs module require() call.
2023-06-02 12:28:13 +07:00
Marc Durdin
d7f22b186f chore(developer): verify long lines compile correctly
Fixes #8888.

Verifies that wrapped lines (ending in \) are handled correctly in
kmcmplib.
2023-06-02 12:01:58 +07:00
Marc Durdin
4e535832d8 chore: cleanup 2023-06-02 11:45:59 +07:00
Marc Durdin
b313272250 chore(common): remove url module ref from common/web/types
The url module is a node module. We need to move responsibility for
resolving the path of the LDML XML <import> statements out of
common/web/types, and into the ultimate consumer, so it's now surfaced
as an option, along with a helper constant that reports the
import.meta.url-relative base path of the standard imports that are
compiled into common/web/types.

This hopefully means we can use this module in both browser and node
contexts without trouble.
2023-06-02 11:38:17 +07:00
Marc Durdin
9a4345c736
Merge pull request #8908 from keymanapp/chore/developer/8885-error-check-loadFile-callback
chore(developer): loadFile callback error check and optimization
2023-06-02 13:21:04 +10:00
Marc Durdin
355b5f9085
Merge pull request #8907 from keymanapp/refactor/developer/8883-move-filename-consistency-check-to-kmc
refactor(developer): move filename consistency check to kmc
2023-06-02 13:20:57 +10:00
Marc Durdin
f762b31d01
Merge pull request #8899 from keymanapp/refactor/developer/8889-kmcmplib-interface-shuffle
refactor(developer): rearrange kmcmplib interface source
2023-06-02 13:20:50 +10:00
Marc Durdin
7301281247 chore(developer): loadFile callback error check and optimization
Fixes #8885.

Adds some optimization and error checking to the loadFile callback in
kmc-kmn. Also handles case of zero-byte bitmap file so we won't crash on
it.
2023-06-01 15:31:31 +07:00
Marc Durdin
c3458d040c refactor(developer): move filename consistency check to kmc
kmcmplib no longer has any filesystem access, so it cannot verify if a
referenced filename in a source file has the same case as the actual
filename on disk (a risk when moving projects between platforms). So
I opted to move this to the `loadFile` callback in kmc, which is the
only place where filesystem is actually accessed, and added
corresponding unit test.

Small additional fixes here:

1. Move from `Buffer` to `Uint8Array` in all kmc-* modules, so that we
   remove that barrier to running on web.
2. Use `callbacks.loadFile` instead of `callbacks.fs.readFileSync`, so
   that we can be sure to run the filename consistency check.
3. Fixed kps parser silently swallowing xml errors on load.
4. Added silent mode to NodeCompilerCallbacks so we could cleanly test
   the new filename consistency hint.
5. Noted a location where we still have NodeJS deps in kmc-ldml.
2023-06-01 15:11:38 +07:00
Marc Durdin
c3ecae4e98 refactor(developer): rearrange kmcmplib interface source
Fixes #8889.

No code changes, just moves WASM interfaces into
CompilerInterfacesWasm.cpp, and CompileKeyboardHandle is renamed to
CompileKeyboardBuffer and moved into its own source file.
2023-06-01 05:29:19 +07:00
Marc Durdin
717b1eea98
chore: Apply code review suggestion
Co-authored-by: Eberhard Beilharz <ermshiperete@users.noreply.github.com>
2023-06-01 08:04:34 +10:00
Marc Durdin
9d351f4798 chore(developer): verify kvks files and report errors
Fixes #8886.

.kvks compiler now returns helpful errors for xml parse failures and
schema validation errors, and for invalid virtual key codes. Introduces
extra infrastructure for reporting and unit testing messages to kmc-kmn.

This also fixes unhandled xml load exceptions and simplifies the error
reporting coming out of the kvks loader, on the basis that only one type
of error was being reported anyway.
2023-06-01 05:02:26 +07:00
Marc Durdin
6f4f20acb8 chore(developer): Add TODO issue numbers to PR 2023-06-01 05:02:24 +07:00
Marc Durdin
47c8a95fb0 refactor(developer): complete fs move out of kmcmplib
* Moves filesystem access out of kmcmplib into kmc-kmn
* Adds filesystem access callback to kmcmplib unit tests
* Cleans up callback interface through wasm
* Adds unit tests for various file load scenarios
* Removes nodefs dependency from kmcmplib wasm build, and removes
  corresponding path mappings which were previously required for wasm
  builds; note that these are still present for the unit tests for
  kmcmplib.
2023-06-01 05:02:23 +07:00
Marc Durdin
980b893644 refactor(developer): move fs for kmn load to caller 2023-06-01 05:02:22 +07:00
Marc Durdin
8edd656edb
Merge pull request #8874 from keymanapp/chore/developer/move-kb-repo-fixtures
chore(developer): move keyboard repo fixtures
2023-05-31 13:28:42 +10:00
Marc Durdin
92278250d5
Merge pull request #8870 from keymanapp/chore/developer/refactor-kmcmplib-interfaces
chore(developer): refactor kmcmplib interfaces
2023-05-31 13:28:30 +10:00
Marc Durdin
8b89ddca5a
Merge pull request #8857 from keymanapp/chore/developer/replace-cwrap-with-bind
chore(developer): replace cwrap wasm bindings
2023-05-31 13:28:21 +10:00
Marc Durdin
f36a908d94 chore(developer): move keyboard repo fixtures
Relocates the keyboard-repo fixtures so we can add other local fixtures
for unit tests.
2023-05-30 13:08:53 +07:00
Marc Durdin
05fe88bb3a chore(developer): remove usekmcmplib flag from kmcomp 2023-05-30 10:57:57 +07:00
Marc Durdin
d763cf315a chore(developer): refactor kmcmplib interfaces
Relates to #8493.

* Removes kmcmplib calls from kmcmpdll (now that we have kmc)
* Removes old kmcmp_CompileKeyboardFile and
  kmcmp_CompileKeyboardFileToBuffer functions in preference for a much
  cleaner kmcmp_CompileKeyboard function
* Removes json validation helper from kmcmplib (we'll use js-native
  json schema validation instead)

This change means that we no longer need to keep compfile.h consistent
between kmcmplib and kmcmpdll. This will simplify upcoming refactoring
of kmcmplib.

kmcmplib no longer writes files, but it does still read them. The next
refactor will move file load responsibility into the caller.
2023-05-30 08:14:23 +07:00
Steven R. Loomis
c89bf648a5 feat(developer): vars again 🙀
- fairly complete tests (both positive and negative) for variables

For: #7377
2023-05-27 22:41:48 -05:00
Steven R. Loomis
1fe6f497f7 feat(developer): VARification steps 🙀
For: #7377
2023-05-27 22:08:16 -05:00
Steven R. Loomis
ca602385b3 feat(developer): vars: hooray for more errors 🙀
For: #7377
2023-05-27 17:01:10 -05:00
Marc Durdin
62b41d385c
Merge pull request #8856 from keymanapp/chore/developer/remove-seterror
chore(developer): remove SetError macro
2023-05-26 18:43:33 +10:00
Marc Durdin
18c4ac5bb2
Merge pull request #8850 from keymanapp/refactor/developer/wasm-compiler-interface
refactor(developer): compiler interface part 1 for wasm
2023-05-26 18:43:24 +10:00
Marc Durdin
a92917f947 chore(developer): replace cwrap wasm bindings
This moves the remainder of the WASM interfaces in kmcmplib to using
emscripten bind. It is a little bit of a step backwards at present for
parseUnicodeSet, because I've changed the output buffer type to an int
for the purposes of simplifying the binding just now. But that can be
improved later, and at least we are consistent with the binding methods.

Next step is to move the filesystem access out of kmcmplib.
2023-05-25 12:54:27 +07:00
Marc Durdin
d0083e984d
Merge pull request #8796 from keymanapp/refactor/developer/kmcmplib-fs-agnostic
refactor(developer): move file write out of WriteCompiledKeyboard and CompileKeyboard merge
2023-05-25 14:06:51 +10:00
Marc Durdin
50186e986e chore(developer): remove SetError macro
The `SetError` macro emitted `return FALSE;` which was confusing for
reviewing code flow. Replaced with explicit `AddCompileMessage()` and
`return FALSE;`.
2023-05-25 09:03:22 +07:00
Marc Durdin
ef101d746c chore(developer): address review comments 2023-05-25 08:24:09 +07:00
Marc Durdin
cdf5f7a7c4 chore(developer): consolidate 'extra' field for FILE_KEYBOARD
FILE_KEYBOARD is a structure used in multiple libraries and languages.
It is passed around between kmcmplib, kmcmpdll, and kmcomp, with three
separate definitions (kmcmplib/compfile.h, kmcmpdll/compfile.h, and
kmcomp/compile.pas). These duplicate definitions must be maintained for
now because of type issues between the legacy kmcmpdll and kmcmplib,
which means that the definitions must be kept in sync.

Because FILE_KEYBOARD_EXTRA has a C++ class in it, it will be
initialized in CompileKeyboardHandle rather than in the caller, so
FILE_KEYBOARD.extra is now a pointer rather than a struct.

When original kmcomp and kmcmpdll are eventually removed, these
duplications will disappear and some of the memory management and
lifecycle will become easier to manage.
2023-05-24 12:14:41 +07:00
Marc Durdin
d1d6dc5d99 refactor(developer): compiler interface part 1 for wasm
This starts the refactor of the .kmn compiler interfaces for WASM,
moving more file writes into typescript and out of the compiler. Adds a
cleaner binding and structures for passing compile metadata back to
typescript for additional build steps (e.g. kvk, js builds).

Will rebase the Typescript-based KMW compiler onto this so it can start
to benefit from the refactoring.

* Fixes a minor issue with loading a .kvks file with an empty flags set.
* Adds a writeFileSync method to the compiler callback interfaces.
* Adds an e2e compiler test to verify that .kmx and .kvk are both
  correctly compiled.
2023-05-23 15:26:28 +07:00
Marc Durdin
15142e9a4b chore(developer): cleanup 2023-05-23 11:52:37 +07:00
Marc Durdin
b6173fda37 fix(developer): 'no keyboard version' no longer emitted
The `Info_KeyboardFileHasNoKeyboardVersion` message is now only emitted
if the package uses `FollowKeyboardVersion`, which broke a unit test in
kmc.
2023-05-23 11:39:44 +07:00
Marc Durdin
e293d7608c chore(developer): add test for missing .js file 2023-05-23 09:28:26 +07:00
Marc Durdin
3828a5c16b refactor(developer): move message tests into test-messages.ts 2023-05-23 08:31:29 +07:00