chiark / gitweb /
Minimal build system and test page for Bedstead-in-WASM
authorBen Harris <bjh21@bjh21.me.uk>
Sat, 13 Sep 2025 21:12:08 +0000 (22:12 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 13 Jan 2026 21:42:18 +0000 (21:42 +0000)
Just allows for typing a command line and seeing the output.

Makefile
webstead.xhtml [new file with mode: 0644]

index fb38014ca7bc4622f79943f389663ff063d2d22b..6e9d205f94c6bb9b0a86eeded681e27ece8ad549 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -111,6 +111,9 @@ bedstead-complement.ps: bedstead
 bedstead-complement.pdf: bedstead-complement.ps bedstead.otf Fontmap
        ps2pdf -P $< $@
 
+%.js: %.c
+       emcc -sMODULARIZE -sEXPORT_ES6 -sEXIT_RUNTIME=1 -sSTRICT -o $@ $<
+
 .PHONY: clean
 clean:
        rm -f bedstead *.ttx *.otf *.bdf *.bdf.ps *.png *.pdf \
diff --git a/webstead.xhtml b/webstead.xhtml
new file mode 100644 (file)
index 0000000..95fa47b
--- /dev/null
@@ -0,0 +1,21 @@
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB" xml:lang="en-GB">
+  <head>
+    <!-- SPDX-License-Identifier: CC0-1.0 -->
+    <title>Bedstead editor test</title>
+    <script type="module">
+      import Bedstead from './bedstead.js';
+      document.getElementById("run").onclick = function(){
+          Bedstead({
+              arguments: document.getElementById("input").value.split(" "),
+          });
+      };
+    </script>
+  </head>
+  <body>
+    <form>
+      <label for="input">Input</label>
+      <input type="text" id="input"/>
+      <input type="button" id="run" value="Run!"/>
+    </form>
+  </body>
+</html>