WebAssembly Port #45

Open
azizghuloum wants to merge 10 commits from azizghuloum/wasm into master
azizghuloum commented 2024-09-26 22:23:39 +02:00 (Migrated from github.com)

Build instructions are in Wasm.Dockerfile and are documented in README. Please let me know if you need something fixed.

Fixes #32

Build instructions are in `Wasm.Dockerfile` and are documented in `README`. Please let me know if you need something fixed. Fixes #32
azizghuloum commented 2024-09-26 22:41:04 +02:00 (Migrated from github.com)

There are two issues with the wasm build worth mentioning:

  1. Unicode nfkc normalization is skipped because I couldn't figure out how to do it. It doesn't seem to affect the included tests and maybe the cfdg files just need to be normalized in the browser/whatever before rendering.
  2. The main function cannot be called twice to process a second file. I think some globals get initialized properly in the first run but their state remains in memory and would be invalid for a second run. When I use cfdg in the browser, I load it in a "one-shot" web worker where input file is set up, main() is called, then the output file is sent back to the browser. It works and is unnoticeable, but kinda wasteful. It would be nice to be able to call main() repeatedly but I understand it was not designed for that.
There are two issues with the wasm build worth mentioning: 1. Unicode nfkc normalization is skipped because I couldn't figure out how to do it. It doesn't seem to affect the included tests and maybe the cfdg files just need to be normalized in the browser/whatever before rendering. 2. The `main` function cannot be called twice to process a second file. I think some globals get initialized properly in the first run but their state remains in memory and would be invalid for a second run. When I use cfdg in the browser, I load it in a "one-shot" web worker where input file is set up, `main()` is called, then the output file is sent back to the browser. It works and is unnoticeable, but kinda wasteful. It would be nice to be able to call `main()` repeatedly but I understand it was not designed for that.
This pull request has changes conflicting with the target branch.
  • Makefile
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin azizghuloum/wasm:azizghuloum/wasm
git switch azizghuloum/wasm

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch master
git merge --no-ff azizghuloum/wasm
git switch azizghuloum/wasm
git rebase master
git switch master
git merge --ff-only azizghuloum/wasm
git switch azizghuloum/wasm
git rebase master
git switch master
git merge --no-ff azizghuloum/wasm
git switch master
git merge --squash azizghuloum/wasm
git switch master
git merge --ff-only azizghuloum/wasm
git switch master
git merge azizghuloum/wasm
git push origin master
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: john/context-free#45
No description provided.