From: Ben Harris Date: Sat, 20 Sep 2025 20:44:19 +0000 (+0100) Subject: webstead: generate initialisers to paste into bedstead.c X-Git-Tag: bedstead-3.261~58 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=74463d2a7668478ddefdb92a66f5816ba27e41f5;p=bedstead.git webstead: generate initialisers to paste into bedstead.c --- diff --git a/webstead.xhtml b/webstead.xhtml index 39e07a6..f2bdd1c 100644 --- a/webstead.xhtml +++ b/webstead.xhtml @@ -40,6 +40,7 @@ import Bedstead from './bedstead.js'; function update_glyph() { var args = []; + var cstr = ""; for (var row of document.getElementById("pixels").rows) { var arg = 0; for (var pixel of row.getElementsByTagName('input')) { @@ -48,12 +49,15 @@ arg += 1 } } - args.push(arg.toString()) + args.push(arg.toString()); + cstr += "\\" + arg.toString(8).padStart(2, "0"); } + document.getElementById("c").textContent = + ` {"${cstr}", U() },`; Bedstead({ arguments: args, print: function(charstring) { - document.getElementById("output").textContent = charstring; + document.getElementById("charstring").textContent = charstring; document.getElementById("rendered") .setAttribute("d", charstring .replaceAll(//g, "") @@ -68,6 +72,7 @@ for (var e of document.getElementsByTagName('input')) { e.onchange = update_glyph; } + update_glyph(); ]]> @@ -148,6 +153,7 @@ -

+

+