From d5a1c8370c1383f015737626b42357d069daefda Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 7 Jun 2026 19:36:55 +0000 Subject: [PATCH 001/138] =?UTF-8?q?host:=20Phase=201=20=E2=80=94=20router?= =?UTF-8?q?=20+=20handler=20+=20GET=20/feed=20endpoint=20on=20Dream,=2028/?= =?UTF-8?q?28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First migrated endpoint onto the SX host. lib/host is a thin wiring layer: a host handler is a Dream handler (request->response) that calls a subsystem public API and serialises via a shared JSON envelope. - handler.sx: host/ok, host/ok-status, host/error, host/json-status (Dream's dream-json is 200-only), host/query-int - router.sx: host/make-app assembles per-domain route groups + /health probe into one dream-router (reuses dr/flatten-routes) - feed.sx: GET /feed reads feed/all + stream combinators, recent-first, with ?actor= filter and ?limit= cap - 3 test suites incl. a golden test (body == subsystem recent stream + envelope) - conformance.sh mirrors lib/dream's runner Builds on dream-on-sx (merged, gate green 480/480) rather than a throwaway native request model; collapses most of plan Phase 4 into Phase 1. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/host/conformance.sh | 103 ++++++++++++++++++++++++++++++++++++++ lib/host/feed.sx | 22 ++++++++ lib/host/handler.sx | 39 +++++++++++++++ lib/host/router.sx | 19 +++++++ lib/host/tests/feed.sx | 98 ++++++++++++++++++++++++++++++++++++ lib/host/tests/handler.sx | 86 +++++++++++++++++++++++++++++++ lib/host/tests/router.sx | 75 +++++++++++++++++++++++++++ plans/host-on-sx.md | 45 ++++++++++++++--- 8 files changed, 480 insertions(+), 7 deletions(-) create mode 100755 lib/host/conformance.sh create mode 100644 lib/host/feed.sx create mode 100644 lib/host/handler.sx create mode 100644 lib/host/router.sx create mode 100644 lib/host/tests/feed.sx create mode 100644 lib/host/tests/handler.sx create mode 100644 lib/host/tests/router.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh new file mode 100755 index 00000000..1d5ce6ec --- /dev/null +++ b/lib/host/conformance.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash +# host-on-sx conformance runner — loads the kernel stdlib, the subsystem +# libraries the host wires to, the host modules, and the host test suites in one +# sx_server process, then reports pass/fail per suite. Mirrors lib/dream's runner. +# +# Usage: +# bash lib/host/conformance.sh # run all suites +# bash lib/host/conformance.sh -v # verbose (list each suite) + +set -uo pipefail +cd "$(git rev-parse --show-toplevel)" + +SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}" +if [ ! -x "$SX_SERVER" ]; then + SX_SERVER="/root/rose-ash/hosts/ocaml/_build/default/bin/sx_server.exe" +fi +if [ ! -x "$SX_SERVER" ]; then + echo "ERROR: sx_server.exe not found." >&2 + exit 1 +fi + +VERBOSE="${1:-}" + +# Kernel + subsystem dependencies, then the host modules. Order matters: +# stdlib/r7rs first, then the feed subsystem (the first migrated domain), then +# Dream (types/json/router) the host builds on, then the host layer itself. +MODULES=( + "spec/stdlib.sx" + "lib/r7rs.sx" + "lib/apl/runtime.sx" + "lib/feed/normalize.sx" + "lib/feed/stream.sx" + "lib/feed/api.sx" + "lib/dream/types.sx" + "lib/dream/json.sx" + "lib/dream/router.sx" + "lib/host/handler.sx" + "lib/host/router.sx" + "lib/host/feed.sx" +) + +# Suites: NAME RUNNER-FN PATH +SUITES=( + "handler host-hd-tests-run! lib/host/tests/handler.sx" + "router host-rt-tests-run! lib/host/tests/router.sx" + "feed host-fd-tests-run! lib/host/tests/feed.sx" +) + +TMPFILE=$(mktemp); trap "rm -f $TMPFILE" EXIT +EPOCH=1 +emit_load () { echo "(epoch $EPOCH)"; echo "(load \"$1\")"; EPOCH=$((EPOCH+1)); } +emit_eval () { echo "(epoch $EPOCH)"; echo "(eval \"$1\")"; EPOCH=$((EPOCH+1)); } + +{ + for M in "${MODULES[@]}"; do emit_load "$M"; done + for SUITE in "${SUITES[@]}"; do + read -r _NAME _RUNNER FILE <<< "$SUITE" + emit_load "$FILE" + emit_eval "($_RUNNER)" + done +} > "$TMPFILE" + +OUTPUT=$(timeout 300 "$SX_SERVER" < "$TMPFILE" 2>&1 || true) + +TOTAL_PASS=0 +TOTAL_FAIL=0 +FAILED_SUITES=() +LAST_DICT_LINES=$(echo "$OUTPUT" | grep -E '^\{:' || true) + +I=0 +while read -r LINE; do + [ -z "$LINE" ] && continue + P=$(echo "$LINE" | grep -oE ':passed [0-9]+' | awk '{print $2}') + F=$(echo "$LINE" | grep -oE ':failed [0-9]+' | awk '{print $2}') + [ -z "$P" ] && P=0 + [ -z "$F" ] && F=0 + SUITE_INFO="${SUITES[$I]}" + SUITE_NAME=$(echo "$SUITE_INFO" | awk '{print $1}') + TOTAL_PASS=$((TOTAL_PASS + P)) + TOTAL_FAIL=$((TOTAL_FAIL + F)) + if [ "$F" -gt 0 ]; then + FAILED_SUITES+=("$SUITE_NAME: $P/$((P+F))") + printf 'X %-12s %d/%d\n' "$SUITE_NAME" "$P" "$((P+F))" + echo "$LINE" | grep -oE ':name "[^"]*"' | sed 's/:name / fail: /' + elif [ "$VERBOSE" = "-v" ]; then + printf 'ok %-12s %d passed\n' "$SUITE_NAME" "$P" + fi + I=$((I+1)) +done <<< "$LAST_DICT_LINES" + +TOTAL=$((TOTAL_PASS + TOTAL_FAIL)) +if [ "$TOTAL" -eq 0 ]; then + echo "ERROR: no suite results parsed. Raw output:" >&2 + echo "$OUTPUT" >&2 + exit 1 +fi +if [ $TOTAL_FAIL -eq 0 ]; then + echo "ok $TOTAL_PASS/$TOTAL host-on-sx tests passed (${#SUITES[@]} suites)" +else + echo "FAIL $TOTAL_PASS/$TOTAL passed, $TOTAL_FAIL failed:" + for S in "${FAILED_SUITES[@]}"; do echo " $S"; done + exit 1 +fi diff --git a/lib/host/feed.sx b/lib/host/feed.sx new file mode 100644 index 00000000..1a1d73f1 --- /dev/null +++ b/lib/host/feed.sx @@ -0,0 +1,22 @@ +;; lib/host/feed.sx — Feed domain endpoints on the host. The first real endpoint +;; migrated onto the SX host: the activity timeline, read straight from the feed +;; subsystem's public API (feed/all + the stream combinators) and serialised as +;; JSON. GET /feed returns recent-first activities; ?actor= filters by actor +;; and ?limit= caps the count. Depends on lib/feed/* + lib/host/handler.sx. + +;; GET /feed -> recent-first activities as a JSON envelope. +;; Query: ?actor= (filter) ?limit= (cap, applied after filtering). +(define host/feed-timeline + (fn (req) + (let ((base (feed/recent (feed/all))) + (actor (dream-query-param req "actor"))) + (let ((filtered (if actor (feed/by-actor base actor) base)) + (limit (dream-query-param req "limit"))) + (let ((capped + (if limit (feed/take filtered (string->number limit)) filtered))) + (host/ok (feed/items capped))))))) + +;; Route group contributed by the feed domain. +(define host/feed-routes + (list + (dream-get "/feed" host/feed-timeline))) diff --git a/lib/host/handler.sx b/lib/host/handler.sx new file mode 100644 index 00000000..6331a13a --- /dev/null +++ b/lib/host/handler.sx @@ -0,0 +1,39 @@ +;; lib/host/handler.sx — Host handler layer: the bridge from a Dream request to a +;; subsystem call and back to a Dream response. A host handler IS a Dream handler +;; (request -> response); these helpers build the JSON envelope every host +;; endpoint shares: {"ok":true,"data":...} on success, {"ok":false,"error":...} +;; on failure. Plus a status-carrying JSON constructor that Dream's own dream-json +;; (200-only) lacks, and a couple of request-reading conveniences. +;; Depends on lib/dream/types.sx + lib/dream/json.sx. + +;; ── responses ────────────────────────────────────────────────────── + +;; JSON response at an arbitrary status (dream-json is 200-only). +(define host/json-status + (fn (status value) + (dream-response status {:content-type "application/json"} + (dream-json-encode value)))) + +;; Success envelope: 200 {"ok":true,"data":}. +(define host/ok + (fn (value) + (host/json-status 200 {:ok true :data value}))) + +;; Success envelope at a chosen status (e.g. 201 for a created resource). +(define host/ok-status + (fn (status value) + (host/json-status status {:ok true :data value}))) + +;; Error envelope: {"ok":false,"error":} at the given status. +(define host/error + (fn (status message) + (host/json-status status {:ok false :error message}))) + +;; ── request reading ──────────────────────────────────────────────── + +;; Integer query param with a fallback (query params arrive as strings). +;; Absent param -> fallback; present -> parsed number. +(define host/query-int + (fn (req name fallback) + (let ((raw (dream-query-param req name))) + (if raw (string->number raw) fallback)))) diff --git a/lib/host/router.sx b/lib/host/router.sx new file mode 100644 index 00000000..400b3df7 --- /dev/null +++ b/lib/host/router.sx @@ -0,0 +1,19 @@ +;; lib/host/router.sx — Host application assembly. A host app is a single Dream +;; router built from per-domain route groups, with a built-in health endpoint and +;; a JSON 404 fallback so the native OCaml HTTP server has one entry point: +;; request -> response. Each subsystem contributes a list of Dream routes (see +;; lib/host/feed.sx); host/make-app concatenates them under one router. +;; dr/flatten-routes (Dream) flattens the nested groups, so a group is just a list +;; of routes. Depends on lib/dream/router.sx + lib/host/handler.sx. + +;; Liveness probe — GET /health -> 200 {"ok":true,"data":"healthy"}. +(define host/health-route + (dream-get "/health" (fn (req) (host/ok "healthy")))) + +;; Build the host app from a list of route groups (each a list of Dream routes). +;; The health route is always mounted first; Dream's router returns a JSON-free +;; 404 for unmatched paths, which host endpoints override per-domain as needed. +(define host/make-app + (fn (groups) + (dream-router + (cons host/health-route groups)))) diff --git a/lib/host/tests/feed.sx b/lib/host/tests/feed.sx new file mode 100644 index 00000000..efebb3a1 --- /dev/null +++ b/lib/host/tests/feed.sx @@ -0,0 +1,98 @@ +;; lib/host/tests/feed.sx — the first migrated endpoint, GET /feed. Includes a +;; golden test: the host response body must equal the feed subsystem's own +;; recent-first stream wrapped in the standard envelope — the endpoint adds the +;; HTTP/JSON shell and nothing else. + +(define host-fd-pass 0) +(define host-fd-fail 0) +(define host-fd-fails (list)) + +(define + host-fd-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-fd-pass (+ host-fd-pass 1)) + (begin + (set! host-fd-fail (+ host-fd-fail 1)) + (append! host-fd-fails {:name name :actual actual :expected expected}))))) + +(define + host-fd-req + (fn (target) (dream-request "GET" target {} ""))) + +(define + host-fd-app + (host/make-app (list host/feed-routes))) + +;; ── empty feed ───────────────────────────────────────────────────── +(feed/reset!) +(host-fd-test + "empty feed 200" + (dream-status (host-fd-app (host-fd-req "/feed"))) + 200) +(host-fd-test + "empty feed data:[]" + (contains? (dream-resp-body (host-fd-app (host-fd-req "/feed"))) "\"data\":[]") + true) + +;; ── seeded feed ──────────────────────────────────────────────────── +(feed/reset!) +(feed/post {:actor "alice" :verb "post" :object "p1" :at 1}) +(feed/post {:actor "bob" :verb "post" :object "p2" :at 2}) +(feed/post {:actor "alice" :verb "like" :object "p2" :at 3}) + +;; recent-first: newest activity (at 3) leads, so its object p2 appears before p1. +(host-fd-test + "timeline recent-first" + (let ((body (dream-resp-body (host-fd-app (host-fd-req "/feed"))))) + (< (index-of body "\"at\":3") (index-of body "\"at\":1"))) + true) + +;; actor filter: only alice's two activities. +(host-fd-test + "actor filter count" + (feed/count + (feed/by-actor (feed/recent (feed/all)) "alice")) + 2) +(host-fd-test + "actor filter excludes bob" + (contains? + (dream-resp-body (host-fd-app (host-fd-req "/feed?actor=alice"))) + "bob") + false) + +;; limit: cap to a single activity (the most recent). +(host-fd-test + "limit caps results" + (contains? + (dream-resp-body (host-fd-app (host-fd-req "/feed?limit=1"))) + "\"at\":1") + false) + +;; ── golden: endpoint = subsystem recent stream + envelope ─────────── +(host-fd-test + "golden full timeline" + (dream-resp-body (host-fd-app (host-fd-req "/feed"))) + (str + "{\"ok\":true,\"data\":" + (dream-json-encode (feed/items (feed/recent (feed/all)))) + "}")) +(host-fd-test + "golden actor-filtered" + (dream-resp-body (host-fd-app (host-fd-req "/feed?actor=alice"))) + (str + "{\"ok\":true,\"data\":" + (dream-json-encode + (feed/items (feed/by-actor (feed/recent (feed/all)) "alice"))) + "}")) + +(define + host-fd-tests-run! + (fn + () + {:total (+ host-fd-pass host-fd-fail) + :passed host-fd-pass + :failed host-fd-fail + :fails host-fd-fails})) diff --git a/lib/host/tests/handler.sx b/lib/host/tests/handler.sx new file mode 100644 index 00000000..3ee988ca --- /dev/null +++ b/lib/host/tests/handler.sx @@ -0,0 +1,86 @@ +;; lib/host/tests/handler.sx — host JSON envelope + request-reading helpers. + +(define host-hd-pass 0) +(define host-hd-fail 0) +(define host-hd-fails (list)) + +(define + host-hd-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-hd-pass (+ host-hd-pass 1)) + (begin + (set! host-hd-fail (+ host-hd-fail 1)) + (append! host-hd-fails {:name name :actual actual :expected expected}))))) + +;; ── host/ok ──────────────────────────────────────────────────────── +(host-hd-test "ok status 200" (dream-status (host/ok "x")) 200) +(host-hd-test + "ok content-type json" + (dream-resp-header (host/ok "x") "content-type") + "application/json") +(host-hd-test + "ok envelope ok:true" + (contains? (dream-resp-body (host/ok "x")) "\"ok\":true") + true) +(host-hd-test + "ok envelope carries data" + (contains? (dream-resp-body (host/ok "hi")) "\"data\":\"hi\"") + true) + +;; ── host/ok-status ───────────────────────────────────────────────── +(host-hd-test "ok-status custom" (dream-status (host/ok-status 201 "y")) 201) +(host-hd-test + "ok-status data" + (contains? (dream-resp-body (host/ok-status 201 "y")) "\"data\":\"y\"") + true) + +;; ── host/error ───────────────────────────────────────────────────── +(host-hd-test "error status" (dream-status (host/error 404 "nope")) 404) +(host-hd-test + "error ok:false" + (contains? (dream-resp-body (host/error 404 "nope")) "\"ok\":false") + true) +(host-hd-test + "error message" + (contains? (dream-resp-body (host/error 404 "nope")) "\"error\":\"nope\"") + true) +(host-hd-test + "error content-type json" + (dream-resp-header (host/error 500 "boom") "content-type") + "application/json") + +;; ── host/json-status ─────────────────────────────────────────────── +(host-hd-test + "json-status arbitrary status" + (dream-status (host/json-status 418 {:a 1})) + 418) +(host-hd-test + "json-status encodes body" + (contains? (dream-resp-body (host/json-status 200 {:a 1})) "\"a\":1") + true) + +;; ── host/query-int ───────────────────────────────────────────────── +(define + host-hd-req + (fn (target) (dream-request "GET" target {} ""))) + +(host-hd-test + "query-int present" + (host/query-int (host-hd-req "/x?limit=5") "limit" 10) + 5) +(host-hd-test + "query-int absent -> fallback" + (host/query-int (host-hd-req "/x") "limit" 10) + 10) + +(define + host-hd-tests-run! + (fn + () + {:total (+ host-hd-pass host-hd-fail) + :passed host-hd-pass + :failed host-hd-fail + :fails host-hd-fails})) diff --git a/lib/host/tests/router.sx b/lib/host/tests/router.sx new file mode 100644 index 00000000..6312f12f --- /dev/null +++ b/lib/host/tests/router.sx @@ -0,0 +1,75 @@ +;; lib/host/tests/router.sx — host app assembly: health endpoint, group mounting, +;; 404 fallback. + +(define host-rt-pass 0) +(define host-rt-fail 0) +(define host-rt-fails (list)) + +(define + host-rt-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-rt-pass (+ host-rt-pass 1)) + (begin + (set! host-rt-fail (+ host-rt-fail 1)) + (append! host-rt-fails {:name name :actual actual :expected expected}))))) + +(define + host-rt-req + (fn (method target) (dream-request method target {} ""))) + +;; An app built from one domain group of two routes. +(define + host-rt-app + (host/make-app + (list + (list + (dream-get "/ping" (fn (req) (host/ok "pong"))) + (dream-get "/widgets/:id" (fn (req) (host/ok (dream-param req "id")))))))) + +;; ── health ───────────────────────────────────────────────────────── +(host-rt-test + "health status 200" + (dream-status (host-rt-app (host-rt-req "GET" "/health"))) + 200) +(host-rt-test + "health body healthy" + (contains? + (dream-resp-body (host-rt-app (host-rt-req "GET" "/health"))) + "healthy") + true) + +;; ── group routes mounted ─────────────────────────────────────────── +(host-rt-test + "group route ping" + (contains? + (dream-resp-body (host-rt-app (host-rt-req "GET" "/ping"))) + "pong") + true) +(host-rt-test + "group path param" + (contains? + (dream-resp-body (host-rt-app (host-rt-req "GET" "/widgets/42"))) + "\"data\":\"42\"") + true) + +;; ── fallback ─────────────────────────────────────────────────────── +(host-rt-test + "unknown path 404" + (dream-status (host-rt-app (host-rt-req "GET" "/nope"))) + 404) +(host-rt-test + "wrong method 405" + (dream-status (host-rt-app (host-rt-req "POST" "/ping"))) + 405) + +(define + host-rt-tests-run! + (fn + () + {:total (+ host-rt-pass host-rt-fail) + :passed host-rt-pass + :failed host-rt-fail + :fails host-rt-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 7179545e..4a01e463 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,7 +36,7 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **0/0** (not yet started) +`bash lib/host/conformance.sh` → **28/28** (3 suites: handler, router, feed). Phase 1 DONE. ## Ground rules @@ -73,10 +73,15 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… ``` ## Phase 1 — Router + handler + one real endpoint -- [ ] `router.sx` — route table, (method,path) match -- [ ] `handler.sx` — request/response model, subsystem dispatch -- [ ] migrate ONE read endpoint (e.g. a feed timeline) end-to-end, golden test -- [ ] `conformance.sh` + scoreboard +- [x] `router.sx` — `host/make-app` assembles per-domain route groups + a built-in + `/health` probe into one Dream router (reuses Dream's `dr/flatten-routes`) +- [x] `handler.sx` — JSON envelope (`host/ok`/`host/ok-status`/`host/error`), + status-carrying `host/json-status` (Dream's `dream-json` is 200-only), and + `host/query-int`. A host handler IS a Dream handler (request -> response). +- [x] migrate ONE read endpoint: `GET /feed` (`lib/host/feed.sx`) reads + `feed/all` + stream combinators, serialises recent-first; `?actor=` filter, + `?limit=` cap. Golden test asserts body == subsystem recent stream + envelope. +- [x] `conformance.sh` (mirrors `lib/dream`'s runner) — 28/28 ## Phase 2 — Middleware + SXTP - [ ] `middleware.sx` — composable auth/acl/mute/error layers @@ -94,7 +99,33 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… - [ ] re-home external adapters as native where replacements land ## Progress log -(loop fills this in) + +- **Phase 1 (DONE, 28/28).** `lib/host/{handler,router,feed}.sx` + three test + suites + `conformance.sh`. The host is a thin wiring layer: a host handler is a + Dream handler that calls a subsystem public API and serialises the result via a + shared JSON envelope. First migrated endpoint: `GET /feed`. + - **Decision — build on Dream from Phase 1, not a throwaway native model.** The + plan front-matter gated Dream to Phase 4, but `dream-on-sx` is merged + (commit fe958bda) and its gate (`ocaml-on-sx` P1–5+P6) is green (480/480), so + reinventing request/response + routing would be pure duplication. Host reuses + Dream's `types.sx` (request/response dicts), `json.sx` (encode), and + `router.sx` (`dream-router`/`dream-get`/`dr/flatten-routes`). Phase 4's + "adopt Dream ergonomics" is therefore largely already satisfied; what remains + for Phase 4 is the live wiring against the real OCaml HTTP server + session. + - The OCaml server handing a `dream-request`-shaped dict to SX handlers is a + `hosts/` change (out of scope) — tracked under Blockers as the eventual + live-wiring step. For now the host layer is exercised purely via conformance. ## Blockers -(loop fills this in) + +- **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in + `hosts/` must hand SX handlers a `dream-request` dict and serialise the returned + `dream-response`. That is a `hosts/` change (out of scope for this loop, which is + `lib/host/**` only). Until then, endpoints are verified via `conformance.sh`, not + HTTP. Not blocking Phase 2 (middleware + SXTP + a write endpoint). +- **Worktree tooling:** in this `loops/host` worktree every sx-tree *write* tool + (`sx_write_file`, `sx_replace_node`, …) raises `yojson "Expected string, got + null"` at the MCP layer — same class as the `loops/dream` worktree gotcha, but + here even `sx_write_file` fails. Read-side sx-tree tools work. New `.sx` files + were created with the `Write` tool (the .sx hook is inactive in this worktree) + and each validated afterwards with `sx_validate` to keep the parse guarantee. From 2ffdd6f07834cd522373fb11e6061e05b6dc2d95 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 7 Jun 2026 19:48:18 +0000 Subject: [PATCH 002/138] =?UTF-8?q?host:=20Phase=202=20=E2=80=94=20middlew?= =?UTF-8?q?are=20(auth+ACL+error)=20+=20guarded=20POST=20/feed,=2043/43?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Composable handler->handler layers over Dream's primitives, with auth and permission POLICY injected so the layer is policy-free and testable: - middleware.sx: host/wrap-errors (JSON 500 via dream-catch-with), host/require-auth (bearer->principal via dream-bearer-token, JSON 401, injected token resolver), host/require-permission (lib/acl acl/permit? gate, JSON 403, injected resource extractor), host/pipeline (first = outermost) - feed.sx: POST /feed via host/feed-write-routes — auth ∘ ACL(post,feed) ∘ wrap-errors over host/feed-create (parse JSON body -> feed/post -> 201; non-object -> 400). Created activity reads back via GET /feed. - middleware suite (9) + feed write tests (6 new); conformance preloads now include the Datalog engine + ACL subsystem + Dream auth/error. ACL works with string atoms (no symbol coercion). Mute/prefs layer and sxtp.sx deferred to the next tick. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/host/conformance.sh | 32 +++++++++-- lib/host/feed.sx | 39 +++++++++++-- lib/host/middleware.sx | 54 ++++++++++++++++++ lib/host/tests/feed.sx | 51 +++++++++++++++-- lib/host/tests/middleware.sx | 107 +++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 28 +++++++-- 6 files changed, 291 insertions(+), 20 deletions(-) create mode 100644 lib/host/middleware.sx create mode 100644 lib/host/tests/middleware.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 1d5ce6ec..c89c4beb 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -22,28 +22,50 @@ fi VERBOSE="${1:-}" # Kernel + subsystem dependencies, then the host modules. Order matters: -# stdlib/r7rs first, then the feed subsystem (the first migrated domain), then -# Dream (types/json/router) the host builds on, then the host layer itself. +# stdlib/r7rs first; the Datalog engine + ACL subsystem (authorisation); the feed +# subsystem (the first migrated domain); Dream (types/json/auth/error/router) the +# host builds on; then the host layer itself. MODULES=( "spec/stdlib.sx" "lib/r7rs.sx" "lib/apl/runtime.sx" + "lib/datalog/tokenizer.sx" + "lib/datalog/parser.sx" + "lib/datalog/unify.sx" + "lib/datalog/db.sx" + "lib/datalog/builtins.sx" + "lib/datalog/aggregates.sx" + "lib/datalog/strata.sx" + "lib/datalog/eval.sx" + "lib/datalog/api.sx" + "lib/datalog/magic.sx" + "lib/acl/schema.sx" + "lib/acl/facts.sx" + "lib/acl/engine.sx" + "lib/acl/explain.sx" + "lib/acl/audit.sx" + "lib/acl/federation.sx" + "lib/acl/api.sx" "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" "lib/dream/types.sx" "lib/dream/json.sx" + "lib/dream/auth.sx" + "lib/dream/error.sx" "lib/dream/router.sx" "lib/host/handler.sx" + "lib/host/middleware.sx" "lib/host/router.sx" "lib/host/feed.sx" ) # Suites: NAME RUNNER-FN PATH SUITES=( - "handler host-hd-tests-run! lib/host/tests/handler.sx" - "router host-rt-tests-run! lib/host/tests/router.sx" - "feed host-fd-tests-run! lib/host/tests/feed.sx" + "handler host-hd-tests-run! lib/host/tests/handler.sx" + "middleware host-mw-tests-run! lib/host/tests/middleware.sx" + "router host-rt-tests-run! lib/host/tests/router.sx" + "feed host-fd-tests-run! lib/host/tests/feed.sx" ) TMPFILE=$(mktemp); trap "rm -f $TMPFILE" EXIT diff --git a/lib/host/feed.sx b/lib/host/feed.sx index 1a1d73f1..47bb58f3 100644 --- a/lib/host/feed.sx +++ b/lib/host/feed.sx @@ -1,8 +1,10 @@ -;; lib/host/feed.sx — Feed domain endpoints on the host. The first real endpoint -;; migrated onto the SX host: the activity timeline, read straight from the feed -;; subsystem's public API (feed/all + the stream combinators) and serialised as -;; JSON. GET /feed returns recent-first activities; ?actor= filters by actor -;; and ?limit= caps the count. Depends on lib/feed/* + lib/host/handler.sx. +;; lib/host/feed.sx — Feed domain endpoints on the host. The first domain migrated +;; onto the SX host: read the activity timeline (GET /feed) and create activities +;; (POST /feed). Both go straight through the feed subsystem's public API; the +;; write path runs behind the host middleware stack (auth + ACL). Depends on +;; lib/feed/* + lib/host/handler.sx + lib/host/middleware.sx (write routes only). + +;; ── read ─────────────────────────────────────────────────────────── ;; GET /feed -> recent-first activities as a JSON envelope. ;; Query: ?actor= (filter) ?limit= (cap, applied after filtering). @@ -16,7 +18,32 @@ (if limit (feed/take filtered (string->number limit)) filtered))) (host/ok (feed/items capped))))))) -;; Route group contributed by the feed domain. +;; Public read route group. (define host/feed-routes (list (dream-get "/feed" host/feed-timeline))) + +;; ── write ────────────────────────────────────────────────────────── + +;; POST /feed -> create an activity from the JSON body. Returns 201 + the created +;; (normalised) activity. Body must be a JSON object; anything else -> 400. +(define host/feed-create + (fn (req) + (let ((raw (dream-json-body req))) + (if (= (type-of raw) "dict") + (host/ok-status 201 (feed/post raw)) + (host/error 400 "invalid activity"))))) + +;; Guarded write route group: POST /feed behind auth + ACL ("post" on "feed"). +;; resolve : token -> principal | nil (injected auth policy, e.g. token lookup +;; against the identity subsystem). Errors thrown downstream become a JSON 500. +(define host/feed-write-routes + (fn (resolve) + (list + (dream-post "/feed" + (host/pipeline + (list + host/wrap-errors + (host/require-auth resolve) + (host/require-permission "post" (fn (req) "feed"))) + host/feed-create))))) diff --git a/lib/host/middleware.sx b/lib/host/middleware.sx new file mode 100644 index 00000000..f919eefa --- /dev/null +++ b/lib/host/middleware.sx @@ -0,0 +1,54 @@ +;; lib/host/middleware.sx — Host middleware: composable handler->handler layers +;; for the cross-cutting concerns every write endpoint shares — error trapping +;; (JSON 500), authentication (bearer token -> principal), and authorisation +;; (ACL permit?). Middleware is plain function composition; host/pipeline threads a +;; list onto a handler, FIRST middleware outermost (so it runs first). Auth and +;; permission policy are INJECTED — the token resolver and the resource extractor — +;; so this layer carries no hardcoded policy. Reuses Dream's bearer/error helpers +;; and lib/acl's public acl/permit?. +;; Depends on lib/dream/{auth,error,router}.sx + lib/acl/api.sx + lib/host/handler.sx. + +;; Compose a list of middlewares onto a handler (first = outermost). +(define host/pipeline + (fn (middlewares handler) + (dr/apply-middlewares middlewares handler))) + +;; The authenticated principal attached by host/require-auth. +(define host/principal (fn (req) (dream-principal req))) + +;; ── error trapping ───────────────────────────────────────────────── +;; Any error thrown downstream becomes a JSON 500 envelope. +(define host/-on-error + (fn (req e) (host/error 500 "internal error"))) +(define host/wrap-errors (dream-catch-with host/-on-error)) + +;; ── authentication ───────────────────────────────────────────────── +;; resolve : token -> principal | nil. Missing/invalid token -> JSON 401 with a +;; WWW-Authenticate: Bearer challenge; success attaches :dream-principal so +;; downstream layers (and host/principal) can read it. +(define host/require-auth + (fn (resolve) + (fn (next) + (fn (req) + (let ((tok (dream-bearer-token req))) + (let ((principal (if tok (resolve tok) nil))) + (if (nil? principal) + (dream-add-header + (host/error 401 "unauthorized") + "www-authenticate" + "Bearer") + (next (assoc req :dream-principal principal))))))))) + +;; ── authorisation ────────────────────────────────────────────────── +;; Gate on ACL: the authed principal must be permitted `action` on the resource +;; computed by res-fn from the request. Denied -> JSON 403. Assumes the ACL fact +;; db was loaded (acl/load!) at startup. Place AFTER host/require-auth. +(define host/require-permission + (fn (action res-fn) + (fn (next) + (fn (req) + (let ((subject (host/principal req)) + (resource (res-fn req))) + (if (acl/permit? subject action resource) + (next req) + (host/error 403 "forbidden"))))))) diff --git a/lib/host/tests/feed.sx b/lib/host/tests/feed.sx index efebb3a1..6d58c9c4 100644 --- a/lib/host/tests/feed.sx +++ b/lib/host/tests/feed.sx @@ -1,7 +1,7 @@ -;; lib/host/tests/feed.sx — the first migrated endpoint, GET /feed. Includes a -;; golden test: the host response body must equal the feed subsystem's own -;; recent-first stream wrapped in the standard envelope — the endpoint adds the -;; HTTP/JSON shell and nothing else. +;; lib/host/tests/feed.sx — the migrated feed endpoints, GET /feed (read) and +;; POST /feed (guarded write). Includes a golden test: the host read response +;; body must equal the feed subsystem's own recent-first stream wrapped in the +;; standard envelope — the endpoint adds the HTTP/JSON shell and nothing else. (define host-fd-pass 0) (define host-fd-fail 0) @@ -43,7 +43,7 @@ (feed/post {:actor "bob" :verb "post" :object "p2" :at 2}) (feed/post {:actor "alice" :verb "like" :object "p2" :at 3}) -;; recent-first: newest activity (at 3) leads, so its object p2 appears before p1. +;; recent-first: newest activity (at 3) leads, so its marker precedes the oldest. (host-fd-test "timeline recent-first" (let ((body (dream-resp-body (host-fd-app (host-fd-req "/feed"))))) @@ -88,6 +88,47 @@ (feed/items (feed/by-actor (feed/recent (feed/all)) "alice"))) "}")) +;; ── write: POST /feed (auth + ACL + action) ──────────────────────── +(acl/load! (list (acl-grant "alice" "post" "feed"))) +(define host-fd-resolve (fn (tok) (if (= tok "good") "alice" nil))) +(define + host-fd-wapp + (host/make-app + (list host/feed-routes (host/feed-write-routes host-fd-resolve)))) +(define + host-fd-post + (fn (auth body) + (dream-request "POST" "/feed" (if auth {:authorization auth} {}) body))) + +(feed/reset!) +(host-fd-test + "post no auth -> 401" + (dream-status (host-fd-wapp (host-fd-post nil "{}"))) + 401) +(host-fd-test + "post unchanged feed after 401" + (feed/size) + 0) +(host-fd-test + "post authed+permitted -> 201" + (dream-status + (host-fd-wapp + (host-fd-post + "Bearer good" + "{\"actor\":\"alice\",\"verb\":\"post\",\"object\":\"p9\",\"at\":9}"))) + 201) +(host-fd-test "post grew feed" (feed/size) 1) +(host-fd-test + "created activity visible in timeline" + (contains? + (dream-resp-body (host-fd-wapp (host-fd-req "/feed"))) + "p9") + true) +(host-fd-test + "post non-object body -> 400" + (dream-status (host-fd-wapp (host-fd-post "Bearer good" "[1,2]"))) + 400) + (define host-fd-tests-run! (fn diff --git a/lib/host/tests/middleware.sx b/lib/host/tests/middleware.sx new file mode 100644 index 00000000..6bb980b8 --- /dev/null +++ b/lib/host/tests/middleware.sx @@ -0,0 +1,107 @@ +;; lib/host/tests/middleware.sx — auth (bearer -> principal), ACL gate, and error +;; trapping, composed via host/pipeline. ACL facts: alice may "post" on "feed". + +(define host-mw-pass 0) +(define host-mw-fail 0) +(define host-mw-fails (list)) + +(define + host-mw-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-mw-pass (+ host-mw-pass 1)) + (begin + (set! host-mw-fail (+ host-mw-fail 1)) + (append! host-mw-fails {:name name :actual actual :expected expected}))))) + +;; ── fixtures ─────────────────────────────────────────────────────── +(acl/load! (list (acl-grant "alice" "post" "feed"))) + +(define host-mw-resolve + (fn (tok) (if (= tok "good") "alice" nil))) + +(define host-mw-handler + (fn (req) (host/ok-status 201 (host/principal req)))) + +;; protected: needs auth + post/feed permission +(define host-mw-protected + (host/pipeline + (list + (host/require-auth host-mw-resolve) + (host/require-permission "post" (fn (req) "feed"))) + host-mw-handler)) + +;; protected with an action alice is NOT granted +(define host-mw-protected-del + (host/pipeline + (list + (host/require-auth host-mw-resolve) + (host/require-permission "delete" (fn (req) "feed"))) + host-mw-handler)) + +(define + host-mw-req + (fn (auth) + (dream-request "POST" "/feed" + (if auth {:authorization auth} {}) + ""))) + +;; ── auth ─────────────────────────────────────────────────────────── +(host-mw-test + "no token -> 401" + (dream-status (host-mw-protected (host-mw-req nil))) + 401) +(host-mw-test + "401 has www-authenticate" + (dream-resp-header (host-mw-protected (host-mw-req nil)) "www-authenticate") + "Bearer") +(host-mw-test + "bad token -> 401" + (dream-status (host-mw-protected (host-mw-req "Bearer wrong"))) + 401) + +;; ── authz ────────────────────────────────────────────────────────── +(host-mw-test + "authed + permitted -> 201" + (dream-status (host-mw-protected (host-mw-req "Bearer good"))) + 201) +(host-mw-test + "principal threaded to handler" + (contains? + (dream-resp-body (host-mw-protected (host-mw-req "Bearer good"))) + "\"data\":\"alice\"") + true) +(host-mw-test + "authed but not permitted -> 403" + (dream-status (host-mw-protected-del (host-mw-req "Bearer good"))) + 403) +(host-mw-test + "403 envelope" + (contains? + (dream-resp-body (host-mw-protected-del (host-mw-req "Bearer good"))) + "\"error\":\"forbidden\"") + true) + +;; ── error trapping ───────────────────────────────────────────────── +(define host-mw-boom (fn (req) (error "kaboom"))) +(host-mw-test + "wrap-errors -> 500" + (dream-status ((host/wrap-errors host-mw-boom) (host-mw-req nil))) + 500) +(host-mw-test + "500 envelope" + (contains? + (dream-resp-body ((host/wrap-errors host-mw-boom) (host-mw-req nil))) + "\"ok\":false") + true) + +(define + host-mw-tests-run! + (fn + () + {:total (+ host-mw-pass host-mw-fail) + :passed host-mw-pass + :failed host-mw-fail + :fails host-mw-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 4a01e463..bca44deb 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,7 +36,8 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **28/28** (3 suites: handler, router, feed). Phase 1 DONE. +`bash lib/host/conformance.sh` → **43/43** (4 suites: handler, middleware, router, +feed). Phase 1 DONE; Phase 2 in progress (middleware + write endpoint DONE, SXTP next). ## Ground rules @@ -84,9 +85,18 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… - [x] `conformance.sh` (mirrors `lib/dream`'s runner) — 28/28 ## Phase 2 — Middleware + SXTP -- [ ] `middleware.sx` — composable auth/acl/mute/error layers -- [ ] `sxtp.sx` — host↔subsystem wire format (align with existing spec) -- [ ] migrate a write endpoint (auth + permission + action) +- [x] `middleware.sx` — composable layers as `handler->handler`: `host/wrap-errors` + (JSON 500), `host/require-auth` (bearer -> principal, JSON 401, INJECTED token + resolver), `host/require-permission` (ACL `acl/permit?` gate, JSON 403, + INJECTED resource extractor), `host/pipeline` (first = outermost). Reuses + Dream's `dream-bearer-token` + `dream-catch-with`; calls lib/acl public API. + Mute/prefs layer deferred (no blocker, add when a domain needs it). +- [ ] `sxtp.sx` — host↔subsystem wire format (align with existing spec at + `applications/sxtp/spec.sx`) +- [x] migrate a write endpoint (auth + permission + action): `POST /feed` + (`host/feed-write-routes resolve`) — auth ∘ ACL("post","feed") ∘ wrap-errors + over `host/feed-create`, which parses the JSON body and `feed/post`s it (201); + non-object body -> 400. Created activity is readable back via `GET /feed`. ## Phase 3 — Strangler migration ledger - [ ] enumerate Quart endpoints; track migrated vs proxied @@ -116,6 +126,16 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… `hosts/` change (out of scope) — tracked under Blockers as the eventual live-wiring step. For now the host layer is exercised purely via conformance. +- **Phase 2 (middleware + write endpoint DONE, 43/43).** `lib/host/middleware.sx` + + a guarded `POST /feed`. Middleware is plain function composition over Dream's + primitives; auth/permission *policy* is injected (token resolver, resource + extractor) so the layer is policy-free and testable. ACL authorisation runs + against lib/acl's public `acl/permit?` (string atoms work — no symbol coercion + needed). The write path proves the auth ∘ permission ∘ action stack end-to-end: + 401 unauth, 403 unpermitted, 201 + readback on success, 400 on bad body. + - **Remaining for Phase 2: `sxtp.sx`** — the host↔subsystem wire format. Align + with the existing spec at `applications/sxtp/spec.sx`. This is the next tick. + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From 065fd248da5785c3044d3f9457310d5d4e76b044 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 7 Jun 2026 20:01:25 +0000 Subject: [PATCH 003/138] =?UTF-8?q?host:=20Phase=202=20complete=20?= =?UTF-8?q?=E2=80=94=20SXTP=20wire=20format=20+=20Dream=20bridge,=2082/82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/host/sxtp.sx implements the host<->subsystem wire format per applications/sxtp/spec.sx: - message algebra (request/response/condition/event + status helpers ok/created/not-found/forbidden/invalid/fail) as string-keyed dicts; verb/status/type stored as symbols (ride the wire bare) - codec: sxtp/serialize (dict -> text/sx list form, deterministic top-level field order, nested messages emitted in their own list form, no :msg leak) and sxtp/parse (text/sx -> dict via a deep keyword-token->string normaliser) - Dream bridge: sxtp/from-dream (HTTP req -> SXTP req, method->verb, query->params) and sxtp/to-dream (SXTP resp -> HTTP resp, status->code, body serialised to text/sx) - 39-test suite covering algebra, serialise/parse round-trip, mappings, bridge Runtime notes: serialize renders string-keyed dicts as {:k v} and symbols bare; parsed keyword tokens are a distinct type (not = to string literals) so parse normalises; unquote-splicing is unreliable so the emitter is str-based. Co-Authored-By: Claude Opus 4.8 (1M context) --- lib/host/conformance.sh | 2 + lib/host/sxtp.sx | 173 ++++++++++++++++++++++++++++++++++++++++ lib/host/tests/sxtp.sx | 129 ++++++++++++++++++++++++++++++ plans/host-on-sx.md | 30 +++++-- 4 files changed, 328 insertions(+), 6 deletions(-) create mode 100644 lib/host/sxtp.sx create mode 100644 lib/host/tests/sxtp.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index c89c4beb..a16d569a 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -56,6 +56,7 @@ MODULES=( "lib/dream/router.sx" "lib/host/handler.sx" "lib/host/middleware.sx" + "lib/host/sxtp.sx" "lib/host/router.sx" "lib/host/feed.sx" ) @@ -64,6 +65,7 @@ MODULES=( SUITES=( "handler host-hd-tests-run! lib/host/tests/handler.sx" "middleware host-mw-tests-run! lib/host/tests/middleware.sx" + "sxtp host-sx-tests-run! lib/host/tests/sxtp.sx" "router host-rt-tests-run! lib/host/tests/router.sx" "feed host-fd-tests-run! lib/host/tests/feed.sx" ) diff --git a/lib/host/sxtp.sx b/lib/host/sxtp.sx new file mode 100644 index 00000000..f6ff211c --- /dev/null +++ b/lib/host/sxtp.sx @@ -0,0 +1,173 @@ +;; lib/host/sxtp.sx — SXTP, the host<->subsystem wire format. SXTP messages are +;; SX s-expressions (content-type text/sx): a request/response/condition/event is +;; a tagged list `(request :verb navigate :path "/x" ...)`. See the protocol spec +;; at applications/sxtp/spec.sx. +;; +;; Representation: internally a message is a plain dict tagged by :msg ("request" +;; /"response"/"condition"/"event"), with string keys so the keyword==string rule +;; makes construction and access trivial. verb/status/type are stored as SYMBOLS +;; (they ride the wire bare, not quoted). The wire LIST form is produced/consumed +;; only at the serialise/parse boundary: +;; sxtp/serialize : msg-dict -> text/sx string +;; sxtp/parse : text/sx string -> msg-dict +;; A Dream HTTP request/response bridges to/from SXTP via sxtp/from-dream and +;; sxtp/to-dream, so the host can speak SXTP to subsystems while serving HTTP. +;; Depends on lib/dream/types.sx (dream-response + request/response accessors). + +;; ── helpers ──────────────────────────────────────────────────────── +(define sxtp/-sym + (fn (x) (if (= (type-of x) "symbol") x (string->symbol x)))) +(define sxtp/-name + (fn (x) (if (= (type-of x) "symbol") (symbol->string x) x))) + +;; ── constructors ─────────────────────────────────────────────────── +;; opts is a dict of optional fields (e.g. {:headers .. :params .. :body ..}). +(define sxtp/request + (fn (verb path opts) + (merge {:msg "request" :verb (sxtp/-sym verb) :path path} opts))) +(define sxtp/response + (fn (status opts) + (merge {:msg "response" :status (sxtp/-sym status)} opts))) +(define sxtp/condition + (fn (ctype opts) + (merge {:msg "condition" :type (sxtp/-sym ctype)} opts))) +(define sxtp/event + (fn (etype opts) + (merge {:msg "event" :type (sxtp/-sym etype)} opts))) + +;; ── predicates ───────────────────────────────────────────────────── +(define sxtp/-is? + (fn (m tag) (and (= (type-of m) "dict") (= (get m :msg) tag)))) +(define sxtp/request? (fn (m) (sxtp/-is? m "request"))) +(define sxtp/response? (fn (m) (sxtp/-is? m "response"))) +(define sxtp/condition? (fn (m) (sxtp/-is? m "condition"))) +(define sxtp/event? (fn (m) (sxtp/-is? m "event"))) + +;; ── accessors ────────────────────────────────────────────────────── +(define sxtp/verb (fn (m) (get m :verb))) +(define sxtp/path (fn (m) (get m :path))) +(define sxtp/req-headers (fn (m) (get m :headers))) +(define sxtp/params (fn (m) (get m :params))) +(define sxtp/param (fn (m name) (get (get m :params) name))) +(define sxtp/body (fn (m) (get m :body))) +(define sxtp/capabilities (fn (m) (get m :capabilities))) +(define sxtp/status (fn (m) (get m :status))) +(define sxtp/resp-headers (fn (m) (get m :headers))) +(define sxtp/stream? (fn (m) (= (get m :stream) true))) +(define sxtp/cond-type (fn (m) (get m :type))) +(define sxtp/cond-message (fn (m) (get m :message))) + +;; ── status helpers (build responses) ─────────────────────────────── +(define sxtp/ok (fn (body) (sxtp/response "ok" {:body body}))) +(define sxtp/created (fn (body) (sxtp/response "created" {:body body}))) +(define sxtp/no-content (fn () (sxtp/response "no-content" {}))) +(define sxtp/not-found + (fn (path message) + (sxtp/response "not-found" + {:body (sxtp/condition "resource-not-found" + {:path path :message message :retry false})}))) +(define sxtp/forbidden + (fn (message) + (sxtp/response "forbidden" + {:body (sxtp/condition "forbidden" {:message message})}))) +(define sxtp/invalid + (fn (message) + (sxtp/response "invalid" + {:body (sxtp/condition "invalid" {:message message})}))) +(define sxtp/fail + (fn (message) + (sxtp/response "error" + {:body (sxtp/condition "error" {:message message})}))) + +;; ── HTTP <-> SXTP mappings ───────────────────────────────────────── +(define sxtp/-method-verbs + {:GET "fetch" :HEAD "fetch" :POST "create" + :PUT "mutate" :PATCH "mutate" :DELETE "delete" :OPTIONS "inspect"}) +(define sxtp/verb-for-method + (fn (method) (sxtp/-sym (get sxtp/-method-verbs (upper method) "fetch")))) + +(define sxtp/-status-http + {:ok 200 :created 201 :accepted 202 :no-content 204 :redirect 302 + :not-modified 304 :error 500 :not-found 404 :forbidden 403 + :invalid 400 :conflict 409 :unavailable 503}) +(define sxtp/http-status + (fn (status) (get sxtp/-status-http (sxtp/-name status) 200))) + +;; ── Dream bridge ─────────────────────────────────────────────────── +;; HTTP request -> SXTP request: method->verb, query->params, headers/body carry. +(define sxtp/from-dream + (fn (req) + (sxtp/request + (sxtp/verb-for-method (get req :method)) + (get req :path) + {:headers (get req :headers) + :params (get req :query) + :body (get req :body)}))) + +;; SXTP response -> HTTP response: status->code, body serialised to text/sx. +(define sxtp/-body-text + (fn (b) (if (nil? b) "" (serialize b)))) +(define sxtp/to-dream + (fn (resp) + (dream-response + (sxtp/http-status (sxtp/status resp)) + (merge {:content-type "text/sx"} (or (sxtp/resp-headers resp) {})) + (sxtp/-body-text (sxtp/body resp))))) + +;; ── wire serialise (msg-dict -> text/sx) ─────────────────────────── +;; Top-level field order is fixed per message type so output is deterministic; +;; nested dict/value order follows the serialize primitive. +(define sxtp/-field-order + {:request (list :verb :path :headers :cookies :params :capabilities :body) + :response (list :status :headers :set-cookie :body :stream) + :condition (list :type :message :path :retry :detail) + :event (list :type :id :body :time)}) +;; A nested SXTP message (a condition/event in a :body) serialises in its own +;; list form; plain data values go through the serialize primitive. +(define sxtp/-emit-value + (fn (v) + (if (and (= (type-of v) "dict") (has-key? v :msg)) + (sxtp/serialize v) + (serialize v)))) +(define sxtp/serialize + (fn (msg) + (let ((head (get msg :msg))) + (let ((order (get sxtp/-field-order head))) + (str "(" + head + (reduce + (fn (acc k) + (if (has-key? msg k) + (str acc " :" k " " (sxtp/-emit-value (get msg k))) + acc)) + "" + order) + ")"))))) + +;; ── wire parse (text/sx -> msg-dict) ─────────────────────────────── +;; parse yields a list with keyword-token keys and possibly keyword-token dict +;; keys; sxtp/-normalize deep-converts those tokens to strings so the result is +;; the same string-keyed shape the constructors produce. +(define sxtp/-normalize + (fn (v) + (let ((t (type-of v))) + (cond + ((= t "keyword") (str v)) + ((= t "dict") + (reduce + (fn (acc k) (assoc acc (str k) (sxtp/-normalize (get v k)))) + {} + (keys v))) + ((= t "list") (map sxtp/-normalize v)) + (true v))))) +(define sxtp/-pairs->dict + (fn (kvs acc) + (if (< (len kvs) 2) + acc + (sxtp/-pairs->dict + (rest (rest kvs)) + (assoc acc (str (first kvs)) (sxtp/-normalize (first (rest kvs)))))))) +(define sxtp/parse + (fn (text) + (let ((lst (parse text))) + (sxtp/-pairs->dict (rest lst) {:msg (symbol->string (first lst))})))) diff --git a/lib/host/tests/sxtp.sx b/lib/host/tests/sxtp.sx new file mode 100644 index 00000000..0abeaf53 --- /dev/null +++ b/lib/host/tests/sxtp.sx @@ -0,0 +1,129 @@ +;; lib/host/tests/sxtp.sx — SXTP message algebra, wire serialise/parse round-trip, +;; and the Dream HTTP <-> SXTP bridge. + +(define host-sx-pass 0) +(define host-sx-fail 0) +(define host-sx-fails (list)) + +(define + host-sx-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-sx-pass (+ host-sx-pass 1)) + (begin + (set! host-sx-fail (+ host-sx-fail 1)) + (append! host-sx-fails {:name name :actual actual :expected expected}))))) + +;; ── constructors + predicates ────────────────────────────────────── +(define host-sx-req (sxtp/request "navigate" "/x" {:headers {:host "h"}})) +(define host-sx-resp (sxtp/ok {:id "e1"})) + +(host-sx-test "request?" (sxtp/request? host-sx-req) true) +(host-sx-test "request not response" (sxtp/response? host-sx-req) false) +(host-sx-test "response?" (sxtp/response? host-sx-resp) true) +(host-sx-test "condition?" (sxtp/condition? (sxtp/condition "x" {})) true) + +;; ── accessors (verb/status are symbols) ──────────────────────────── +(host-sx-test "verb" (symbol->string (sxtp/verb host-sx-req)) "navigate") +(host-sx-test "path" (sxtp/path host-sx-req) "/x") +(host-sx-test "req header" (get (sxtp/req-headers host-sx-req) :host) "h") +(host-sx-test "status" (symbol->string (sxtp/status host-sx-resp)) "ok") +(host-sx-test "body" (get (sxtp/body host-sx-resp) :id) "e1") + +;; ── status helpers ───────────────────────────────────────────────── +(host-sx-test "created status" (symbol->string (sxtp/status (sxtp/created {}))) "created") +(host-sx-test + "not-found status" + (symbol->string (sxtp/status (sxtp/not-found "/p" "gone"))) + "not-found") +(host-sx-test + "not-found body is condition" + (sxtp/condition? (sxtp/body (sxtp/not-found "/p" "gone"))) + true) +(host-sx-test + "forbidden message" + (sxtp/cond-message (sxtp/body (sxtp/forbidden "no"))) + "no") + +;; ── serialise (deterministic top-level field order) ──────────────── +(host-sx-test + "serialize request" + (sxtp/serialize host-sx-req) + "(request :verb navigate :path \"/x\" :headers {:host \"h\"})") +(host-sx-test + "serialize ok" + (sxtp/serialize (sxtp/ok {:id "e1"})) + "(response :status ok :body {:id \"e1\"})") +;; nested condition rides the wire in its (condition ...) list form, no :msg leak. +(host-sx-test + "serialize nested condition as list" + (contains? + (sxtp/serialize (sxtp/not-found "/p" "gone")) + "(condition :type resource-not-found") + true) +(host-sx-test + "serialize no :msg leak" + (contains? (sxtp/serialize host-sx-resp) ":msg") + false) + +;; ── parse + round-trip ───────────────────────────────────────────── +(define host-sx-parsed + (sxtp/parse "(request :verb query :path \"/events\" :headers {:host \"h\"})")) +(host-sx-test "parse msg type" (sxtp/request? host-sx-parsed) true) +(host-sx-test "parse verb" (symbol->string (sxtp/verb host-sx-parsed)) "query") +(host-sx-test "parse path" (sxtp/path host-sx-parsed) "/events") +(host-sx-test + "parse nested header normalised" + (get (sxtp/req-headers host-sx-parsed) :host) + "h") + +(define host-sx-rt (sxtp/parse (sxtp/serialize (sxtp/ok {:id "e1" :n 3})))) +(host-sx-test "round-trip status" (symbol->string (sxtp/status host-sx-rt)) "ok") +(host-sx-test "round-trip body id" (get (sxtp/body host-sx-rt) :id) "e1") +(host-sx-test "round-trip body n" (get (sxtp/body host-sx-rt) :n) 3) + +;; ── HTTP <-> SXTP mappings ───────────────────────────────────────── +(host-sx-test "verb GET->fetch" (symbol->string (sxtp/verb-for-method "GET")) "fetch") +(host-sx-test "verb POST->create" (symbol->string (sxtp/verb-for-method "POST")) "create") +(host-sx-test "verb DELETE->delete" (symbol->string (sxtp/verb-for-method "DELETE")) "delete") +(host-sx-test "verb unknown->fetch" (symbol->string (sxtp/verb-for-method "WIBBLE")) "fetch") +(host-sx-test "http ok->200" (sxtp/http-status (string->symbol "ok")) 200) +(host-sx-test "http not-found->404" (sxtp/http-status (string->symbol "not-found")) 404) + +;; ── Dream bridge ─────────────────────────────────────────────────── +(define host-sx-from + (sxtp/from-dream (dream-request "POST" "/feed?a=1" {} "hi"))) +(host-sx-test "from-dream verb" (symbol->string (sxtp/verb host-sx-from)) "create") +(host-sx-test "from-dream path" (sxtp/path host-sx-from) "/feed") +(host-sx-test "from-dream param" (sxtp/param host-sx-from "a") "1") +(host-sx-test "from-dream body" (sxtp/body host-sx-from) "hi") + +(define host-sx-tod (sxtp/to-dream (sxtp/ok {:id "e1"}))) +(host-sx-test "to-dream status" (dream-status host-sx-tod) 200) +(host-sx-test + "to-dream content-type text/sx" + (dream-resp-header host-sx-tod "content-type") + "text/sx") +(host-sx-test + "to-dream body is sx text" + (dream-resp-body host-sx-tod) + "{:id \"e1\"}") +(host-sx-test + "to-dream not-found->404" + (dream-status (sxtp/to-dream (sxtp/not-found "/p" "gone"))) + 404) +(host-sx-test + "to-dream forbidden->403" + (dream-status (sxtp/to-dream (sxtp/forbidden "no"))) + 403) + +(define + host-sx-tests-run! + (fn + () + {:total (+ host-sx-pass host-sx-fail) + :passed host-sx-pass + :failed host-sx-fail + :fails host-sx-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index bca44deb..83504b56 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,8 +36,8 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **43/43** (4 suites: handler, middleware, router, -feed). Phase 1 DONE; Phase 2 in progress (middleware + write endpoint DONE, SXTP next). +`bash lib/host/conformance.sh` → **82/82** (5 suites: handler, middleware, sxtp, +router, feed). Phases 1 & 2 DONE; Phase 3 (strangler ledger) next. ## Ground rules @@ -91,8 +91,15 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… INJECTED resource extractor), `host/pipeline` (first = outermost). Reuses Dream's `dream-bearer-token` + `dream-catch-with`; calls lib/acl public API. Mute/prefs layer deferred (no blocker, add when a domain needs it). -- [ ] `sxtp.sx` — host↔subsystem wire format (align with existing spec at - `applications/sxtp/spec.sx`) +- [x] `sxtp.sx` — host↔subsystem wire format (per `applications/sxtp/spec.sx`). + Message algebra (`sxtp/request`/`response`/`condition`/`event` + status + helpers `sxtp/ok`/`created`/`not-found`/`forbidden`/`invalid`/`fail`) as + string-keyed dicts; verb/status/type as symbols (ride the wire bare). Codec: + `sxtp/serialize` (dict → `text/sx` list form, deterministic field order, + nested messages in their own list form, no `:msg` leak) and `sxtp/parse` + (`text/sx` → dict, deep keyword-token→string normaliser). Dream bridge: + `sxtp/from-dream` (HTTP req → SXTP req, method→verb, query→params) and + `sxtp/to-dream` (SXTP resp → HTTP resp, status→code, body→`text/sx`). - [x] migrate a write endpoint (auth + permission + action): `POST /feed` (`host/feed-write-routes resolve`) — auth ∘ ACL("post","feed") ∘ wrap-errors over `host/feed-create`, which parses the JSON body and `feed/post`s it (201); @@ -133,8 +140,19 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… against lib/acl's public `acl/permit?` (string atoms work — no symbol coercion needed). The write path proves the auth ∘ permission ∘ action stack end-to-end: 401 unauth, 403 unpermitted, 201 + readback on success, 400 on bad body. - - **Remaining for Phase 2: `sxtp.sx`** — the host↔subsystem wire format. Align - with the existing spec at `applications/sxtp/spec.sx`. This is the next tick. +- **Phase 2 COMPLETE (82/82).** `lib/host/sxtp.sx` adds the SXTP codec + Dream + bridge (39-test suite). Key representation calls, learned by probing the runtime: + keywords are strings at eval time but the `serialize` primitive renders + string-keyed dicts back as `{:k v}` and symbols bare — so messages are + string-keyed dicts with verb/status/type as symbols, and a small str-based + emitter produces wire-faithful list form. `parse` needs a deep normaliser + because parsed keyword tokens are a distinct type (not `=` to string literals). + `unquote-splicing` is unreliable here, so the serializer is str-based, not + quasiquote-based. + - **Next: Phase 3 — strangler migration ledger.** Enumerate the Quart endpoints + (use the `rose-ash-services` `svc_routes` MCP tool), track migrated vs proxied, + and stand up a golden-response harness against the live Quart responses. Then + cut over the smallest whole domain (`likes` or `relations`) as proof. ## Blockers From ef7de817bb45906f00284ea1910276881243aec7 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 17:11:22 +0000 Subject: [PATCH 004/138] =?UTF-8?q?host:=20Phase=203=20=E2=80=94=20strangl?= =?UTF-8?q?er=20migration=20ledger=20+=20coverage,=20107/107?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- lib/host/conformance.sh | 2 + lib/host/ledger.sx | 82 ++++++++++++++++++++++++++++++++++++ lib/host/tests/ledger.sx | 89 ++++++++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 29 +++++++++++-- 4 files changed, 198 insertions(+), 4 deletions(-) create mode 100644 lib/host/ledger.sx create mode 100644 lib/host/tests/ledger.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index a16d569a..ff94802d 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -59,6 +59,7 @@ MODULES=( "lib/host/sxtp.sx" "lib/host/router.sx" "lib/host/feed.sx" + "lib/host/ledger.sx" ) # Suites: NAME RUNNER-FN PATH @@ -68,6 +69,7 @@ SUITES=( "sxtp host-sx-tests-run! lib/host/tests/sxtp.sx" "router host-rt-tests-run! lib/host/tests/router.sx" "feed host-fd-tests-run! lib/host/tests/feed.sx" + "ledger host-lg-tests-run! lib/host/tests/ledger.sx" ) TMPFILE=$(mktemp); trap "rm -f $TMPFILE" EXIT diff --git a/lib/host/ledger.sx b/lib/host/ledger.sx new file mode 100644 index 00000000..445d9146 --- /dev/null +++ b/lib/host/ledger.sx @@ -0,0 +1,82 @@ +;; lib/host/ledger.sx — the strangler migration ledger. A catalogue of every +;; rose-ash HTTP endpoint with its Quart original and its current host status, so +;; the cut-over from Quart to the SX host is tracked endpoint-by-endpoint rather +;; than big-bang. Status is one of: +;; :native — born on the host, has no Quart original (e.g. /health probe) +;; :migrated — moved off Quart, now served by an SX handler +;; :proxied — still on Quart; the host forwards until cut over +;; Coverage (how far the strangler has progressed = how much is OFF Quart) is +;; computed from the catalogue. Pure data + queries — no IO, fully conformable. + +;; ── entry constructor ─────────────────────────────────────────────── +;; quart is a "service:handler" ref string (nil for :native endpoints); handler +;; is the SX handler name serving it (nil while still :proxied). +(define host/ledger-entry + (fn (domain method path quart status handler) + {:domain domain :method method :path path + :quart quart :status status :handler handler})) + +;; ── the catalogue ─────────────────────────────────────────────────── +;; Reflects the live host: feed reads+writes migrated, /health native, the +;; internal-only likes/relations data+action endpoints still proxied to Quart. +;; relations is the next cut-over candidate — it already has a real SX subsystem +;; (lib/relations); likes has none, so it stays proxied until one exists. +(define host/ledger + (list + (host/ledger-entry "host" "GET" "/health" nil "native" "host/health-route") + (host/ledger-entry "feed" "GET" "/feed" "feed:timeline" "migrated" "host/feed-timeline") + (host/ledger-entry "feed" "POST" "/feed" "feed:create" "migrated" "host/feed-create") + (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "proxied" nil) + (host/ledger-entry "relations" "GET" "/internal/data/get-parents" "relations:get_parents" "proxied" nil) + (host/ledger-entry "relations" "POST" "/internal/actions/relate" "relations:relate" "proxied" nil) + (host/ledger-entry "relations" "POST" "/internal/actions/unrelate" "relations:unrelate" "proxied" nil) + (host/ledger-entry "likes" "GET" "/internal/data/is-liked" "likes:is_liked" "proxied" nil) + (host/ledger-entry "likes" "GET" "/internal/data/liked-slugs" "likes:liked_slugs" "proxied" nil) + (host/ledger-entry "likes" "GET" "/internal/data/liked-ids" "likes:liked_ids" "proxied" nil) + (host/ledger-entry "likes" "POST" "/internal/actions/toggle" "likes:toggle" "proxied" nil))) + +;; ── status / domain queries ───────────────────────────────────────── +(define host/ledger-by-status + (fn (ledger status) (filter (fn (e) (= (get e :status) status)) ledger))) +(define host/ledger-migrated (fn (ledger) (host/ledger-by-status ledger "migrated"))) +(define host/ledger-proxied (fn (ledger) (host/ledger-by-status ledger "proxied"))) +(define host/ledger-native (fn (ledger) (host/ledger-by-status ledger "native"))) +(define host/ledger-by-domain + (fn (ledger domain) (filter (fn (e) (= (get e :domain) domain)) ledger))) + +;; An endpoint is OFF Quart (served by the host) iff native or migrated. +(define host/ledger-served? + (fn (e) (or (= (get e :status) "native") (= (get e :status) "migrated")))) + +;; First entry matching (method, path), or nil. +(define host/ledger-find + (fn (ledger method path) + (let ((hits (filter + (fn (e) (and (= (get e :method) method) (= (get e :path) path))) + ledger))) + (if (> (len hits) 0) (first hits) nil)))) + +;; Distinct domains in the catalogue (order: first-seen, reversed by cons). +(define host/ledger-domains + (fn (ledger) + (reduce + (fn (acc e) + (let ((d (get e :domain))) + (if (some (fn (x) (= x d)) acc) acc (cons d acc)))) + (list) + ledger))) + +;; ── coverage ──────────────────────────────────────────────────────── +;; served = off Quart (migrated + native); percent = served / total, floored. +(define host/ledger-coverage + (fn (ledger) + (let ((total (len ledger)) + (migrated (len (host/ledger-migrated ledger))) + (proxied (len (host/ledger-proxied ledger))) + (native (len (host/ledger-native ledger)))) + {:total total + :migrated migrated + :proxied proxied + :native native + :served (+ migrated native) + :percent (if (= total 0) 0 (quotient (* 100 (+ migrated native)) total))}))) diff --git a/lib/host/tests/ledger.sx b/lib/host/tests/ledger.sx new file mode 100644 index 00000000..8b1c0f0a --- /dev/null +++ b/lib/host/tests/ledger.sx @@ -0,0 +1,89 @@ +;; lib/host/tests/ledger.sx — the strangler migration ledger: entry shape, +;; status/domain queries, find, distinct domains, and coverage maths. + +(define host-lg-pass 0) +(define host-lg-fail 0) +(define host-lg-fails (list)) + +(define + host-lg-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-lg-pass (+ host-lg-pass 1)) + (begin + (set! host-lg-fail (+ host-lg-fail 1)) + (append! host-lg-fails {:name name :actual actual :expected expected}))))) + +;; ── entry constructor ─────────────────────────────────────────────── +(define host-lg-e (host/ledger-entry "feed" "GET" "/feed" "feed:timeline" "migrated" "host/feed-timeline")) +(host-lg-test "entry domain" (get host-lg-e :domain) "feed") +(host-lg-test "entry path" (get host-lg-e :path) "/feed") +(host-lg-test "entry status" (get host-lg-e :status) "migrated") +(host-lg-test "entry handler" (get host-lg-e :handler) "host/feed-timeline") + +;; ── find ──────────────────────────────────────────────────────────── +(host-lg-test + "find GET /feed -> migrated" + (get (host/ledger-find host/ledger "GET" "/feed") :status) + "migrated") +(host-lg-test + "find GET /feed -> handler" + (get (host/ledger-find host/ledger "GET" "/feed") :handler) + "host/feed-timeline") +(host-lg-test + "find POST /feed -> create" + (get (host/ledger-find host/ledger "POST" "/feed") :handler) + "host/feed-create") +(host-lg-test "find missing -> nil" (host/ledger-find host/ledger "GET" "/nope") nil) + +;; ── status queries ────────────────────────────────────────────────── +(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 2) +(host-lg-test "native count" (len (host/ledger-native host/ledger)) 1) +(host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 8) + +;; ── served? predicate ─────────────────────────────────────────────── +(host-lg-test + "served? migrated" + (host/ledger-served? (host/ledger-find host/ledger "GET" "/feed")) + true) +(host-lg-test + "served? native" + (host/ledger-served? (host/ledger-find host/ledger "GET" "/health")) + true) +(host-lg-test + "served? proxied false" + (host/ledger-served? (host/ledger-find host/ledger "POST" "/internal/actions/relate")) + false) + +;; ── domain queries ────────────────────────────────────────────────── +(host-lg-test "relations domain count" (len (host/ledger-by-domain host/ledger "relations")) 4) +(host-lg-test "likes domain count" (len (host/ledger-by-domain host/ledger "likes")) 4) +(host-lg-test "domains count" (len (host/ledger-domains host/ledger)) 4) +(host-lg-test + "domains has relations" + (some (fn (d) (= d "relations")) (host/ledger-domains host/ledger)) + true) +(host-lg-test + "domains has feed" + (some (fn (d) (= d "feed")) (host/ledger-domains host/ledger)) + true) + +;; ── coverage ──────────────────────────────────────────────────────── +(define host-lg-cov (host/ledger-coverage host/ledger)) +(host-lg-test "coverage total" (get host-lg-cov :total) 11) +(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 2) +(host-lg-test "coverage proxied" (get host-lg-cov :proxied) 8) +(host-lg-test "coverage native" (get host-lg-cov :native) 1) +(host-lg-test "coverage served" (get host-lg-cov :served) 3) +(host-lg-test "coverage percent" (get host-lg-cov :percent) 27) + +(define + host-lg-tests-run! + (fn + () + {:total (+ host-lg-pass host-lg-fail) + :passed host-lg-pass + :failed host-lg-fail + :fails host-lg-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 83504b56..23ecf4a0 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,8 +36,9 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **82/82** (5 suites: handler, middleware, sxtp, -router, feed). Phases 1 & 2 DONE; Phase 3 (strangler ledger) next. +`bash lib/host/conformance.sh` → **107/107** (6 suites: handler, middleware, sxtp, +router, feed, ledger). Phases 1 & 2 DONE; Phase 3 (strangler ledger) underway — +ledger module landed; `relations` cut-over next. ## Ground rules @@ -106,9 +107,16 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… non-object body -> 400. Created activity is readable back via `GET /feed`. ## Phase 3 — Strangler migration ledger -- [ ] enumerate Quart endpoints; track migrated vs proxied +- [x] enumerate Quart endpoints; track migrated vs proxied — `ledger.sx`: a + catalogue of every endpoint (domain, method, path, Quart original, status + `:native`/`:migrated`/`:proxied`, SX handler) + queries (by-status/by-domain, + `host/ledger-find`, `host/ledger-served?`, distinct domains) and + `host/ledger-coverage` (off-Quart % = (migrated+native)/total). Seeded with + the live state: feed reads+writes migrated, `/health` native, the + internal-only `relations`/`likes` data+action endpoints proxied. - [ ] golden-response harness vs the live Quart responses -- [ ] cut over a whole domain (smallest: `likes` or `relations`) as proof +- [ ] cut over a whole domain (`relations` — it has a real SX subsystem + `lib/relations`; `likes` has none so it stays proxied) as proof ## Phase 4 — Dream framework layer (gated) - [ ] gate: `ocaml-on-sx` Phases 1–5 + minimal stdlib green @@ -154,6 +162,19 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… and stand up a golden-response harness against the live Quart responses. Then cut over the smallest whole domain (`likes` or `relations`) as proof. +- **Phase 3 — ledger module (DONE, 107/107).** `lib/host/ledger.sx` + a 25-test + suite. Enumerated the endpoint surface via the `rose-ash-services` MCP + (`svc_routes`/`svc_queries`/`svc_actions`): `likes` and `relations` have **no + public blueprint routes** — they're internal-only, exposed as + `/internal/data/{query}` + `/internal/actions/{action}` (HMAC-signed). The + ledger is a pure-data catalogue keyed by (domain, method, path) carrying each + endpoint's Quart original, status, and serving SX handler; coverage reports the + off-Quart percentage. Cut-over target chosen: **`relations`** (already has a real + SX subsystem `lib/relations` — children/parents reads + relate/unrelate writes + map straight onto its public API); `likes` stays proxied (no SX lib to dispatch + to). NEXT: migrate the `relations` read endpoints onto host handlers (flip their + ledger status to `:migrated`) with golden tests. + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From 11aba081f4da5ea0878e18fdb16a53f14f0b05e3 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 17:24:37 +0000 Subject: [PATCH 005/138] =?UTF-8?q?host:=20Phase=203=20=E2=80=94=20relatio?= =?UTF-8?q?ns=20READ=20cut-over=20(get-children/get-parents),=20121/121?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate the two internal relations read queries onto lib/relations: GET /internal/data/get-children + /get-parents dispatch to relations/children and relations/parents. Bridge the Quart (type,id) node key to a graph atom symbol "type:id" with relation-type as the edge kind; optional child/parent -type params filter by "type:" prefix. Golden tests pin each endpoint to subsystem-call + envelope. Ledger entries flipped to :migrated (off-Quart coverage 27% -> 45%). Co-Authored-By: Claude Opus 4.8 --- lib/host/conformance.sh | 8 +++ lib/host/ledger.sx | 10 ++-- lib/host/relations.sx | 58 +++++++++++++++++++ lib/host/tests/ledger.sx | 16 ++++-- lib/host/tests/relations.sx | 112 ++++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 31 ++++++++-- 6 files changed, 219 insertions(+), 16 deletions(-) create mode 100644 lib/host/relations.sx create mode 100644 lib/host/tests/relations.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index ff94802d..57ee4a2f 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -46,6 +46,12 @@ MODULES=( "lib/acl/audit.sx" "lib/acl/federation.sx" "lib/acl/api.sx" + "lib/relations/schema.sx" + "lib/relations/engine.sx" + "lib/relations/api.sx" + "lib/relations/explain.sx" + "lib/relations/federation.sx" + "lib/relations/tree.sx" "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" @@ -59,6 +65,7 @@ MODULES=( "lib/host/sxtp.sx" "lib/host/router.sx" "lib/host/feed.sx" + "lib/host/relations.sx" "lib/host/ledger.sx" ) @@ -69,6 +76,7 @@ SUITES=( "sxtp host-sx-tests-run! lib/host/tests/sxtp.sx" "router host-rt-tests-run! lib/host/tests/router.sx" "feed host-fd-tests-run! lib/host/tests/feed.sx" + "relations host-rl-tests-run! lib/host/tests/relations.sx" "ledger host-lg-tests-run! lib/host/tests/ledger.sx" ) diff --git a/lib/host/ledger.sx b/lib/host/ledger.sx index 445d9146..5104918e 100644 --- a/lib/host/ledger.sx +++ b/lib/host/ledger.sx @@ -18,16 +18,16 @@ ;; ── the catalogue ─────────────────────────────────────────────────── ;; Reflects the live host: feed reads+writes migrated, /health native, the -;; internal-only likes/relations data+action endpoints still proxied to Quart. -;; relations is the next cut-over candidate — it already has a real SX subsystem -;; (lib/relations); likes has none, so it stays proxied until one exists. +;; relations READ endpoints migrated onto lib/relations (see lib/host/relations.sx), +;; relations writes + the internal-only likes data+action endpoints still proxied +;; to Quart. likes has no SX subsystem, so it stays proxied until one exists. (define host/ledger (list (host/ledger-entry "host" "GET" "/health" nil "native" "host/health-route") (host/ledger-entry "feed" "GET" "/feed" "feed:timeline" "migrated" "host/feed-timeline") (host/ledger-entry "feed" "POST" "/feed" "feed:create" "migrated" "host/feed-create") - (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "proxied" nil) - (host/ledger-entry "relations" "GET" "/internal/data/get-parents" "relations:get_parents" "proxied" nil) + (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "migrated" "host/relations-children") + (host/ledger-entry "relations" "GET" "/internal/data/get-parents" "relations:get_parents" "migrated" "host/relations-parents") (host/ledger-entry "relations" "POST" "/internal/actions/relate" "relations:relate" "proxied" nil) (host/ledger-entry "relations" "POST" "/internal/actions/unrelate" "relations:unrelate" "proxied" nil) (host/ledger-entry "likes" "GET" "/internal/data/is-liked" "likes:is_liked" "proxied" nil) diff --git a/lib/host/relations.sx b/lib/host/relations.sx new file mode 100644 index 00000000..70bc65e7 --- /dev/null +++ b/lib/host/relations.sx @@ -0,0 +1,58 @@ +;; lib/host/relations.sx — Relations domain endpoints on the host. The relations +;; service is internal-only (no public routes): Quart exposes it as signed +;; /internal/data/{query} reads + /internal/actions/{action} writes. This migrates +;; the two READ queries — get-children, get-parents — straight onto the SX host, +;; dispatching to the lib/relations subsystem (a saturating Datalog graph). +;; +;; Node model: the Quart relations API keys nodes by a (type, id) pair; the graph +;; subsystem keys them by an opaque atom. We bridge by composing the atom as the +;; symbol "type:id", with the relation-type as the edge kind. Optional child-type +;; / parent-type params filter the result by that "type:" prefix — matching the +;; Quart queries' optional type narrowing. +;; Depends on lib/relations/* + lib/host/handler.sx + lib/dream/* (query params). + +;; ── node helpers ──────────────────────────────────────────────────── +(define host/-rel-node + (fn (type id) (string->symbol (str type ":" id)))) +(define host/-rel-node-type? + (fn (node type) (starts-with? (symbol->string node) (str type ":")))) +(define host/-rel-strings + (fn (nodes) (map (fn (n) (symbol->string n)) nodes))) + +;; ── GET /internal/data/get-children ───────────────────────────────── +;; query: parent-type, parent-id, relation-type (required); child-type (optional +;; filter). Returns the child node ids ("type:id") for the parent under that kind. +(define host/relations-children + (fn (req) + (let ((ptype (dream-query-param req "parent-type")) + (pid (dream-query-param req "parent-id")) + (kind (dream-query-param req "relation-type"))) + (if (and ptype pid kind) + (let ((kids (relations/children (host/-rel-node ptype pid) (string->symbol kind))) + (ctype (dream-query-param req "child-type"))) + (let ((sel (if ctype (filter (fn (k) (host/-rel-node-type? k ctype)) kids) kids))) + (host/ok (host/-rel-strings sel)))) + (host/error 400 "missing parameter"))))) + +;; ── GET /internal/data/get-parents ────────────────────────────────── +;; query: child-type, child-id, relation-type (required); parent-type (optional +;; filter). Returns the parent node ids ("type:id") for the child under that kind. +(define host/relations-parents + (fn (req) + (let ((ctype (dream-query-param req "child-type")) + (cid (dream-query-param req "child-id")) + (kind (dream-query-param req "relation-type"))) + (if (and ctype cid kind) + (let ((ps (relations/parents (host/-rel-node ctype cid) (string->symbol kind))) + (ptype (dream-query-param req "parent-type"))) + (let ((sel (if ptype (filter (fn (p) (host/-rel-node-type? p ptype)) ps) ps))) + (host/ok (host/-rel-strings sel)))) + (host/error 400 "missing parameter"))))) + +;; ── read route group ──────────────────────────────────────────────── +;; Internal data reads (the signed-internal-auth gate is a separate middleware +;; concern, like the feed reads); these dispatch straight to the subsystem. +(define host/relations-routes + (list + (dream-get "/internal/data/get-children" host/relations-children) + (dream-get "/internal/data/get-parents" host/relations-parents))) diff --git a/lib/host/tests/ledger.sx b/lib/host/tests/ledger.sx index 8b1c0f0a..bffd5a86 100644 --- a/lib/host/tests/ledger.sx +++ b/lib/host/tests/ledger.sx @@ -37,11 +37,15 @@ (get (host/ledger-find host/ledger "POST" "/feed") :handler) "host/feed-create") (host-lg-test "find missing -> nil" (host/ledger-find host/ledger "GET" "/nope") nil) +(host-lg-test + "find migrated relations read -> handler" + (get (host/ledger-find host/ledger "GET" "/internal/data/get-children") :handler) + "host/relations-children") ;; ── status queries ────────────────────────────────────────────────── -(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 2) +(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 4) (host-lg-test "native count" (len (host/ledger-native host/ledger)) 1) -(host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 8) +(host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 6) ;; ── served? predicate ─────────────────────────────────────────────── (host-lg-test @@ -73,11 +77,11 @@ ;; ── coverage ──────────────────────────────────────────────────────── (define host-lg-cov (host/ledger-coverage host/ledger)) (host-lg-test "coverage total" (get host-lg-cov :total) 11) -(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 2) -(host-lg-test "coverage proxied" (get host-lg-cov :proxied) 8) +(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 4) +(host-lg-test "coverage proxied" (get host-lg-cov :proxied) 6) (host-lg-test "coverage native" (get host-lg-cov :native) 1) -(host-lg-test "coverage served" (get host-lg-cov :served) 3) -(host-lg-test "coverage percent" (get host-lg-cov :percent) 27) +(host-lg-test "coverage served" (get host-lg-cov :served) 5) +(host-lg-test "coverage percent" (get host-lg-cov :percent) 45) (define host-lg-tests-run! diff --git a/lib/host/tests/relations.sx b/lib/host/tests/relations.sx new file mode 100644 index 00000000..fa3567de --- /dev/null +++ b/lib/host/tests/relations.sx @@ -0,0 +1,112 @@ +;; lib/host/tests/relations.sx — the migrated relations read endpoints, +;; GET /internal/data/get-children and /get-parents, dispatching to lib/relations. +;; Golden tests pin each endpoint to "subsystem call + standard envelope": the +;; host adds the HTTP/JSON shell over relations/children|parents and nothing else +;; (golden derived from the same subsystem call, so result order matches). + +(define host-rl-pass 0) +(define host-rl-fail 0) +(define host-rl-fails (list)) + +(define + host-rl-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-rl-pass (+ host-rl-pass 1)) + (begin + (set! host-rl-fail (+ host-rl-fail 1)) + (append! host-rl-fails {:name name :actual actual :expected expected}))))) + +(define host-rl-req (fn (target) (dream-request "GET" target {} ""))) +(define host-rl-app (host/make-app (list host/relations-routes))) +(define host-rl-sym (fn (s) (string->symbol s))) + +;; ── seed a known graph ────────────────────────────────────────────── +;; org:1 --member--> list:7, list:8 ; org:1 --owner--> page:9 +(relations/load! (list)) +(relations/relate (host-rl-sym "org:1") (host-rl-sym "list:7") (host-rl-sym "member")) +(relations/relate (host-rl-sym "org:1") (host-rl-sym "list:8") (host-rl-sym "member")) +(relations/relate (host-rl-sym "org:1") (host-rl-sym "page:9") (host-rl-sym "owner")) + +;; ── get-children ──────────────────────────────────────────────────── +(define host-rl-kids + "/internal/data/get-children?parent-type=org&parent-id=1&relation-type=member") +(host-rl-test "children 200" (dream-status (host-rl-app (host-rl-req host-rl-kids))) 200) +(host-rl-test + "children has list:7" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-kids))) "list:7") + true) +(host-rl-test + "children has list:8" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-kids))) "list:8") + true) +(host-rl-test + "children excludes other-kind page:9" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-kids))) "page:9") + false) +(host-rl-test + "children count via subsystem" + (len (relations/children (host-rl-sym "org:1") (host-rl-sym "member"))) + 2) + +;; child-type filter narrows by node prefix. +(host-rl-test + "children child-type=list keeps both" + (contains? + (dream-resp-body (host-rl-app (host-rl-req (str host-rl-kids "&child-type=list")))) + "list:8") + true) +(host-rl-test + "children child-type=page filters all out" + (contains? + (dream-resp-body (host-rl-app (host-rl-req (str host-rl-kids "&child-type=page")))) + "list:7") + false) + +;; ── get-parents ───────────────────────────────────────────────────── +(define host-rl-par + "/internal/data/get-parents?child-type=list&child-id=7&relation-type=member") +(host-rl-test "parents 200" (dream-status (host-rl-app (host-rl-req host-rl-par))) 200) +(host-rl-test + "parents has org:1" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-par))) "org:1") + true) + +;; ── missing required params -> 400 ────────────────────────────────── +(host-rl-test + "children missing param -> 400" + (dream-status (host-rl-app (host-rl-req "/internal/data/get-children?parent-type=org"))) + 400) +(host-rl-test + "parents missing param -> 400" + (dream-status (host-rl-app (host-rl-req "/internal/data/get-parents?child-type=list"))) + 400) + +;; ── golden: endpoint = subsystem call + envelope ──────────────────── +(host-rl-test + "golden children" + (dream-resp-body (host-rl-app (host-rl-req host-rl-kids))) + (str + "{\"ok\":true,\"data\":" + (dream-json-encode + (host/-rel-strings (relations/children (host-rl-sym "org:1") (host-rl-sym "member")))) + "}")) +(host-rl-test + "golden parents" + (dream-resp-body (host-rl-app (host-rl-req host-rl-par))) + (str + "{\"ok\":true,\"data\":" + (dream-json-encode + (host/-rel-strings (relations/parents (host-rl-sym "list:7") (host-rl-sym "member")))) + "}")) + +(define + host-rl-tests-run! + (fn + () + {:total (+ host-rl-pass host-rl-fail) + :passed host-rl-pass + :failed host-rl-fail + :fails host-rl-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 23ecf4a0..a2fc90de 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,9 +36,10 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **107/107** (6 suites: handler, middleware, sxtp, -router, feed, ledger). Phases 1 & 2 DONE; Phase 3 (strangler ledger) underway — -ledger module landed; `relations` cut-over next. +`bash lib/host/conformance.sh` → **121/121** (7 suites: handler, middleware, sxtp, +router, feed, relations, ledger). Phases 1 & 2 DONE; Phase 3 (strangler ledger) +underway — ledger module + `relations` READ cut-over landed (45% off Quart); +relations writes + golden harness next. ## Ground rules @@ -115,8 +116,13 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… the live state: feed reads+writes migrated, `/health` native, the internal-only `relations`/`likes` data+action endpoints proxied. - [ ] golden-response harness vs the live Quart responses -- [ ] cut over a whole domain (`relations` — it has a real SX subsystem - `lib/relations`; `likes` has none so it stays proxied) as proof +- [~] cut over a whole domain (`relations`) as proof — READ side DONE + (`lib/host/relations.sx`): `GET /internal/data/get-children` + `/get-parents` + dispatch to `lib/relations` (`relations/children`/`parents`). Node model: + graph atom = symbol `"type:id"`, edge = relation-type; optional child/parent + `-type` param filters by `"type:"` prefix. Golden tests pin each endpoint to + `subsystem-call + envelope`. Ledger entries flipped to `:migrated`. WRITE side + (`relate`/`unrelate` actions, behind auth+ACL like POST /feed) next. ## Phase 4 — Dream framework layer (gated) - [ ] gate: `ocaml-on-sx` Phases 1–5 + minimal stdlib green @@ -175,6 +181,21 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… to). NEXT: migrate the `relations` read endpoints onto host handlers (flip their ledger status to `:migrated`) with golden tests. +- **Phase 3 — relations READ cut-over (DONE, 121/121).** `lib/host/relations.sx` + + a 13-test golden suite; ledger flipped (off-Quart coverage 27% → 45%). The two + internal read queries (`get-children`, `get-parents`) now dispatch to the + `lib/relations` Datalog graph. Bridge: the Quart `(type, id)` node key maps to a + graph atom `(string->symbol "type:id")` with relation-type as the edge kind; + optional `child-type`/`parent-type` params filter the result list by `"type:"` + prefix (verified live: composite-string nodes round-trip through + `relations/relate` → `relations/children`). Golden discipline: `relations` is + internal-only (no public Quart route — confirmed via `svc_routes`), so the golden + is a **pinned fixture** (a known graph loaded in-test, asserted as + `subsystem-call + envelope`) rather than a live Quart capture. Reads are + unguarded for now — the signed-internal-auth gate is a separate middleware layer, + same as the feed reads. NEXT: relations WRITE actions (`relate`/`unrelate`) + behind the auth+ACL pipeline (mirroring POST /feed). + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From bac80f6c0b2b2c0cde8f29ef37a6b74e673a8115 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 17:30:45 +0000 Subject: [PATCH 006/138] =?UTF-8?q?host:=20Phase=203=20=E2=80=94=20relatio?= =?UTF-8?q?ns=20WRITE=20cut-over=20(attach/detach-child),=20132/132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate the container relations write actions onto lib/relations: POST /internal/actions/attach-child + /detach-child dispatch to relations/relate and relations/unrelate over the same "type:id" node model, behind the auth+ACL pipeline (wrap-errors . require-auth . require-permission), mirroring POST /feed. Closed-loop test: attach -> visible via get-children -> detach -> gone; 401/403/400 guards. Ledger now models the full relations surface (7 endpoints): container reads+writes migrated, typed relate/unrelate/can-relate proxied (registry+cardinality validation not in lib/relations). Off-Quart coverage 45% -> 50%. Co-Authored-By: Claude Opus 4.8 --- lib/host/ledger.sx | 20 ++++++---- lib/host/relations.sx | 74 +++++++++++++++++++++++++++++++++++++ lib/host/tests/ledger.sx | 24 ++++++++---- lib/host/tests/relations.sx | 68 ++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 39 ++++++++++++++----- 5 files changed, 200 insertions(+), 25 deletions(-) diff --git a/lib/host/ledger.sx b/lib/host/ledger.sx index 5104918e..f6a66f44 100644 --- a/lib/host/ledger.sx +++ b/lib/host/ledger.sx @@ -18,18 +18,24 @@ ;; ── the catalogue ─────────────────────────────────────────────────── ;; Reflects the live host: feed reads+writes migrated, /health native, the -;; relations READ endpoints migrated onto lib/relations (see lib/host/relations.sx), -;; relations writes + the internal-only likes data+action endpoints still proxied -;; to Quart. likes has no SX subsystem, so it stays proxied until one exists. +;; relations container endpoints migrated onto lib/relations (reads get-children/ +;; get-parents + writes attach-child/detach-child — see lib/host/relations.sx). +;; The TYPED relations actions (relate/unrelate/can-relate) stay proxied: they +;; carry registry + cardinality validation lib/relations does not implement. The +;; internal-only likes data+action endpoints stay proxied too — likes has no SX +;; subsystem to dispatch to. (define host/ledger (list (host/ledger-entry "host" "GET" "/health" nil "native" "host/health-route") (host/ledger-entry "feed" "GET" "/feed" "feed:timeline" "migrated" "host/feed-timeline") (host/ledger-entry "feed" "POST" "/feed" "feed:create" "migrated" "host/feed-create") - (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "migrated" "host/relations-children") - (host/ledger-entry "relations" "GET" "/internal/data/get-parents" "relations:get_parents" "migrated" "host/relations-parents") - (host/ledger-entry "relations" "POST" "/internal/actions/relate" "relations:relate" "proxied" nil) - (host/ledger-entry "relations" "POST" "/internal/actions/unrelate" "relations:unrelate" "proxied" nil) + (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "migrated" "host/relations-children") + (host/ledger-entry "relations" "GET" "/internal/data/get-parents" "relations:get_parents" "migrated" "host/relations-parents") + (host/ledger-entry "relations" "POST" "/internal/actions/attach-child" "relations:attach_child" "migrated" "host/relations-attach") + (host/ledger-entry "relations" "POST" "/internal/actions/detach-child" "relations:detach_child" "migrated" "host/relations-detach") + (host/ledger-entry "relations" "POST" "/internal/actions/relate" "relations:relate" "proxied" nil) + (host/ledger-entry "relations" "POST" "/internal/actions/unrelate" "relations:unrelate" "proxied" nil) + (host/ledger-entry "relations" "POST" "/internal/actions/can-relate" "relations:can_relate" "proxied" nil) (host/ledger-entry "likes" "GET" "/internal/data/is-liked" "likes:is_liked" "proxied" nil) (host/ledger-entry "likes" "GET" "/internal/data/liked-slugs" "likes:liked_slugs" "proxied" nil) (host/ledger-entry "likes" "GET" "/internal/data/liked-ids" "likes:liked_ids" "proxied" nil) diff --git a/lib/host/relations.sx b/lib/host/relations.sx index 70bc65e7..4ed3fc30 100644 --- a/lib/host/relations.sx +++ b/lib/host/relations.sx @@ -56,3 +56,77 @@ (list (dream-get "/internal/data/get-children" host/relations-children) (dream-get "/internal/data/get-parents" host/relations-parents))) + +;; ── writes: container relations (attach-child / detach-child) ──────── +;; The write side of get-children/get-parents: a container edge between a parent +;; (type,id) and child (type,id) under a relation kind. Maps to relations/relate +;; and relations/unrelate over the same "type:id" node model, so an attach is +;; immediately visible through get-children. (The TYPED relate/unrelate/can-relate +;; actions stay on Quart — they carry registry + cardinality validation that +;; lib/relations does not implement.) Body is the action's JSON params dict. + +;; Pull the four node coordinates + kind from a payload; nil if any are absent. +(define host/-rel-edge + (fn (p) + (let ((pt (get p :parent-type)) (pid (get p :parent-id)) + (ct (get p :child-type)) (cid (get p :child-id)) + (kind (get p :relation-type))) + (if (and pt pid ct cid kind) + {:parent (host/-rel-node pt pid) + :child (host/-rel-node ct cid) + :kind (string->symbol kind) + :parent-id (str pt ":" pid) + :child-id (str ct ":" cid) + :relation kind} + nil)))) + +;; POST /internal/actions/attach-child — create the container edge. 201 on success. +(define host/relations-attach + (fn (req) + (let ((p (dream-json-body req))) + (if (= (type-of p) "dict") + (let ((e (host/-rel-edge p))) + (if e + (begin + (relations/relate (get e :parent) (get e :child) (get e :kind)) + (host/ok-status 201 + {:parent (get e :parent-id) :child (get e :child-id) + :relation (get e :relation)})) + (host/error 400 "missing parameter"))) + (host/error 400 "invalid payload"))))) + +;; POST /internal/actions/detach-child — remove the container edge. 200 on success. +(define host/relations-detach + (fn (req) + (let ((p (dream-json-body req))) + (if (= (type-of p) "dict") + (let ((e (host/-rel-edge p))) + (if e + (begin + (relations/unrelate (get e :parent) (get e :child) (get e :kind)) + (host/ok + {:parent (get e :parent-id) :child (get e :child-id) + :relation (get e :relation) :detached true})) + (host/error 400 "missing parameter"))) + (host/error 400 "invalid payload"))))) + +;; Guarded write route group: each action behind auth + ACL. attach needs +;; ("relate","relations"); detach needs ("unrelate","relations"). resolve is the +;; injected token->principal auth policy (same shape as host/feed-write-routes). +(define host/relations-write-routes + (fn (resolve) + (list + (dream-post "/internal/actions/attach-child" + (host/pipeline + (list + host/wrap-errors + (host/require-auth resolve) + (host/require-permission "relate" (fn (req) "relations"))) + host/relations-attach)) + (dream-post "/internal/actions/detach-child" + (host/pipeline + (list + host/wrap-errors + (host/require-auth resolve) + (host/require-permission "unrelate" (fn (req) "relations"))) + host/relations-detach))))) diff --git a/lib/host/tests/ledger.sx b/lib/host/tests/ledger.sx index bffd5a86..d2c3b628 100644 --- a/lib/host/tests/ledger.sx +++ b/lib/host/tests/ledger.sx @@ -41,11 +41,19 @@ "find migrated relations read -> handler" (get (host/ledger-find host/ledger "GET" "/internal/data/get-children") :handler) "host/relations-children") +(host-lg-test + "find migrated relations write -> handler" + (get (host/ledger-find host/ledger "POST" "/internal/actions/attach-child") :handler) + "host/relations-attach") +(host-lg-test + "typed relate still proxied" + (get (host/ledger-find host/ledger "POST" "/internal/actions/relate") :status) + "proxied") ;; ── status queries ────────────────────────────────────────────────── -(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 4) +(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 6) (host-lg-test "native count" (len (host/ledger-native host/ledger)) 1) -(host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 6) +(host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 7) ;; ── served? predicate ─────────────────────────────────────────────── (host-lg-test @@ -62,7 +70,7 @@ false) ;; ── domain queries ────────────────────────────────────────────────── -(host-lg-test "relations domain count" (len (host/ledger-by-domain host/ledger "relations")) 4) +(host-lg-test "relations domain count" (len (host/ledger-by-domain host/ledger "relations")) 7) (host-lg-test "likes domain count" (len (host/ledger-by-domain host/ledger "likes")) 4) (host-lg-test "domains count" (len (host/ledger-domains host/ledger)) 4) (host-lg-test @@ -76,12 +84,12 @@ ;; ── coverage ──────────────────────────────────────────────────────── (define host-lg-cov (host/ledger-coverage host/ledger)) -(host-lg-test "coverage total" (get host-lg-cov :total) 11) -(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 4) -(host-lg-test "coverage proxied" (get host-lg-cov :proxied) 6) +(host-lg-test "coverage total" (get host-lg-cov :total) 14) +(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 6) +(host-lg-test "coverage proxied" (get host-lg-cov :proxied) 7) (host-lg-test "coverage native" (get host-lg-cov :native) 1) -(host-lg-test "coverage served" (get host-lg-cov :served) 5) -(host-lg-test "coverage percent" (get host-lg-cov :percent) 45) +(host-lg-test "coverage served" (get host-lg-cov :served) 7) +(host-lg-test "coverage percent" (get host-lg-cov :percent) 50) (define host-lg-tests-run! diff --git a/lib/host/tests/relations.sx b/lib/host/tests/relations.sx index fa3567de..90d265b6 100644 --- a/lib/host/tests/relations.sx +++ b/lib/host/tests/relations.sx @@ -102,6 +102,74 @@ (host/-rel-strings (relations/parents (host-rl-sym "list:7") (host-rl-sym "member")))) "}")) +;; ── writes: attach-child / detach-child (auth + ACL + closed loop) ── +(acl/load! + (list + (acl-grant "carol" "relate" "relations") + (acl-grant "carol" "unrelate" "relations"))) +;; carol is permitted; dave authenticates but has no grant. +(define host-rl-resolve + (fn (tok) + (cond ((= tok "good") "carol") ((= tok "weak") "dave") (true nil)))) +(define host-rl-wapp + (host/make-app + (list host/relations-routes (host/relations-write-routes host-rl-resolve)))) +(define host-rl-post + (fn (action auth body) + (dream-request "POST" (str "/internal/actions/" action) + (if auth {:authorization auth} {}) body))) +(define host-rl-edge + "{\"parent-type\":\"org\",\"parent-id\":\"2\",\"child-type\":\"list\",\"child-id\":\"5\",\"relation-type\":\"member\"}") +(define host-rl-org2 + "/internal/data/get-children?parent-type=org&parent-id=2&relation-type=member") + +(relations/load! (list)) + +;; auth gate +(host-rl-test + "attach no auth -> 401" + (dream-status (host-rl-wapp (host-rl-post "attach-child" nil "{}"))) + 401) +(host-rl-test + "attach authed-but-unpermitted -> 403" + (dream-status (host-rl-wapp (host-rl-post "attach-child" "Bearer weak" host-rl-edge))) + 403) +(host-rl-test + "graph unchanged after 403" + (len (relations/children (host-rl-sym "org:2") (host-rl-sym "member"))) + 0) + +;; permitted attach -> 201, and visible through the migrated read +(host-rl-test + "attach authed+permitted -> 201" + (dream-status (host-rl-wapp (host-rl-post "attach-child" "Bearer good" host-rl-edge))) + 201) +(host-rl-test + "attached edge visible via get-children" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-org2))) "list:5") + true) + +;; detach -> 200, and gone from the read +(host-rl-test + "detach authed+permitted -> 200" + (dream-status (host-rl-wapp (host-rl-post "detach-child" "Bearer good" host-rl-edge))) + 200) +(host-rl-test + "detached edge gone from get-children" + (contains? (dream-resp-body (host-rl-app (host-rl-req host-rl-org2))) "list:5") + false) + +;; bad payloads +(host-rl-test + "attach non-object body -> 400" + (dream-status (host-rl-wapp (host-rl-post "attach-child" "Bearer good" "[1,2]"))) + 400) +(host-rl-test + "attach missing param -> 400" + (dream-status + (host-rl-wapp (host-rl-post "attach-child" "Bearer good" "{\"parent-type\":\"org\"}"))) + 400) + (define host-rl-tests-run! (fn diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index a2fc90de..8e3f5814 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,10 +36,10 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **121/121** (7 suites: handler, middleware, sxtp, +`bash lib/host/conformance.sh` → **132/132** (7 suites: handler, middleware, sxtp, router, feed, relations, ledger). Phases 1 & 2 DONE; Phase 3 (strangler ledger) -underway — ledger module + `relations` READ cut-over landed (45% off Quart); -relations writes + golden harness next. +underway — ledger module + `relations` container cut-over landed (reads + guarded +writes, 50% off Quart). Golden-response harness vs live Quart next. ## Ground rules @@ -116,13 +116,15 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… the live state: feed reads+writes migrated, `/health` native, the internal-only `relations`/`likes` data+action endpoints proxied. - [ ] golden-response harness vs the live Quart responses -- [~] cut over a whole domain (`relations`) as proof — READ side DONE - (`lib/host/relations.sx`): `GET /internal/data/get-children` + `/get-parents` - dispatch to `lib/relations` (`relations/children`/`parents`). Node model: - graph atom = symbol `"type:id"`, edge = relation-type; optional child/parent - `-type` param filters by `"type:"` prefix. Golden tests pin each endpoint to - `subsystem-call + envelope`. Ledger entries flipped to `:migrated`. WRITE side - (`relate`/`unrelate` actions, behind auth+ACL like POST /feed) next. +- [x] cut over a whole domain (`relations`) as proof — the CONTAINER relations are + fully on the host (`lib/host/relations.sx`): reads `GET .../get-children` + + `/get-parents` → `relations/children`/`parents`; writes `POST + .../attach-child` + `/detach-child` → `relations/relate`/`unrelate`, behind + the auth+ACL pipeline (mirrors POST /feed). Node model: graph atom = symbol + `"type:id"`, edge = relation-type; `child`/`parent-type` params filter by + `"type:"` prefix. Closed-loop test: attach → visible via get-children → + detach → gone. The TYPED actions (`relate`/`unrelate`/`can-relate`) stay + proxied by design — registry + cardinality validation lib/relations lacks. ## Phase 4 — Dream framework layer (gated) - [ ] gate: `ocaml-on-sx` Phases 1–5 + minimal stdlib green @@ -196,6 +198,23 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… same as the feed reads. NEXT: relations WRITE actions (`relate`/`unrelate`) behind the auth+ACL pipeline (mirroring POST /feed). +- **Phase 3 — relations WRITE cut-over (DONE, 132/132).** `lib/host/relations.sx` + gains `host/relations-attach`/`-detach` (`POST .../attach-child` + `/detach-child`) + and `host/relations-write-routes` — the write side of the container reads, + dispatching to `relations/relate`/`unrelate` over the same `"type:id"` node + model so an attach is immediately visible through `get-children`. Each runs + behind the host pipeline `wrap-errors ∘ require-auth ∘ require-permission` + (`"relate"`/`"unrelate"` on `"relations"`) — exactly the POST /feed stack. The + relations test suite proves the closed loop end-to-end: 401 unauth, 403 authed- + but-unpermitted (graph unchanged), 201 attach → child visible via the migrated + read → 200 detach → child gone; 400 on bad/short payloads. The ledger now models + the full relations surface (7 endpoints): container reads+writes `:migrated`, + typed `relate`/`unrelate`/`can-relate` `:proxied` (registry/cardinality + validation not in lib/relations). Off-Quart coverage 45% → **50%** (7/14). + `relations` is the first whole *coherent feature* (container relations) fully + off Quart. NEXT: golden-response harness vs live Quart, then survey the next + domain (blog/likes proxied — likes needs an SX subsystem first). + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From d917a5f92f7decbef6b20433a7c98e0caec35e41 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 17:41:58 +0000 Subject: [PATCH 007/138] =?UTF-8?q?host:=20live=20wiring=20=E2=80=94=20nat?= =?UTF-8?q?ive=20http-listen=20<->=20Dream=20bridge=20+=20serve.sh,=20145/?= =?UTF-8?q?145?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/host/server.sx adapts the native http-listen contract (string-keyed {method,path,query,headers,body} -> {:status :headers :body}) to the Dream host app: native->dream reassembles path+query into a target dream-request parses; dream->native is near-identity (dream-response is already {:body :headers :status}). host/serve = http-listen over host/native-handler . host/make-app. lib/host/serve.sh boots the full module set and serves in the foreground (container-entry shaped). Verified live on a host port: health/feed/ feed?actor=/relations reads serve real JSON, unknown->404. server suite (13) covers the bridge as pure functions. Co-Authored-By: Claude Opus 4.8 --- lib/host/conformance.sh | 2 + lib/host/serve.sh | 85 ++++++++++++++++++++++++++++++++++++++ lib/host/server.sx | 44 ++++++++++++++++++++ lib/host/tests/server.sx | 88 ++++++++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 44 ++++++++++++++++---- 5 files changed, 255 insertions(+), 8 deletions(-) create mode 100755 lib/host/serve.sh create mode 100644 lib/host/server.sx create mode 100644 lib/host/tests/server.sx diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 57ee4a2f..8b4d6b0c 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -66,6 +66,7 @@ MODULES=( "lib/host/router.sx" "lib/host/feed.sx" "lib/host/relations.sx" + "lib/host/server.sx" "lib/host/ledger.sx" ) @@ -77,6 +78,7 @@ SUITES=( "router host-rt-tests-run! lib/host/tests/router.sx" "feed host-fd-tests-run! lib/host/tests/feed.sx" "relations host-rl-tests-run! lib/host/tests/relations.sx" + "server host-sv-tests-run! lib/host/tests/server.sx" "ledger host-lg-tests-run! lib/host/tests/ledger.sx" ) diff --git a/lib/host/serve.sh b/lib/host/serve.sh new file mode 100755 index 00000000..d19b76a5 --- /dev/null +++ b/lib/host/serve.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# host-on-sx live server launcher. Loads the kernel stdlib, the subsystem +# libraries, and the host modules into one sx_server process, then calls +# (host/serve PORT ...) which binds the native http-listen server to the +# Dream-shaped host app. Runs in the FOREGROUND (http-listen blocks), so this +# doubles as a container entrypoint and a local launcher. +# +# Usage: +# bash lib/host/serve.sh # serve on $HOST_PORT (default 8910) +# HOST_PORT=8920 bash lib/host/serve.sh # pick a port +# +# The module list is kept identical to lib/host/conformance.sh so what serves is +# exactly what the suites verify. + +set -uo pipefail +cd "$(git rev-parse --show-toplevel)" + +SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}" +if [ ! -x "$SX_SERVER" ]; then + SX_SERVER="/root/rose-ash/hosts/ocaml/_build/default/bin/sx_server.exe" +fi +if [ ! -x "$SX_SERVER" ]; then + echo "ERROR: sx_server.exe not found." >&2 + exit 1 +fi + +PORT="${HOST_PORT:-8910}" + +# Modules: every load line from conformance.sh's MODULES list, minus the ledger +# (not needed to serve). server.sx supplies host/serve. +MODULES=( + "spec/stdlib.sx" + "lib/r7rs.sx" + "lib/apl/runtime.sx" + "lib/datalog/tokenizer.sx" + "lib/datalog/parser.sx" + "lib/datalog/unify.sx" + "lib/datalog/db.sx" + "lib/datalog/builtins.sx" + "lib/datalog/aggregates.sx" + "lib/datalog/strata.sx" + "lib/datalog/eval.sx" + "lib/datalog/api.sx" + "lib/datalog/magic.sx" + "lib/acl/schema.sx" + "lib/acl/facts.sx" + "lib/acl/engine.sx" + "lib/acl/explain.sx" + "lib/acl/audit.sx" + "lib/acl/federation.sx" + "lib/acl/api.sx" + "lib/relations/schema.sx" + "lib/relations/engine.sx" + "lib/relations/api.sx" + "lib/relations/explain.sx" + "lib/relations/federation.sx" + "lib/relations/tree.sx" + "lib/feed/normalize.sx" + "lib/feed/stream.sx" + "lib/feed/api.sx" + "lib/dream/types.sx" + "lib/dream/json.sx" + "lib/dream/auth.sx" + "lib/dream/error.sx" + "lib/dream/router.sx" + "lib/host/handler.sx" + "lib/host/middleware.sx" + "lib/host/sxtp.sx" + "lib/host/router.sx" + "lib/host/feed.sx" + "lib/host/relations.sx" + "lib/host/server.sx" +) + +EPOCH=1 +{ + for M in "${MODULES[@]}"; do + echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) + done + echo "(epoch $EPOCH)" + # Anonymous read endpoints: feed timeline + relations container reads. Guarded + # write groups (auth/ACL or internal-HMAC) are added here once their injected + # policy is supplied at wiring time. + echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes))\")" +} | exec "$SX_SERVER" diff --git a/lib/host/server.sx b/lib/host/server.sx new file mode 100644 index 00000000..77850f18 --- /dev/null +++ b/lib/host/server.sx @@ -0,0 +1,44 @@ +;; lib/host/server.sx — the live wiring: bridge the native OCaml http-listen +;; server to the Dream-shaped host app, and serve. The native server hands a +;; handler a STRING-keyed request dict {"method" "path" "query" "headers" "body"} +;; and expects back {:status :headers :body}. The host app (host/make-app -> +;; dream-router) is a fn dream-request -> dream-response. This module adapts +;; between the two shapes and calls http-listen. +;; Depends on lib/dream/* (dream-request/response accessors) + lib/host/router.sx +;; + the kernel http-listen primitive. + +;; ── native request -> dream request ───────────────────────────────── +;; Reassemble path + query into the target string dream-request parses, and carry +;; method/headers/body. Missing fields default empty. +(define host/-native->dream + (fn (req) + (let ((path (or (get req "path") "/")) + (query (or (get req "query") "")) + (method (or (get req "method") "GET")) + (headers (or (get req "headers") {})) + (body (or (get req "body") ""))) + (let ((target (if (> (len query) 0) (str path "?" query) path))) + (dream-request method target headers body))))) + +;; ── dream response -> native response ─────────────────────────────── +;; dream-response is already {:body :headers :status}; the native server wants +;; {:status :headers :body}. Same keys — normalise the shape explicitly so the +;; contract is visible (and headers/body never nil). +(define host/-dream->native + (fn (resp) + {:status (dream-status resp) + :headers (or (dream-headers resp) {}) + :body (or (dream-resp-body resp) "")})) + +;; ── adapter + serve ───────────────────────────────────────────────── +;; Wrap a Dream app as a native http-listen handler. +(define host/native-handler + (fn (app) + (fn (req) + (host/-dream->native (app (host/-native->dream req)))))) + +;; Build the app from route groups and start the native server on `port`. +;; Blocks (the http-listen primitive runs the server loop). +(define host/serve + (fn (port groups) + (http-listen port (host/native-handler (host/make-app groups))))) diff --git a/lib/host/tests/server.sx b/lib/host/tests/server.sx new file mode 100644 index 00000000..ac99151f --- /dev/null +++ b/lib/host/tests/server.sx @@ -0,0 +1,88 @@ +;; lib/host/tests/server.sx — the native<->dream bridge. Pure-function coverage of +;; host/-native->dream, host/-dream->native, and the host/native-handler adapter +;; over a real host app (no socket — the http-listen call itself is exercised live +;; via lib/host/serve.sx, not here). + +(define host-sv-pass 0) +(define host-sv-fail 0) +(define host-sv-fails (list)) + +(define + host-sv-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-sv-pass (+ host-sv-pass 1)) + (begin + (set! host-sv-fail (+ host-sv-fail 1)) + (append! host-sv-fails {:name name :actual actual :expected expected}))))) + +(define host-sv-native + (fn (method path query body) + {"method" method "path" path "query" query "body" body "headers" {}})) + +;; ── native request -> dream request ───────────────────────────────── +(define host-sv-dreq (host/-native->dream (host-sv-native "post" "/feed" "actor=alice" "hi"))) +(host-sv-test "n->d method upcased" (get host-sv-dreq :method) "POST") +(host-sv-test "n->d path" (get host-sv-dreq :path) "/feed") +(host-sv-test "n->d query param" (dream-query-param host-sv-dreq "actor") "alice") +(host-sv-test "n->d body" (get host-sv-dreq :body) "hi") +;; empty query -> bare path, no trailing "?" +(host-sv-test + "n->d empty query -> bare path" + (get (host/-native->dream (host-sv-native "GET" "/health" "" "")) :path) + "/health") + +;; ── dream response -> native response ─────────────────────────────── +(define host-sv-nresp + (host/-dream->native (dream-response 201 {:content-type "application/json"} "{}"))) +(host-sv-test "d->n status" (get host-sv-nresp :status) 201) +(host-sv-test "d->n body" (get host-sv-nresp :body) "{}") +(host-sv-test "d->n headers is dict" (= (type-of (get host-sv-nresp :headers)) "dict") true) + +;; ── adapter over a real host app ──────────────────────────────────── +(feed/reset!) +(define host-sv-app (host/native-handler (host/make-app (list host/feed-routes)))) +(host-sv-test + "health -> 200" + (get (host-sv-app (host-sv-native "GET" "/health" "" "")) :status) + 200) +(host-sv-test + "health body healthy" + (contains? (get (host-sv-app (host-sv-native "GET" "/health" "" "")) :body) "healthy") + true) +(host-sv-test + "feed read -> 200" + (get (host-sv-app (host-sv-native "GET" "/feed" "" "")) :status) + 200) +;; native response shape is exactly {:status :headers :body} +(host-sv-test + "native resp keys" + (let ((r (host-sv-app (host-sv-native "GET" "/health" "" "")))) + (and (has-key? r :status) (has-key? r :headers) (has-key? r :body))) + true) + +;; ── relations read through the bridge (end-to-end shape) ──────────── +(relations/load! (list)) +(relations/relate (string->symbol "org:1") (string->symbol "list:7") (string->symbol "member")) +(define host-sv-rapp (host/native-handler (host/make-app (list host/relations-routes)))) +(host-sv-test + "relations read via bridge" + (contains? + (get + (host-sv-rapp + (host-sv-native "GET" "/internal/data/get-children" + "parent-type=org&parent-id=1&relation-type=member" "")) + :body) + "list:7") + true) + +(define + host-sv-tests-run! + (fn + () + {:total (+ host-sv-pass host-sv-fail) + :passed host-sv-pass + :failed host-sv-fail + :fails host-sv-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 8e3f5814..42cdc24b 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,10 +36,13 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **132/132** (7 suites: handler, middleware, sxtp, -router, feed, relations, ledger). Phases 1 & 2 DONE; Phase 3 (strangler ledger) -underway — ledger module + `relations` container cut-over landed (reads + guarded -writes, 50% off Quart). Golden-response harness vs live Quart next. +`bash lib/host/conformance.sh` → **145/145** (8 suites: handler, middleware, sxtp, +router, feed, relations, server, ledger). Phases 1 & 2 DONE; Phase 3 cut-over +landed (50% off Quart). **The host now serves live HTTP** — `lib/host/server.sx` +bridges the native `http-listen` server to the Dream app and `lib/host/serve.sh` +boots it (verified: GET /health, /feed, /feed?actor=, relations get-children/ +get-parents all serve real JSON on a host port; unknown→404). Remaining: golden +harness vs live Quart, internal-HMAC middleware, docker stack + Caddy subdomain. ## Ground rules @@ -126,10 +129,18 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… detach → gone. The TYPED actions (`relate`/`unrelate`/`can-relate`) stay proxied by design — registry + cardinality validation lib/relations lacks. -## Phase 4 — Dream framework layer (gated) -- [ ] gate: `ocaml-on-sx` Phases 1–5 + minimal stdlib green -- [ ] adopt `dream-on-sx` routing/middleware/session ergonomics over the same handlers -- [ ] re-home external adapters as native where replacements land +## Phase 4 — Live wiring + Dream framework layer +- [x] native `http-listen` ↔ Dream-app bridge (`lib/host/server.sx`: + `host/native-handler`/`host/serve`) + `lib/host/serve.sh` launcher. Serves + real HTTP on a host port — verified live (health/feed/relations reads + 404). +- [ ] promote into the docker stack + a Caddy subdomain (NOT `rose-ash.com` — that + is the legacy public site, untouched). Scope now includes `hosts/` + Caddy. +- [ ] proxy-to-Quart fallback for un-migrated paths (strangler requirement before + a real subdomain fronts users). +- [ ] internal-HMAC middleware on `/internal/*` (service-to-service auth; protocol + checks native, signature check needs an HMAC-SHA256 kernel prim — absent today). +- [ ] (gated) adopt `dream-on-sx` session/CSRF ergonomics; re-home external + adapters as native where replacements land. ## Progress log @@ -215,6 +226,23 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… off Quart. NEXT: golden-response harness vs live Quart, then survey the next domain (blog/likes proxied — likes needs an SX subsystem first). +- **Phase 4 — live wiring bridge (DONE, 145/145).** `lib/host/server.sx` adapts the + native `http-listen` contract (string-keyed req `{"method" "path" "query" + "headers" "body"}` → `{:status :headers :body}`) to the Dream app: `host/-native + ->dream` reassembles `path`+`query` into a target `dream-request` parses; + `host/-dream->native` is near-identity (dream-response is already `{:body + :headers :status}`). `host/serve port groups` = `http-listen` over + `host/native-handler (host/make-app groups)`. `lib/host/serve.sh` boots the full + module set (mirrors conformance) and serves in the foreground (container-entry + shaped). **Verified live** on a host port: `/health` 200 JSON, `/feed` recent- + first seeded activities, `/feed?actor=` filtered, relations `get-children`/`get- + parents` real JSON, unknown→404. Demo run was a standalone `sx_server.exe` + process (NOT the docker stack) — killed by its own PID, never `pkill` (siblings + share the binary). The standing "live wiring is a hosts/ change" Blocker is + resolved for the SX side: the bridge is pure SX in `lib/host`; only the *launch* + (docker stack + Caddy) remains. NEXT: golden harness, internal-HMAC, then promote + into the stack behind a fresh subdomain. + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From 014dd06d2b78684fbe04c264ec795bacab8f1956 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 17:57:38 +0000 Subject: [PATCH 008/138] =?UTF-8?q?host:=20go=20live=20=E2=80=94=20blog.ro?= =?UTF-8?q?se-ash.com=20served=20by=20the=20SX=20host=20in=20the=20stack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Promote lib/host into the docker stack behind blog.rose-ash.com (reusing a down Quart subdomain). New compose service sx_host runs lib/host/serve.sh on externalnet; Caddy reverse-proxies blog.rose-ash.com -> sx-dev-sx_host-1:8000. hosts/ fix: http-listen bound inet_addr_loopback only, unreachable from other containers. Add SX_HTTP_HOST env (default loopback for tests/local; stack sets 0.0.0.0) in sx_server.ml. serve.sh made container-friendly (SX_PROJECT_DIR). Verified live through Cloudflare->Caddy: /health, /feed, relations reads serve real JSON; / 404 (no root route yet). rose-ash.com untouched. Conformance 145/145 green with the rebuilt binary. Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 37 ++++++++++++++++++++++++++++++++++ hosts/ocaml/bin/sx_server.ml | 9 ++++++++- lib/host/serve.sh | 4 +++- plans/host-on-sx.md | 14 +++++++++++-- 4 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 docker-compose.dev-sx-host.yml diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml new file mode 100644 index 00000000..8a63156e --- /dev/null +++ b/docker-compose.dev-sx-host.yml @@ -0,0 +1,37 @@ +# host-on-sx live service — the SX web host (lib/host) served by the native +# http-listen server via lib/host/serve.sh. Joins the sx-dev project + externalnet +# so Caddy can reverse_proxy a subdomain to it (blog.rose-ash.com). Isolated from +# the sx_docs server: separate container, separate port. +# +# Usage: +# docker compose -p sx-dev -f docker-compose.dev-sx-host.yml up -d sx_host +# docker compose -p sx-dev -f docker-compose.dev-sx-host.yml logs -f sx_host +# docker compose -p sx-dev -f docker-compose.dev-sx-host.yml down + +services: + sx_host: + image: registry.rose-ash.com:5000/sx_docs:latest + container_name: sx-dev-sx_host-1 + entrypoint: ["bash", "/app/lib/host/serve.sh"] + working_dir: /app + environment: + SX_PROJECT_DIR: /app + SX_SERVER: /app/bin/sx_server + HOST_PORT: "8000" + # Bind all interfaces so Caddy (on externalnet) can reach it. + SX_HTTP_HOST: "0.0.0.0" + OCAMLRUNPARAM: "b" + volumes: + # SX source (hot-reload on container restart) + - ./spec:/app/spec:ro + - ./lib:/app/lib:ro + # OCaml server binary — this worktree's build (has the SX_HTTP_HOST bind fix) + - ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro + networks: + - externalnet + - default + restart: unless-stopped + +networks: + externalnet: + external: true diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index e95fcba3..006ab145 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -745,8 +745,15 @@ let setup_evaluator_bridge env = | _ -> raise (Eval_error "http-listen: (port handler)") in let sock = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in Unix.setsockopt sock Unix.SO_REUSEADDR true; + (* Bind host: loopback by default (safe for tests + local runs); set + SX_HTTP_HOST=0.0.0.0 to expose on the network (container/Caddy). *) + let bind_addr = + match Sys.getenv_opt "SX_HTTP_HOST" with + | Some h -> (try Unix.inet_addr_of_string h + with _ -> Unix.inet_addr_loopback) + | None -> Unix.inet_addr_loopback in Unix.bind sock - (Unix.ADDR_INET (Unix.inet_addr_loopback, port)); + (Unix.ADDR_INET (bind_addr, port)); Unix.listen sock 64; (* SX runtime is shared across threads — serialize handler calls. *) let mtx = Mutex.create () in diff --git a/lib/host/serve.sh b/lib/host/serve.sh index d19b76a5..6f79032f 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -13,7 +13,9 @@ # exactly what the suites verify. set -uo pipefail -cd "$(git rev-parse --show-toplevel)" +# Project root: SX_PROJECT_DIR in containers (set to /app by the compose stack), +# else the git toplevel for local runs. +cd "${SX_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || echo .)}" SX_SERVER="${SX_SERVER:-hosts/ocaml/_build/default/bin/sx_server.exe}" if [ ! -x "$SX_SERVER" ]; then diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 42cdc24b..adc1118a 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -133,8 +133,18 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… - [x] native `http-listen` ↔ Dream-app bridge (`lib/host/server.sx`: `host/native-handler`/`host/serve`) + `lib/host/serve.sh` launcher. Serves real HTTP on a host port — verified live (health/feed/relations reads + 404). -- [ ] promote into the docker stack + a Caddy subdomain (NOT `rose-ash.com` — that - is the legacy public site, untouched). Scope now includes `hosts/` + Caddy. +- [x] promote into the docker stack + a Caddy subdomain — **LIVE at + `https://blog.rose-ash.com`** (reusing a down Quart subdomain). New compose + service `sx_host` (`docker-compose.dev-sx-host.yml`, container + `sx-dev-sx_host-1`) runs `serve.sh` on `externalnet`; Caddy reverse-proxies + `blog.rose-ash.com` → `sx-dev-sx_host-1:8000`. Required a `hosts/` fix: + `http-listen` bound `inet_addr_loopback` only — added `SX_HTTP_HOST` env + (default loopback; stack sets `0.0.0.0`) in `sx_server.ml`, rebuilt this + worktree's binary. Verified: `/health`, `/feed`, relations reads serve real + JSON through Cloudflare→Caddy; `/` 404 (no root route yet). `rose-ash.com` + untouched. CAVEAT: `/root/caddy/Caddyfile` is an inode-pinned bind mount — + edited file shows a NEW inode the container can't see; loaded live via + `caddy reload` from a non-bind path. A caddy restart reconciles the bind. - [ ] proxy-to-Quart fallback for un-migrated paths (strangler requirement before a real subdomain fronts users). - [ ] internal-HMAC middleware on `/internal/*` (service-to-service auth; protocol From 2217a704a619b94e909c6b2ab618fcd205c4f52d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 18:01:17 +0000 Subject: [PATCH 009/138] =?UTF-8?q?host:=20reconcile=20Caddy=20bind=20(res?= =?UTF-8?q?tart)=20=E2=80=94=20blog.rose-ash.com=20durable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- plans/host-on-sx.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index adc1118a..74532f49 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -142,9 +142,11 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… (default loopback; stack sets `0.0.0.0`) in `sx_server.ml`, rebuilt this worktree's binary. Verified: `/health`, `/feed`, relations reads serve real JSON through Cloudflare→Caddy; `/` 404 (no root route yet). `rose-ash.com` - untouched. CAVEAT: `/root/caddy/Caddyfile` is an inode-pinned bind mount — - edited file shows a NEW inode the container can't see; loaded live via - `caddy reload` from a non-bind path. A caddy restart reconciles the bind. + untouched. (Inode-pinned bind-mount gotcha: editing `/root/caddy/Caddyfile` + via a tool swaps its inode so the container kept the old content — loaded live + via reload-from-non-bind-path, then RECONCILED by restarting Caddy so the + bind re-points to the corrected file. Verified post-restart: blog serves, and + `sx.rose-ash.com`/`rose-ash.com` survived.) - [ ] proxy-to-Quart fallback for un-migrated paths (strangler requirement before a real subdomain fronts users). - [ ] internal-HMAC middleware on `/internal/*` (service-to-service auth; protocol From e2a90e3bbdfab1e865464660619e6c19bb3afa38 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 18:08:12 +0000 Subject: [PATCH 010/138] host: blog published-post read endpoint GET // -> HTML, 156/156 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/host/blog.sx serves blog posts as HTML at GET // (the original strangler target, Quart blog post_detail). A post is a content-on-sx CtDoc rendered via content/html; anonymous + world-visible. In-memory slug->doc registry now (host/blog-lookup swappable for a persist-backed content stream later, handler/route unchanged). :slug catch-all mounted LAST so /feed, /health, /internal/* take precedence. Needs the Smalltalk+persist+content preload chain + (st-bootstrap-classes!)+(content/bootstrap!) — blog.sx self-bootstraps at load. serve.sh loads the chain + seeds a welcome post. Ledger gains the migrated blog post-detail (off-Quart 50% -> 53%). LIVE: blog.rose-ash.com/welcome/ renders real HTML through Cloudflare->Caddy; /feed still JSON (precedence verified), unknown slug 404. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 50 +++++++++++++++++++++++ lib/host/conformance.sh | 17 ++++++++ lib/host/ledger.sx | 1 + lib/host/serve.sh | 30 ++++++++++++-- lib/host/tests/blog.sx | 85 ++++++++++++++++++++++++++++++++++++++++ lib/host/tests/ledger.sx | 17 +++++--- plans/host-on-sx.md | 12 +++++- 7 files changed, 200 insertions(+), 12 deletions(-) create mode 100644 lib/host/blog.sx create mode 100644 lib/host/tests/blog.sx diff --git a/lib/host/blog.sx b/lib/host/blog.sx new file mode 100644 index 00000000..049dec76 --- /dev/null +++ b/lib/host/blog.sx @@ -0,0 +1,50 @@ +;; lib/host/blog.sx — Blog domain on the host. Serves published posts as HTML at +;; GET // — the original strangler target (Quart: blog/bp/post/routes.py, +;; handler post_detail). Published posts are world-visible, so this endpoint is +;; ANONYMOUS — no auth, visibility is trivially "visible". +;; +;; A post is a content-on-sx document (CtDoc) rendered to HTML via the content +;; facade (content/html). Posts live in an in-memory registry keyed by slug: this +;; is the "prove the machinery" step — swap host/blog-lookup for a persist-backed +;; content stream later without touching the handler or the route. +;; Depends on lib/content/* (+ the Smalltalk + persist preloads its classes need) +;; + lib/dream/* + lib/host/handler.sx. + +;; Register the content class table + render methods (idempotent). Must run before +;; any CtDoc is built/rendered; called at module load below. +(define host/blog-bootstrap! + (fn () (begin (st-bootstrap-classes!) (content/bootstrap!)))) + +;; ── in-memory post registry (slug -> CtDoc) ───────────────────────── +(define host/blog-posts {}) +(define host/blog-register! + (fn (slug doc) (set! host/blog-posts (assoc host/blog-posts slug doc)))) +(define host/blog-lookup (fn (slug) (get host/blog-posts slug))) +(define host/blog-reset! (fn () (set! host/blog-posts {}))) + +;; Build a simple post doc (title heading + body paragraph). Convenience for +;; seeding and tests; real posts arrive from the content store. +(define host/blog-make + (fn (slug title body) + (doc-append + (doc-append (doc-empty slug) (mk-heading (str slug "-h") 1 title)) + (mk-text (str slug "-body") body)))) + +;; ── handler: GET // -> rendered HTML (200) or 404 ───────────── +(define host/blog-post + (fn (req) + (let ((slug (dream-param req "slug"))) + (let ((doc (host/blog-lookup slug))) + (if doc + (dream-html (content/html doc)) + (dream-html-status 404 + (str "Not found" + "

404

No published post: " slug "

"))))))) + +;; Anonymous read route. MUST be mounted LAST: the :slug pattern matches any +;; single-segment path, so domain routes (/feed, /health) take precedence. +(define host/blog-routes + (list (dream-get "/:slug" host/blog-post))) + +;; Self-bootstrap at load (content modules are loaded before this one). +(host/blog-bootstrap!) diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 8b4d6b0c..05e8dd30 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -55,6 +55,21 @@ MODULES=( "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" + "lib/smalltalk/tokenizer.sx" + "lib/smalltalk/parser.sx" + "lib/guest/reflective/class-chain.sx" + "lib/smalltalk/runtime.sx" + "lib/guest/reflective/env.sx" + "lib/smalltalk/eval.sx" + "lib/persist/event.sx" + "lib/persist/backend.sx" + "lib/persist/log.sx" + "lib/persist/kv.sx" + "lib/persist/api.sx" + "lib/content/block.sx" + "lib/content/doc.sx" + "lib/content/render.sx" + "lib/content/api.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" @@ -66,6 +81,7 @@ MODULES=( "lib/host/router.sx" "lib/host/feed.sx" "lib/host/relations.sx" + "lib/host/blog.sx" "lib/host/server.sx" "lib/host/ledger.sx" ) @@ -78,6 +94,7 @@ SUITES=( "router host-rt-tests-run! lib/host/tests/router.sx" "feed host-fd-tests-run! lib/host/tests/feed.sx" "relations host-rl-tests-run! lib/host/tests/relations.sx" + "blog host-bl-tests-run! lib/host/tests/blog.sx" "server host-sv-tests-run! lib/host/tests/server.sx" "ledger host-lg-tests-run! lib/host/tests/ledger.sx" ) diff --git a/lib/host/ledger.sx b/lib/host/ledger.sx index f6a66f44..fc03be47 100644 --- a/lib/host/ledger.sx +++ b/lib/host/ledger.sx @@ -27,6 +27,7 @@ (define host/ledger (list (host/ledger-entry "host" "GET" "/health" nil "native" "host/health-route") + (host/ledger-entry "blog" "GET" "/:slug" "blog:post_detail" "migrated" "host/blog-post") (host/ledger-entry "feed" "GET" "/feed" "feed:timeline" "migrated" "host/feed-timeline") (host/ledger-entry "feed" "POST" "/feed" "feed:create" "migrated" "host/feed-create") (host/ledger-entry "relations" "GET" "/internal/data/get-children" "relations:get_children" "migrated" "host/relations-children") diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 6f79032f..87ea91ef 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -60,6 +60,21 @@ MODULES=( "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" + "lib/smalltalk/tokenizer.sx" + "lib/smalltalk/parser.sx" + "lib/guest/reflective/class-chain.sx" + "lib/smalltalk/runtime.sx" + "lib/guest/reflective/env.sx" + "lib/smalltalk/eval.sx" + "lib/persist/event.sx" + "lib/persist/backend.sx" + "lib/persist/log.sx" + "lib/persist/kv.sx" + "lib/persist/api.sx" + "lib/content/block.sx" + "lib/content/doc.sx" + "lib/content/render.sx" + "lib/content/api.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" @@ -71,6 +86,7 @@ MODULES=( "lib/host/router.sx" "lib/host/feed.sx" "lib/host/relations.sx" + "lib/host/blog.sx" "lib/host/server.sx" ) @@ -79,9 +95,15 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done + # Seed a welcome post so blog.rose-ash.com/welcome/ renders live (until posts + # arrive from a persist-backed content store). echo "(epoch $EPOCH)" - # Anonymous read endpoints: feed timeline + relations container reads. Guarded - # write groups (auth/ACL or internal-HMAC) are added here once their injected - # policy is supplied at wiring time. - echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes))\")" + echo "(eval \"(host/blog-register! \\\"welcome\\\" (host/blog-make \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"This page is rendered by lib/host on the SX runtime — no Quart.\\\"))\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + # Anonymous read endpoints: feed timeline + relations container reads + blog + # post detail (blog-routes LAST — the :slug catch-all must not shadow the rest). + # Guarded write groups (auth/ACL or internal-HMAC) are added here once their + # injected policy is supplied at wiring time. + echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes host/blog-routes))\")" } | exec "$SX_SERVER" diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx new file mode 100644 index 00000000..02899e73 --- /dev/null +++ b/lib/host/tests/blog.sx @@ -0,0 +1,85 @@ +;; lib/host/tests/blog.sx — the blog published-post read endpoint. A registered +;; post renders to HTML at GET //; unknown slugs 404. Also pins route +;; precedence: the catch-all :slug must NOT shadow domain routes mounted before it. + +(define host-bl-pass 0) +(define host-bl-fail 0) +(define host-bl-fails (list)) + +(define + host-bl-test + (fn + (name actual expected) + (if + (= actual expected) + (set! host-bl-pass (+ host-bl-pass 1)) + (begin + (set! host-bl-fail (+ host-bl-fail 1)) + (append! host-bl-fails {:name name :actual actual :expected expected}))))) + +(define host-bl-req (fn (target) (dream-request "GET" target {} ""))) +;; feed mounted BEFORE blog so /feed is not captured by the :slug catch-all. +(define host-bl-app + (host/make-app (list host/feed-routes host/blog-routes))) + +;; ── render a registered post ──────────────────────────────────────── +(host/blog-reset!) +(host/blog-register! "welcome" (host/blog-make "welcome" "Hello SX" "Served by lib/host.")) + +(host-bl-test + "post 200" + (dream-status (host-bl-app (host-bl-req "/welcome/"))) + 200) +(host-bl-test + "post content-type html" + (contains? (dream-resp-header (host-bl-app (host-bl-req "/welcome/")) "content-type") "text/html") + true) +(host-bl-test + "post renders heading" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) "

Hello SX

") + true) +(host-bl-test + "post renders body" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) "Served by lib/host.") + true) +;; trailing slash optional — /welcome and /welcome/ both resolve +(host-bl-test + "no trailing slash also 200" + (dream-status (host-bl-app (host-bl-req "/welcome"))) + 200) + +;; golden: endpoint body == content facade render of the same doc +(host-bl-test + "golden = content/html" + (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) + (content/html (host/blog-make "welcome" "Hello SX" "Served by lib/host."))) + +;; ── unknown slug -> 404 ───────────────────────────────────────────── +(host-bl-test + "unknown slug 404" + (dream-status (host-bl-app (host-bl-req "/nope/"))) + 404) +(host-bl-test + "404 names the slug" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/nope/"))) "nope") + true) + +;; ── route precedence: domain routes win over the :slug catch-all ──── +(feed/reset!) +(host-bl-test + "/feed served by feed, not blog 404" + (dream-status (host-bl-app (host-bl-req "/feed"))) + 200) +(host-bl-test + "/feed body is the feed envelope, not HTML" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/feed"))) "\"ok\":true") + true) + +(define + host-bl-tests-run! + (fn + () + {:total (+ host-bl-pass host-bl-fail) + :passed host-bl-pass + :failed host-bl-fail + :fails host-bl-fails})) diff --git a/lib/host/tests/ledger.sx b/lib/host/tests/ledger.sx index d2c3b628..bd85a827 100644 --- a/lib/host/tests/ledger.sx +++ b/lib/host/tests/ledger.sx @@ -50,8 +50,13 @@ (get (host/ledger-find host/ledger "POST" "/internal/actions/relate") :status) "proxied") +(host-lg-test + "find migrated blog post -> handler" + (get (host/ledger-find host/ledger "GET" "/:slug") :handler) + "host/blog-post") + ;; ── status queries ────────────────────────────────────────────────── -(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 6) +(host-lg-test "migrated count" (len (host/ledger-migrated host/ledger)) 7) (host-lg-test "native count" (len (host/ledger-native host/ledger)) 1) (host-lg-test "proxied count" (len (host/ledger-proxied host/ledger)) 7) @@ -72,7 +77,7 @@ ;; ── domain queries ────────────────────────────────────────────────── (host-lg-test "relations domain count" (len (host/ledger-by-domain host/ledger "relations")) 7) (host-lg-test "likes domain count" (len (host/ledger-by-domain host/ledger "likes")) 4) -(host-lg-test "domains count" (len (host/ledger-domains host/ledger)) 4) +(host-lg-test "domains count" (len (host/ledger-domains host/ledger)) 5) (host-lg-test "domains has relations" (some (fn (d) (= d "relations")) (host/ledger-domains host/ledger)) @@ -84,12 +89,12 @@ ;; ── coverage ──────────────────────────────────────────────────────── (define host-lg-cov (host/ledger-coverage host/ledger)) -(host-lg-test "coverage total" (get host-lg-cov :total) 14) -(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 6) +(host-lg-test "coverage total" (get host-lg-cov :total) 15) +(host-lg-test "coverage migrated" (get host-lg-cov :migrated) 7) (host-lg-test "coverage proxied" (get host-lg-cov :proxied) 7) (host-lg-test "coverage native" (get host-lg-cov :native) 1) -(host-lg-test "coverage served" (get host-lg-cov :served) 7) -(host-lg-test "coverage percent" (get host-lg-cov :percent) 50) +(host-lg-test "coverage served" (get host-lg-cov :served) 8) +(host-lg-test "coverage percent" (get host-lg-cov :percent) 53) (define host-lg-tests-run! diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 74532f49..1ea233cd 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,8 +36,8 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **145/145** (8 suites: handler, middleware, sxtp, -router, feed, relations, server, ledger). Phases 1 & 2 DONE; Phase 3 cut-over +`bash lib/host/conformance.sh` → **156/156** (9 suites: handler, middleware, sxtp, +router, feed, relations, blog, server, ledger). Phases 1 & 2 DONE; Phase 3 cut-over landed (50% off Quart). **The host now serves live HTTP** — `lib/host/server.sx` bridges the native `http-listen` server to the Dream app and `lib/host/serve.sh` boots it (verified: GET /health, /feed, /feed?actor=, relations get-children/ @@ -147,6 +147,14 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… via reload-from-non-bind-path, then RECONCILED by restarting Caddy so the bind re-points to the corrected file. Verified post-restart: blog serves, and `sx.rose-ash.com`/`rose-ash.com` survived.) +- [x] blog published-post read endpoint — `lib/host/blog.sx`: `GET //` + renders a content-on-sx `CtDoc` to HTML via `content/html` (anonymous, + world-visible). In-memory slug→doc registry now (swap `host/blog-lookup` for + a persist-backed content stream later, handler/route unchanged). `:slug` + catch-all mounted LAST so domain routes win. **LIVE**: `blog.rose-ash.com/ + welcome/` renders real HTML through Caddy. Needs Smalltalk+persist+content + preloads + `(st-bootstrap-classes!)`+`(content/bootstrap!)` (self-bootstraps + at load). - [ ] proxy-to-Quart fallback for un-migrated paths (strangler requirement before a real subdomain fronts users). - [ ] internal-HMAC middleware on `/internal/*` (service-to-service auth; protocol From 4e79b010b2962fcfcc99d5ab0d1fef5272d6e02d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 18:33:00 +0000 Subject: [PATCH 011/138] host: blog persisted in durable SX store + materialised view, 158/158 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blog posts now live in the durable SX store (persist/durable-backend, on-disk under $SX_PERSIST_DIR — already built: sx_persist_store.ml + lib/persist/ durable.sx). Publishing appends insert ops to the slug's content stream; posts survive restarts (verified: seq/log stable across container restart, re-seed idempotent). Read path: http-listen handlers can't drive per-request perform/IO (sx_call doesn't resolve the CEK IO suspension the way the main loop does), so posts are materialised from the store into an in-memory view at boot (host/blog-load-all! + host/blog-seed!) and request handlers read the view — perform-free. Store is source of truth; view is a boot-rebuilt cache. Deploy: docker-compose.dev-sx-host.yml mounts /root/sx-host-persist (chowned to appuser 10001) at /data/persist; SX_PERSIST_DIR set. blog.rose-ash.com/welcome/ live. Per-request-IO kernel fix tracked in the plan as the next task. Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 6 +++ lib/host/blog.sx | 88 ++++++++++++++++++++++++---------- lib/host/conformance.sh | 2 + lib/host/serve.sh | 18 +++++-- lib/host/tests/blog.sx | 18 ++++--- plans/host-on-sx.md | 14 +++++- 6 files changed, 110 insertions(+), 36 deletions(-) diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 8a63156e..5f01c24a 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -20,6 +20,8 @@ services: HOST_PORT: "8000" # Bind all interfaces so Caddy (on externalnet) can reach it. SX_HTTP_HOST: "0.0.0.0" + # Durable persist store root — on a named volume so data survives restarts. + SX_PERSIST_DIR: /data/persist OCAMLRUNPARAM: "b" volumes: # SX source (hot-reload on container restart) @@ -27,6 +29,10 @@ services: - ./lib:/app/lib:ro # OCaml server binary — this worktree's build (has the SX_HTTP_HOST bind fix) - ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro + # Durable persist store (the SX op-log/kv on disk) — survives restarts. + # Host dir, chowned to the image's appuser (uid 10001) so the non-root + # server can write: sudo mkdir -p /root/sx-host-persist && sudo chown 10001:10001 /root/sx-host-persist + - /root/sx-host-persist:/data/persist networks: - externalnet - default diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 049dec76..7d0ad3ce 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -1,34 +1,72 @@ -;; lib/host/blog.sx — Blog domain on the host. Serves published posts as HTML at -;; GET // — the original strangler target (Quart: blog/bp/post/routes.py, -;; handler post_detail). Published posts are world-visible, so this endpoint is -;; ANONYMOUS — no auth, visibility is trivially "visible". +;; lib/host/blog.sx — Blog domain on the host. Posts are content-on-sx documents +;; whose SOURCE OF TRUTH is the durable SX store (persist op-log on disk): a post +;; is published by appending insert ops to its stream. Serving GET // renders +;; the post to HTML via content/html. The original strangler target (Quart blog +;; post_detail); published posts are world-visible, so this endpoint is ANONYMOUS. ;; -;; A post is a content-on-sx document (CtDoc) rendered to HTML via the content -;; facade (content/html). Posts live in an in-memory registry keyed by slug: this -;; is the "prove the machinery" step — swap host/blog-lookup for a persist-backed -;; content stream later without touching the handler or the route. -;; Depends on lib/content/* (+ the Smalltalk + persist preloads its classes need) -;; + lib/dream/* + lib/host/handler.sx. +;; READ PATH — materialised view, not per-request IO. The durable backend reads +;; via `perform` (kernel IO suspension), which is serviceable on the main thread +;; (boot) but NOT inside an http-listen request handler thread. So posts are +;; materialised from the store into an in-memory view at boot (and on publish), +;; and request handlers read that view — fast, perform-free. The store stays the +;; source of truth; the view is a cache rebuilt from it on startup. +;; Depends on lib/content/* (+ Smalltalk + persist preloads) + lib/dream/* + +;; lib/host/handler.sx. -;; Register the content class table + render methods (idempotent). Must run before -;; any CtDoc is built/rendered; called at module load below. +;; Register content classes + render methods (idempotent); called at load below. (define host/blog-bootstrap! (fn () (begin (st-bootstrap-classes!) (content/bootstrap!)))) -;; ── in-memory post registry (slug -> CtDoc) ───────────────────────── -(define host/blog-posts {}) -(define host/blog-register! - (fn (slug doc) (set! host/blog-posts (assoc host/blog-posts slug doc)))) -(define host/blog-lookup (fn (slug) (get host/blog-posts slug))) -(define host/blog-reset! (fn () (set! host/blog-posts {}))) +;; ── store (durable source of truth) + view (in-memory serving cache) ─ +(define host/blog-store (persist/open)) +(define host/blog-view {}) +(define host/blog-use-store! + (fn (b) (begin (set! host/blog-store b) (set! host/blog-view {})))) -;; Build a simple post doc (title heading + body paragraph). Convenience for -;; seeding and tests; real posts arrive from the content store. -(define host/blog-make - (fn (slug title body) - (doc-append - (doc-append (doc-empty slug) (mk-heading (str slug "-h") 1 title)) - (mk-text (str slug "-body") body)))) +;; content streams are keyed "content:"; recover the slug. +(define host/blog--stream-slug + (fn (stream) + (if (starts-with? stream "content:") (substr stream 8) nil))) + +;; ── publish + lookup ──────────────────────────────────────────────── +;; Publish a simple post (title heading + body paragraph): append its insert ops +;; to the durable store, then refresh the in-memory view. `at` is a logical ts. +(define host/blog-publish! + (fn (slug title body at) + (let ((hid (str slug "-h")) (tid (str slug "-body"))) + (content/commit-all! host/blog-store slug + (list + (op-insert (mk-heading hid 1 title) nil) + (op-insert (mk-text tid body) hid)) + at) + (set! host/blog-view + (assoc host/blog-view slug (content/head host/blog-store slug)))))) + +;; Materialise every persisted post from the store into the view. Run at boot on +;; the main thread (content/head performs IO, fine here, not in a request). +(define host/blog-load-all! + (fn () + (for-each + (fn (stream) + (let ((slug (host/blog--stream-slug stream))) + (when slug + (let ((doc (content/head host/blog-store slug))) + (when (> (content/count doc) 0) + (set! host/blog-view (assoc host/blog-view slug doc))))))) + (persist/backend-streams host/blog-store)))) + +;; Idempotent seed: if the slug isn't already materialised, recover it from the +;; store (prior run) or publish it fresh. No duplicate ops on restart. +(define host/blog-seed! + (fn (slug title body at) + (when (nil? (get host/blog-view slug)) + (let ((existing (content/head host/blog-store slug))) + (if (> (content/count existing) 0) + (set! host/blog-view (assoc host/blog-view slug existing)) + (host/blog-publish! slug title body at)))))) + +;; Lookup is pure in-memory (no perform) — safe inside a request handler. +(define host/blog-lookup (fn (slug) (get host/blog-view slug))) ;; ── handler: GET // -> rendered HTML (200) or 404 ───────────── (define host/blog-post diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 05e8dd30..7326cd52 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -70,6 +70,8 @@ MODULES=( "lib/content/doc.sx" "lib/content/render.sx" "lib/content/api.sx" + "lib/content/store.sx" + "lib/persist/durable.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 87ea91ef..6bde5d8c 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -75,6 +75,8 @@ MODULES=( "lib/content/doc.sx" "lib/content/render.sx" "lib/content/api.sx" + "lib/content/store.sx" + "lib/persist/durable.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" @@ -95,10 +97,20 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done - # Seed a welcome post so blog.rose-ash.com/welcome/ renders live (until posts - # arrive from a persist-backed content store). + # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), + # then idempotently seed a welcome post — re-seeding is a no-op if it already + # exists on disk, so restarts don't duplicate blocks. echo "(epoch $EPOCH)" - echo "(eval \"(host/blog-register! \\\"welcome\\\" (host/blog-make \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"This page is rendered by lib/host on the SX runtime — no Quart.\\\"))\")" + echo "(eval \"(host/blog-use-store! (persist/durable-backend))\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + # Materialise any persisted posts into the in-memory view, then ensure the + # welcome post exists (idempotent). Both run on the main thread (IO is fine + # here; request handlers only read the view). + echo "(eval \"(host/blog-load-all!)\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"This page is rendered by lib/host on the SX runtime, persisted in the SX store — no Quart.\\\" 1)\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" # Anonymous read endpoints: feed timeline + relations container reads + blog diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 02899e73..1e1af943 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -22,9 +22,9 @@ (define host-bl-app (host/make-app (list host/feed-routes host/blog-routes))) -;; ── render a registered post ──────────────────────────────────────── -(host/blog-reset!) -(host/blog-register! "welcome" (host/blog-make "welcome" "Hello SX" "Served by lib/host.")) +;; ── publish a post to a fresh in-memory store (hermetic) ──────────── +(host/blog-use-store! (persist/open)) +(host/blog-publish! "welcome" "Hello SX" "Served by lib/host." 1) (host-bl-test "post 200" @@ -48,11 +48,17 @@ (dream-status (host-bl-app (host-bl-req "/welcome"))) 200) -;; golden: endpoint body == content facade render of the same doc +;; golden: endpoint body == the exact rendered HTML of the published post (host-bl-test - "golden = content/html" + "golden render" (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) - (content/html (host/blog-make "welcome" "Hello SX" "Served by lib/host."))) + "

Hello SX

Served by lib/host.

") + +;; persistence: a post materialises from the op-log (replay), and re-seeding is +;; idempotent (no duplicate blocks appended). +(host-bl-test "lookup materialises 2 blocks" (content/count (host/blog-lookup "welcome")) 2) +(host/blog-seed! "welcome" "Hello SX" "Served by lib/host." 2) +(host-bl-test "re-seed is idempotent" (content/count (host/blog-lookup "welcome")) 2) ;; ── unknown slug -> 404 ───────────────────────────────────────────── (host-bl-test diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 1ea233cd..5d536328 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,8 +36,18 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **156/156** (9 suites: handler, middleware, sxtp, -router, feed, relations, blog, server, ledger). Phases 1 & 2 DONE; Phase 3 cut-over +`bash lib/host/conformance.sh` → **158/158** (9 suites: handler, middleware, sxtp, +router, feed, relations, blog, server, ledger). Blog posts now persist in the +durable SX store (`persist/durable-backend`, on-disk under `$SX_PERSIST_DIR`), +materialised into an in-memory view at boot and served from there. + +> **Per-request IO gap (kernel):** `http-listen` handlers run via +> `Sx_runtime.sx_call`, which does NOT drive `perform`/IO to completion the way +> the main eval loop does (`Sx_types._cek_io_resolver` is global but the handler +> path returns the suspension). Proven: a handler doing a durable `persist/read` +> returns an empty/broken response. Workaround for blog reads = materialise at +> boot. REAL FIX (next): make the http-listen handler invocation resolve IO like +> the main loop — then handlers can read/write the store per request. Phases 1 & 2 DONE; Phase 3 cut-over landed (50% off Quart). **The host now serves live HTTP** — `lib/host/server.sx` bridges the native `http-listen` server to the Dream app and `lib/host/serve.sh` boots it (verified: GET /health, /feed, /feed?actor=, relations get-children/ From 7c11d4edaa086078ccf289c96501995717da2151 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 18:59:36 +0000 Subject: [PATCH 012/138] host: per-request IO kernel fix + fully-dynamic blog (no cache), 159/159 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit KERNEL (sx_server.ml): route http-listen handlers through cek_run_with_io instead of bare Sx_runtime.sx_call, so handlers resolve per-request IO (durable persist reads/writes) via the same IO-driving runner the REPL uses. Verified: per-request read+write, 10 concurrent writes (15 on disk, no corruption), handler errors don't crash the server, http contract 6/6. BLOG: fully dynamic — host/blog-post reads the post from the durable store (content/head) AND renders (content/html) per request, no in-memory view, no cached output. Possible because of the IO fix. Honest ~2s due to interpreted Smalltalk render. Render speed is NOT solved here: the JIT (precompiler) isn't installed in the serving mode and currently miscompiles the Smalltalk evaluator's nested ASTs (enabling it breaks ~60% of tests). Fixing the JIT is a separate, high-payoff effort. Documented in the plan. Co-Authored-By: Claude Opus 4.8 --- hosts/ocaml/bin/sx_server.ml | 10 +++++- lib/host/blog.sx | 70 +++++++++++++----------------------- lib/host/serve.sh | 8 ++--- lib/host/tests/blog.sx | 9 ++--- plans/host-on-sx.md | 29 +++++++++++---- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 006ab145..eaf8f93b 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -814,7 +814,15 @@ let setup_evaluator_bridge env = Hashtbl.replace req "body" (String body); Mutex.lock mtx; let resp = - (try Sx_runtime.sx_call handler [Dict req] + (* Run the handler through the IO-aware CEK runner (not bare + sx_call) so request handlers can perform per-request IO — + durable store reads/writes resolve via cek_run_with_io's + suspension loop instead of returning an unresolved suspension. *) + (try + let st = Sx_ref.continue_with_call handler + (List [Dict req]) (Env (Sx_types.make_env ())) + (List [Dict req]) (List []) in + cek_run_with_io st with e -> Mutex.unlock mtx; raise e) in Mutex.unlock mtx; let getk k = match resp with diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 7d0ad3ce..b6397409 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -1,15 +1,16 @@ ;; lib/host/blog.sx — Blog domain on the host. Posts are content-on-sx documents -;; whose SOURCE OF TRUTH is the durable SX store (persist op-log on disk): a post -;; is published by appending insert ops to its stream. Serving GET // renders -;; the post to HTML via content/html. The original strangler target (Quart blog +;; whose source of truth is the durable SX store (persist op-log on disk). Serving +;; GET // is FULLY DYNAMIC: the handler reads the post from the store and +;; renders it to HTML, per request — no in-memory view, no cached output. This is +;; possible because http-listen handlers now resolve per-request IO (the +;; cek_run_with_io kernel fix). The original strangler target (Quart blog ;; post_detail); published posts are world-visible, so this endpoint is ANONYMOUS. ;; -;; READ PATH — materialised view, not per-request IO. The durable backend reads -;; via `perform` (kernel IO suspension), which is serviceable on the main thread -;; (boot) but NOT inside an http-listen request handler thread. So posts are -;; materialised from the store into an in-memory view at boot (and on publish), -;; and request handlers read that view — fast, perform-free. The store stays the -;; source of truth; the view is a cache rebuilt from it on startup. +;; NOTE ON SPEED: content/html runs the interpreted Smalltalk-on-SX dispatch +;; (~2s for a tiny doc) because the JIT is not installed in this serving mode AND +;; currently miscompiles the Smalltalk evaluator's nested ASTs. Making the render +;; fast is a JIT-compiler fix (or a Smalltalk-interpreter optimisation), tracked +;; separately — it is NOT solved by caching the output. ;; Depends on lib/content/* (+ Smalltalk + persist preloads) + lib/dream/* + ;; lib/host/handler.sx. @@ -17,20 +18,13 @@ (define host/blog-bootstrap! (fn () (begin (st-bootstrap-classes!) (content/bootstrap!)))) -;; ── store (durable source of truth) + view (in-memory serving cache) ─ +;; ── store (durable source of truth, injectable) ───────────────────── (define host/blog-store (persist/open)) -(define host/blog-view {}) -(define host/blog-use-store! - (fn (b) (begin (set! host/blog-store b) (set! host/blog-view {})))) +(define host/blog-use-store! (fn (b) (set! host/blog-store b))) -;; content streams are keyed "content:"; recover the slug. -(define host/blog--stream-slug - (fn (stream) - (if (starts-with? stream "content:") (substr stream 8) nil))) - -;; ── publish + lookup ──────────────────────────────────────────────── +;; ── publish + lookup (per-request, against the store) ─────────────── ;; Publish a simple post (title heading + body paragraph): append its insert ops -;; to the durable store, then refresh the in-memory view. `at` is a logical ts. +;; to the durable store. `at` is a caller-supplied logical timestamp. (define host/blog-publish! (fn (slug title body at) (let ((hid (str slug "-h")) (tid (str slug "-body"))) @@ -38,35 +32,21 @@ (list (op-insert (mk-heading hid 1 title) nil) (op-insert (mk-text tid body) hid)) - at) - (set! host/blog-view - (assoc host/blog-view slug (content/head host/blog-store slug)))))) + at)))) -;; Materialise every persisted post from the store into the view. Run at boot on -;; the main thread (content/head performs IO, fine here, not in a request). -(define host/blog-load-all! - (fn () - (for-each - (fn (stream) - (let ((slug (host/blog--stream-slug stream))) - (when slug - (let ((doc (content/head host/blog-store slug))) - (when (> (content/count doc) 0) - (set! host/blog-view (assoc host/blog-view slug doc))))))) - (persist/backend-streams host/blog-store)))) - -;; Idempotent seed: if the slug isn't already materialised, recover it from the -;; store (prior run) or publish it fresh. No duplicate ops on restart. +;; Idempotent seed: publish only if the slug has no content yet (so a restart +;; replaying serve.sh doesn't append duplicate blocks to a persisted post). (define host/blog-seed! (fn (slug title body at) - (when (nil? (get host/blog-view slug)) - (let ((existing (content/head host/blog-store slug))) - (if (> (content/count existing) 0) - (set! host/blog-view (assoc host/blog-view slug existing)) - (host/blog-publish! slug title body at)))))) + (when (= (content/count (content/head host/blog-store slug)) 0) + (host/blog-publish! slug title body at)))) -;; Lookup is pure in-memory (no perform) — safe inside a request handler. -(define host/blog-lookup (fn (slug) (get host/blog-view slug))) +;; Materialise the post from the store by replaying its op-log; nil if no content. +;; Reads the durable store via per-request IO (works inside the handler thread). +(define host/blog-lookup + (fn (slug) + (let ((doc (content/head host/blog-store slug))) + (if (> (content/count doc) 0) doc nil)))) ;; ── handler: GET // -> rendered HTML (200) or 404 ───────────── (define host/blog-post diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 6bde5d8c..e2298ecb 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -104,12 +104,8 @@ EPOCH=1 echo "(eval \"(host/blog-use-store! (persist/durable-backend))\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" - # Materialise any persisted posts into the in-memory view, then ensure the - # welcome post exists (idempotent). Both run on the main thread (IO is fine - # here; request handlers only read the view). - echo "(eval \"(host/blog-load-all!)\")" - EPOCH=$((EPOCH+1)) - echo "(epoch $EPOCH)" + # Idempotently seed the welcome post into the durable store (no-op if present). + # Handlers read + render from the store per request (per-request IO). echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"This page is rendered by lib/host on the SX runtime, persisted in the SX store — no Quart.\\\" 1)\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 1e1af943..7c934d77 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -54,11 +54,12 @@ (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) "

Hello SX

Served by lib/host.

") -;; persistence: a post materialises from the op-log (replay), and re-seeding is -;; idempotent (no duplicate blocks appended). -(host-bl-test "lookup materialises 2 blocks" (content/count (host/blog-lookup "welcome")) 2) +;; persistence: the store holds 2 blocks (op-log replay), lookup materialises the +;; doc from the store per call, and re-seeding is idempotent (no duplicate blocks). +(host-bl-test "store has 2 blocks" (content/count (content/head host/blog-store "welcome")) 2) +(host-bl-test "lookup materialises the doc" (content/count (host/blog-lookup "welcome")) 2) (host/blog-seed! "welcome" "Hello SX" "Served by lib/host." 2) -(host-bl-test "re-seed is idempotent" (content/count (host/blog-lookup "welcome")) 2) +(host-bl-test "re-seed is idempotent" (content/count (content/head host/blog-store "welcome")) 2) ;; ── unknown slug -> 404 ───────────────────────────────────────────── (host-bl-test diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 5d536328..25ccbc5d 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -41,13 +41,28 @@ router, feed, relations, blog, server, ledger). Blog posts now persist in the durable SX store (`persist/durable-backend`, on-disk under `$SX_PERSIST_DIR`), materialised into an in-memory view at boot and served from there. -> **Per-request IO gap (kernel):** `http-listen` handlers run via -> `Sx_runtime.sx_call`, which does NOT drive `perform`/IO to completion the way -> the main eval loop does (`Sx_types._cek_io_resolver` is global but the handler -> path returns the suspension). Proven: a handler doing a durable `persist/read` -> returns an empty/broken response. Workaround for blog reads = materialise at -> boot. REAL FIX (next): make the http-listen handler invocation resolve IO like -> the main loop — then handlers can read/write the store per request. Phases 1 & 2 DONE; Phase 3 cut-over +> **Per-request IO (kernel) — FIXED.** `http-listen` handlers used to run via +> `Sx_runtime.sx_call` (bare CEK, no IO resolution), so a handler doing a durable +> `persist/read` returned an unresolved suspension. Fixed in `sx_server.ml`: the +> handler now runs through `cek_run_with_io` (`Sx_ref.continue_with_call` → +> `cek_run_with_io`), the same IO-driving runner the REPL uses — it resolves +> persist ops via `Sx_persist_store.handle_op` between CEK steps. Verified: +> handlers do per-request durable reads + writes (incl. 10 concurrent, 15 events +> on disk, no corruption); handler errors don't crash the server. NOTE: this is +> the per-request *IO* fix; it does NOT speed up the interpreted Smalltalk render +> (`/welcome/` still ~2s) — that's a separate concern, addressed by caching the +> rendered HTML at boot. (Pre-existing: an erroring handler closes the connection +> with no response instead of a 500 — worth improving later.) +> +> **Render speed (separate from IO) — NOT precompiled.** `/welcome/` is ~2s because +> the interpreted Smalltalk-on-SX render runs on the tree-walking CEK: the JIT hook +> (`register_jit_hook`) is installed only in `--http` page mode, not the epoch/ +> http-listen serving mode (`make_server_env`), so zero `[jit]` activity. Enabling +> it in that mode breaks correctness (router 3/6, feed 4/11, … — the known JIT- +> bytecode bug on complex nested ASTs, which the Smalltalk evaluator is). So the +> render is slow until the JIT compiler is fixed (big win, broad payoff — its own +> loop) or the Smalltalk interpreter is optimised. Blog is FULLY DYNAMIC (reads +> store + renders per request, no cache) — slowness is honest, not hidden. Phases 1 & 2 DONE; Phase 3 cut-over landed (50% off Quart). **The host now serves live HTTP** — `lib/host/server.sx` bridges the native `http-listen` server to the Dream app and `lib/host/serve.sh` boots it (verified: GET /health, /feed, /feed?actor=, relations get-children/ From 85e0af83f649e618cdb301b4cab59d2007babc25 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 19:24:59 +0000 Subject: [PATCH 013/138] host: blog post CRUD (list/create/update/delete) + fail-loud test runner, 175/175 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRUD on the durable content store, per-request IO: GET /posts list (public) -> [{slug,title}] GET // read (public) -> HTML / 404 POST /posts create (auth+ACL edit/blog) -> 201/400/409 PUT /posts/ update title+body -> 200/400/404 DELETE /posts/ delete (truncate) -> 200/404 Writes behind the auth+ACL pipeline; create=insert ops, update=op-updates, delete=stream truncate. 16 new CRUD tests (full lifecycle + 401/403/409/404). GOTCHA fixed: is a reserved CEK special form — a (let ((guard ...))) helper was shadowed by it ((guard h) ran the guard special form -> 'first: expected list'). Renamed to host/blog--protect; namespace-prefix all helpers. HARDENING: conformance.sh now FAILS LOUD on load/eval errors. A test file that errors mid-load silently truncates its suite and reports a false green (this hid the CRUD failure as 'blog 13 passed, 0 failed'). The runner greps for error markers and aborts. Documented the SX gotcha set + prevention ladder in the plan. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 155 ++++++++++++++++++++++++++++++++++------ lib/host/conformance.sh | 11 +++ lib/host/tests/blog.sx | 79 ++++++++++++++++++++ plans/host-on-sx.md | 26 +++++++ 4 files changed, 248 insertions(+), 23 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index b6397409..775bb97e 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -1,30 +1,47 @@ ;; lib/host/blog.sx — Blog domain on the host. Posts are content-on-sx documents -;; whose source of truth is the durable SX store (persist op-log on disk). Serving -;; GET // is FULLY DYNAMIC: the handler reads the post from the store and -;; renders it to HTML, per request — no in-memory view, no cached output. This is -;; possible because http-listen handlers now resolve per-request IO (the -;; cek_run_with_io kernel fix). The original strangler target (Quart blog -;; post_detail); published posts are world-visible, so this endpoint is ANONYMOUS. +;; whose source of truth is the durable SX store (persist op-log on disk). Full +;; post CRUD, all dispatching to the content store per request (per-request IO): +;; GET /posts list posts (public) -> JSON [{slug,title}] +;; GET // read a post (public) -> rendered HTML / 404 +;; POST /posts create (guarded) -> 201 / 400 / 409 +;; PUT /posts/ update title+body (guarded)-> 200 / 400 / 404 +;; DELETE /posts/ delete (guarded) -> 200 / 404 +;; Reads are anonymous (published posts are world-visible); writes run behind the +;; auth + ACL pipeline ("edit" on "blog"), like the editor would require. ;; -;; NOTE ON SPEED: content/html runs the interpreted Smalltalk-on-SX dispatch -;; (~2s for a tiny doc) because the JIT is not installed in this serving mode AND -;; currently miscompiles the Smalltalk evaluator's nested ASTs. Making the render -;; fast is a JIT-compiler fix (or a Smalltalk-interpreter optimisation), tracked -;; separately — it is NOT solved by caching the output. +;; A post is two blocks under stream "content:": a heading (id "-h") +;; and a body paragraph (id "-body"). create appends insert ops, update +;; appends op-updates to those ids, delete truncates the stream. Materialising + +;; rendering happens per request (interpreted Smalltalk render is ~2s — a JIT +;; concern, tracked separately, NOT solved by caching). ;; Depends on lib/content/* (+ Smalltalk + persist preloads) + lib/dream/* + -;; lib/host/handler.sx. +;; lib/host/{handler,middleware}.sx. ;; Register content classes + render methods (idempotent); called at load below. (define host/blog-bootstrap! (fn () (begin (st-bootstrap-classes!) (content/bootstrap!)))) -;; ── store (durable source of truth, injectable) ───────────────────── +;; ── store (durable source of truth, injectable) + logical clock ───── (define host/blog-store (persist/open)) (define host/blog-use-store! (fn (b) (set! host/blog-store b))) +(define host/blog-clock 0) +(define host/blog-tick! (fn () (begin (set! host/blog-clock (+ host/blog-clock 1)) host/blog-clock))) -;; ── publish + lookup (per-request, against the store) ─────────────── -;; Publish a simple post (title heading + body paragraph): append its insert ops -;; to the durable store. `at` is a caller-supplied logical timestamp. +;; content streams are keyed "content:"; recover the slug ("content:" = 8). +(define host/blog--stream-slug + (fn (stream) (if (starts-with? stream "content:") (substr stream 8) nil))) + +;; ── post helpers (per-request, against the store) ─────────────────── +(define host/blog-exists? + (fn (slug) (> (content/count (content/head host/blog-store slug)) 0))) + +;; First heading's text, else a placeholder. +(define host/blog-title + (fn (doc) + (let ((hs (filter (fn (b) (= (blk-type b) "heading")) (content/blocks doc)))) + (if (> (len hs) 0) (str (blk-get (first hs) "text")) "(untitled)")))) + +;; Create: append the post's insert ops to its stream. (define host/blog-publish! (fn (slug title body at) (let ((hid (str slug "-h")) (tid (str slug "-body"))) @@ -34,21 +51,49 @@ (op-insert (mk-text tid body) hid)) at)))) -;; Idempotent seed: publish only if the slug has no content yet (so a restart -;; replaying serve.sh doesn't append duplicate blocks to a persisted post). +;; Update: append op-updates to the post's heading + body blocks. +(define host/blog-update! + (fn (slug title body at) + (let ((hid (str slug "-h")) (tid (str slug "-body"))) + (content/commit-all! host/blog-store slug + (list (op-update hid "text" title) (op-update tid "text" body)) + at)))) + +;; Delete: truncate the post's stream (clears all content -> lookup nil -> 404). +(define host/blog-delete! + (fn (slug) + (let ((stream (content/-stream slug))) + (persist/truncate host/blog-store stream (persist/last-seq host/blog-store stream))))) + +;; Idempotent seed: publish only if the slug has no content yet. (define host/blog-seed! (fn (slug title body at) (when (= (content/count (content/head host/blog-store slug)) 0) (host/blog-publish! slug title body at)))) ;; Materialise the post from the store by replaying its op-log; nil if no content. -;; Reads the durable store via per-request IO (works inside the handler thread). (define host/blog-lookup (fn (slug) (let ((doc (content/head host/blog-store slug))) (if (> (content/count doc) 0) doc nil)))) -;; ── handler: GET // -> rendered HTML (200) or 404 ───────────── +;; All posts with content, as [{:slug :title}]. +(define host/blog-list + (fn () + (reduce + (fn (acc stream) + (let ((slug (host/blog--stream-slug stream))) + (if slug + (let ((doc (content/head host/blog-store slug))) + (if (> (content/count doc) 0) + (append acc (list {:slug slug :title (host/blog-title doc)})) + acc)) + acc))) + (list) + (persist/backend-streams host/blog-store)))) + +;; ── handlers ──────────────────────────────────────────────────────── +;; GET // -> rendered HTML (200) or 404. (define host/blog-post (fn (req) (let ((slug (dream-param req "slug"))) @@ -59,10 +104,74 @@ (str "Not found" "

404

No published post: " slug "

"))))))) -;; Anonymous read route. MUST be mounted LAST: the :slug pattern matches any -;; single-segment path, so domain routes (/feed, /health) take precedence. +;; GET /posts -> JSON list of posts. +(define host/blog-index (fn (req) (host/ok (host/blog-list)))) + +;; POST /posts -> create from JSON {slug,title,body}. 409 if it exists. +(define host/blog-create + (fn (req) + (let ((p (dream-json-body req))) + (if (= (type-of p) "dict") + (let ((slug (get p :slug)) (title (get p :title)) (body (get p :body))) + (if (and slug title body) + (if (host/blog-exists? slug) + (host/error 409 "post already exists") + (begin + (host/blog-publish! slug title body (host/blog-tick!)) + (host/ok-status 201 {:slug slug :title title}))) + (host/error 400 "slug, title, body required"))) + (host/error 400 "invalid payload"))))) + +;; PUT /posts/ -> update title+body from JSON {title,body}. 404 if absent. +(define host/blog-update-handler + (fn (req) + (let ((slug (dream-param req "slug")) (p (dream-json-body req))) + (if (= (type-of p) "dict") + (if (host/blog-exists? slug) + (let ((title (get p :title)) (body (get p :body))) + (if (and title body) + (begin + (host/blog-update! slug title body (host/blog-tick!)) + (host/ok {:slug slug :title title :updated true})) + (host/error 400 "title, body required"))) + (host/error 404 "no such post")) + (host/error 400 "invalid payload"))))) + +;; DELETE /posts/ -> delete. 404 if absent. +(define host/blog-delete-handler + (fn (req) + (let ((slug (dream-param req "slug"))) + (if (host/blog-exists? slug) + (begin (host/blog-delete! slug) (host/ok {:slug slug :deleted true})) + (host/error 404 "no such post"))))) + +;; ── routes ────────────────────────────────────────────────────────── +;; Public reads: /posts (list) BEFORE /:slug (the catch-all), so a literal +;; /posts isn't captured as a slug. MUST be mounted LAST in the app (the :slug +;; pattern matches any single-segment path, so domain routes take precedence). (define host/blog-routes - (list (dream-get "/:slug" host/blog-post))) + (list + (dream-get "/posts" host/blog-index) + (dream-get "/:slug" host/blog-post))) + +;; Guarded writes: create/update/delete behind auth + ACL ("edit","blog"). +;; resolve : token -> principal | nil (injected auth policy, like the feed writes). +;; NB: the wrapper is named host/blog--protect, NOT `guard` — `guard` is a reserved +;; CEK special form and a local binding of that name is shadowed by it. +(define host/blog--protect + (fn (resolve h) + (host/pipeline + (list + host/wrap-errors + (host/require-auth resolve) + (host/require-permission "edit" (fn (req) "blog"))) + h))) +(define host/blog-write-routes + (fn (resolve) + (list + (dream-post "/posts" (host/blog--protect resolve host/blog-create)) + (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) + (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) ;; Self-bootstrap at load (content modules are loaded before this one). (host/blog-bootstrap!) diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 7326cd52..9a13159c 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -117,6 +117,17 @@ emit_eval () { echo "(epoch $EPOCH)"; echo "(eval \"$1\")"; EPOCH=$((EPOCH+1)); OUTPUT=$(timeout 300 "$SX_SERVER" < "$TMPFILE" 2>&1 || true) +# Fail LOUD on any load/eval error. A test file that errors mid-load silently +# truncates its suite — the runner returns only the tests that ran before the +# error, so the suite reports a false green (e.g. "blog 13 passed, 0 failed" +# when 16 CRUD tests never ran). Catch the error markers and abort before the +# pass/fail tally can hide them. +if echo "$OUTPUT" | grep -qE 'Undefined symbol|Unhandled exception|\[load\][^|]*[Ee]rror|expected list, got|: error '; then + echo "FAIL: load/eval error detected — a suite may be silently truncated:" >&2 + echo "$OUTPUT" | grep -nE 'Undefined symbol|Unhandled exception|\[load\]|expected list, got|: error ' | head -20 >&2 + exit 1 +fi + TOTAL_PASS=0 TOTAL_FAIL=0 FAILED_SUITES=() diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 7c934d77..91531ef8 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -82,6 +82,85 @@ (contains? (dream-resp-body (host-bl-app (host-bl-req "/feed"))) "\"ok\":true") true) +;; ── CRUD: list / create / update / delete (writes auth+ACL guarded) ─ +(acl/load! (list (acl-grant "editor" "edit" "blog"))) +(define host-bl-resolve + (fn (tok) (cond ((= tok "good") "editor") ((= tok "weak") "reader") (true nil)))) +(define host-bl-wapp + (host/make-app (list (host/blog-write-routes host-bl-resolve) host/blog-routes))) +(define host-bl-send + (fn (method target auth body) + (dream-request method target (if auth {:authorization auth} {}) body))) + +;; start from a clean store +(host/blog-use-store! (persist/open)) + +;; list empty +(host-bl-test "list empty -> data:[]" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "\"data\":[]") + true) + +;; create requires auth +(host-bl-test "create no auth -> 401" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" nil "{}"))) + 401) +(host-bl-test "create authed-unpermitted -> 403" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer weak" + "{\"slug\":\"hello\",\"title\":\"Hi\",\"body\":\"B\"}"))) + 403) +;; create permitted -> 201 +(host-bl-test "create -> 201" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" + "{\"slug\":\"hello\",\"title\":\"Hello World\",\"body\":\"First post.\"}"))) + 201) +;; created post renders at GET // +(host-bl-test "created post reads back as HTML" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) "

Hello World

") + true) +;; appears in the list +(host-bl-test "list shows created post" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "Hello World") + true) +;; create duplicate -> 409 +(host-bl-test "create duplicate -> 409" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" + "{\"slug\":\"hello\",\"title\":\"X\",\"body\":\"Y\"}"))) + 409) +;; missing fields -> 400 +(host-bl-test "create missing fields -> 400" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "{\"slug\":\"x\"}"))) + 400) + +;; update -> 200 and content changes +(host-bl-test "update -> 200" + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/hello" "Bearer good" + "{\"title\":\"Edited Title\",\"body\":\"Edited body.\"}"))) + 200) +(host-bl-test "update changed the rendered post" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) "

Edited Title

") + true) +(host-bl-test "update missing post -> 404" + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/ghost" "Bearer good" + "{\"title\":\"T\",\"body\":\"B\"}"))) + 404) +(host-bl-test "update no auth -> 401" + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/hello" nil "{}"))) + 401) + +;; delete -> 200, then gone (404) and absent from list +(host-bl-test "delete -> 200" + (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/hello" "Bearer good" ""))) + 200) +(host-bl-test "deleted post -> 404" + (dream-status (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) + 404) +(host-bl-test "deleted post gone from list" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "hello") + false) +(host-bl-test "delete missing -> 404" + (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/ghost" "Bearer good" ""))) + 404) + (define host-bl-tests-run! (fn diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 25ccbc5d..17f1734b 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -288,6 +288,32 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… (docker stack + Caddy) remains. NEXT: golden harness, internal-HMAC, then promote into the stack behind a fresh subdomain. +## SX gotchas + how this loop guards against them + +The SX dev experience has real footguns. Most are statically detectable; the +tools exist (`sx_validate`, `deps-check`, `sx_format_check`) but must be *gated*. +Hit/relevant here: +- **Reserved-name shadowing** — `guard`/`bind`/`conj`/`disj` are special forms or + host primitives; a local binding of that name is silently shadowed by the form. + (`(let ((guard ...)))` made `(guard handler)` invoke the R7RS `guard` special + form → `first: expected list`.) Fix: namespace-prefix every helper + (`host/blog--protect`, never `guard`). +- **Silent test truncation** — a test file that errors mid-load returns only the + tests that ran before the error, reporting a FALSE GREEN ("blog 13 passed, 0 + failed" while 16 CRUD tests never ran). **GUARDED**: `conformance.sh` now greps + the run output for `Undefined symbol` / `Unhandled exception` / `expected list, + got` / `[load] … error` and aborts loudly before the tally can hide it. +- **`let` is parallel** (bindings can't see each other), **bodies need `(do …)`** + (only the last expr evaluates), **`append!` no-ops on map/rest-derived lists**, + **parsed keyword tokens ≠ string literals**. These produce wrong *results*, so + test coverage catches them as red (not silent) — provided the runner is honest, + which the truncation guard now ensures. + +Prevention ladder: parse (`sx_validate` after every edit) → unresolved/shadowed +symbols (`deps-check`, candidate pre-commit gate) → fail-loud runner (done) → +behavioural tests. A `deps-check`-style "binding shadows a special form" lint +would catch the reserved-name class before runtime — a worthwhile follow-up. + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From 64985ff6f7cd9eecb87aaa839a8eb7b7d06998e9 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 19:29:06 +0000 Subject: [PATCH 014/138] host: blog home page GET / -> HTML post index, 179/179 GET / renders an HTML index listing every post (title linking to //), built from host/blog-list; empty -> 'No posts yet'. GET /posts stays the JSON API. Live: blog.rose-ash.com/ lists the welcome post linking to /welcome/. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 18 +++++++++++++++++- lib/host/tests/blog.sx | 14 ++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 775bb97e..61c6e031 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -104,9 +104,24 @@ (str "Not found" "

404

No published post: " slug "

"))))))) -;; GET /posts -> JSON list of posts. +;; GET /posts -> JSON list of posts (API). (define host/blog-index (fn (req) (host/ok (host/blog-list)))) +;; GET / -> HTML index page listing posts, each linking to //. +(define host/blog--li + (fn (acc p) + (str acc "
  • " (get p :title) "
  • "))) +(define host/blog-home + (fn (req) + (let ((posts (host/blog-list))) + (dream-html + (str + "Blog" + "

    Posts

    " + (if (> (len posts) 0) + (str "
      " (reduce host/blog--li "" posts) "
    ") + "

    No posts yet.

    ")))))) + ;; POST /posts -> create from JSON {slug,title,body}. 409 if it exists. (define host/blog-create (fn (req) @@ -151,6 +166,7 @@ ;; pattern matches any single-segment path, so domain routes take precedence). (define host/blog-routes (list + (dream-get "/" host/blog-home) (dream-get "/posts" host/blog-index) (dream-get "/:slug" host/blog-post))) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 91531ef8..08d7088f 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -99,6 +99,13 @@ (host-bl-test "list empty -> data:[]" (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "\"data\":[]") true) +;; HTML home page when empty +(host-bl-test "home / -> 200 html" + (contains? (dream-resp-header (host-bl-wapp (host-bl-send "GET" "/" nil "")) "content-type") "text/html") + true) +(host-bl-test "empty home says no posts" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "No posts yet") + true) ;; create requires auth (host-bl-test "create no auth -> 401" @@ -121,6 +128,13 @@ (host-bl-test "list shows created post" (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "Hello World") true) +;; home page lists it with a link to // +(host-bl-test "home lists post title" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "Hello World") + true) +(host-bl-test "home links to the post" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "href=\"/hello/\"") + true) ;; create duplicate -> 409 (host-bl-test "create duplicate -> 409" (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" From 6ed9e7dbe630d7a54f4702079fe2f42aa8e76b9f Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 19:52:05 +0000 Subject: [PATCH 015/138] host: blog on the editor's sx_content model + render-to-html, 171/171 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pivot blog to the SX editor's content model. The editor (blog/sx/editor.sx) emits sx_content = SX element markup, NOT content-on-sx CtDoc blocks. So a post is now a {slug,title,sx_content,status} record in the durable persist KV, and a post page is render-to-html(parse sx_content) — server-side, static, no client runtime needed to view. Endpoints: GET / (HTML index), // (rendered post), /posts (JSON list), /new (create form); POST /new (form-urlencoded editor ingest, slug from title, 303 redirect), POST /posts (JSON create), PUT/DELETE /posts/. Writes behind auth+ACL (edit/blog). Dropped the content-on-sx/Smalltalk preload chain; added spec/render + web/adapter-html (render-to-html) + lib/dream/form. BONUS: render-to-html is ~0ms (vs the 2s content-on-sx Smalltalk asHTML) — it doesn't hit the JIT-miscompiled path, so blog rendering is no longer slow. Live: blog.rose-ash.com/ lists posts, /welcome/ renders instantly. Reads live; the form-ingest write path needs an auth decision before going live (browser forms can't send bearer; needs session or a Caddy basicauth gate). Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 260 +++++++++++++++++++++------------------- lib/host/conformance.sh | 14 +-- lib/host/serve.sh | 22 +--- lib/host/tests/blog.sx | 218 +++++++++++++-------------------- plans/host-on-sx.md | 13 +- 5 files changed, 234 insertions(+), 293 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 61c6e031..0b2498fb 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -1,113 +1,87 @@ -;; lib/host/blog.sx — Blog domain on the host. Posts are content-on-sx documents -;; whose source of truth is the durable SX store (persist op-log on disk). Full -;; post CRUD, all dispatching to the content store per request (per-request IO): -;; GET /posts list posts (public) -> JSON [{slug,title}] -;; GET // read a post (public) -> rendered HTML / 404 -;; POST /posts create (guarded) -> 201 / 400 / 409 -;; PUT /posts/ update title+body (guarded)-> 200 / 400 / 404 -;; DELETE /posts/ delete (guarded) -> 200 / 404 -;; Reads are anonymous (published posts are world-visible); writes run behind the -;; auth + ACL pipeline ("edit" on "blog"), like the editor would require. +;; lib/host/blog.sx — Blog domain on the host, on the EDITOR's content model. +;; The SX post editor (blog/sx/editor.sx) emits `sx_content`: SX element markup +;; (e.g. "(article (h1 \"T\") (p \"body\" (strong \"x\")))"), NOT content-on-sx +;; CtDoc blocks. So a post here is a record {slug,title,sx_content,status} stored +;; in the durable persist KV, and a post page is `render-to-html (parse sx_content)` +;; — server-side, static, no client runtime needed to view a published post. ;; -;; A post is two blocks under stream "content:": a heading (id "-h") -;; and a body paragraph (id "-body"). create appends insert ops, update -;; appends op-updates to those ids, delete truncates the stream. Materialising + -;; rendering happens per request (interpreted Smalltalk render is ~2s — a JIT -;; concern, tracked separately, NOT solved by caching). -;; Depends on lib/content/* (+ Smalltalk + persist preloads) + lib/dream/* + -;; lib/host/{handler,middleware}.sx. +;; GET / HTML index of posts (public) +;; GET // rendered post (public) -> HTML / 404 +;; GET /posts JSON list (public) -> [{slug,title,status}] +;; GET /new HTML create form (public chrome) +;; POST /new form-urlencoded ingest from the editor (guarded) +;; POST /posts JSON create (guarded) +;; PUT /posts/ JSON update (guarded) +;; DELETE /posts/ delete (guarded) +;; Reads anonymous; writes behind the auth+ACL pipeline ("edit" on "blog"). +;; Depends on spec/render + web/adapter-html (render-to-html), lib/persist/* +;; (durable KV), lib/dream/* (+ form), lib/host/{handler,middleware}.sx. -;; Register content classes + render methods (idempotent); called at load below. -(define host/blog-bootstrap! - (fn () (begin (st-bootstrap-classes!) (content/bootstrap!)))) - -;; ── store (durable source of truth, injectable) + logical clock ───── +;; ── store (durable persist KV, injectable) ────────────────────────── (define host/blog-store (persist/open)) (define host/blog-use-store! (fn (b) (set! host/blog-store b))) -(define host/blog-clock 0) -(define host/blog-tick! (fn () (begin (set! host/blog-clock (+ host/blog-clock 1)) host/blog-clock))) +(define host/blog--key (fn (slug) (str "blog:" slug))) -;; content streams are keyed "content:"; recover the slug ("content:" = 8). -(define host/blog--stream-slug - (fn (stream) (if (starts-with? stream "content:") (substr stream 8) nil))) +;; slug from a title: lowercase, words joined by '-'. (Punctuation kept simple.) +(define host/blog-slugify + (fn (title) + (join "-" (filter (fn (w) (not (= w ""))) (split (lower title) " "))))) -;; ── post helpers (per-request, against the store) ─────────────────── +;; ── records ───────────────────────────────────────────────────────── +(define host/blog-get + (fn (slug) (persist/backend-kv-get host/blog-store (host/blog--key slug)))) (define host/blog-exists? - (fn (slug) (> (content/count (content/head host/blog-store slug)) 0))) - -;; First heading's text, else a placeholder. -(define host/blog-title - (fn (doc) - (let ((hs (filter (fn (b) (= (blk-type b) "heading")) (content/blocks doc)))) - (if (> (len hs) 0) (str (blk-get (first hs) "text")) "(untitled)")))) - -;; Create: append the post's insert ops to its stream. -(define host/blog-publish! - (fn (slug title body at) - (let ((hid (str slug "-h")) (tid (str slug "-body"))) - (content/commit-all! host/blog-store slug - (list - (op-insert (mk-heading hid 1 title) nil) - (op-insert (mk-text tid body) hid)) - at)))) - -;; Update: append op-updates to the post's heading + body blocks. -(define host/blog-update! - (fn (slug title body at) - (let ((hid (str slug "-h")) (tid (str slug "-body"))) - (content/commit-all! host/blog-store slug - (list (op-update hid "text" title) (op-update tid "text" body)) - at)))) - -;; Delete: truncate the post's stream (clears all content -> lookup nil -> 404). + (fn (slug) (persist/backend-kv-has? host/blog-store (host/blog--key slug)))) +(define host/blog-put! + (fn (slug title sx-content status) + (persist/backend-kv-put host/blog-store (host/blog--key slug) + {:slug slug :title title :sx-content sx-content :status status}))) (define host/blog-delete! - (fn (slug) - (let ((stream (content/-stream slug))) - (persist/truncate host/blog-store stream (persist/last-seq host/blog-store stream))))) - -;; Idempotent seed: publish only if the slug has no content yet. + (fn (slug) (persist/backend-kv-delete host/blog-store (host/blog--key slug)))) (define host/blog-seed! - (fn (slug title body at) - (when (= (content/count (content/head host/blog-store slug)) 0) - (host/blog-publish! slug title body at)))) + (fn (slug title sx-content status) + (when (not (host/blog-exists? slug)) (host/blog-put! slug title sx-content status)))) -;; Materialise the post from the store by replaying its op-log; nil if no content. -(define host/blog-lookup - (fn (slug) - (let ((doc (content/head host/blog-store slug))) - (if (> (content/count doc) 0) doc nil)))) - -;; All posts with content, as [{:slug :title}]. -(define host/blog-list +;; all blog slugs (kv keys are "blog:") +(define host/blog-slugs (fn () (reduce - (fn (acc stream) - (let ((slug (host/blog--stream-slug stream))) - (if slug - (let ((doc (content/head host/blog-store slug))) - (if (> (content/count doc) 0) - (append acc (list {:slug slug :title (host/blog-title doc)})) - acc)) - acc))) + (fn (acc k) + (if (starts-with? k "blog:") (append acc (list (substr k 5))) acc)) (list) - (persist/backend-streams host/blog-store)))) + (persist/backend-kv-keys host/blog-store)))) +(define host/blog-list + (fn () + (map + (fn (slug) + (let ((r (host/blog-get slug))) + {:slug slug :title (get r :title) :status (get r :status)})) + (host/blog-slugs)))) -;; ── handlers ──────────────────────────────────────────────────────── -;; GET // -> rendered HTML (200) or 404. +;; ── render ────────────────────────────────────────────────────────── +;; A post's sx_content is SX element markup -> HTML via the component renderer. +(define host/blog-render + (fn (record) + (let ((sx (get record :sx-content))) + (if (and sx (not (= sx ""))) + (render-to-html (parse sx)) + (str "

    (empty post)

    "))))) +(define host/blog--page + (fn (title body) + (str "" title "" body))) + +;; ── read handlers ─────────────────────────────────────────────────── (define host/blog-post (fn (req) (let ((slug (dream-param req "slug"))) - (let ((doc (host/blog-lookup slug))) - (if doc - (dream-html (content/html doc)) + (let ((r (host/blog-get slug))) + (if r + (dream-html + (host/blog--page (get r :title) (host/blog-render r))) (dream-html-status 404 - (str "Not found" - "

    404

    No published post: " slug "

    "))))))) + (host/blog--page "Not found" + (str "

    404

    No published post: " slug "

    ")))))))) -;; GET /posts -> JSON list of posts (API). -(define host/blog-index (fn (req) (host/ok (host/blog-list)))) - -;; GET / -> HTML index page listing posts, each linking to //. (define host/blog--li (fn (acc p) (str acc "
  • " (get p :title) "
  • "))) @@ -115,44 +89,82 @@ (fn (req) (let ((posts (host/blog-list))) (dream-html - (str - "Blog" - "

    Posts

    " - (if (> (len posts) 0) - (str "
      " (reduce host/blog--li "" posts) "
    ") - "

    No posts yet.

    ")))))) + (host/blog--page "Blog" + (str "

    Posts

    " + (if (> (len posts) 0) + (str "
      " (reduce host/blog--li "" posts) "
    ") + "

    No posts yet.

    ") + "

    + New post

    ")))))) -;; POST /posts -> create from JSON {slug,title,body}. 409 if it exists. +(define host/blog-index (fn (req) (host/ok (host/blog-list)))) + +;; ── create form (GET /new) — minimal chrome; the SX editor posts here too ── +(define host/blog-new-form + (fn (req) + (dream-html + (host/blog--page "New post" + (str + "

    New post

    " + "
    " + "

    " + "

    " + "

    " + "

    " + "

    ← all posts

    "))))) + +;; ── write handlers ────────────────────────────────────────────────── +;; POST /new — form-urlencoded ingest (the editor's submit shape: title, +;; sx_content, status, custom_excerpt, csrf_token). Slug derived from the title. +;; Redirects to the new post on success. +(define host/blog-form-submit + (fn (req) + (let ((title (dream-form-field req "title")) + (sx-content (dream-form-field req "sx_content")) + (status (or (dream-form-field req "status") "published"))) + (if (and title (not (= title ""))) + (let ((slug (host/blog-slugify title))) + (begin + (host/blog-put! slug title (or sx-content "") status) + (dream-redirect (str "/" slug "/")))) + (dream-html-status 400 + (host/blog--page "Error" "

    Title is required. back

    ")))))) + +;; POST /posts — JSON create {slug?,title,sx_content,status}. 409 if slug exists. (define host/blog-create (fn (req) (let ((p (dream-json-body req))) (if (= (type-of p) "dict") - (let ((slug (get p :slug)) (title (get p :title)) (body (get p :body))) - (if (and slug title body) - (if (host/blog-exists? slug) - (host/error 409 "post already exists") - (begin - (host/blog-publish! slug title body (host/blog-tick!)) - (host/ok-status 201 {:slug slug :title title}))) - (host/error 400 "slug, title, body required"))) + (let ((title (get p :title))) + (if (and title (not (= title ""))) + (let ((slug (or (get p :slug) (host/blog-slugify title)))) + (if (host/blog-exists? slug) + (host/error 409 "post already exists") + (begin + (host/blog-put! slug title (or (get p :sx_content) "") + (or (get p :status) "published")) + (host/ok-status 201 {:slug slug :title title})))) + (host/error 400 "title required"))) (host/error 400 "invalid payload"))))) -;; PUT /posts/ -> update title+body from JSON {title,body}. 404 if absent. +;; PUT /posts/ — JSON update {title?,sx_content?,status?}. 404 if absent. (define host/blog-update-handler (fn (req) (let ((slug (dream-param req "slug")) (p (dream-json-body req))) (if (= (type-of p) "dict") - (if (host/blog-exists? slug) - (let ((title (get p :title)) (body (get p :body))) - (if (and title body) - (begin - (host/blog-update! slug title body (host/blog-tick!)) - (host/ok {:slug slug :title title :updated true})) - (host/error 400 "title, body required"))) - (host/error 404 "no such post")) + (let ((r (host/blog-get slug))) + (if r + (begin + (host/blog-put! slug + (or (get p :title) (get r :title)) + (or (get p :sx_content) (get r :sx-content)) + (or (get p :status) (get r :status))) + (host/ok {:slug slug :updated true})) + (host/error 404 "no such post"))) (host/error 400 "invalid payload"))))) -;; DELETE /posts/ -> delete. 404 if absent. +;; DELETE /posts/ (define host/blog-delete-handler (fn (req) (let ((slug (dream-param req "slug"))) @@ -161,19 +173,17 @@ (host/error 404 "no such post"))))) ;; ── routes ────────────────────────────────────────────────────────── -;; Public reads: /posts (list) BEFORE /:slug (the catch-all), so a literal -;; /posts isn't captured as a slug. MUST be mounted LAST in the app (the :slug -;; pattern matches any single-segment path, so domain routes take precedence). +;; Public reads + the create form. /, /posts, /new BEFORE /:slug (catch-all). +;; MUST be mounted LAST in the app so domain routes (/feed, /health) win. (define host/blog-routes (list (dream-get "/" host/blog-home) (dream-get "/posts" host/blog-index) + (dream-get "/new" host/blog-new-form) (dream-get "/:slug" host/blog-post))) -;; Guarded writes: create/update/delete behind auth + ACL ("edit","blog"). -;; resolve : token -> principal | nil (injected auth policy, like the feed writes). -;; NB: the wrapper is named host/blog--protect, NOT `guard` — `guard` is a reserved -;; CEK special form and a local binding of that name is shadowed by it. +;; Guarded writes: form ingest + JSON create/update/delete behind auth+ACL. +;; NB: helper is host/blog--protect, NOT `guard` (reserved special form). (define host/blog--protect (fn (resolve h) (host/pipeline @@ -185,9 +195,7 @@ (define host/blog-write-routes (fn (resolve) (list + (dream-post "/new" (host/blog--protect resolve host/blog-form-submit)) (dream-post "/posts" (host/blog--protect resolve host/blog-create)) (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) - -;; Self-bootstrap at load (content modules are loaded before this one). -(host/blog-bootstrap!) diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 9a13159c..8e4974dd 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -55,27 +55,19 @@ MODULES=( "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" - "lib/smalltalk/tokenizer.sx" - "lib/smalltalk/parser.sx" - "lib/guest/reflective/class-chain.sx" - "lib/smalltalk/runtime.sx" - "lib/guest/reflective/env.sx" - "lib/smalltalk/eval.sx" "lib/persist/event.sx" "lib/persist/backend.sx" "lib/persist/log.sx" "lib/persist/kv.sx" "lib/persist/api.sx" - "lib/content/block.sx" - "lib/content/doc.sx" - "lib/content/render.sx" - "lib/content/api.sx" - "lib/content/store.sx" "lib/persist/durable.sx" + "spec/render.sx" + "web/adapter-html.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" "lib/dream/error.sx" + "lib/dream/form.sx" "lib/dream/router.sx" "lib/host/handler.sx" "lib/host/middleware.sx" diff --git a/lib/host/serve.sh b/lib/host/serve.sh index e2298ecb..9ffc1d24 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -60,27 +60,19 @@ MODULES=( "lib/feed/normalize.sx" "lib/feed/stream.sx" "lib/feed/api.sx" - "lib/smalltalk/tokenizer.sx" - "lib/smalltalk/parser.sx" - "lib/guest/reflective/class-chain.sx" - "lib/smalltalk/runtime.sx" - "lib/guest/reflective/env.sx" - "lib/smalltalk/eval.sx" "lib/persist/event.sx" "lib/persist/backend.sx" "lib/persist/log.sx" "lib/persist/kv.sx" "lib/persist/api.sx" - "lib/content/block.sx" - "lib/content/doc.sx" - "lib/content/render.sx" - "lib/content/api.sx" - "lib/content/store.sx" "lib/persist/durable.sx" + "spec/render.sx" + "web/adapter-html.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" "lib/dream/error.sx" + "lib/dream/form.sx" "lib/dream/router.sx" "lib/host/handler.sx" "lib/host/middleware.sx" @@ -98,15 +90,13 @@ EPOCH=1 echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), - # then idempotently seed a welcome post — re-seeding is a no-op if it already - # exists on disk, so restarts don't duplicate blocks. + # then idempotently seed a welcome post (sx_content = SX element markup, the + # editor's content model). Re-seeding is a no-op if the slug already exists. echo "(epoch $EPOCH)" echo "(eval \"(host/blog-use-store! (persist/durable-backend))\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" - # Idempotently seed the welcome post into the durable store (no-op if present). - # Handlers read + render from the store per request (per-request IO). - echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"This page is rendered by lib/host on the SX runtime, persisted in the SX store — no Quart.\\\" 1)\")" + echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"(article (h1 \\\\\\\"Welcome to the SX host\\\\\\\") (p \\\\\\\"Rendered by lib/host via render-to-html, from the durable SX store.\\\\\\\"))\\\" \\\"published\\\")\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" # Anonymous read endpoints: feed timeline + relations container reads + blog diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 08d7088f..65076017 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -1,185 +1,131 @@ -;; lib/host/tests/blog.sx — the blog published-post read endpoint. A registered -;; post renders to HTML at GET //; unknown slugs 404. Also pins route -;; precedence: the catch-all :slug must NOT shadow domain routes mounted before it. +;; lib/host/tests/blog.sx — blog on the editor's content model. Posts are +;; {slug,title,sx_content,status} records in the durable KV; a post page is +;; render-to-html(parse sx_content). Covers read/render, home index, JSON list, +;; slugify, the form-urlencoded editor ingest, and JSON CRUD (auth+ACL guarded). (define host-bl-pass 0) (define host-bl-fail 0) (define host-bl-fails (list)) - (define host-bl-test - (fn - (name actual expected) - (if - (= actual expected) + (fn (name actual expected) + (if (= actual expected) (set! host-bl-pass (+ host-bl-pass 1)) (begin (set! host-bl-fail (+ host-bl-fail 1)) (append! host-bl-fails {:name name :actual actual :expected expected}))))) (define host-bl-req (fn (target) (dream-request "GET" target {} ""))) -;; feed mounted BEFORE blog so /feed is not captured by the :slug catch-all. -(define host-bl-app - (host/make-app (list host/feed-routes host/blog-routes))) +(define host-bl-app (host/make-app (list host/feed-routes host/blog-routes))) -;; ── publish a post to a fresh in-memory store (hermetic) ──────────── +;; ── slugify ───────────────────────────────────────────────────────── +(host-bl-test "slugify" (host/blog-slugify "Hello World") "hello-world") +(host-bl-test "slugify trims spaces" (host/blog-slugify " A B ") "a-b") + +;; ── render a stored post ──────────────────────────────────────────── (host/blog-use-store! (persist/open)) -(host/blog-publish! "welcome" "Hello SX" "Served by lib/host." 1) +(host/blog-put! "hello" "Hello World" + "(article (h1 \"Hello World\") (p \"A \" (strong \"bold\") \" word.\"))" "published") -(host-bl-test - "post 200" - (dream-status (host-bl-app (host-bl-req "/welcome/"))) - 200) -(host-bl-test - "post content-type html" - (contains? (dream-resp-header (host-bl-app (host-bl-req "/welcome/")) "content-type") "text/html") +(host-bl-test "post 200" (dream-status (host-bl-app (host-bl-req "/hello/"))) 200) +(host-bl-test "post content-type html" + (contains? (dream-resp-header (host-bl-app (host-bl-req "/hello/")) "content-type") "text/html") true) -(host-bl-test - "post renders heading" - (contains? (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) "

    Hello SX

    ") +(host-bl-test "post renders sx_content markup" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/hello/"))) "bold") true) -(host-bl-test - "post renders body" - (contains? (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) "Served by lib/host.") - true) -;; trailing slash optional — /welcome and /welcome/ both resolve -(host-bl-test - "no trailing slash also 200" - (dream-status (host-bl-app (host-bl-req "/welcome"))) - 200) - -;; golden: endpoint body == the exact rendered HTML of the published post -(host-bl-test - "golden render" - (dream-resp-body (host-bl-app (host-bl-req "/welcome/"))) - "

    Hello SX

    Served by lib/host.

    ") - -;; persistence: the store holds 2 blocks (op-log replay), lookup materialises the -;; doc from the store per call, and re-seeding is idempotent (no duplicate blocks). -(host-bl-test "store has 2 blocks" (content/count (content/head host/blog-store "welcome")) 2) -(host-bl-test "lookup materialises the doc" (content/count (host/blog-lookup "welcome")) 2) -(host/blog-seed! "welcome" "Hello SX" "Served by lib/host." 2) -(host-bl-test "re-seed is idempotent" (content/count (content/head host/blog-store "welcome")) 2) - -;; ── unknown slug -> 404 ───────────────────────────────────────────── -(host-bl-test - "unknown slug 404" - (dream-status (host-bl-app (host-bl-req "/nope/"))) - 404) -(host-bl-test - "404 names the slug" - (contains? (dream-resp-body (host-bl-app (host-bl-req "/nope/"))) "nope") +(host-bl-test "post title in page" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/hello/"))) "Hello World") true) -;; ── route precedence: domain routes win over the :slug catch-all ──── +;; ── home + list ───────────────────────────────────────────────────── +(host-bl-test "home lists post" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/"))) "href=\"/hello/\"") + true) +(host-bl-test "json list shows post" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/posts"))) "\"slug\":\"hello\"") + true) +(host-bl-test "GET /new shows form" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/new"))) " data:[]" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "\"data\":[]") - true) -;; HTML home page when empty -(host-bl-test "home / -> 200 html" - (contains? (dream-resp-header (host-bl-wapp (host-bl-send "GET" "/" nil "")) "content-type") "text/html") - true) -(host-bl-test "empty home says no posts" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "No posts yet") +;; -- editor form ingest (form-urlencoded, the editor's submit shape) -- +(host-bl-test "form ingest no auth -> 401" + (dream-status (host-bl-wapp (host-bl-send "POST" "/new" nil + "application/x-www-form-urlencoded" "title=X"))) + 401) +(host-bl-test "form ingest authed -> 303 redirect" + (dream-status (host-bl-wapp (host-bl-send "POST" "/new" "Bearer good" + "application/x-www-form-urlencoded" + "title=My+First+Post&sx_content=(article+(h1+%22My+First+Post%22)+(p+%22Hi%22))&status=published"))) + 303) +(host-bl-test "form ingest set Location to the new slug" + (dream-resp-header + (host-bl-wapp (host-bl-send "POST" "/new" "Bearer good" + "application/x-www-form-urlencoded" + "title=Another+One&sx_content=(p+%22x%22)&status=published")) + "location") + "/another-one/") +(host-bl-test "ingested post renders" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/"))) "

    My First Post

    ") true) -;; create requires auth -(host-bl-test "create no auth -> 401" - (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" nil "{}"))) - 401) -(host-bl-test "create authed-unpermitted -> 403" - (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer weak" - "{\"slug\":\"hello\",\"title\":\"Hi\",\"body\":\"B\"}"))) - 403) -;; create permitted -> 201 -(host-bl-test "create -> 201" - (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" - "{\"slug\":\"hello\",\"title\":\"Hello World\",\"body\":\"First post.\"}"))) +;; -- JSON CRUD -- +(host-bl-test "json create -> 201" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "application/json" + "{\"title\":\"Json Post\",\"sx_content\":\"(p \\\"jp\\\")\",\"status\":\"draft\"}"))) 201) -;; created post renders at GET // -(host-bl-test "created post reads back as HTML" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) "

    Hello World

    ") - true) -;; appears in the list -(host-bl-test "list shows created post" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "Hello World") - true) -;; home page lists it with a link to // -(host-bl-test "home lists post title" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "Hello World") - true) -(host-bl-test "home links to the post" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/" nil ""))) "href=\"/hello/\"") - true) -;; create duplicate -> 409 -(host-bl-test "create duplicate -> 409" - (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" - "{\"slug\":\"hello\",\"title\":\"X\",\"body\":\"Y\"}"))) +(host-bl-test "json create unpermitted -> 403" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer weak" "application/json" + "{\"title\":\"Nope\"}"))) + 403) +(host-bl-test "json create duplicate -> 409" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "application/json" + "{\"slug\":\"json-post\",\"title\":\"Json Post\"}"))) 409) -;; missing fields -> 400 -(host-bl-test "create missing fields -> 400" - (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "{\"slug\":\"x\"}"))) +(host-bl-test "json create no title -> 400" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "application/json" "{}"))) 400) - -;; update -> 200 and content changes (host-bl-test "update -> 200" - (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/hello" "Bearer good" - "{\"title\":\"Edited Title\",\"body\":\"Edited body.\"}"))) + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/json-post" "Bearer good" "application/json" + "{\"sx_content\":\"(p \\\"edited\\\")\"}"))) 200) -(host-bl-test "update changed the rendered post" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) "

    Edited Title

    ") +(host-bl-test "update changed content" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/json-post/"))) "edited") true) -(host-bl-test "update missing post -> 404" - (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/ghost" "Bearer good" - "{\"title\":\"T\",\"body\":\"B\"}"))) +(host-bl-test "update missing -> 404" + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/ghost" "Bearer good" "application/json" "{}"))) 404) -(host-bl-test "update no auth -> 401" - (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/hello" nil "{}"))) - 401) - -;; delete -> 200, then gone (404) and absent from list (host-bl-test "delete -> 200" - (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/hello" "Bearer good" ""))) + (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/json-post" "Bearer good" "" ""))) 200) -(host-bl-test "deleted post -> 404" - (dream-status (host-bl-wapp (host-bl-send "GET" "/hello/" nil ""))) - 404) -(host-bl-test "deleted post gone from list" - (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/posts" nil ""))) "hello") - false) +(host-bl-test "deleted -> 404" (dream-status (host-bl-wapp (host-bl-req "/json-post/"))) 404) (host-bl-test "delete missing -> 404" - (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/ghost" "Bearer good" ""))) + (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/ghost" "Bearer good" "" ""))) 404) (define host-bl-tests-run! - (fn - () + (fn () {:total (+ host-bl-pass host-bl-fail) - :passed host-bl-pass - :failed host-bl-fail - :fails host-bl-fails})) + :passed host-bl-pass :failed host-bl-fail :fails host-bl-fails})) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 17f1734b..993ba3c3 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -36,10 +36,15 @@ host — no `ocaml-on-sx` dependency. ## Status (rolling) -`bash lib/host/conformance.sh` → **158/158** (9 suites: handler, middleware, sxtp, -router, feed, relations, blog, server, ledger). Blog posts now persist in the -durable SX store (`persist/durable-backend`, on-disk under `$SX_PERSIST_DIR`), -materialised into an in-memory view at boot and served from there. +`bash lib/host/conformance.sh` → **171/171** (9 suites: handler, middleware, sxtp, +router, feed, relations, blog, server, ledger). **Blog now runs on the EDITOR's +content model** (`sx_content` = SX element markup, what `blog/sx/editor.sx` +emits), NOT content-on-sx CtDoc: a post is a `{slug,title,sx_content,status}` +record in the durable persist **KV**, and a post page is `render-to-html (parse +sx_content)`. Full CRUD + an editor form-ingest endpoint (`POST /new`, +form-urlencoded) + JSON API, writes auth+ACL guarded. **`render-to-html` is fast +(~0ms)** — it doesn't hit the JIT-miscompiled Smalltalk path, so blog rendering +is no longer the 2s problem (that was content-on-sx's `asHTML`). > **Per-request IO (kernel) — FIXED.** `http-listen` handlers used to run via > `Sx_runtime.sx_call` (bare CEK, no IO resolution), so a handler doing a durable From e201eef686904677505495b35bfcb67bec628c61 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 19:57:14 +0000 Subject: [PATCH 016/138] =?UTF-8?q?host:=20experimental=20unguarded=20crea?= =?UTF-8?q?te-only=20POST=20/new=20=E2=80=94=20editor=20publishes=20live,?= =?UTF-8?q?=20173/173?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit host/blog-open-create-routes mounts POST /new with error-trapping but NO auth (create-only; no PUT/DELETE), so the SX editor can publish to the host end-to-end on the experimental subdomain. VALIDATED LIVE: editor-style form-urlencoded POST -> 303 -> post renders at // and lists on /. Deliberate short-lived public write hole (create-only, obscure subdomain). MUST be gated before real use: Caddy basicauth on /new, or session auth. Swap host/blog-open-create-routes -> host/blog-write-routes to gate. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 8 ++++++++ lib/host/serve.sh | 5 ++++- lib/host/tests/blog.sx | 11 +++++++++++ plans/host-on-sx.md | 10 ++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 0b2498fb..c2efd087 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -199,3 +199,11 @@ (dream-post "/posts" (host/blog--protect resolve host/blog-create)) (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) + +;; EXPERIMENTAL: create-only, UNGUARDED — POST /new form ingest with error +;; trapping but NO auth, for validating the editor->host publish loop on the +;; experimental subdomain. Create-only by design (no PUT/DELETE), so the worst +;; case is junk posts, not overwrite/delete. GATE before any real use. +(define host/blog-open-create-routes + (list + (dream-post "/new" (host/pipeline (list host/wrap-errors) host/blog-form-submit)))) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 9ffc1d24..0d7d8680 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -103,5 +103,8 @@ EPOCH=1 # post detail (blog-routes LAST — the :slug catch-all must not shadow the rest). # Guarded write groups (auth/ACL or internal-HMAC) are added here once their # injected policy is supplied at wiring time. - echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes host/blog-routes))\")" + # EXPERIMENTAL: host/blog-open-create-routes mounts POST /new UNGUARDED (no + # auth) so the editor can publish end-to-end on the experimental subdomain. + # Create-only (no PUT/DELETE). GATE (Caddy basicauth / sessions) before real use. + echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes host/blog-open-create-routes host/blog-routes))\")" } | exec "$SX_SERVER" diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 65076017..bf36e9e1 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -124,6 +124,17 @@ (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/ghost" "Bearer good" "" ""))) 404) +;; -- experimental unguarded create-only route (POST /new, no auth) -- +(define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) +(host/blog-use-store! (persist/open)) +(host-bl-test "open create no auth -> 303" + (dream-status (host-bl-oapp (host-bl-send "POST" "/new" nil + "application/x-www-form-urlencoded" "title=Open+Post&sx_content=(p+%22o%22)&status=published"))) + 303) +(host-bl-test "open-created post renders" + (contains? (dream-resp-body (host-bl-oapp (host-bl-req "/open-post/"))) "

    o

    ") + true) + (define host-bl-tests-run! (fn () diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index 993ba3c3..afb2711b 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -319,6 +319,16 @@ symbols (`deps-check`, candidate pre-commit gate) → fail-loud runner (done) behavioural tests. A `deps-check`-style "binding shadows a special form" lint would catch the reserved-name class before runtime — a worthwhile follow-up. +## ⚠ Experimental: unguarded create live on blog.rose-ash.com + +`host/blog-open-create-routes` mounts **`POST /new` with NO auth** (create-only, +error-trapped) so the SX editor can publish end-to-end. **Validated live**: an +editor-style form POST → 303 → the post renders at `//` and lists on `/`. +This is a deliberate, short-lived public write hole (create-only — no PUT/DELETE +exposed; obscure subdomain). **MUST be gated before real use** — Caddy basicauth +on `/new` (the `/root/caddy/auth` dir exists) or session auth once identity lands. +Swap `host/blog-open-create-routes` → `host/blog-write-routes ` to gate. + ## Blockers - **Live wiring to the native OCaml HTTP server** (Phase 3/4): the prod server in From 8e817e974f5bc6cda2dd2a2897320d3006890025 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:04:24 +0000 Subject: [PATCH 017/138] =?UTF-8?q?host:=20scope=20Phase=205=20=E2=80=94?= =?UTF-8?q?=20generic=20interactive=20SX-page=20serving=20(host=20SSR)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frame the editor as one instance of a general gap: the host serves JSON + static content but cannot serve interactive SX component/island pages. Scope the generic capability — reuse the kernel's existing shell pipeline (~shared:shell/ sx-page-shell + http_inject_shell_statics + http_render_page) rather than reinvent — in 5 gated sub-steps: page-render from a handler, shell statics, static-asset serving, island hydration, editor POC. Documents why render-to-html alone fails (mangles evaluated-component attributes) and that component SSR is slow until the JIT loop lands. Modern editor = SX reactive island (defisland + signals) over a content-on-sx model; replace the legacy Lexical/Koenig editor, don't resurrect it (the POST /new ingest already speaks sx_content). Co-Authored-By: Claude Opus 4.8 --- plans/host-on-sx.md | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index afb2711b..003d3a3c 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -192,6 +192,67 @@ lib/host/sxtp.sx subsystem APIs (feed/search/commerce/… - [ ] (gated) adopt `dream-on-sx` session/CSRF ergonomics; re-home external adapters as native where replacements land. +## Phase 5 — Generic interactive SX-page serving (host SSR) + +**The generic gap.** A host serves three classes: (1) JSON/data endpoints — +DONE; (2) static content pages — DONE (`render-to-html` on *parsed* markup, e.g. +blog post `sx_content`); (3) **interactive UI pages** — component/island trees +with attributes + client behaviour — **the host cannot do this at all.** The +"editor problem" is one instance; dashboards, account, market-browse, any admin +screen are the same gap. The capability — not the editor — is the deliverable. + +**Why `render-to-html` alone is insufficient (proven).** `render-to-html` on +parsed markup handles attributes (`
    `); but an *evaluated* component +tree mangles them (`(form :id ..)` → `
    idpost-new-form…`) because in the +host preload tags don't collect keyword args as attrs. The `--http` docs server +already does this correctly via its component-render + shell pipeline. So: reuse +that pipeline, don't reinvent or patch per-component. + +**Reuse, don't rebuild.** The kernel already has: `~shared:shell/sx-page-shell` +(emits `` + inlined component/island defs in `" + "" + "" + "")))) ;; ── write handlers ────────────────────────────────────────────────── ;; POST /new — form-urlencoded ingest (the editor's submit shape: title, From b4974db25ff4d198a691981d0f37f757b73c1229 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:24:37 +0000 Subject: [PATCH 020/138] =?UTF-8?q?host:=20style=20the=20/new=20editor=20?= =?UTF-8?q?=E2=80=94=20inline=20sx-editor=20styles=20via=20render-page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The editor was unstyled: editor.css is .koenig-lexical-scoped (the OTHER editor); the sx-editor's .sx-* styles live in the ~editor/sx-editor-styles component (inline " diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index c5ab4f1b..90578404 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -63,6 +63,8 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" + "blog/sx/layouts.sx" + "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 0d7d8680..3191725f 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -68,6 +68,8 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" + "blog/sx/layouts.sx" + "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" From 3369166a037d3548b211399078f7c0f5362c2429 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:35:57 +0000 Subject: [PATCH 021/138] =?UTF-8?q?host:=20per-block=20guarded=20render=20?= =?UTF-8?q?=E2=80=94=20editor=20posts=20never=20502,=20real=20prose=20show?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A post created with the editor stored sx_content containing components the host can't resolve: the legacy editor emits bare ~kg-md while the cards are ~kg_cards/kg-md (drift — not papered over with aliases). render-to-html threw on the undefined symbol and host/blog-render had no error handling -> handler crash -> 502 on a REAL post (/mddddd/). Fix: render each block of the (<> ...) fragment under its own guard via render-page (env-supplied). Real prose (p/h1/ul/...) renders; an unsupported or malformed block degrades to a
    placeholder; a bad block never crashes the handler. Verified live: /mddddd/ + all junk posts now 200 (text shown, cards placeheld). Full kg-card rendering = follow-on (resolve the name drift / native editor). Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index e0ecf755..6f4f3f7a 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -59,12 +59,30 @@ (host/blog-slugs)))) ;; ── render ────────────────────────────────────────────────────────── -;; A post's sx_content is SX element markup -> HTML via the component renderer. +;; A post's sx_content is SX element markup -> HTML via render-page (which supplies +;; the server env so components resolve + keyword attrs are kept). +;; +;; Rendered PER BLOCK and guarded: the editor wraps content in a (<> ...) fragment +;; of blocks, some of which the host can't render (the legacy editor emits bare +;; ~kg-md cards while the components are ~kg_cards/kg-md — drift we don't paper over +;; with aliases). Rendering each block under its own guard means the real prose +;; (p/h1/ul/...) shows and only the unsupported block degrades to a placeholder — +;; and a bad block never crashes the handler (-> 502). +(define host/blog--render-node + (fn (node) + (guard (e (true "
    (unsupported block)
    ")) + (render-page node)))) (define host/blog-render (fn (record) (let ((sx (get record :sx-content))) (if (and sx (not (= sx ""))) - (render-to-html (parse sx)) + (let ((tree (guard (e (true nil)) (parse sx)))) + (cond + ((nil? tree) "

    (unparseable content)

    ") + ((and (= (type-of tree) "list") (> (len tree) 0) + (= (str (first tree)) "<>")) + (join "" (map host/blog--render-node (rest tree)))) + (else (host/blog--render-node tree)))) (str "

    (empty post)

    "))))) (define host/blog--page (fn (title body) From 962cb1b43e26693611783aa48a9485a97a024e0d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:47:17 +0000 Subject: [PATCH 022/138] =?UTF-8?q?host:=20revert=20legacy-editor=20shims?= =?UTF-8?q?=20=E2=80=94=20clean=20over=20fancy,=20181/181?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull out the debt that revived the legacy editor: removed kg-compat.sx (uncommitted bare->namespaced kg-card aliases), the ./blog container mount, the legacy sx-editor.js + hardcoded asset URLs + ~editor/sx-editor-styles reuse at /new, and the blog/sx preloads. /new is now a clean minimal form. Finding that reshapes Phase 5: render-page (5.1) renders STATIC component trees but is NOT the full evaluator — a component with a data loop ((map fn items) over (unquote data)) errors 'Not callable: nil'. So clean dynamic component pages + a native island editor need the aser SSR pipeline (5.2), not just render-page. Posts still render via per-block guarded render-page; unsupported editor cards (~kg-md) show placeholders by design (no alias shim). All endpoints 200, boot clean. Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 3 -- lib/host/blog.sx | 50 +++++++++++----------------------- lib/host/conformance.sh | 2 -- lib/host/serve.sh | 2 -- plans/host-on-sx.md | 18 ++++++++++-- 5 files changed, 31 insertions(+), 44 deletions(-) diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 185751d7..3621980d 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -28,9 +28,6 @@ services: - ./spec:/app/spec:ro - ./lib:/app/lib:ro - ./web:/app/web:ro - # blog app SX — reused for the editor's style component (transitional; - # retire when the editor + its styles are host-owned / asset-managed) - - ./blog:/app/blog:ro # OCaml server binary — this worktree's build (has the SX_HTTP_HOST bind fix) - ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro # Durable persist store (the SX op-log/kv on disk) — survives restarts. diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 6f4f3f7a..53e610c5 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -116,43 +116,25 @@ (define host/blog-index (fn (req) (host/ok (host/blog-list)))) -;; ── create page (GET /new) — the real WYSIWYG block editor ────────── -;; Mounts the self-contained sx-editor.js (Ghost/Koenig-style block editor) that -;; serializes the visual edit to `sx_content`. Assets (sx-browser.js for Sx.parse, -;; sx-editor.js, editor.css) are referenced from the docs static host -;; (sx.rose-ash.com/static/scripts) — no host static-serving needed. On submit the -;; handle's getSx() fills the hidden sx_content field, then it POSTs to /new. -;; (This reuses the legacy JS editor; a native SX-island editor is the future.) -(define host/blog--asset "https://sx.rose-ash.com/static/scripts") +;; ── create page (GET /new) — clean minimal form ──────────────────── +;; A plain create form: title + sx_content (SX element markup) + status. No +;; legacy JS editor, no external assets, no shims. The rich WYSIWYG is a future +;; native SX-island editor served via the Phase-5.2 SSR pipeline (render-page +;; alone can't render dynamic-logic component bodies — proven). Posts to /new. (define host/blog-new-form (fn (req) (dream-html - (str - "New post" - ;; FontAwesome for the editor's +/slash-menu icons. - "" - ;; The sx-editor's own styles (.sx-*), rendered from its component via 5.1. - (render-page (quote (~editor/sx-editor-styles))) - "" - "" - "" - "" - "" - "
    " - "
    " - "" - "" - "all posts
    " - "" - "" - "" - "" - "")))) + (host/blog--page "New post" + (str + "

    New post

    " + "
    " + "

    " + "

    " + "

    " + "

    " + "

    ← all posts

    "))))) ;; ── write handlers ────────────────────────────────────────────────── ;; POST /new — form-urlencoded ingest (the editor's submit shape: title, diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 90578404..c5ab4f1b 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -63,8 +63,6 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" - "blog/sx/layouts.sx" - "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 3191725f..0d7d8680 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -68,8 +68,6 @@ MODULES=( "lib/persist/durable.sx" "spec/render.sx" "web/adapter-html.sx" - "blog/sx/layouts.sx" - "blog/sx/editor.sx" "lib/dream/types.sx" "lib/dream/json.sx" "lib/dream/auth.sx" diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index c8ba5df7..cabe03c8 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -228,9 +228,21 @@ Sub-steps (each independently gated/verified): mangling). Root cause confirmed: bare render-to-html on an *evaluated* tree mangles attrs; `render-page` renders the *unevaluated* expr so expansion + attr-collection happen in render-to-html. -- [ ] **5.2 Shell statics in the host env.** Run `http_inject_shell_statics` for - the host's loaded components so the shell can inline defs/CSS/asset-hashes. - Gate: a full page shell emits with component defs inlined. +- [ ] **5.2 Shell statics + aser SSR (the real dynamic-page path).** `render-page` + (5.1) renders STATIC component trees, but is NOT the full evaluator — + dynamic-logic bodies fail (proven: a component doing `(map fn items)` over + `(unquote data)` → "Not callable: nil"). Clean dynamic component pages + (a posts loop) + island pages therefore need the **aser** pipeline (evaluate + control flow, serialise tags) + `http_inject_shell_statics` (component defs / + CSS / asset hashes) + `~shared:shell/sx-page-shell`. Gate: a page with a data + loop renders, and a full shell emits with defs inlined. + NOTE (2026-06-19): the legacy-editor stopgaps (kg-compat aliases, `./blog` + mount, legacy `sx-editor.js` + hardcoded asset URLs at `/new`, the + `~editor/sx-editor-styles` reuse) were REVERTED — they were debt to revive + stale code. `/new` is now a clean minimal form; host pages still use minimal + shell HTML until the aser path lands. Posts render via per-block guarded + `render-page`; unsupported editor cards (e.g. `~kg-md`) show placeholders by + design (no alias shim). - [ ] **5.3 Static-asset serving.** Serve `/scripts/*.js`, `/*.css`, `/wasm/*` from `shared/static`. Host has none today — needs a kernel file-serving route in the `http-listen` server (or a file-read prim + SX static handler). From c16924a991cdaabdcdad4e490238192c0e291146 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 20:56:05 +0000 Subject: [PATCH 023/138] host: blog pages as SX trees + render-page (no embedded HTML) The handler runs the dynamic logic in the full evaluator and builds a static SX element tree via quasiquote; render-page (5.1) renders it. No aser pipeline needed for server-rendered pages. host/blog--page is now an (html (head..)(body..)) tree; home builds the posts
      via map+quasiquote; the post body is rendered per-block then injected with (raw! ...); /new is an SX form tree. Only the doctype prefix remains as a string (render-to-html doesn't emit it). 181/181. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 79 +++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 53e610c5..a6ac57d9 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -84,57 +84,80 @@ (join "" (map host/blog--render-node (rest tree)))) (else (host/blog--render-node tree)))) (str "

      (empty post)

      "))))) +;; ── page shell ────────────────────────────────────────────────────── +;; A page is an SX element tree, rendered via render-page (5.1). The handler +;; builds the tree (running any dynamic logic in the full evaluator, e.g. a posts +;; loop) and render-page renders the static result — no embedded HTML strings, +;; only the doctype prefix render-to-html doesn't emit. `body` is an SX node. (define host/blog--page (fn (title body) - (str "" title "" body))) + (str "" + (render-page + (quasiquote + (html + (head (meta :charset "utf-8") (title (unquote title))) + (body (unquote body)))))))) ;; ── read handlers ─────────────────────────────────────────────────── +;; Post body is rendered per-block (a guarded HTML string) then injected raw. (define host/blog-post (fn (req) (let ((slug (dream-param req "slug"))) (let ((r (host/blog-get slug))) (if r (dream-html - (host/blog--page (get r :title) (host/blog-render r))) + (host/blog--page (get r :title) + (quasiquote (article (raw! (unquote (host/blog-render r))))))) (dream-html-status 404 (host/blog--page "Not found" - (str "

      404

      No published post: " slug "

      ")))))))) + (quasiquote + (div (h1 "404") + (p (unquote (str "No published post: " slug)))))))))))) -(define host/blog--li - (fn (acc p) - (str acc "
    • " (get p :title) "
    • "))) (define host/blog-home (fn (req) (let ((posts (host/blog-list))) - (dream-html - (host/blog--page "Blog" - (str "

      Posts

      " - (if (> (len posts) 0) - (str "
        " (reduce host/blog--li "" posts) "
      ") - "

      No posts yet.

      ") - "

      + New post

      ")))))) + (let ((items + (map + (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + posts))) + (let ((listing (if (> (len posts) 0) + (list (quote ul) items) + (quote (p "No posts yet."))))) + (dream-html + (host/blog--page "Blog" + (quasiquote + (div (h1 "Posts") + (unquote listing) + (p (a :href "/new" "+ New post"))))))))))) (define host/blog-index (fn (req) (host/ok (host/blog-list)))) -;; ── create page (GET /new) — clean minimal form ──────────────────── -;; A plain create form: title + sx_content (SX element markup) + status. No -;; legacy JS editor, no external assets, no shims. The rich WYSIWYG is a future -;; native SX-island editor served via the Phase-5.2 SSR pipeline (render-page -;; alone can't render dynamic-logic component bodies — proven). Posts to /new. +;; ── create page (GET /new) — clean minimal form as an SX tree ─────── +;; No legacy JS editor, no external assets, no shims. The rich WYSIWYG is a +;; future native SX-island editor (Phase 5.2+). Posts to /new. (define host/blog-new-form (fn (req) (dream-html (host/blog--page "New post" - (str - "

      New post

      " - "
      " - "

      " - "

      " - "

      " - "

      " - "

      ← all posts

      "))))) + (quasiquote + (div + (h1 "New post") + (form :method "post" :action "/new" + (p (input :name "title" :placeholder "Title" + :style "font-size:1.4em;width:100%")) + (p (textarea :name "sx_content" :rows "12" + :style "width:100%;font-family:monospace" + :placeholder "(p \"Your post as SX markup\")")) + (p (select :name "status" + (option :value "draft" "Draft") + (option :value "published" "Published")) + " " + (button :type "submit" "Publish"))) + (p (a :href "/" "all posts")))))))) ;; ── write handlers ────────────────────────────────────────────────── ;; POST /new — form-urlencoded ingest (the editor's submit shape: title, From 2713636e367eabc03b22f4c8b8ba815367f0bbd5 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 19 Jun 2026 21:04:21 +0000 Subject: [PATCH 024/138] host: hand off the native SX-island editor (browser-capable session) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The editor is the interactivity layer — it belongs on the --http island pipeline (SSRs + hydrates islands), not the http-listen host, and needs browser/Playwright iteration which this worktree lacks. plans/blog-editor-island.md is the handoff: goal, architecture (docs-side island -> host /new), the live host contract (form-urlencoded title/sx_content/status -> 303), the sx_content markup to emit (standard tags, NOT legacy ~kg-* cards), island authoring gotchas, and pointers. Host side is ready (ingest proven; CORS on request). Phase 5.5 marked handed off. Co-Authored-By: Claude Opus 4.8 --- plans/blog-editor-island.md | 75 +++++++++++++++++++++++++++++++++++++ plans/host-on-sx.md | 12 ++++-- 2 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 plans/blog-editor-island.md diff --git a/plans/blog-editor-island.md b/plans/blog-editor-island.md new file mode 100644 index 00000000..b26fd2cf --- /dev/null +++ b/plans/blog-editor-island.md @@ -0,0 +1,75 @@ +# Handoff: native SX-island blog editor + +> Handed off from the **host-on-sx** loop (2026-06-19). Build this in a +> **browser-capable session** (Playwright installed) — a reactive island only +> proves out when it hydrates in a browser; this worktree has no Playwright. + +## Goal + +A native **SX reactive island** WYSIWYG block editor for blog posts — replacing +the legacy `shared/static/scripts/sx-editor.js` (Koenig-era JS, ~2500 lines). +It edits blocks reactively and, on publish, emits **`sx_content`** (SX element +markup) + a title + status, and submits to the host's create endpoint. + +## Architecture (decided this session) + +- The editor is the **interactivity layer**, so it lives on the **`--http` + island pipeline** (`sx.rose-ash.com`, which already SSRs + hydrates islands), + **NOT** in the `http-listen` host (the host deliberately doesn't do island + hydration — see `plans/host-on-sx.md` Phase 5). +- It **publishes to the host**: the host serves `blog.rose-ash.com` and owns the + durable store + create/render. The editor is a docs-side island that talks to + the host's API. Two cooperating SX servers: host = content/API/state, `--http` + = interactive UI. + +## The host contract (already live + proven) + +`POST /new` on the host (`blog.rose-ash.com`) — **works today**: +- Body: **form-urlencoded** `title`, `sx_content`, `status` (`draft`/`published`). +- Behaviour: slug derived from title, post stored in the durable KV, **303 + redirect** to `//`. +- `host/blog-form-submit` in `lib/host/blog.sx`; route `host/blog-open-create-routes` + (currently UNGUARDED experimental — gate before real use). +- A **form POST** (303 redirect) needs **no CORS**. If the editor uses `fetch` + instead, the host needs CORS on `/new` — the host loop can add `dream-cors-with` + (`lib/dream/cors.sx`) in minutes; just ask. + +## `sx_content` format — what to emit + +SX **element markup**, rendered host-side by `render-page` → `render-to-html`, +**per block, guarded** (`host/blog-render` in `lib/host/blog.sx`). So: +- Top level is a fragment: `(<> (h2 "Title") (p "para " (strong "bold")) (ul (li "a") (li "b")))`. +- **Use standard tags `render-to-html` knows**: `p h1..h6 ul ol li blockquote + code pre strong em a img figure hr br span div`. These render cleanly + fast. +- **AVOID the legacy `~kg-*` card components** — they show as `(unsupported + block)` placeholders (the legacy editor emits bare `~kg-md` but the components + are `~kg_cards/kg-md` — name drift we deliberately did NOT alias). If cards are + wanted, define **canonical** card components the host loads (no bare-name shim). +- A bad/unknown block degrades to a placeholder, never crashes the page — but + aim to emit only renderable markup. + +## Build notes + +- It's a `defisland` served as a `defpage` on `--http`. Example island: + `sx/sx/home/stepper.sx`. Reactive primitives: `signal`/`deref`/`computed`/ + `effect` (see the signals spec). +- **SX island authoring gotchas** (CLAUDE.md "SX Island Authoring Rules"): + multi-expr bodies need `(do …)`; `let` is parallel (nest for sequencing); + reactive text needs `(deref (computed …))`; effects go in an inner `let`. +- A reasonable MVP: title input (signal) + an ordered list of block signals + (type + text), add/remove/reorder, a few block types (paragraph, heading, + list, quote, code), a **live preview** (computed → rendered), and a Publish + that serialises blocks → `sx_content` and form-POSTs to the host's `/new`. +- **Test with `sx_playwright`** (inspect / hydrate / interact / trace-boot) — + hydrate the island, simulate typing, assert the serialized `sx_content` and + the live preview. Don't ship an island you haven't hydrated in a browser. + +## Pointers + +- Host ingest + render + page shell: `lib/host/blog.sx` (the `/new` POST is the + target; `host/blog-render` shows exactly which markup renders). +- `render-page` (host's component renderer) + the static-page pattern: + `lib/host/page.sx`, `plans/host-on-sx.md` Phase 5. +- Island example: `sx/sx/home/stepper.sx`. HTML renderer (tags it knows): + `web/adapter-html.sx`. Legacy editor (reference only, being replaced): + `shared/static/scripts/sx-editor.js`. diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index cabe03c8..d21e8f58 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -251,10 +251,14 @@ Sub-steps (each independently gated/verified): - [ ] **5.4 Island hydration.** Confirm a trivial island page boots + hydrates client-side (sx-browser.js) when served by the host. Gate: a counter island increments in the browser. -- [ ] **5.5 Editor POC.** Serve an editor page as the FIRST interactive consumer, - its form/island posting to the existing `POST /new` ingest (already proven). - Gate: visual edit → publish → renders, end-to-end in a browser. (The POC - validates the *capability*; the editor itself is replaced next — see below.) +- [~] **5.5 Editor POC — HANDED OFF.** The native SX-island editor is the + interactivity layer; per the architecture it lives on the `--http` island + pipeline (not the host) and needs browser/Playwright iteration (absent in + this worktree). Handoff brief: `plans/blog-editor-island.md`. The host side + is READY: `POST /new` ingest is live + proven (form-urlencoded + title/sx_content/status → 303); CORS can be added on request if the editor + uses fetch. Decision: don't port island hydration into the host; the editor + is a docs-side island that publishes to the host. **Note:** component SSR is interpreted → slow until the `sx-vm-extensions` JIT loop lands; correctness first, speed follows. Scope spans `hosts/` (page-render From 3b8e1dfe2e0e82b52f512b5e270989340ae44f98 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 21:51:41 +0000 Subject: [PATCH 025/138] host: live writes via signed sessions + kernel multi-Set-Cookie (193/193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unblock the guarded blog write routes for browsers: a login form sets a signed session cookie that the same routes accept (alongside Bearer), so publishing works end-to-end on blog.rose-ash.com without Quart. - kernel: http-listen emit serialises a response :set-cookies LIST as one Set-Cookie header each (a headers dict can't hold more than one). Purely additive — responses without :set-cookies are unchanged. - server.sx: host/-dream->native forwards :set-cookies to the native resp. - lib/host/session.sx: durable, signed sessions on the persist KV (session/create|exists|get|set|clear), wired via dream-sessions-signed. - lib/host/auth.sx: GET/POST /login + POST /logout; host/require-user accepts a session principal OR a Bearer token. - router.sx: host/make-app wraps the whole app in the session middleware and auto-mounts /login + /logout — the front door always has sessions. - blog.sx: write routes use host/require-user; serve.sh flips POST /new from the experimental UNGUARDED route to the guarded write routes, with admin creds + signing secret + ACL grant from the container env. - session conformance suite (12): login->cookie->guarded write 201; no cookie/forged/logged-out -> 401; Bearer fallback still works. Verified live on blog.rose-ash.com: 401 unauthenticated, 303 login, 303 publish, anonymous read renders, post persists across container recreate. Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 7 ++ hosts/ocaml/bin/sx_server.ml | 12 ++++ lib/host/auth.sx | 96 +++++++++++++++++++++++++++ lib/host/blog.sx | 2 +- lib/host/conformance.sh | 4 ++ lib/host/router.sx | 16 +++-- lib/host/serve.sh | 42 +++++++++--- lib/host/server.sx | 6 +- lib/host/session.sx | 70 ++++++++++++++++++++ lib/host/tests/session.sx | 117 +++++++++++++++++++++++++++++++++ 10 files changed, 357 insertions(+), 15 deletions(-) create mode 100644 lib/host/auth.sx create mode 100644 lib/host/session.sx create mode 100644 lib/host/tests/session.sx diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 3621980d..63536980 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -22,6 +22,13 @@ services: SX_HTTP_HOST: "0.0.0.0" # Durable persist store root — on a named volume so data survives restarts. SX_PERSIST_DIR: /data/persist + # Blog write auth: admin login + session-cookie signing secret. The blog + # write routes (POST /new, POST/PUT/DELETE /posts) are guarded by a session + # login or Bearer token, so these gate publishing. Not a real site — these + # are demo creds; rotate by editing here and recreating the container. + SX_ADMIN_USER: admin + SX_ADMIN_PASSWORD: "sx-host-camper-van-2026" + SX_SESSION_SECRET: "ra-host-sess-7c1f9b3e2a8d4056" OCAMLRUNPARAM: "b" volumes: # SX source (hot-reload on container restart) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index b4c00115..3cae0201 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -850,6 +850,18 @@ let setup_evaluator_bridge env = List.iter (fun (k, v) -> Buffer.add_string buf (Printf.sprintf "%s: %s\r\n" k v)) rhdrs; + (* Cookies: a response carries :set-cookies as a LIST of pre-formatted + cookie strings (Dream's dream-set-cookie), because a headers Dict + cannot hold more than one Set-Cookie. Emit one header per item. *) + (match getk "set-cookies" with + | Some (List items) -> + List.iter (fun v -> + match v with + | String s -> + Buffer.add_string buf + (Printf.sprintf "Set-Cookie: %s\r\n" s) + | _ -> ()) items + | _ -> ()); if not (List.exists (fun (k, _) -> String.lowercase_ascii k = "content-type") diff --git a/lib/host/auth.sx b/lib/host/auth.sx new file mode 100644 index 00000000..95fe9afc --- /dev/null +++ b/lib/host/auth.sx @@ -0,0 +1,96 @@ +;; lib/host/auth.sx — browser login on top of host sessions (lib/host/session.sx). +;; A login form posts credentials; on success the principal is written to the +;; session cookie. The guarded write routes then accept EITHER a logged-in session +;; OR a Bearer token (host/require-user), so the same routes serve browsers and API +;; clients. Single admin user; credentials come from $SX_ADMIN_USER / _PASSWORD +;; (set in serve.sh) — the in-source defaults are dev-only. +;; +;; Depends on lib/host/session.sx, lib/host/{handler,middleware}.sx, lib/dream/* +;; (form/types/session) + the kernel render-page primitive. + +;; ── page shell (own copy; render-page renders the static SX tree) ─── +(define host/-auth-page + (fn (title body) + (str "" + (render-page + (quasiquote + (html + (head (meta :charset "utf-8") (title (unquote title))) + (body (unquote body)))))))) + +;; ── admin credential (override from env in serve.sh) ──────────────── +(define host/admin-user "admin") +(define host/admin-password "letmein") +(define host/auth-set-admin! + (fn (u p) (begin (set! host/admin-user u) (set! host/admin-password p)))) +(define host/-verify-cred + (fn (user pass) + (and (not (= pass "")) + (= user host/admin-user) + (= pass host/admin-password)))) + +;; ── GET /login — minimal SX login form ────────────────────────────── +(define host/login-page + (fn (req) + (dream-html + (host/-auth-page "Log in" + (quasiquote + (div + (h1 "Log in") + (form :method "post" :action "/login" + (p (input :name "username" :placeholder "username")) + (p (input :name "password" :type "password" :placeholder "password")) + (p (button :type "submit" "Log in"))))))))) + +;; ── POST /login — verify, write session principal, redirect home ──── +;; The session middleware (host/sessions) has already created/loaded the session +;; and will set the cookie on this response, so writing :principal here lands on +;; the right sid and the browser keeps the cookie. +(define host/login-submit + (fn (req) + (let ((user (dream-form-field req "username")) + (pass (dream-form-field req "password"))) + (if (host/-verify-cred user pass) + (begin + (host/login! req user) + (dream-redirect "/")) + (dream-html-status 401 + (host/-auth-page "Log in" + (quasiquote + (div (h1 "Log in") + (p "Invalid credentials.") + (p (a :href "/login" "Try again.")))))))))) + +;; ── POST /logout — clear the session, redirect home ───────────────── +(define host/logout-submit + (fn (req) + (begin + (host/logout! req) + (dream-redirect "/")))) + +;; ── login routes (mounted by host/make-app) ───────────────────────── +(define host/auth-routes + (list + (dream-get "/login" host/login-page) + (dream-post "/login" host/login-submit) + (dream-post "/logout" host/logout-submit))) + +;; ── auth middleware: session principal OR bearer token ────────────── +;; Place AFTER the session middleware (so host/current-principal can read the +;; session) and BEFORE host/require-permission. resolve : token -> principal | nil +;; is the bearer fallback for API clients; a logged-in browser needs no token. +(define host/require-user + (fn (resolve) + (fn (next) + (fn (req) + (let ((sp (host/current-principal req))) + (let ((principal + (if (and sp (not (= sp ""))) + sp + (let ((tok (dream-bearer-token req))) + (if tok (resolve tok) nil))))) + (if (or (nil? principal) (= principal "")) + (dream-add-header + (host/error 401 "unauthorized") + "www-authenticate" "Bearer") + (next (assoc req :dream-principal principal))))))))) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index a6ac57d9..1322a8c1 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -234,7 +234,7 @@ (host/pipeline (list host/wrap-errors - (host/require-auth resolve) + (host/require-user resolve) (host/require-permission "edit" (fn (req) "blog"))) h))) (define host/blog-write-routes diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index c5ab4f1b..0a4ad863 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -68,9 +68,12 @@ MODULES=( "lib/dream/auth.sx" "lib/dream/error.sx" "lib/dream/form.sx" + "lib/dream/session.sx" "lib/dream/router.sx" "lib/host/handler.sx" "lib/host/middleware.sx" + "lib/host/session.sx" + "lib/host/auth.sx" "lib/host/sxtp.sx" "lib/host/router.sx" "lib/host/feed.sx" @@ -90,6 +93,7 @@ SUITES=( "feed host-fd-tests-run! lib/host/tests/feed.sx" "relations host-rl-tests-run! lib/host/tests/relations.sx" "blog host-bl-tests-run! lib/host/tests/blog.sx" + "session host-se-tests-run! lib/host/tests/session.sx" "page host-pg-tests-run! lib/host/tests/page.sx" "server host-sv-tests-run! lib/host/tests/server.sx" "ledger host-lg-tests-run! lib/host/tests/ledger.sx" diff --git a/lib/host/router.sx b/lib/host/router.sx index 400b3df7..678ae9fb 100644 --- a/lib/host/router.sx +++ b/lib/host/router.sx @@ -4,16 +4,22 @@ ;; request -> response. Each subsystem contributes a list of Dream routes (see ;; lib/host/feed.sx); host/make-app concatenates them under one router. ;; dr/flatten-routes (Dream) flattens the nested groups, so a group is just a list -;; of routes. Depends on lib/dream/router.sx + lib/host/handler.sx. +;; of routes. Depends on lib/dream/router.sx + lib/host/handler.sx + the host +;; session middleware (lib/host/session.sx) and login routes (lib/host/auth.sx). ;; Liveness probe — GET /health -> 200 {"ok":true,"data":"healthy"}. (define host/health-route (dream-get "/health" (fn (req) (host/ok "healthy")))) ;; Build the host app from a list of route groups (each a list of Dream routes). -;; The health route is always mounted first; Dream's router returns a JSON-free -;; 404 for unmatched paths, which host endpoints override per-domain as needed. +;; The health route + login routes are always mounted; Dream's router returns a +;; JSON 404 for unmatched paths, which host endpoints override per-domain as +;; needed. The WHOLE app is wrapped in the signed-session middleware so every +;; request carries a session and any handler can log a principal in/out — this is +;; the front door, so sessions are not optional. (define host/make-app (fn (groups) - (dream-router - (cons host/health-route groups)))) + (let ((router (dream-router + (cons host/health-route + (cons host/auth-routes groups))))) + ((host/sessions) router)))) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 0d7d8680..c31c2dc4 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -73,9 +73,12 @@ MODULES=( "lib/dream/auth.sx" "lib/dream/error.sx" "lib/dream/form.sx" + "lib/dream/session.sx" "lib/dream/router.sx" "lib/host/handler.sx" "lib/host/middleware.sx" + "lib/host/session.sx" + "lib/host/auth.sx" "lib/host/sxtp.sx" "lib/host/router.sx" "lib/host/feed.sx" @@ -84,6 +87,13 @@ MODULES=( "lib/host/server.sx" ) +# Admin login credentials + session signing secret. Override via the container +# env; the in-source defaults are dev-only. The blog write routes are now GUARDED +# (session login or Bearer), so these gate publishing on blog.rose-ash.com. +ADMIN_USER="${SX_ADMIN_USER:-admin}" +ADMIN_PASS="${SX_ADMIN_PASSWORD:-letmein}" +SESSION_SECRET="${SX_SESSION_SECRET:-rose-ash-host-dev-secret-change-me}" + EPOCH=1 { for M in "${MODULES[@]}"; do @@ -95,16 +105,32 @@ EPOCH=1 echo "(epoch $EPOCH)" echo "(eval \"(host/blog-use-store! (persist/durable-backend))\")" EPOCH=$((EPOCH+1)) + # Session signing secret + admin login credentials, then grant the admin + # principal "edit" on "blog" so a logged-in session passes the ACL gate on the + # write routes. Sessions stay IN-MEMORY (default store) — logins reset on + # restart but the durable KV isn't spammed by anonymous/ crawler sessions + # (lazy session creation is a future lib/dream/session.sx improvement). + echo "(epoch $EPOCH)" + echo "(eval \"(host/session-set-secret! \\\"$SESSION_SECRET\\\")\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + echo "(eval \"(host/auth-set-admin! \\\"$ADMIN_USER\\\" \\\"$ADMIN_PASS\\\")\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + echo "(eval \"(acl/load! (list (acl-grant \\\"$ADMIN_USER\\\" \\\"edit\\\" \\\"blog\\\")))\")" + EPOCH=$((EPOCH+1)) + # Idempotently seed a welcome post (sx_content = SX element markup, the editor's + # content model). Re-seeding is a no-op if the slug already exists. echo "(epoch $EPOCH)" echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"(article (h1 \\\\\\\"Welcome to the SX host\\\\\\\") (p \\\\\\\"Rendered by lib/host via render-to-html, from the durable SX store.\\\\\\\"))\\\" \\\"published\\\")\")" EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" - # Anonymous read endpoints: feed timeline + relations container reads + blog - # post detail (blog-routes LAST — the :slug catch-all must not shadow the rest). - # Guarded write groups (auth/ACL or internal-HMAC) are added here once their - # injected policy is supplied at wiring time. - # EXPERIMENTAL: host/blog-open-create-routes mounts POST /new UNGUARDED (no - # auth) so the editor can publish end-to-end on the experimental subdomain. - # Create-only (no PUT/DELETE). GATE (Caddy basicauth / sessions) before real use. - echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes host/blog-open-create-routes host/blog-routes))\")" + # Anonymous reads (feed timeline + relations container reads + blog post detail) + # plus the GUARDED blog write routes: POST /new (editor form ingest), POST/PUT/ + # DELETE /posts behind host/require-user (session login OR Bearer) + ACL. make-app + # auto-mounts /login + /logout and wraps everything in the signed-session + # middleware, so a browser logs in then publishes. The bearer resolver is a stub + # (no API tokens configured) — browser session is the live auth path for now. + # blog-routes LAST — its GET /:slug catch-all must not shadow the rest. + echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes (host/blog-write-routes (fn (tok) nil)) host/blog-routes))\")" } | exec "$SX_SERVER" diff --git a/lib/host/server.sx b/lib/host/server.sx index 77850f18..b9f0ff07 100644 --- a/lib/host/server.sx +++ b/lib/host/server.sx @@ -23,11 +23,15 @@ ;; ── dream response -> native response ─────────────────────────────── ;; dream-response is already {:body :headers :status}; the native server wants ;; {:status :headers :body}. Same keys — normalise the shape explicitly so the -;; contract is visible (and headers/body never nil). +;; contract is visible (and headers/body never nil). :set-cookies is a LIST of +;; pre-formatted cookie strings (Dream's dream-set-cookie); the kernel http-listen +;; emit serialises one Set-Cookie header per item (a headers dict can't hold more +;; than one). Carry it through so sessions/login can set the cookie. (define host/-dream->native (fn (resp) {:status (dream-status resp) :headers (or (dream-headers resp) {}) + :set-cookies (dream-resp-cookies resp) :body (or (dream-resp-body resp) "")})) ;; ── adapter + serve ───────────────────────────────────────────────── diff --git a/lib/host/session.sx b/lib/host/session.sx new file mode 100644 index 00000000..5004617c --- /dev/null +++ b/lib/host/session.sx @@ -0,0 +1,70 @@ +;; lib/host/session.sx — durable, signed sessions for the host. +;; Backs Dream's session middleware ops (session/create|exists|get|set|clear) +;; with the SAME durable persist KV the blog uses, so a login survives restarts. +;; The session cookie carries only a signed sid (dream-sessions-signed): the sid +;; itself is a persisted monotonic counter ("s1", "s2", …) — cheap and ordered — +;; and the HMAC signature (dr/sess-hash, keyed by host/session-secret) makes a +;; guessed or forged cookie unusable. http-listen serialises handler calls under a +;; mutex, so the counter increment is race-free. +;; +;; Depends on lib/dream/session.sx (dream-sessions-signed + cookie helpers) and +;; lib/persist/* (the KV backend). Wired into host/make-app via host/sessions. + +;; ── store (durable persist KV, injectable; mirrors host/blog-store) ── +(define host/session-store (persist/open)) +(define host/session-use-store! (fn (b) (set! host/session-store b))) + +;; ── signing secret (override from $SX_SESSION_SECRET in serve.sh) ──── +(define host/session-secret "rose-ash-host-dev-secret-change-me") +(define host/session-set-secret! (fn (s) (set! host/session-secret s))) + +;; ── keys ──────────────────────────────────────────────────────────── +(define host/-sess-key (fn (sid) (str "session:" sid))) +(define host/-sess-counter-key "session:-counter") + +;; mint the next sid from a persisted counter (signature guards guessability) +(define host/-sess-next-sid + (fn () + (let ((n (+ 1 (or (persist/backend-kv-get host/session-store host/-sess-counter-key) 0)))) + (begin + (persist/backend-kv-put host/session-store host/-sess-counter-key n) + (str "s" n))))) + +;; ── backend io fn: dispatch session/* ops onto the persist KV ─────── +(define host/session-backend + (fn (op) + (let ((kind (get op :op))) + (cond + ((= kind "session/create") + (let ((sid (host/-sess-next-sid))) + (begin + (persist/backend-kv-put host/session-store (host/-sess-key sid) {}) + sid))) + ((= kind "session/exists") + (persist/backend-kv-has? host/session-store (host/-sess-key (get op :sid)))) + ((= kind "session/get") + (get + (or (persist/backend-kv-get host/session-store (host/-sess-key (get op :sid))) {}) + (get op :key))) + ((= kind "session/set") + (let ((sid (get op :sid))) + (persist/backend-kv-put host/session-store (host/-sess-key sid) + (assoc + (or (persist/backend-kv-get host/session-store (host/-sess-key sid)) {}) + (get op :key) + (get op :val))))) + ((= kind "session/load") + (or (persist/backend-kv-get host/session-store (host/-sess-key (get op :sid))) {})) + ((= kind "session/clear") + (persist/backend-kv-delete host/session-store (host/-sess-key (get op :sid)))) + (else nil))))) + +;; ── middleware for the host pipeline: signed cookie + durable backend ─ +(define host/sessions + (fn () (dream-sessions-signed host/session-backend host/session-secret))) + +;; ── handler-facing helpers ────────────────────────────────────────── +;; The logged-in principal (or nil), and login/logout writing the session field. +(define host/current-principal (fn (req) (dream-session-field req :principal))) +(define host/login! (fn (req principal) (dream-set-session-field req :principal principal))) +(define host/logout! (fn (req) (dream-invalidate-session req))) diff --git a/lib/host/tests/session.sx b/lib/host/tests/session.sx new file mode 100644 index 00000000..7b867af3 --- /dev/null +++ b/lib/host/tests/session.sx @@ -0,0 +1,117 @@ +;; lib/host/tests/session.sx — the live-write story end-to-end: a browser logs in +;; (POST /login) → signed session cookie → guarded write succeeds; no cookie → 401; +;; the Bearer path still works for API clients; logout drops the principal. +;; make-app auto-mounts /login + /logout and wraps everything in host/sessions, so +;; these tests drive the WHOLE app handler (session middleware + router) the way +;; the native server does. + +(define host-se-pass 0) +(define host-se-fail 0) +(define host-se-fails (list)) + +(define host-se-test + (fn (name actual expected) + (if (= actual expected) + (set! host-se-pass (+ host-se-pass 1)) + (begin + (set! host-se-fail (+ host-se-fail 1)) + (append! host-se-fails {:name name :actual actual :expected expected}))))) + +;; ── fixtures ──────────────────────────────────────────────────────── +(acl/load! (list (acl-grant "admin" "edit" "blog"))) +(host/auth-set-admin! "admin" "secret") +(host/session-set-secret! "test-session-secret") + +;; bearer fallback for API clients (session is the browser path) +(define host-se-resolve (fn (tok) (if (= tok "apitoken") "admin" nil))) + +;; a guarded write route isolating the session mechanism from blog specifics: +;; same pipeline shape as host/blog--protect (wrap-errors + require-user + ACL). +(define host-se-secure-h + (host/pipeline + (list + host/wrap-errors + (host/require-user host-se-resolve) + (host/require-permission "edit" (fn (req) "blog"))) + (fn (req) (host/ok-status 201 (host/principal req))))) + +(define host-se-app + (host/make-app (list (list (dream-post "/secure" host-se-secure-h))))) + +;; ── helpers ───────────────────────────────────────────────────────── +(define host-se-login + (fn (user pass) + (host-se-app + (dream-request "POST" "/login" {} + (str "username=" user "&password=" pass))))) + +;; the name=value pair from the Set-Cookie (drop the "; Path=…" attributes) +(define host-se-cookie-of + (fn (resp) + (let ((c (first (dream-resp-cookies resp)))) + (if (nil? c) nil (substr c 0 (index-of c ";")))))) + +(define host-se-secure + (fn (cookie) + (host-se-app + (dream-request "POST" "/secure" (if cookie {:cookie cookie} {}) "")))) + +(define host-se-secure-bearer + (fn (tok) + (host-se-app + (dream-request "POST" "/secure" {:authorization (str "Bearer " tok)} "")))) + +;; ── login ─────────────────────────────────────────────────────────── +(host-se-test "login good creds -> 303 redirect" + (dream-status (host-se-login "admin" "secret")) 303) +(host-se-test "login good creds sets a session cookie" + (not (nil? (host-se-cookie-of (host-se-login "admin" "secret")))) true) +(host-se-test "login bad creds -> 401" + (dream-status (host-se-login "admin" "wrong")) 401) + +;; ── session-authed write ──────────────────────────────────────────── +(host-se-test "logged-in session passes the guarded write -> 201" + (dream-status (host-se-secure (host-se-cookie-of (host-se-login "admin" "secret")))) + 201) +(host-se-test "principal threaded from the session to the handler" + (contains? + (dream-resp-body (host-se-secure (host-se-cookie-of (host-se-login "admin" "secret")))) + "\"data\":\"admin\"") + true) + +;; ── unauthenticated / forged ──────────────────────────────────────── +(host-se-test "no cookie -> 401" + (dream-status (host-se-secure nil)) 401) +(host-se-test "bad-cred login leaves an anonymous session (no principal) -> 401" + (dream-status (host-se-secure (host-se-cookie-of (host-se-login "admin" "wrong")))) + 401) +(host-se-test "forged cookie -> 401" + (dream-status (host-se-secure "dream.session=s1|forged")) 401) + +;; ── bearer fallback (API path still works) ────────────────────────── +(host-se-test "valid bearer token -> 201" + (dream-status (host-se-secure-bearer "apitoken")) 201) +(host-se-test "invalid bearer token -> 401" + (dream-status (host-se-secure-bearer "nope")) 401) + +;; ── logout ────────────────────────────────────────────────────────── +;; log in, get the cookie, log out with it, then the same cookie no longer authes. +(define host-se-logout + (fn (cookie) + (host-se-app + (dream-request "POST" "/logout" (if cookie {:cookie cookie} {}) "")))) +(define host-se-live-cookie (host-se-cookie-of (host-se-login "admin" "secret"))) +(host-se-test "logout returns 303" + (dream-status (host-se-logout host-se-live-cookie)) 303) +(host-se-test "after logout the cookie no longer authes -> 401" + (begin + (host-se-logout host-se-live-cookie) + (dream-status (host-se-secure host-se-live-cookie))) + 401) + +(define host-se-tests-run! + (fn () + {:total (+ host-se-pass host-se-fail) + :passed host-se-pass + :failed host-se-fail + :fails host-se-fails})) From 83044ad2f04d59468395ec2288d89cbe72a80193 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:08:33 +0000 Subject: [PATCH 026/138] host: malformed posts degrade instead of 502 (parse-safe + 500 boundary) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A post whose sx_content is malformed SX (e.g. "

      / return 502, surfaced as a Cloudflare error page. Root cause: the kernel `parse` raises a native Parse_error that an SX (guard ...) cannot catch (guard only traps SX conditions), so host/blog-render's guard around (parse sx) was ineffective; the exception escaped to the http-listen loop, which swallowed it and wrote NO response — a dropped connection that Caddy/Cloudflare relay as 502. - kernel: add `parse-safe` — like parse but returns nil on malformed input (value-returning, so untrusted text can be handled without a host exception). - kernel: http-listen now synthesises a 500 response on ANY handler exception instead of dropping the connection, so the origin stays responsive (no more proxy 502 / branded error page) and the error is logged. This is also the only place a native exception can be trapped, since SX guard can't. - blog: host/blog-render uses (parse-safe sx) — malformed bodies render the existing "(unparseable content)" placeholder; the per-block render guard already covers unknown components (~kg-*), so /mddddd/ recovers too. Verified live: /try-thus/ and /mddddd/ now 200 with placeholders; working posts, home, and login unaffected. 193/193 conformance. Co-Authored-By: Claude Opus 4.8 --- hosts/ocaml/bin/sx_server.ml | 36 ++++++++++++++++++++++++++++++++---- lib/host/blog.sx | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 3cae0201..f14f49f6 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -817,14 +817,28 @@ let setup_evaluator_bridge env = (* Run the handler through the IO-aware CEK runner (not bare sx_call) so request handlers can perform per-request IO — durable store reads/writes resolve via cek_run_with_io's - suspension loop instead of returning an unresolved suspension. *) + suspension loop instead of returning an unresolved suspension. + On ANY handler exception, synthesise a 500 response rather than + letting it escape: an escaped exception drops the connection + with no bytes written, which a reverse proxy (Caddy/Cloudflare) + surfaces as a 502 error page. A real 500 keeps the origin + responsive and debuggable. Note: a native exception (e.g. the + parser's Parse_error) cannot be caught by an SX (guard ...), so + this boundary is the only place it can be trapped. *) (try let st = Sx_ref.continue_with_call handler (List [Dict req]) (Env (Sx_types.make_env ())) (List [Dict req]) (List []) in - cek_run_with_io st - with e -> Mutex.unlock mtx; raise e) in - Mutex.unlock mtx; + let r = cek_run_with_io st in + Mutex.unlock mtx; r + with e -> + Mutex.unlock mtx; + Printf.eprintf "[http-listen] handler error: %s\n%!" + (Printexc.to_string e); + let d = Sx_types.make_dict () in + Hashtbl.replace d "status" (Integer 500); + Hashtbl.replace d "body" (String "Internal Server Error"); + Dict d) in let getk k = match resp with | Dict h -> Hashtbl.find_opt h k | _ -> None in let status = match getk "status" with @@ -1250,6 +1264,20 @@ let setup_type_constructors env = (* Already a value — return as-is *) v | _ -> raise (Eval_error "parse: expected string")); + (* Like parse, but returns nil instead of raising on malformed input. The + parser raises a native Parse_error that an SX-level (guard ...) cannot catch + (guard only traps SX conditions, not host exceptions), so code that handles + untrusted text — e.g. a stored post body — needs a value-returning parse to + degrade gracefully rather than crash the request. *) + bind "parse-safe" (fun args -> + match args with + | [String s] | [SxExpr s] -> + (try + let exprs = Sx_parser.parse_all s in + (match exprs with [e] -> e | _ -> List exprs) + with _ -> Nil) + | [v] -> v + | _ -> Nil); (* Native bytecode compiler — bootstrapped from lib/compiler.sx *) bind "compile" (fun args -> match args with [expr] -> Sx_compiler.compile expr | _ -> Nil); diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 1322a8c1..872eeec3 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -76,7 +76,7 @@ (fn (record) (let ((sx (get record :sx-content))) (if (and sx (not (= sx ""))) - (let ((tree (guard (e (true nil)) (parse sx)))) + (let ((tree (parse-safe sx))) (cond ((nil? tree) "

      (unparseable content)

      ") ((and (= (type-of tree) "list") (> (len tree) 0) From 5d9cb4c6eac0748ef1876e8c86c851227b308696 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:12:03 +0000 Subject: [PATCH 027/138] host: reject malformed sx_content at write time (blog 33/33, 199 total) Complete the malformed-post defence: instead of only degrading on read, refuse to store a post whose body won't parse, so bad content never enters the durable store in the first place. - host/blog-content-ok?: empty body is allowed, otherwise it must parse (parse-safe non-nil). - POST /new (form): missing title OR unparseable body -> 400 HTML page. - POST /posts (JSON): unparseable sx_content -> 400 "invalid sx_content". - PUT /posts/:slug (JSON): unparseable sx_content -> 400, existing post left intact. - 6 new blog tests: each write path rejects "

      400 + slug 404 (not stored); valid publish unaffected. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 76 ++++++++++++++++++++++++++++-------------- lib/host/tests/blog.sx | 25 ++++++++++++++ 2 files changed, 76 insertions(+), 25 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 872eeec3..7138cfdc 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -159,22 +159,42 @@ (button :type "submit" "Publish"))) (p (a :href "/" "all posts")))))))) +;; ── write-time validation ─────────────────────────────────────────── +;; sx_content must be storable as renderable SX: empty is allowed (an empty post), +;; otherwise it must parse. parse-safe returns nil on malformed input (the kernel +;; parser raises a native Parse_error an SX guard can't catch), so this rejects a +;; bad body at write time instead of letting it 500 on read. Mirrors the read-path +;; guard in host/blog-render — bad content never enters the durable store. +(define host/blog-content-ok? + (fn (sx) + (or (nil? sx) (= sx "") (not (nil? (parse-safe sx)))))) + ;; ── write handlers ────────────────────────────────────────────────── ;; POST /new — form-urlencoded ingest (the editor's submit shape: title, ;; sx_content, status, custom_excerpt, csrf_token). Slug derived from the title. -;; Redirects to the new post on success. +;; Redirects to the new post on success; rejects a missing title or unparseable +;; body with a 400 HTML page (this path serves a browser form). (define host/blog-form-submit (fn (req) (let ((title (dream-form-field req "title")) (sx-content (dream-form-field req "sx_content")) (status (or (dream-form-field req "status") "published"))) - (if (and title (not (= title ""))) - (let ((slug (host/blog-slugify title))) - (begin - (host/blog-put! slug title (or sx-content "") status) - (dream-redirect (str "/" slug "/")))) - (dream-html-status 400 - (host/blog--page "Error" "

      Title is required. back

      ")))))) + (cond + ((or (nil? title) (= title "")) + (dream-html-status 400 + (host/blog--page "Error" + (quasiquote (div (h1 "Error") (p "Title is required.") + (p (a :href "/new" "Back"))))))) + ((not (host/blog-content-ok? sx-content)) + (dream-html-status 400 + (host/blog--page "Error" + (quasiquote (div (h1 "Error") (p "Post body is not valid SX markup.") + (p (a :href "/new" "Back"))))))) + (else + (let ((slug (host/blog-slugify title))) + (begin + (host/blog-put! slug title (or sx-content "") status) + (dream-redirect (str "/" slug "/"))))))))) ;; POST /posts — JSON create {slug?,title,sx_content,status}. 409 if slug exists. (define host/blog-create @@ -182,15 +202,18 @@ (let ((p (dream-json-body req))) (if (= (type-of p) "dict") (let ((title (get p :title))) - (if (and title (not (= title ""))) - (let ((slug (or (get p :slug) (host/blog-slugify title)))) - (if (host/blog-exists? slug) - (host/error 409 "post already exists") - (begin - (host/blog-put! slug title (or (get p :sx_content) "") - (or (get p :status) "published")) - (host/ok-status 201 {:slug slug :title title})))) - (host/error 400 "title required"))) + (cond + ((or (nil? title) (= title "")) (host/error 400 "title required")) + ((not (host/blog-content-ok? (get p :sx_content))) + (host/error 400 "invalid sx_content")) + (else + (let ((slug (or (get p :slug) (host/blog-slugify title)))) + (if (host/blog-exists? slug) + (host/error 409 "post already exists") + (begin + (host/blog-put! slug title (or (get p :sx_content) "") + (or (get p :status) "published")) + (host/ok-status 201 {:slug slug :title title}))))))) (host/error 400 "invalid payload"))))) ;; PUT /posts/ — JSON update {title?,sx_content?,status?}. 404 if absent. @@ -199,14 +222,17 @@ (let ((slug (dream-param req "slug")) (p (dream-json-body req))) (if (= (type-of p) "dict") (let ((r (host/blog-get slug))) - (if r - (begin - (host/blog-put! slug - (or (get p :title) (get r :title)) - (or (get p :sx_content) (get r :sx-content)) - (or (get p :status) (get r :status))) - (host/ok {:slug slug :updated true})) - (host/error 404 "no such post"))) + (cond + ((nil? r) (host/error 404 "no such post")) + ((not (host/blog-content-ok? (get p :sx_content))) + (host/error 400 "invalid sx_content")) + (else + (begin + (host/blog-put! slug + (or (get p :title) (get r :title)) + (or (get p :sx_content) (get r :sx-content)) + (or (get p :status) (get r :status))) + (host/ok {:slug slug :updated true}))))) (host/error 400 "invalid payload"))))) ;; DELETE /posts/ diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index bf36e9e1..692355ee 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -124,6 +124,31 @@ (dream-status (host-bl-wapp (host-bl-send "DELETE" "/posts/ghost" "Bearer good" "" ""))) 404) +;; -- write-time validation: malformed sx_content rejected, never stored -- +;; "%3Ch1+broken%29" decodes to "

      400" + (dream-status (host-bl-wapp (host-bl-send "POST" "/new" "Bearer good" + "application/x-www-form-urlencoded" + "title=Bad+Form&sx_content=%3Ch1+broken%29&status=published"))) + 400) +(host-bl-test "rejected form post was not stored" + (dream-status (host-bl-wapp (host-bl-req "/bad-form/"))) + 404) +(host-bl-test "json create malformed sx_content -> 400" + (dream-status (host-bl-wapp (host-bl-send "POST" "/posts" "Bearer good" "application/json" + "{\"title\":\"Bad Json\",\"sx_content\":\"

      400" + (dream-status (host-bl-wapp (host-bl-send "PUT" "/posts/my-first-post" "Bearer good" + "application/json" "{\"sx_content\":\"

      My First Post

      ") + true) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 1eec131101d23ef77230112309966aa3eb3a5f1b Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:19:54 +0000 Subject: [PATCH 028/138] host: view + edit the SX source of each blog post (blog 47/47, 213 total) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Posts ARE SX source, so expose it: a public raw-source view and a guarded in-browser source editor. - GET //source — raw sx_content as text/plain (public; a published post's source isn't secret). - GET //edit — edit form pre-filled with the post's title, raw source (in a textarea, render-to-html-escaped so it shows verbatim), and status (current value pre-selected). Guarded (editor only). Slug is preserved. - POST //edit — save the edited source; same write-time validation as create (unparseable body -> 400, post left intact); 303 back to the post. - post page gains "view source · edit · all posts" footer links. Routing: /:slug/source + /:slug/edit are two-segment patterns; the router consumes :param as exactly one segment and requires a full match, so /:slug does not shadow them (asserted). 14 new blog tests cover view (200/text-plain/ raw body/404/no-shadow) and edit (401 unauth GET+POST, 200 form, source shown, 303 save, persisted, slug preserved, 400 malformed, 404 missing). Verified live on blog.rose-ash.com: view source, guarded edit form, save round-trip (rendered post + source both reflect the edit). Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 87 +++++++++++++++++++++++++++++++++++++++++- lib/host/tests/blog.sx | 45 ++++++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 7138cfdc..4a62fc46 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -107,7 +107,15 @@ (if r (dream-html (host/blog--page (get r :title) - (quasiquote (article (raw! (unquote (host/blog-render r))))))) + (quasiquote + (div + (article (raw! (unquote (host/blog-render r)))) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" + (a :href (unquote (str "/" slug "/source")) "view source") + " · " + (a :href (unquote (str "/" slug "/edit")) "edit") + " · " + (a :href "/" "all posts")))))) (dream-html-status 404 (host/blog--page "Not found" (quasiquote @@ -136,6 +144,20 @@ (define host/blog-index (fn (req) (host/ok (host/blog-list)))) +;; GET //source — the raw sx_content as text/plain. Posts ARE SX source, so +;; this just hands back the stored markup (public; a published post's source is +;; not secret). 404 if the post is absent. +(define host/blog-source + (fn (req) + (let ((slug (dream-param req "slug"))) + (let ((r (host/blog-get slug))) + (if r + (dream-response 200 {:content-type "text/plain; charset=utf-8"} + (or (get r :sx-content) "")) + (dream-html-status 404 + (host/blog--page "Not found" + (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug)))))))))))) + ;; ── create page (GET /new) — clean minimal form as an SX tree ─────── ;; No legacy JS editor, no external assets, no shims. The rich WYSIWYG is a ;; future native SX-island editor (Phase 5.2+). Posts to /new. @@ -243,6 +265,66 @@ (begin (host/blog-delete! slug) (host/ok {:slug slug :deleted true})) (host/error 404 "no such post"))))) +;; GET //edit — edit form pre-filled with the post's current title, raw +;; sx_content (in a textarea — render-to-html escapes the text child, so the +;; browser shows the source verbatim), and status (current value pre-selected). +;; Guarded: only an editor reaches the editor. Keeps the slug (edits don't re-slug). +(define host/blog-edit-form + (fn (req) + (let ((slug (dream-param req "slug"))) + (let ((r (host/blog-get slug))) + (if (nil? r) + (dream-html-status 404 + (host/blog--page "Not found" + (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) + (let ((status (get r :status))) + (let ((mk-opt + (fn (val label) + (if (= val status) + (quasiquote (option :value (unquote val) :selected "selected" (unquote label))) + (quasiquote (option :value (unquote val) (unquote label))))))) + (dream-html + (host/blog--page (str "Edit: " (get r :title)) + (quasiquote + (div + (h1 (unquote (str "Edit: " (get r :title)))) + (form :method "post" :action (unquote (str "/" slug "/edit")) + (p (input :name "title" :value (unquote (get r :title)) + :style "font-size:1.4em;width:100%")) + (p (textarea :name "sx_content" :rows "16" + :style "width:100%;font-family:monospace" + (unquote (or (get r :sx-content) "")))) + (p (select :name "status" + (unquote (mk-opt "draft" "Draft")) + (unquote (mk-opt "published" "Published"))) + " " + (button :type "submit" "Save"))) + (p (a :href (unquote (str "/" slug "/")) "view post") + " · " + (a :href (unquote (str "/" slug "/source")) "view source"))))))))))))) + +;; POST //edit — save the edited source. Same write-time validation as the +;; create paths (unparseable body -> 400, post left intact). Slug is preserved. +(define host/blog-edit-submit + (fn (req) + (let ((slug (dream-param req "slug"))) + (let ((r (host/blog-get slug))) + (if (nil? r) + (dream-html-status 404 + (host/blog--page "Not found" + (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) + (let ((title (or (dream-form-field req "title") (get r :title))) + (sx-content (or (dream-form-field req "sx_content") "")) + (status (or (dream-form-field req "status") (get r :status)))) + (if (host/blog-content-ok? sx-content) + (begin + (host/blog-put! slug title sx-content status) + (dream-redirect (str "/" slug "/"))) + (dream-html-status 400 + (host/blog--page "Error" + (quasiquote (div (h1 "Error") (p "Post body is not valid SX markup.") + (p (a :href (unquote (str "/" slug "/edit")) "Back"))))))))))))) + ;; ── routes ────────────────────────────────────────────────────────── ;; Public reads + the create form. /, /posts, /new BEFORE /:slug (catch-all). ;; MUST be mounted LAST in the app so domain routes (/feed, /health) win. @@ -251,6 +333,7 @@ (dream-get "/" host/blog-home) (dream-get "/posts" host/blog-index) (dream-get "/new" host/blog-new-form) + (dream-get "/:slug/source" host/blog-source) (dream-get "/:slug" host/blog-post))) ;; Guarded writes: form ingest + JSON create/update/delete behind auth+ACL. @@ -267,6 +350,8 @@ (fn (resolve) (list (dream-post "/new" (host/blog--protect resolve host/blog-form-submit)) + (dream-get "/:slug/edit" (host/blog--protect resolve host/blog-edit-form)) + (dream-post "/:slug/edit" (host/blog--protect resolve host/blog-edit-submit)) (dream-post "/posts" (host/blog--protect resolve host/blog-create)) (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 692355ee..93819b0e 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -149,6 +149,51 @@ (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/"))) "

      My First Post

      ") true) +;; -- view source (public) -- +(host-bl-test "view source -> 200" + (dream-status (host-bl-wapp (host-bl-req "/my-first-post/source"))) 200) +(host-bl-test "view source is text/plain" + (dream-resp-header (host-bl-wapp (host-bl-req "/my-first-post/source")) "content-type") + "text/plain; charset=utf-8") +(host-bl-test "view source returns raw sx_content" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/source"))) "(article") + true) +(host-bl-test "view source missing -> 404" + (dream-status (host-bl-wapp (host-bl-req "/ghost/source"))) 404) +(host-bl-test "/:slug not shadowed by /:slug/source" + (dream-status (host-bl-wapp (host-bl-req "/my-first-post/"))) 200) + +;; -- edit source (guarded GET form + guarded POST save) -- +(host-bl-test "edit form no auth -> 401" + (dream-status (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" nil "" ""))) 401) +(host-bl-test "edit form authed -> 200" + (dream-status (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" "Bearer good" "" ""))) 200) +(host-bl-test "edit form shows current source" + (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" "Bearer good" "" ""))) + "(article") + true) +(host-bl-test "edit submit no auth -> 401" + (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" nil + "application/x-www-form-urlencoded" "sx_content=(p+%22x%22)"))) 401) +(host-bl-test "edit submit authed -> 303" + (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" "Bearer good" + "application/x-www-form-urlencoded" + "title=My+First+Post&sx_content=(p+%22edited+via+editor%22)&status=published"))) 303) +(host-bl-test "edit persisted the new content" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/"))) "edited via editor") + true) +(host-bl-test "edit preserves the slug" + (dream-resp-header + (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" "Bearer good" + "application/x-www-form-urlencoded" "title=Renamed&sx_content=(p+%22y%22)&status=draft")) + "location") + "/my-first-post/") +(host-bl-test "edit malformed body -> 400" + (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" "Bearer good" + "application/x-www-form-urlencoded" "sx_content=%3Ch1+broken%29"))) 400) +(host-bl-test "edit missing post -> 404" + (dream-status (host-bl-wapp (host-bl-send "GET" "/ghost/edit" "Bearer good" "" ""))) 404) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 5d5ff9948eda59645360bf4d45b7cf36db745e3d Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:26:34 +0000 Subject: [PATCH 029/138] host: browser auth redirects to login (no more raw JSON 401), with return-to MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking "edit" while logged out returned a raw JSON 401 {"ok":false,"error":"unauthorized"} — a dead end in the browser. HTML routes now redirect to a usable login page and return you afterwards. - host/require-login: browser-shaped guard. Same session-or-bearer check as host/require-user, but on failure REDIRECTS to /login?next= instead of JSON 401. (host/require-user stays for JSON/API routes.) - host/-principal-of: shared session-then-bearer resolution. - login honours ?next=: GET /login renders a hidden next field; POST /login redirects there on success and re-renders the form (with next) on failure. - host/-safe-next: only same-site absolute paths are honoured — //evil.com and http://… fall back to "/", closing the open-redirect. - blog: host/blog--protect-html (require-login) guards the browser routes — POST /new, GET/POST /:slug/edit; the JSON /posts routes keep host/require-user. Do we need login? Yes — it's the write/edit auth boundary; without it anyone could edit or delete posts. The bug was the dead-end 401, not the gate. Now logged-out edit -> login -> back to edit is a clean flow. Tests: blog no-auth write routes assert 303 + Location /login(+next); session suite gains next round-trip + open-redirect-guard cases. 218/218. Verified live: /welcome/edit logged out -> 303 /login?next=/welcome/edit; login -> 303 back to /welcome/edit -> 200. Co-Authored-By: Claude Opus 4.8 --- lib/host/auth.sx | 94 ++++++++++++++++++++++++++------------- lib/host/blog.sx | 18 ++++++-- lib/host/tests/blog.sx | 21 ++++++--- lib/host/tests/session.sx | 17 +++++++ 4 files changed, 109 insertions(+), 41 deletions(-) diff --git a/lib/host/auth.sx b/lib/host/auth.sx index 95fe9afc..e008520e 100644 --- a/lib/host/auth.sx +++ b/lib/host/auth.sx @@ -29,37 +29,49 @@ (= user host/admin-user) (= pass host/admin-password)))) -;; ── GET /login — minimal SX login form ────────────────────────────── +;; A return-to target is only honoured if it's a same-site absolute PATH — guards +;; against an open-redirect (//evil.com, http://…) smuggled through ?next=. +(define host/-safe-next + (fn (n) + (if (and n (not (= n "")) (starts-with? n "/") (not (starts-with? n "//"))) + n "/"))) + +;; The login form, parameterised by where to return after success. +(define host/-login-form + (fn (next-path message) + (host/-auth-page "Log in" + (quasiquote + (div + (h1 "Log in") + (unquote (if message (quasiquote (p :style "color:#b00" (unquote message))) "")) + (form :method "post" :action "/login" + (input :type "hidden" :name "next" :value (unquote next-path)) + (p (input :name "username" :placeholder "username")) + (p (input :name "password" :type "password" :placeholder "password")) + (p (button :type "submit" "Log in")))))))) + +;; ── GET /login — login form, honouring ?next= (where to go after login) ───── (define host/login-page (fn (req) (dream-html - (host/-auth-page "Log in" - (quasiquote - (div - (h1 "Log in") - (form :method "post" :action "/login" - (p (input :name "username" :placeholder "username")) - (p (input :name "password" :type "password" :placeholder "password")) - (p (button :type "submit" "Log in"))))))))) + (host/-login-form (host/-safe-next (dream-query-param req "next")) nil)))) -;; ── POST /login — verify, write session principal, redirect home ──── +;; ── POST /login — verify, write session principal, redirect to ?next ──────── ;; The session middleware (host/sessions) has already created/loaded the session ;; and will set the cookie on this response, so writing :principal here lands on -;; the right sid and the browser keeps the cookie. +;; the right sid and the browser keeps the cookie. On failure the form re-renders +;; with the same return target so the user lands where they were headed. (define host/login-submit (fn (req) (let ((user (dream-form-field req "username")) - (pass (dream-form-field req "password"))) + (pass (dream-form-field req "password")) + (next-path (host/-safe-next (dream-form-field req "next")))) (if (host/-verify-cred user pass) (begin (host/login! req user) - (dream-redirect "/")) + (dream-redirect next-path)) (dream-html-status 401 - (host/-auth-page "Log in" - (quasiquote - (div (h1 "Log in") - (p "Invalid credentials.") - (p (a :href "/login" "Try again.")))))))))) + (host/-login-form next-path "Invalid credentials — try again.")))))) ;; ── POST /logout — clear the session, redirect home ───────────────── (define host/logout-submit @@ -75,22 +87,40 @@ (dream-post "/login" host/login-submit) (dream-post "/logout" host/logout-submit))) -;; ── auth middleware: session principal OR bearer token ────────────── +;; The authenticated principal for a request, or nil: a logged-in session takes +;; precedence, else a Bearer token resolved by `resolve` (the API fallback). +(define host/-principal-of + (fn (req resolve) + (let ((sp (host/current-principal req))) + (if (and sp (not (= sp ""))) + sp + (let ((tok (dream-bearer-token req))) + (if tok (resolve tok) nil)))))) + +;; ── auth middleware (API shape): session principal OR bearer token ── ;; Place AFTER the session middleware (so host/current-principal can read the -;; session) and BEFORE host/require-permission. resolve : token -> principal | nil -;; is the bearer fallback for API clients; a logged-in browser needs no token. +;; session) and BEFORE host/require-permission. On failure -> JSON 401 with a +;; Bearer challenge. For API/JSON routes; browser pages want host/require-login. (define host/require-user (fn (resolve) (fn (next) (fn (req) - (let ((sp (host/current-principal req))) - (let ((principal - (if (and sp (not (= sp ""))) - sp - (let ((tok (dream-bearer-token req))) - (if tok (resolve tok) nil))))) - (if (or (nil? principal) (= principal "")) - (dream-add-header - (host/error 401 "unauthorized") - "www-authenticate" "Bearer") - (next (assoc req :dream-principal principal))))))))) + (let ((principal (host/-principal-of req resolve))) + (if (or (nil? principal) (= principal "")) + (dream-add-header + (host/error 401 "unauthorized") + "www-authenticate" "Bearer") + (next (assoc req :dream-principal principal)))))))) + +;; ── auth middleware (browser shape): same check, but on failure REDIRECT to +;; the login page with a return-to, instead of a raw JSON 401. Use this for HTML +;; routes (an edit form, the create form) so an unauthenticated click lands on a +;; usable login page and returns to where it was headed after logging in. ── +(define host/require-login + (fn (resolve) + (fn (next) + (fn (req) + (let ((principal (host/-principal-of req resolve))) + (if (or (nil? principal) (= principal "")) + (dream-redirect (str "/login?next=" (host/-safe-next (dream-path req)))) + (next (assoc req :dream-principal principal)))))))) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 4a62fc46..bbbf7f17 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -346,12 +346,24 @@ (host/require-user resolve) (host/require-permission "edit" (fn (req) "blog"))) h))) +;; Browser variant: identical ACL gate, but an unauthenticated request REDIRECTS +;; to the login page (host/require-login) rather than returning a raw JSON 401 — +;; the form/edit pages are HTML, so a logged-out click should land on /login and +;; return here afterwards. +(define host/blog--protect-html + (fn (resolve h) + (host/pipeline + (list + host/wrap-errors + (host/require-login resolve) + (host/require-permission "edit" (fn (req) "blog"))) + h))) (define host/blog-write-routes (fn (resolve) (list - (dream-post "/new" (host/blog--protect resolve host/blog-form-submit)) - (dream-get "/:slug/edit" (host/blog--protect resolve host/blog-edit-form)) - (dream-post "/:slug/edit" (host/blog--protect resolve host/blog-edit-submit)) + (dream-post "/new" (host/blog--protect-html resolve host/blog-form-submit)) + (dream-get "/:slug/edit" (host/blog--protect-html resolve host/blog-edit-form)) + (dream-post "/:slug/edit" (host/blog--protect-html resolve host/blog-edit-submit)) (dream-post "/posts" (host/blog--protect resolve host/blog-create)) (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 93819b0e..f4d5a604 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -70,10 +70,14 @@ (host/blog-use-store! (persist/open)) ;; -- editor form ingest (form-urlencoded, the editor's submit shape) -- -(host-bl-test "form ingest no auth -> 401" +(host-bl-test "form ingest no auth -> redirect to login" (dream-status (host-bl-wapp (host-bl-send "POST" "/new" nil "application/x-www-form-urlencoded" "title=X"))) - 401) + 303) +(host-bl-test "form ingest no auth Location is /login" + (contains? (dream-resp-header (host-bl-wapp (host-bl-send "POST" "/new" nil + "application/x-www-form-urlencoded" "title=X")) "location") "/login") + true) (host-bl-test "form ingest authed -> 303 redirect" (dream-status (host-bl-wapp (host-bl-send "POST" "/new" "Bearer good" "application/x-www-form-urlencoded" @@ -164,17 +168,22 @@ (dream-status (host-bl-wapp (host-bl-req "/my-first-post/"))) 200) ;; -- edit source (guarded GET form + guarded POST save) -- -(host-bl-test "edit form no auth -> 401" - (dream-status (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" nil "" ""))) 401) +(host-bl-test "edit form no auth -> redirect to login" + (dream-status (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" nil "" ""))) 303) +(host-bl-test "edit form no auth Location carries next=/…/edit" + (contains? + (dream-resp-header (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" nil "" "")) "location") + "/login?next=/my-first-post/edit") + true) (host-bl-test "edit form authed -> 200" (dream-status (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" "Bearer good" "" ""))) 200) (host-bl-test "edit form shows current source" (contains? (dream-resp-body (host-bl-wapp (host-bl-send "GET" "/my-first-post/edit" "Bearer good" "" ""))) "(article") true) -(host-bl-test "edit submit no auth -> 401" +(host-bl-test "edit submit no auth -> redirect to login" (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" nil - "application/x-www-form-urlencoded" "sx_content=(p+%22x%22)"))) 401) + "application/x-www-form-urlencoded" "sx_content=(p+%22x%22)"))) 303) (host-bl-test "edit submit authed -> 303" (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/edit" "Bearer good" "application/x-www-form-urlencoded" diff --git a/lib/host/tests/session.sx b/lib/host/tests/session.sx index 7b867af3..3040792d 100644 --- a/lib/host/tests/session.sx +++ b/lib/host/tests/session.sx @@ -69,6 +69,23 @@ (host-se-test "login bad creds -> 401" (dream-status (host-se-login "admin" "wrong")) 401) +;; ── return-to (?next=) after login ────────────────────────────────── +(host-se-test "login page carries ?next in a hidden field" + (contains? + (dream-resp-body (host-se-app (dream-request "GET" "/login?next=/secure" {} ""))) + "value=\"/secure\"") + true) +(host-se-test "login redirects to next on success" + (dream-resp-header + (host-se-app (dream-request "POST" "/login" {} "username=admin&password=secret&next=/secure")) + "location") + "/secure") +(host-se-test "login rejects open-redirect next (//evil) -> /" + (dream-resp-header + (host-se-app (dream-request "POST" "/login" {} "username=admin&password=secret&next=//evil.com")) + "location") + "/") + ;; ── session-authed write ──────────────────────────────────────────── (host-se-test "logged-in session passes the guarded write -> 201" (dream-status (host-se-secure (host-se-cookie-of (host-se-login "admin" "secret")))) From 6419aa38c5f4581b90b9c67b02d5e7f8aa32831f Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:36:00 +0000 Subject: [PATCH 030/138] host: discoverable log in / log out footer link MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Login had no visible entry point — you could only reach it by hitting a guard. Add an auth footer the pages splice in: "log in" when logged out, "signed in as · log out" when logged in. - host/auth-footer: SX fragment reading the session principal; guards a session-less request so it's safe to call anywhere. - GET /logout added alongside POST so the footer link is a plain (logout is low-harm; GET is acceptable). Clears the session, redirects home. - home and post pages splice (host/auth-footer req) into their footer. Tests: home + post footers show a login link when anonymous; GET /logout -> 303. 221/221. Verified live: anonymous shows "log in"; logged in shows "signed in as admin · log out"; /logout reverts it. Co-Authored-By: Claude Opus 4.8 --- lib/host/auth.sx | 17 ++++++++++++++++- lib/host/blog.sx | 8 ++++++-- lib/host/tests/blog.sx | 8 ++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/lib/host/auth.sx b/lib/host/auth.sx index e008520e..3921d6af 100644 --- a/lib/host/auth.sx +++ b/lib/host/auth.sx @@ -73,7 +73,8 @@ (dream-html-status 401 (host/-login-form next-path "Invalid credentials — try again.")))))) -;; ── POST /logout — clear the session, redirect home ───────────────── +;; ── /logout — clear the session, redirect home. Allowed on GET too so a plain +;; footer link can log out (logout is low-harm, so GET is acceptable here). ───── (define host/logout-submit (fn (req) (begin @@ -85,8 +86,22 @@ (list (dream-get "/login" host/login-page) (dream-post "/login" host/login-submit) + (dream-get "/logout" host/logout-submit) (dream-post "/logout" host/logout-submit))) +;; ── auth footer fragment ──────────────────────────────────────────── +;; A small SX node pages splice into their footer: "log in" when logged out, +;; "signed in as · log out" when logged in. Guards a session-less request +;; (no middleware) so it's safe to call anywhere. Reads the session principal. +(define host/auth-footer + (fn (req) + (let ((who (if (get req :dream-session) (host/current-principal req) nil))) + (if (and who (not (= who ""))) + (quasiquote + (span (unquote (str "signed in as " who)) " · " + (a :href "/logout" "log out"))) + (quote (a :href "/login" "log in")))))) + ;; The authenticated principal for a request, or nil: a logged-in session takes ;; precedence, else a Bearer token resolved by `resolve` (the API fallback). (define host/-principal-of diff --git a/lib/host/blog.sx b/lib/host/blog.sx index bbbf7f17..8fbdd1af 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -115,7 +115,9 @@ " · " (a :href (unquote (str "/" slug "/edit")) "edit") " · " - (a :href "/" "all posts")))))) + (a :href "/" "all posts") + " · " + (unquote (host/auth-footer req))))))) (dream-html-status 404 (host/blog--page "Not found" (quasiquote @@ -140,7 +142,9 @@ (quasiquote (div (h1 "Posts") (unquote listing) - (p (a :href "/new" "+ New post"))))))))))) + (p (a :href "/new" "+ New post")) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" + (unquote (host/auth-footer req)))))))))))) (define host/blog-index (fn (req) (host/ok (host/blog-list)))) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index f4d5a604..68618b03 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -203,6 +203,14 @@ (host-bl-test "edit missing post -> 404" (dream-status (host-bl-wapp (host-bl-send "GET" "/ghost/edit" "Bearer good" "" ""))) 404) +;; -- auth footer (discoverable login/logout) -- +(host-bl-test "home footer shows a log in link when anonymous" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/"))) ">log in") true) +(host-bl-test "post footer shows a log in link when anonymous" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/my-first-post/"))) ">log in") true) +(host-bl-test "GET /logout -> 303" + (dream-status (host-bl-app (host-bl-req "/logout"))) 303) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From ccbee8c1beb16674125658300a1a78d1c043b3cb Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 25 Jun 2026 22:57:03 +0000 Subject: [PATCH 031/138] =?UTF-8?q?host:=20relate=20posts=20=E2=80=94=20"r?= =?UTF-8?q?elated=20posts"=20on=20blog=20=C3=97=20relations=20(blog=2061/6?= =?UTF-8?q?1,=20230)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compose two already-migrated domains: a post is a relations-graph node "blog:", and a "related" link is a symmetric pair of edges (lib/relations). The post page shows a "Related posts" block; the edit page gets an editor to add (by slug) and remove relations. - host/blog-relate!/unrelate!/related: symmetric edges under kind "related"; related slugs = blog children, existence-filtered against ONE kv-keys read. - post page: "Related posts" links block; edit page: related editor (remove buttons + add-by-slug box). - POST /:slug/relate, /:slug/unrelate — guarded browser routes (redirect to login like the other write routes); relate validates the other post exists. - delete cleans up a post's related edges (no dangling links). IO ORDERING (the live 500 that conformance missed): host/blog--related-block/ -editor do durable reads (perform). Performing inside the quasiquote, via unquote, while the page tree renders raised Sx_vm.VmSuspended under http-listen; the in-memory conformance store never performs, so it passed. Fix mirrors host/blog-home: do the reads in the handler's let bindings BEFORE the quasiquote, and check related-existence against a single host/blog-slugs read rather than a perform per candidate inside filter. 9 relate tests (guard, symmetry, render, no-op on missing, unrelate both ways, delete cleanup). Verified live: relate -> Related block both ways; unrelate clears it; posts without relations and the whole site stay 200. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 152 ++++++++++++++++++++++++++++++++++++----- lib/host/tests/blog.sx | 38 +++++++++++ 2 files changed, 174 insertions(+), 16 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 8fbdd1af..7e87fa76 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -84,6 +84,37 @@ (join "" (map host/blog--render-node (rest tree)))) (else (host/blog--render-node tree)))) (str "

      (empty post)

      "))))) +;; ── related posts (blog × relations) ──────────────────────────────── +;; A "related" link between two posts is a SYMMETRIC pair of edges in the +;; relations graph (lib/relations): node = "blog:", kind = related. Edges go +;; both ways so "related posts" reads the same from either side via children alone +;; — composing two already-migrated domains (blog + relations) on the host. +(define host/blog--rel-kind (string->symbol "related")) +(define host/blog--node (fn (slug) (string->symbol (str "blog:" slug)))) + +(define host/blog-relate! + (fn (a b) + (begin + (relations/relate (host/blog--node a) (host/blog--node b) host/blog--rel-kind) + (relations/relate (host/blog--node b) (host/blog--node a) host/blog--rel-kind)))) +(define host/blog-unrelate! + (fn (a b) + (begin + (relations/unrelate (host/blog--node a) (host/blog--node b) host/blog--rel-kind) + (relations/unrelate (host/blog--node b) (host/blog--node a) host/blog--rel-kind)))) + +;; related slugs for a post: blog children under "related", stripped to slug, and +;; limited to posts that still exist (a deleted post can leave a dangling edge). +;; Existence is checked against ONE kv-keys read (host/blog-slugs), not a perform +;; per candidate — keeping IO out of the inner filter. +(define host/blog-related + (fn (slug) + (let ((existing (host/blog-slugs))) + (let ((kids (relations/children (host/blog--node slug) host/blog--rel-kind))) + (filter (fn (s) (contains? existing s)) + (map (fn (n) (substr (symbol->string n) 5)) + (filter (fn (n) (starts-with? (symbol->string n) "blog:")) kids))))))) + ;; ── page shell ────────────────────────────────────────────────────── ;; A page is an SX element tree, rendered via render-page (5.1). The handler ;; builds the tree (running any dynamic logic in the full evaluator, e.g. a posts @@ -98,6 +129,51 @@ (head (meta :charset "utf-8") (title (unquote title))) (body (unquote body)))))))) +;; "Related posts" block for the post page: a list of links, or "" when none. +;; Records (slug+title) are fetched up front so the SX tree is built from +;; in-memory data — no durable read happens while the page tree is rendered. +(define host/blog--related-block + (fn (slug) + (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (host/blog-related slug)))) + (if (> (len rel) 0) + (let ((items + (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + rel))) + (quasiquote + (div :style "margin-top:2em" + (h3 "Related posts") + (unquote (list (quote ul) items))))) + "")))) + +;; Related-posts editor for the edit page: current links each with a remove +;; button, plus an "add related" box (relate by slug; the submit validates it). +(define host/blog--related-editor + (fn (slug) + (let ((rel (host/blog-related slug))) + (quasiquote + (div :style "margin-top:2em;border-top:1px solid #ccc;padding-top:1em" + (h3 "Related posts") + (unquote + (if (> (len rel) 0) + (list (quote ul) + (map (fn (s) + (quasiquote + (li (a :href (unquote (str "/" s "/")) (unquote s)) " " + (form :method "post" :style "display:inline" + :action (unquote (str "/" slug "/unrelate")) + (input :type "hidden" :name "other" :value (unquote s)) + (button :type "submit" "remove"))))) + rel)) + (quote (p :style "opacity:0.7" "None yet.")))) + (form :method "post" :action (unquote (str "/" slug "/relate")) + (input :name "other" :placeholder "slug to relate") + " " + (button :type "submit" "Add related"))))))) + ;; ── read handlers ─────────────────────────────────────────────────── ;; Post body is rendered per-block (a guarded HTML string) then injected raw. (define host/blog-post @@ -105,19 +181,25 @@ (let ((slug (dream-param req "slug"))) (let ((r (host/blog-get slug))) (if r - (dream-html - (host/blog--page (get r :title) - (quasiquote - (div - (article (raw! (unquote (host/blog-render r)))) - (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" - (a :href (unquote (str "/" slug "/source")) "view source") - " · " - (a :href (unquote (str "/" slug "/edit")) "edit") - " · " - (a :href "/" "all posts") - " · " - (unquote (host/auth-footer req))))))) + ;; Compute the rendered body + related block in let bindings BEFORE the + ;; quasiquote — host/blog--related-block does durable reads, and IO must + ;; happen in the handler body, not while the page tree is being built. + (let ((body-html (host/blog-render r)) + (related-block (host/blog--related-block slug))) + (dream-html + (host/blog--page (get r :title) + (quasiquote + (div + (article (raw! (unquote body-html))) + (unquote related-block) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" + (a :href (unquote (str "/" slug "/source")) "view source") + " · " + (a :href (unquote (str "/" slug "/edit")) "edit") + " · " + (a :href "/" "all posts") + " · " + (unquote (host/auth-footer req)))))))) (dream-html-status 404 (host/blog--page "Not found" (quasiquote @@ -266,9 +348,40 @@ (fn (req) (let ((slug (dream-param req "slug"))) (if (host/blog-exists? slug) - (begin (host/blog-delete! slug) (host/ok {:slug slug :deleted true})) + (begin + ;; drop the post's related edges so no dangling links survive it + (for-each (fn (o) (host/blog-unrelate! slug o)) (host/blog-related slug)) + (host/blog-delete! slug) + (host/ok {:slug slug :deleted true})) (host/error 404 "no such post"))))) +;; POST //relate — relate this post to another (form field `other` = slug). +;; Validated: the other post must exist and differ; otherwise it's a no-op. Always +;; redirects back to the edit page. Guarded like the other browser write routes. +(define host/blog-relate-submit + (fn (req) + (let ((slug (dream-param req "slug")) + (other (dream-form-field req "other"))) + (if (nil? (host/blog-get slug)) + (dream-html-status 404 + (host/blog--page "Not found" + (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) + (begin + (when (and other (not (= other "")) (not (= other slug)) (host/blog-exists? other)) + (host/blog-relate! slug other)) + (dream-redirect (str "/" slug "/edit"))))))) + +;; POST //unrelate — remove the relation to `other`. Idempotent; redirects +;; back to the edit page. +(define host/blog-unrelate-submit + (fn (req) + (let ((slug (dream-param req "slug")) + (other (dream-form-field req "other"))) + (begin + (when (and other (not (= other ""))) + (host/blog-unrelate! slug other)) + (dream-redirect (str "/" slug "/edit")))))) + ;; GET //edit — edit form pre-filled with the post's current title, raw ;; sx_content (in a textarea — render-to-html escapes the text child, so the ;; browser shows the source verbatim), and status (current value pre-selected). @@ -282,7 +395,10 @@ (host/blog--page "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (let ((status (get r :status))) - (let ((mk-opt + ;; related-editor does durable reads — compute it here, not in the + ;; quasiquote, so IO stays in the handler body. + (let ((related-editor (host/blog--related-editor slug)) + (mk-opt (fn (val label) (if (= val status) (quasiquote (option :value (unquote val) :selected "selected" (unquote label))) @@ -303,7 +419,9 @@ (unquote (mk-opt "published" "Published"))) " " (button :type "submit" "Save"))) - (p (a :href (unquote (str "/" slug "/")) "view post") + (unquote related-editor) + (p :style "margin-top:1.5em" + (a :href (unquote (str "/" slug "/")) "view post") " · " (a :href (unquote (str "/" slug "/source")) "view source"))))))))))))) @@ -368,6 +486,8 @@ (dream-post "/new" (host/blog--protect-html resolve host/blog-form-submit)) (dream-get "/:slug/edit" (host/blog--protect-html resolve host/blog-edit-form)) (dream-post "/:slug/edit" (host/blog--protect-html resolve host/blog-edit-submit)) + (dream-post "/:slug/relate" (host/blog--protect-html resolve host/blog-relate-submit)) + (dream-post "/:slug/unrelate" (host/blog--protect-html resolve host/blog-unrelate-submit)) (dream-post "/posts" (host/blog--protect resolve host/blog-create)) (dream-put "/posts/:slug" (host/blog--protect resolve host/blog-update-handler)) (dream-delete "/posts/:slug" (host/blog--protect resolve host/blog-delete-handler))))) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 68618b03..e98c9c1f 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -211,6 +211,44 @@ (host-bl-test "GET /logout -> 303" (dream-status (host-bl-app (host-bl-req "/logout"))) 303) +;; -- relate posts (blog × relations) -- +;; my-first-post and another-one both exist in the write-test store at this point. +(host-bl-test "relate no auth -> redirect to login" + (dream-status (host-bl-wapp (host-bl-send "POST" "/my-first-post/relate" nil + "application/x-www-form-urlencoded" "other=another-one"))) 303) +(host-bl-test "relate authed -> 303 back to edit" + (dream-resp-header (host-bl-wapp (host-bl-send "POST" "/my-first-post/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=another-one")) "location") + "/my-first-post/edit") +(host-bl-test "related is symmetric (a -> b)" + (contains? (host/blog-related "my-first-post") "another-one") true) +(host-bl-test "related is symmetric (b -> a)" + (contains? (host/blog-related "another-one") "my-first-post") true) +(host-bl-test "post page shows a Related posts block" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/"))) "Related posts") true) +(host-bl-test "post page links the related post" + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/my-first-post/"))) "/another-one/") true) +(host-bl-test "relate nonexistent other -> no-op" + (begin + (host-bl-wapp (host-bl-send "POST" "/my-first-post/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=ghost-post")) + (contains? (host/blog-related "my-first-post") "ghost-post")) + false) +(host-bl-test "unrelate -> removes the link both ways" + (begin + (host-bl-wapp (host-bl-send "POST" "/my-first-post/unrelate" "Bearer good" + "application/x-www-form-urlencoded" "other=another-one")) + (list (contains? (host/blog-related "my-first-post") "another-one") + (contains? (host/blog-related "another-one") "my-first-post"))) + (list false false)) +(host-bl-test "delete cleans up related edges" + (begin + (host-bl-wapp (host-bl-send "POST" "/my-first-post/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=another-one")) + (host-bl-wapp (host-bl-send "DELETE" "/posts/another-one" "Bearer good" "" "")) + (contains? (host/blog-related "my-first-post") "another-one")) + false) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 04aa537c7b00ba328e2548c867bec32d62687ce0 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 26 Jun 2026 10:53:54 +0000 Subject: [PATCH 032/138] host: logged-in "add related" hint + filterable infinite-scroll relate picker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make relating discoverable and pleasant: a hint on posts with no relations, and a real candidate picker on the edit page. - post page: when a post has no relations AND the viewer is logged in, show a subtle "No related posts yet — add some" hint linking to the edit page; anonymous viewers still see nothing. - GET //relate-options?q=&offset= — SX endpoint returning one page of candidate rows (HTML
    • fragment): every post except itself and ones already related, narrowed by q (case-insensitive title/slug substring), title-sorted, paginated by host/blog--picker-limit. Public read; the relate POST stays guarded. - GET /relate-picker.js — small vanilla glue (debounced live filter + scroll-to-load-more) served from a route. The host serves static HTML (no SX island hydration), so the interactive layer is a cached script, not an island; data-slug on the input carries the post to it. - edit page: the plain "slug to relate" box becomes a filter input + scrollable results list (#relate-filter/#relate-results) populated by the script; each row is a one-click relate form. 8 tests: endpoint lists/excludes-self/filters-by-q/excludes-already-related, JS route content-type + glue, hint shown logged-in / hidden anonymous. 238/238. Verified live: hint (logged-in only), candidate rows, q=filter, JS route (node --check OK), edit picker UI with data-slug. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 116 ++++++++++++++++++++++++++++++++++------- lib/host/tests/blog.sx | 28 ++++++++++ 2 files changed, 124 insertions(+), 20 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 7e87fa76..384c174a 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -115,6 +115,64 @@ (map (fn (n) (substr (symbol->string n) 5)) (filter (fn (n) (starts-with? (symbol->string n) "blog:")) kids))))))) +;; ── relate picker (filterable, paginated candidate list) ──────────── +;; Candidates to relate `slug` to: every post except itself and ones already +;; related, narrowed by `q` (case-insensitive substring of title or slug), +;; title-sorted. One page is `host/blog--picker-limit` rows from `offset`. +(define host/blog--picker-limit 20) +(define host/blog--relate-candidates + (fn (slug q) + (let ((already (host/blog-related slug)) + (ql (lower (or q "")))) + (let ((cands + (filter + (fn (p) + (and (not (= (get p :slug) slug)) + (not (contains? already (get p :slug))) + (or (= ql "") + (contains? (lower (get p :title)) ql) + (contains? (get p :slug) ql)))) + (host/blog-list)))) + ;; title-sort via [title slug] pairs (sort compares the title first) + (map (fn (pair) {:slug (nth pair 1) :title (nth pair 0)}) + (sort (map (fn (p) (list (get p :title) (get p :slug))) cands))))))) + +;; One candidate row: a tiny form whose button adds the relation (POST /relate). +(define host/blog--picker-item + (fn (slug p) + (quasiquote + (li :style "border-bottom:1px solid #eee" + (form :method "post" :style "margin:0" + :action (unquote (str "/" slug "/relate")) + (input :type "hidden" :name "other" :value (unquote (get p :slug))) + (button :type "submit" + :style "width:100%;text-align:left;background:none;border:none;padding:0.5em;cursor:pointer" + (unquote (get p :title)))))))) + +;; GET //relate-options?q=&offset= — one page of candidate rows as an HTML +;; fragment (the
    • s the picker script appends). Public read (same data as +;; /posts); the relate action itself stays guarded. +(define host/blog-relate-options + (fn (req) + (let ((slug (dream-param req "slug")) + (q (or (dream-query-param req "q") "")) + (offset (host/query-int req "offset" 0))) + (let ((page (take (drop (host/blog--relate-candidates slug q) offset) + host/blog--picker-limit))) + (dream-html + (join "" (map (fn (p) (render-page (host/blog--picker-item slug p))) page))))))) + +;; GET /relate-picker.js — progressive-enhancement glue for the edit-page picker: +;; debounced live filter + scroll-to-load-more against //relate-options. The +;; host serves static HTML (no SX hydration), so the interactive layer is a small +;; vanilla script served from this route (read once, cached). +(define host/blog-picker-js-src + "(function(){var f=document.getElementById('relate-filter');if(!f)return;var r=document.getElementById('relate-results');var slug=f.getAttribute('data-slug'),off=0,q='',busy=false,done=false,t;function load(reset){if(busy||(!reset&&done))return;busy=true;if(reset){off=0;done=false;}fetch('/'+slug+'/relate-options?q='+encodeURIComponent(q)+'&offset='+off).then(function(x){return x.text();}).then(function(h){var d=document.createElement('div');d.innerHTML=h;var n=d.children.length;if(reset)r.innerHTML='';while(d.firstChild)r.appendChild(d.firstChild);off+=n;done=n<20;busy=false;}).catch(function(){busy=false;});}f.addEventListener('input',function(){clearTimeout(t);t=setTimeout(function(){q=f.value.trim();load(true);},200);});r.addEventListener('scroll',function(){if(r.scrollTop+r.clientHeight>=r.scrollHeight-40){load(false);}});load(true);})();") +(define host/blog-picker-js + (fn (req) + (dream-response 200 {:content-type "application/javascript; charset=utf-8"} + host/blog-picker-js-src))) + ;; ── page shell ────────────────────────────────────────────────────── ;; A page is an SX element tree, rendered via render-page (5.1). The handler ;; builds the tree (running any dynamic logic in the full evaluator, e.g. a posts @@ -129,25 +187,33 @@ (head (meta :charset "utf-8") (title (unquote title))) (body (unquote body)))))))) -;; "Related posts" block for the post page: a list of links, or "" when none. -;; Records (slug+title) are fetched up front so the SX tree is built from -;; in-memory data — no durable read happens while the page tree is rendered. +;; "Related posts" block for the post page: a list of links when there are any; +;; a subtle "add some" hint when there are none AND the viewer is logged in (an +;; editor); nothing for an anonymous viewer. Records (slug+title) are fetched up +;; front so the SX tree is built from in-memory data — no durable read happens +;; while the page tree is rendered. (define host/blog--related-block - (fn (slug) + (fn (slug logged-in) (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) (host/blog-related slug)))) - (if (> (len rel) 0) - (let ((items - (map (fn (p) - (quasiquote - (li (a :href (unquote (str "/" (get p :slug) "/")) - (unquote (get p :title)))))) - rel))) + (cond + ((> (len rel) 0) + (let ((items + (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + rel))) + (quasiquote + (div :style "margin-top:2em" + (h3 "Related posts") + (unquote (list (quote ul) items)))))) + (logged-in (quasiquote - (div :style "margin-top:2em" - (h3 "Related posts") - (unquote (list (quote ul) items))))) - "")))) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.7" + "No related posts yet — " + (a :href (unquote (str "/" slug "/edit")) "add some") "."))) + (else ""))))) ;; Related-posts editor for the edit page: current links each with a remove ;; button, plus an "add related" box (relate by slug; the submit validates it). @@ -169,10 +235,17 @@ (button :type "submit" "remove"))))) rel)) (quote (p :style "opacity:0.7" "None yet.")))) - (form :method "post" :action (unquote (str "/" slug "/relate")) - (input :name "other" :placeholder "slug to relate") - " " - (button :type "submit" "Add related"))))))) + ;; add: a filterable, infinite-scrolling picker. The filter input + the + ;; results list are populated by /relate-picker.js (debounced filter, + ;; scroll-to-load) hitting //relate-options; each row's button + ;; POSTs /relate. data-slug carries the post to the script. + (h4 :style "margin-bottom:0.3em" "Add related") + (input :type "text" :id "relate-filter" :data-slug (unquote slug) + :placeholder "filter posts…" :autocomplete "off" + :style "width:100%;padding:0.4em;box-sizing:border-box") + (ul :id "relate-results" + :style "list-style:none;padding:0;margin:0.5em 0;max-height:240px;overflow:auto;border:1px solid #ddd") + (raw! "")))))) ;; ── read handlers ─────────────────────────────────────────────────── ;; Post body is rendered per-block (a guarded HTML string) then injected raw. @@ -185,7 +258,8 @@ ;; quasiquote — host/blog--related-block does durable reads, and IO must ;; happen in the handler body, not while the page tree is being built. (let ((body-html (host/blog-render r)) - (related-block (host/blog--related-block slug))) + (related-block (host/blog--related-block slug + (not (nil? (host/current-principal req)))))) (dream-html (host/blog--page (get r :title) (quasiquote @@ -455,7 +529,9 @@ (dream-get "/" host/blog-home) (dream-get "/posts" host/blog-index) (dream-get "/new" host/blog-new-form) + (dream-get "/relate-picker.js" host/blog-picker-js) (dream-get "/:slug/source" host/blog-source) + (dream-get "/:slug/relate-options" host/blog-relate-options) (dream-get "/:slug" host/blog-post))) ;; Guarded writes: form ingest + JSON create/update/delete behind auth+ACL. diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index e98c9c1f..35965c3c 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -249,6 +249,34 @@ (contains? (host/blog-related "my-first-post") "another-one")) false) +;; -- relate picker (filterable candidate endpoint + glue + hint) -- +(host/blog-put! "alpha-post" "Alpha Post" "(p \"a\")" "published") +(host/blog-put! "beta-post" "Beta Post" "(p \"b\")" "published") +(host/blog-put! "gamma-post" "Gamma Post" "(p \"g\")" "published") +(host-bl-test "relate-options lists other posts" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options"))) "Beta Post") true) +(host-bl-test "relate-options excludes the post itself" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options"))) ">Alpha Post<") false) +(host-bl-test "relate-options filters by q (title substring)" + (let ((body (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options?q=beta"))))) + (list (contains? body "Beta Post") (contains? body "Gamma Post"))) + (list true false)) +(host-bl-test "relate-options excludes already-related candidates" + (begin + (host/blog-relate! "alpha-post" "beta-post") + (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options"))) "Beta Post")) + false) +(host/blog-unrelate! "alpha-post" "beta-post") +(host-bl-test "relate-picker.js served as javascript" + (dream-resp-header (host-bl-app (host-bl-req "/relate-picker.js")) "content-type") + "application/javascript; charset=utf-8") +(host-bl-test "relate-picker.js carries the fetch glue" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/relate-picker.js"))) "relate-options") true) +(host-bl-test "related block: hint when logged-in + no relations" + (contains? (str (host/blog--related-block "gamma-post" true)) "add some") true) +(host-bl-test "related block: empty when anonymous + no relations" + (= (host/blog--related-block "gamma-post" false) "") true) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 697931bf41be42c5ecdb04f66d9dc8c68fa551c4 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 12:07:47 +0000 Subject: [PATCH 033/138] host: Playwright check for the relate picker (+ 2 bugs it caught) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire a browser check for the picker, run it against an ephemeral host server, and fix the two real bugs it surfaced. - lib/host/playwright/relate-picker.spec.js — drives login-redirect-return, JS candidate load + infinite scroll, debounced filter, and click-to-relate (asserting the relation shows on the post page). - lib/host/playwright/run-picker-check.sh — spins up an ephemeral host server (this worktree's binary + lib, temp persist), seeds a host post + 25 candidates, runs the spec in the main worktree's Playwright/chromium, tears everything down. No live-site dependency, no live-data pollution. 4/4 pass. Bugs the check caught: 1. Query params weren't %-decoded — dream's form parser decodes but its query parser doesn't, so a filter "Item 13" arrived as "Item%2013" and matched nothing. Fix: decode q with dream's own dr/url-decode in host/blog-relate- options. (+ conformance test for a spaced filter.) 2. A filter typed while a load was in flight got dropped (busy guard returned with no trailing fetch). Fix: a `pending` flag re-runs the load when the in-flight one finishes, coalescing to the latest query. 239/239 conformance; JS node --check clean. Verified live: spaced filter returns matches; served JS carries the pending-reload fix. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 7 ++- lib/host/playwright/relate-picker.spec.js | 62 ++++++++++++++++++++ lib/host/playwright/run-picker-check.sh | 70 +++++++++++++++++++++++ lib/host/tests/blog.sx | 4 ++ 4 files changed, 141 insertions(+), 2 deletions(-) create mode 100644 lib/host/playwright/relate-picker.spec.js create mode 100755 lib/host/playwright/run-picker-check.sh diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 384c174a..a3bb1521 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -155,7 +155,10 @@ (define host/blog-relate-options (fn (req) (let ((slug (dream-param req "slug")) - (q (or (dream-query-param req "q") "")) + ;; dream's query parser does not %-decode values (its form parser does), + ;; so a filter like "Item 13" arrives as "Item%2013" — decode it with + ;; dream's own dr/url-decode before matching. + (q (dr/url-decode (or (dream-query-param req "q") ""))) (offset (host/query-int req "offset" 0))) (let ((page (take (drop (host/blog--relate-candidates slug q) offset) host/blog--picker-limit))) @@ -167,7 +170,7 @@ ;; host serves static HTML (no SX hydration), so the interactive layer is a small ;; vanilla script served from this route (read once, cached). (define host/blog-picker-js-src - "(function(){var f=document.getElementById('relate-filter');if(!f)return;var r=document.getElementById('relate-results');var slug=f.getAttribute('data-slug'),off=0,q='',busy=false,done=false,t;function load(reset){if(busy||(!reset&&done))return;busy=true;if(reset){off=0;done=false;}fetch('/'+slug+'/relate-options?q='+encodeURIComponent(q)+'&offset='+off).then(function(x){return x.text();}).then(function(h){var d=document.createElement('div');d.innerHTML=h;var n=d.children.length;if(reset)r.innerHTML='';while(d.firstChild)r.appendChild(d.firstChild);off+=n;done=n<20;busy=false;}).catch(function(){busy=false;});}f.addEventListener('input',function(){clearTimeout(t);t=setTimeout(function(){q=f.value.trim();load(true);},200);});r.addEventListener('scroll',function(){if(r.scrollTop+r.clientHeight>=r.scrollHeight-40){load(false);}});load(true);})();") + "(function(){var f=document.getElementById('relate-filter');if(!f)return;var r=document.getElementById('relate-results');var slug=f.getAttribute('data-slug'),off=0,q='',busy=false,done=false,pending=false,t;function load(reset){if(busy){if(reset)pending=true;return;}if(!reset&&done)return;busy=true;if(reset){off=0;done=false;}fetch('/'+slug+'/relate-options?q='+encodeURIComponent(q)+'&offset='+off).then(function(x){return x.text();}).then(function(h){var d=document.createElement('div');d.innerHTML=h;var n=d.children.length;if(reset)r.innerHTML='';while(d.firstChild)r.appendChild(d.firstChild);off+=n;done=n<20;busy=false;if(pending){pending=false;load(true);}}).catch(function(){busy=false;if(pending){pending=false;load(true);}});}f.addEventListener('input',function(){clearTimeout(t);t=setTimeout(function(){q=f.value.trim();load(true);},200);});r.addEventListener('scroll',function(){if(r.scrollTop+r.clientHeight>=r.scrollHeight-40){load(false);}});load(true);})();") (define host/blog-picker-js (fn (req) (dream-response 200 {:content-type "application/javascript; charset=utf-8"} diff --git a/lib/host/playwright/relate-picker.spec.js b/lib/host/playwright/relate-picker.spec.js new file mode 100644 index 00000000..17f454a1 --- /dev/null +++ b/lib/host/playwright/relate-picker.spec.js @@ -0,0 +1,62 @@ +// Browser check for the relate picker (lib/host/blog.sx). Runs against an +// ephemeral host server seeded with a host post + 25 candidates by +// run-picker-check.sh, which copies this spec into the Playwright env and sets +// SX_TEST_URL. Exercises the login redirect, the JS-driven candidate load, +// debounced filter, infinite scroll, and click-to-relate. +const { test, expect } = require('playwright/test'); + +const USER = process.env.SX_ADMIN_USER || 'admin'; +const PASS = process.env.SX_ADMIN_PASSWORD || 'letmein'; +const HOST = 'picker-host'; // the post whose edit page we drive +const LIMIT = 20; // host/blog--picker-limit + +// Navigate to a guarded path; the host redirects to /login?next=…, so fill the +// form and we should land back on the original path (exercises the auth flow). +async function loginTo(page, path) { + await page.goto(path); + await page.waitForURL(/\/login/); + await page.fill('input[name="username"]', USER); + await page.fill('input[name="password"]', PASS); + await page.click('button[type="submit"]'); + await page.waitForURL((u) => !u.pathname.startsWith('/login')); +} + +test.describe('relate picker', () => { + test('login redirect returns to the edit page', async ({ page }) => { + await loginTo(page, `/${HOST}/edit`); + await expect(page).toHaveURL(new RegExp(`/${HOST}/edit`)); + await expect(page.locator('#relate-filter')).toBeVisible(); + }); + + test('picker loads a page of candidates then loads more on scroll', async ({ page }) => { + await loginTo(page, `/${HOST}/edit`); + const rows = page.locator('#relate-results li'); + // initial JS load fills exactly one page + await expect.poll(() => rows.count(), { timeout: 8000 }).toBe(LIMIT); + // scroll the results box to the bottom -> infinite scroll fetches the rest + await page.locator('#relate-results').evaluate((el) => el.scrollTo(0, el.scrollHeight)); + await expect.poll(() => rows.count(), { timeout: 8000 }).toBeGreaterThan(LIMIT); + }); + + test('typing in the filter narrows the candidates', async ({ page }) => { + await loginTo(page, `/${HOST}/edit`); + await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBeGreaterThan(0); + await page.fill('#relate-filter', 'Item 13'); + await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBe(1); + await expect(page.locator('#relate-results')).toContainText('Picker Item 13'); + }); + + test('clicking a candidate relates it (and it shows on the post page)', async ({ page }) => { + await loginTo(page, `/${HOST}/edit`); + await page.fill('#relate-filter', 'Item 07'); + await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBe(1); + await page.locator('#relate-results button').first().click(); + // form POST -> 303 back to the edit page; the related list now links the slug + await expect(page).toHaveURL(new RegExp(`/${HOST}/edit`)); + await expect(page.locator('a[href="/picker-item-07/"]')).toHaveCount(1); + // and the public post page shows the Related posts block with the title + await page.goto(`/${HOST}/`); + await expect(page.getByRole('heading', { name: 'Related posts' })).toBeVisible(); + await expect(page.locator('body')).toContainText('Picker Item 07'); + }); +}); diff --git a/lib/host/playwright/run-picker-check.sh b/lib/host/playwright/run-picker-check.sh new file mode 100755 index 00000000..4de0372c --- /dev/null +++ b/lib/host/playwright/run-picker-check.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +# Browser check for the relate picker. Spins up an EPHEMERAL host server (this +# worktree's binary + lib, a temp persist dir), seeds a host post + 25 candidates, +# runs lib/host/playwright/relate-picker.spec.js in the main worktree's Playwright, +# then tears everything down. No live-site dependency, no live-data pollution. +# +# bash lib/host/playwright/run-picker-check.sh +# +# Requires: the OCaml binary built (hosts/ocaml/_build/default/bin/sx_server.exe) +# and Playwright + chromium in /root/rose-ash (the architecture worktree). +set -uo pipefail +cd "$(git rev-parse --show-toplevel)" +ROOT=$(pwd) + +PORT="${PICKER_PORT:-8912}" +PW_DIR="${PW_DIR:-/root/rose-ash}" # worktree that has node_modules + chromium +USER="admin" +PASS="picker-check-pw" +SECRET="picker-check-secret" +PDIR=$(mktemp -d) +JAR=$(mktemp) +SPEC_SRC="lib/host/playwright/relate-picker.spec.js" +SPEC_DST="$PW_DIR/tests/playwright/_picker-check.spec.js" +SERVE_LOG=$(mktemp) + +cleanup() { + [ -n "${SVPID:-}" ] && kill "$SVPID" 2>/dev/null + # kill whatever is still bound to the port (serve.sh re-parents via `| exec`) + local pid + pid=$(ss -lptn "sport = :$PORT" 2>/dev/null | grep -oE 'pid=[0-9]+' | head -1 | cut -d= -f2) + [ -n "$pid" ] && kill "$pid" 2>/dev/null + rm -f "$SPEC_DST" "$JAR" "$SERVE_LOG" + rm -rf "$PDIR" +} +trap cleanup EXIT + +echo "== starting ephemeral host server on :$PORT (persist=$PDIR) ==" +HOST_PORT="$PORT" SX_PERSIST_DIR="$PDIR" \ + SX_ADMIN_USER="$USER" SX_ADMIN_PASSWORD="$PASS" SX_SESSION_SECRET="$SECRET" \ + bash lib/host/serve.sh >"$SERVE_LOG" 2>&1 & +SVPID=$! + +for i in $(seq 1 60); do + curl -sf -o /dev/null "http://127.0.0.1:$PORT/health" 2>/dev/null && break + sleep 1 + [ "$i" = "60" ] && { echo "server never came up:"; cat "$SERVE_LOG"; exit 1; } +done +echo "== server up ==" + +echo "== seeding 1 host post + 25 candidates ==" +curl -s -c "$JAR" -o /dev/null -X POST "http://127.0.0.1:$PORT/login" \ + --data "username=$USER&password=$PASS" +curl -s -b "$JAR" -o /dev/null -X POST "http://127.0.0.1:$PORT/new" \ + --data 'title=Picker Host&sx_content=(p "host")&status=published' +for n in $(seq -w 1 25); do + curl -s -b "$JAR" -o /dev/null -X POST "http://127.0.0.1:$PORT/new" \ + --data "title=Picker Item $n&sx_content=(p \"item $n\")&status=published" +done +echo "== seeded ($(curl -s "http://127.0.0.1:$PORT/posts" | grep -o '"slug"' | wc -l) posts) ==" + +echo "== running Playwright ==" +cp "$ROOT/$SPEC_SRC" "$SPEC_DST" +cd "$PW_DIR" +SX_TEST_URL="http://127.0.0.1:$PORT" SX_ADMIN_USER="$USER" SX_ADMIN_PASSWORD="$PASS" \ + node_modules/.bin/playwright test _picker-check.spec.js --workers=1 \ + --config tests/playwright/playwright.config.js +RC=$? + +echo "== done (exit $RC) ==" +exit $RC diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 35965c3c..dc59fe39 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -261,6 +261,10 @@ (let ((body (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options?q=beta"))))) (list (contains? body "Beta Post") (contains? body "Gamma Post"))) (list true false)) +(host-bl-test "relate-options filter url-decodes q (spaces)" + (let ((body (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options?q=Beta%20Post"))))) + (list (contains? body "Beta Post") (contains? body "Gamma Post"))) + (list true false)) (host-bl-test "relate-options excludes already-related candidates" (begin (host/blog-relate! "alpha-post" "beta-post") From dc0cf0b4cce452eb6178399f1612ef8237e24eb6 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 16:21:14 +0000 Subject: [PATCH 034/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=201,=20generalize=20edges=20to=20carry=20a=20kind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plan: plans/typed-posts-and-relations.md. "Typing is just relating to a type", types are posts. Phase 1 lifts the hard-coded kind:"related" into a parameter, driven by one registry — the spine the later phases (type resolution, tags, picker) build on. Zero user-visible change. - host/blog-rel-kinds registry: {kind,label,symmetric,candidates[,inverse-label]} for related (symmetric) / is-a / tagged (directed). One place knows each kind's direction, label, and candidate set. - host/blog-relate!/unrelate! take a kind; symmetric kinds write both directions, directed kinds write one. host/blog-out/in read children/parents per kind; host/blog-related = out(slug,"related") (back-compat). - relate/unrelate routes carry a `kind` form field (default "related"), validated against the registry. delete drops edges across ALL kinds + both directions. 6 tests: symmetric reads both sides, directed writes one (inverse via host/blog-in), unrelate is kind-scoped, unknown kind rejected, default kind = related. 244/244; Playwright picker 4/4 (related path unchanged). Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 124 ++++++++++++++++++++--------- lib/host/tests/blog.sx | 38 ++++++++- plans/typed-posts-and-relations.md | 96 ++++++++++++++++++++++ 3 files changed, 218 insertions(+), 40 deletions(-) create mode 100644 plans/typed-posts-and-relations.md diff --git a/lib/host/blog.sx b/lib/host/blog.sx index a3bb1521..0d874db6 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -85,35 +85,68 @@ (else (host/blog--render-node tree)))) (str "

      (empty post)

      "))))) ;; ── related posts (blog × relations) ──────────────────────────────── -;; A "related" link between two posts is a SYMMETRIC pair of edges in the -;; relations graph (lib/relations): node = "blog:", kind = related. Edges go -;; both ways so "related posts" reads the same from either side via children alone -;; — composing two already-migrated domains (blog + relations) on the host. -(define host/blog--rel-kind (string->symbol "related")) +;; Every link between posts is a typed edge in the relations graph (lib/relations): +;; node = "blog:", kind = a relation kind. "related" is symmetric; directed +;; kinds (is-a, tagged) carry meaning by direction. The registry below is the one +;; place that knows each kind's direction, label, and candidate set — relate, the +;; picker, and rendering all read from it (see plans/typed-posts-and-relations.md). +;; "Typing is just relating to a type": classification is an is-a/tagged edge to a +;; type-post, and types ARE posts (same blog: namespace). (define host/blog--node (fn (slug) (string->symbol (str "blog:" slug)))) -(define host/blog-relate! - (fn (a b) - (begin - (relations/relate (host/blog--node a) (host/blog--node b) host/blog--rel-kind) - (relations/relate (host/blog--node b) (host/blog--node a) host/blog--rel-kind)))) -(define host/blog-unrelate! - (fn (a b) - (begin - (relations/unrelate (host/blog--node a) (host/blog--node b) host/blog--rel-kind) - (relations/unrelate (host/blog--node b) (host/blog--node a) host/blog--rel-kind)))) +(define host/blog-rel-kinds + (list + {:kind "related" :label "Related posts" :symmetric true :candidates "all"} + {:kind "is-a" :label "Types" :symmetric false :candidates "types" + :inverse-label "Instances"} + {:kind "tagged" :label "Tags" :symmetric false :candidates "tags" + :inverse-label "Tagged with this"})) -;; related slugs for a post: blog children under "related", stripped to slug, and -;; limited to posts that still exist (a deleted post can leave a dangling edge). -;; Existence is checked against ONE kv-keys read (host/blog-slugs), not a perform -;; per candidate — keeping IO out of the inner filter. -(define host/blog-related - (fn (slug) +;; registry lookup; nil for an unknown kind (relate validates against this) +(define host/blog--kind-spec + (fn (kind) + (reduce (fn (acc k) (if (= (get k :kind) kind) k acc)) nil host/blog-rel-kinds))) +(define host/blog--kind-symmetric? + (fn (kind) (let ((s (host/blog--kind-spec kind))) (and s (get s :symmetric))))) + +;; ── edges (parameterised by kind) ─────────────────────────────────── +;; A symmetric kind writes both directions, so children alone read it from either +;; side; a directed kind writes one edge (the inverse is host/blog-in). +(define host/blog-relate! + (fn (a b kind) + (let ((k (string->symbol kind))) + (begin + (relations/relate (host/blog--node a) (host/blog--node b) k) + (when (host/blog--kind-symmetric? kind) + (relations/relate (host/blog--node b) (host/blog--node a) k)))))) +(define host/blog-unrelate! + (fn (a b kind) + (let ((k (string->symbol kind))) + (begin + (relations/unrelate (host/blog--node a) (host/blog--node b) k) + (when (host/blog--kind-symmetric? kind) + (relations/unrelate (host/blog--node b) (host/blog--node a) k)))))) + +;; nodes -> existing blog slugs: strip "blog:", drop non-blog and deleted targets. +;; Existence is one kv-keys read (host/blog-slugs), NOT a perform per candidate — +;; keeping IO out of the inner filter (and out of the page-render quasiquote). +(define host/blog--edge-slugs + (fn (nodes) (let ((existing (host/blog-slugs))) - (let ((kids (relations/children (host/blog--node slug) host/blog--rel-kind))) - (filter (fn (s) (contains? existing s)) - (map (fn (n) (substr (symbol->string n) 5)) - (filter (fn (n) (starts-with? (symbol->string n) "blog:")) kids))))))) + (filter (fn (s) (contains? existing s)) + (map (fn (n) (substr (symbol->string n) 5)) + (filter (fn (n) (starts-with? (symbol->string n) "blog:")) nodes)))))) + +;; outgoing targets / incoming sources of `slug` under `kind`, as slug lists. +(define host/blog-out + (fn (slug kind) + (host/blog--edge-slugs (relations/children (host/blog--node slug) (string->symbol kind))))) +(define host/blog-in + (fn (slug kind) + (host/blog--edge-slugs (relations/parents (host/blog--node slug) (string->symbol kind))))) + +;; back-compat: "related posts" is just the symmetric "related" kind. +(define host/blog-related (fn (slug) (host/blog-out slug "related"))) ;; ── relate picker (filterable, paginated candidate list) ──────────── ;; Candidates to relate `slug` to: every post except itself and ones already @@ -421,42 +454,57 @@ (host/error 400 "invalid payload"))))) ;; DELETE /posts/ +;; drop every edge touching `slug`, across all kinds + both directions, so a +;; deleted post leaves no dangling links anywhere in the graph. +(define host/blog--drop-all-edges! + (fn (slug) + (for-each + (fn (spec) + (let ((kind (get spec :kind))) + (begin + (for-each (fn (o) (host/blog-unrelate! slug o kind)) (host/blog-out slug kind)) + (for-each (fn (o) (host/blog-unrelate! o slug kind)) (host/blog-in slug kind))))) + host/blog-rel-kinds))) + (define host/blog-delete-handler (fn (req) (let ((slug (dream-param req "slug"))) (if (host/blog-exists? slug) (begin - ;; drop the post's related edges so no dangling links survive it - (for-each (fn (o) (host/blog-unrelate! slug o)) (host/blog-related slug)) + (host/blog--drop-all-edges! slug) (host/blog-delete! slug) (host/ok {:slug slug :deleted true})) (host/error 404 "no such post"))))) -;; POST //relate — relate this post to another (form field `other` = slug). -;; Validated: the other post must exist and differ; otherwise it's a no-op. Always -;; redirects back to the edit page. Guarded like the other browser write routes. +;; POST //relate — relate this post to another (form `other` = slug, `kind` = +;; relation kind, default "related"). Validated: kind must be a known kind and the +;; other post must exist and differ; otherwise a no-op. Redirects back to the edit +;; page. Guarded like the other browser write routes. (define host/blog-relate-submit (fn (req) (let ((slug (dream-param req "slug")) - (other (dream-form-field req "other"))) + (other (dream-form-field req "other")) + (kind (or (dream-form-field req "kind") "related"))) (if (nil? (host/blog-get slug)) (dream-html-status 404 (host/blog--page "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (begin - (when (and other (not (= other "")) (not (= other slug)) (host/blog-exists? other)) - (host/blog-relate! slug other)) + (when (and other (not (= other "")) (not (= other slug)) + (host/blog--kind-spec kind) (host/blog-exists? other)) + (host/blog-relate! slug other kind)) (dream-redirect (str "/" slug "/edit"))))))) -;; POST //unrelate — remove the relation to `other`. Idempotent; redirects -;; back to the edit page. +;; POST //unrelate — remove the relation to `other` under `kind` (default +;; "related"). Idempotent; redirects back to the edit page. (define host/blog-unrelate-submit (fn (req) (let ((slug (dream-param req "slug")) - (other (dream-form-field req "other"))) + (other (dream-form-field req "other")) + (kind (or (dream-form-field req "kind") "related"))) (begin - (when (and other (not (= other ""))) - (host/blog-unrelate! slug other)) + (when (and other (not (= other "")) (host/blog--kind-spec kind)) + (host/blog-unrelate! slug other kind)) (dream-redirect (str "/" slug "/edit")))))) ;; GET //edit — edit form pre-filled with the post's current title, raw diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index dc59fe39..bf78240c 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -267,10 +267,10 @@ (list true false)) (host-bl-test "relate-options excludes already-related candidates" (begin - (host/blog-relate! "alpha-post" "beta-post") + (host/blog-relate! "alpha-post" "beta-post" "related") (contains? (dream-resp-body (host-bl-app (host-bl-req "/alpha-post/relate-options"))) "Beta Post")) false) -(host/blog-unrelate! "alpha-post" "beta-post") +(host/blog-unrelate! "alpha-post" "beta-post" "related") (host-bl-test "relate-picker.js served as javascript" (dream-resp-header (host-bl-app (host-bl-req "/relate-picker.js")) "content-type") "application/javascript; charset=utf-8") @@ -281,6 +281,40 @@ (host-bl-test "related block: empty when anonymous + no relations" (= (host/blog--related-block "gamma-post" false) "") true) +;; -- Phase 1: relations carry a kind -- +(host-bl-test "symmetric kind (related) reads from both sides" + (begin + (host/blog-relate! "alpha-post" "gamma-post" "related") + (list (contains? (host/blog-out "alpha-post" "related") "gamma-post") + (contains? (host/blog-out "gamma-post" "related") "alpha-post"))) + (list true true)) +(host-bl-test "directed kind (tagged) writes one direction; inverse via host/blog-in" + (begin + (host/blog-relate! "alpha-post" "beta-post" "tagged") + (list (contains? (host/blog-out "alpha-post" "tagged") "beta-post") + (contains? (host/blog-out "beta-post" "tagged") "alpha-post") + (contains? (host/blog-in "beta-post" "tagged") "alpha-post"))) + (list true false true)) +(host-bl-test "unrelate is kind-scoped (related edge survives a tagged unrelate)" + (begin + (host/blog-unrelate! "alpha-post" "beta-post" "tagged") + (list (contains? (host/blog-out "alpha-post" "tagged") "beta-post") + (contains? (host/blog-out "alpha-post" "related") "gamma-post"))) + (list false true)) +(host/blog-unrelate! "alpha-post" "gamma-post" "related") +(host-bl-test "relate-submit rejects an unknown kind (no-op)" + (begin + (host-bl-wapp (host-bl-send "POST" "/alpha-post/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=beta-post&kind=bogus")) + (contains? (host/blog-out "alpha-post" "bogus") "beta-post")) + false) +(host-bl-test "default kind is related (no kind field)" + (begin + (host-bl-wapp (host-bl-send "POST" "/alpha-post/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=beta-post")) + (contains? (host/blog-out "alpha-post" "related") "beta-post")) + true) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) diff --git a/plans/typed-posts-and-relations.md b/plans/typed-posts-and-relations.md new file mode 100644 index 00000000..21f3320d --- /dev/null +++ b/plans/typed-posts-and-relations.md @@ -0,0 +1,96 @@ +# Typed posts & relations — typing is just relating to a type + +> host-on-sx. Driving idea: **classification is a relation to a type node, and +> types are posts.** Everything (related, tag, category, series, type) becomes a +> typed edge in `lib/relations` over `blog:` nodes. One primitive. + +## Decisions + +- **Types are posts.** No new node namespace — content-posts and type/tag posts + are all `blog:`. A "tag" is a post; tagging documents itself. +- **`is-a` is the typing edge; `tagged` is membership.** Kept distinct so a tag + page can list members without conflating "ocaml is a tag" with "hello is + tagged ocaml". +- **Hierarchy is core, not deferred.** `is-a`/`subtype-of` transitive closure via + `lib/relations` reachability is what makes typing-as-relation more than flat + labels. All typing helpers are transitive from the first line, or subtypes + silently break candidate/`is-a?` checks later. +- **Validation is gradual, not deferred.** A type-post *optionally* carries a + schema slot; validation runs only where one exists. Tags declare none (stay + folksonomy-free); `article` can declare "needs a heading". The hook lands with + the type phase (reusing `host/blog-content-ok?`); only schema *expressiveness* + grows over time. This closes the nominal/structural loop: the declared `is-a` + edge is a claim, the validator checks the content honors it. +- **Scalars stay fields.** `status`/`title`/`sx_content` remain fields, not edges + — listings filter on them constantly and `lib/relations` re-saturates Datalog + per query. Links-to-shared-nodes → edges; per-post hot scalars → fields. + +## The linchpin: a relation-kind registry + +One data structure drives validation, the picker candidate sets, and rendering: + +``` +host/blog-rel-kinds = + ({:kind "related" :label "Related posts" :symmetric true :candidates "all"} + {:kind "is-a" :label "Types" :symmetric false :candidates "types" + :inverse-label "Instances"} + {:kind "tagged" :label "Tags" :symmetric false :candidates "tags" + :inverse-label "Tagged with this"}) +``` + +`:symmetric` → write both directions on relate. `:candidates` → what the picker +offers (`all` = every post; `tags` = `is-a? blog:tag` transitively; `types` = +`is-a? blog:type`). `:label`/`:inverse-label` → headings. + +## Phases + +### Phase 1 — Kind generalization + registry ← START HERE +Pure refactor; zero user-visible change (related keeps working). +- `host/blog-rel-kinds` registry + `host/blog--kind-spec`/`--kind-symmetric?`. +- `host/blog-relate!(a,b,kind)` / `unrelate!(a,b,kind)` — directed; symmetric kinds + also write the reverse (today's "related" behavior = the symmetric case). +- `host/blog-out(slug,kind)` (children) / `host/blog-in(slug,kind)` (parents), + existence-filtered. `host/blog-related(slug)` = `out(slug,"related")` (back-compat). +- Routes carry `kind` (form field, default `"related"`); validated against registry. +- `delete` cleanup drops edges across **all** kinds, both directions. + +### Phase 2 — Type resolution via reachability (the spine) +- Seed root type-posts: `blog:type` ("Type") and `blog:tag is-a blog:type`, + each documenting itself. Idempotent seed in `serve.sh`. +- `host/blog-types-of(slug)` = direct `is-a` targets ∪ `subtype-of`-reach of each + (SX-side composition over `lib/relations` reach — no new Datalog rules). +- `host/blog-is-a?(slug, type)` — **transitive**. +- Type-posts carry an optional `:schema` slot (designed now, mostly empty). +- Validation hook: `host/blog-content-ok?` extended to also run any schema(s) + implied by the post's declared types. No schema → no-op (gradual). + +### Phase 3 — Tags as posts +- "is a tag" = `host/blog-is-a? slug "tag"` (transitive). Helpers + `host/blog-tags(slug)` = `out(slug,"tagged")`, `host/blog-tagged-with(tag)` = + `in(tag,"tagged")`. +- Edit page: a "This post is a tag" toggle = add/remove `is-a blog:tag` edge. + +### Phase 4 — Render (data-driven from the registry) +- Post page iterates the registry → "Related posts" + "Tags" blocks, same code. +- Tag-post page: its own content (the tag's documentation) **plus** "Tagged with + this" (incoming `tagged`). A tag page documents the tag AND lists its members. +- Optional `/tags` index = posts `is-a? blog:tag`. + +### Phase 5 — Generalize the picker +- `host/blog--relate-candidates(slug, q, kind)` branches on the kind's + `:candidates` (all / tags / types). +- `relate-options` endpoint takes `&kind=`; picker filter input carries + `data-kind`; `relate-picker.js` forwards it. +- Edit page renders one picker section per kind from the registry. + +### Phase 6 — Schema expressiveness (ongoing) +- Grow the type `:schema` language: start minimal (required block kinds / a + predicate over content), richer later. Enforcement already wired in Phase 2; + only the language grows. Not a blocker — a gradient. + +## Notes +- Node model unchanged (`blog:`); only `kind` varies. The relate machinery, + picker, and post-page block all generalize by lifting the hard-coded + `kind: "related"` into a parameter. +- A type can *be* a post all the way up (`blog:tag is-a blog:type`); meta-circular + but bounded by seeding a small root set. From 71dd040d8038de3d0b4c44bfc5cc4d5ce64fd12e Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 16:25:52 +0000 Subject: [PATCH 035/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=201.5,=20durable=20edge=20store=20+=20boot=20replay?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lib/relations holds the graph in memory only (a Datalog cache), so related/tags/ types were wiped on every restart while the posts (durable KV) survived — fatal for a model where tags and types ARE relations. Make the host the durable source of truth. - every physical edge is also a KV row "edge:||" in the blog store (host/blog--add-edge!/--del-edge! wrap relations/relate+unrelate with kv-put/kv-delete). '|' is safe: slugs are [a-z0-9-], kinds are registry names. - host/blog-load-edges! rebuilds the in-memory graph from edge:* keys; serve.sh calls it on boot right after pointing the store at the durable backend. - lib/relations stays an in-memory cache; the durable KV is the source of truth (same shape as the blog pointing at the durable backend). 3 tests: KV row written on relate, replay rebuilds the graph after an in-memory wipe (restart sim), unrelate deletes the row. 247/247. Verified live: related welcome<->hello, force-recreated the container (wipes the in-memory graph), the relation + its rendered block survived the restart. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 58 ++++++++++++++++++++++++++++++++++-------- lib/host/serve.sh | 6 +++++ lib/host/tests/blog.sx | 18 +++++++++++++ 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 0d874db6..cdad9642 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -109,23 +109,59 @@ (define host/blog--kind-symmetric? (fn (kind) (let ((s (host/blog--kind-spec kind))) (and s (get s :symmetric))))) -;; ── edges (parameterised by kind) ─────────────────────────────────── +;; ── edges (parameterised by kind, DURABLE) ────────────────────────── +;; lib/relations holds the graph in memory (a Datalog cache that re-saturates per +;; query); it does NOT survive a restart. So the host owns the durable source of +;; truth: every physical edge is also a KV row "edge:||" in the +;; blog store, replayed into the in-memory graph on boot (host/blog-load-edges!). +;; '|' is a safe delimiter — slugs are [a-z0-9-], kinds are registry names. +(define host/blog--edge-key (fn (src kind dst) (str "edge:" src "|" kind "|" dst))) + +(define host/blog--add-edge! + (fn (src dst kind) + (begin + (relations/relate (host/blog--node src) (host/blog--node dst) (string->symbol kind)) + (persist/backend-kv-put host/blog-store (host/blog--edge-key src kind dst) 1)))) +(define host/blog--del-edge! + (fn (src dst kind) + (begin + (relations/unrelate (host/blog--node src) (host/blog--node dst) (string->symbol kind)) + (persist/backend-kv-delete host/blog-store (host/blog--edge-key src kind dst))))) + ;; A symmetric kind writes both directions, so children alone read it from either ;; side; a directed kind writes one edge (the inverse is host/blog-in). (define host/blog-relate! (fn (a b kind) - (let ((k (string->symbol kind))) - (begin - (relations/relate (host/blog--node a) (host/blog--node b) k) - (when (host/blog--kind-symmetric? kind) - (relations/relate (host/blog--node b) (host/blog--node a) k)))))) + (begin + (host/blog--add-edge! a b kind) + (when (host/blog--kind-symmetric? kind) (host/blog--add-edge! b a kind))))) (define host/blog-unrelate! (fn (a b kind) - (let ((k (string->symbol kind))) - (begin - (relations/unrelate (host/blog--node a) (host/blog--node b) k) - (when (host/blog--kind-symmetric? kind) - (relations/unrelate (host/blog--node b) (host/blog--node a) k)))))) + (begin + (host/blog--del-edge! a b kind) + (when (host/blog--kind-symmetric? kind) (host/blog--del-edge! b a kind))))) + +;; rebuild the in-memory graph from the durable edge store — called on boot, after +;; the store is pointed at the durable backend. Each "edge:||" key +;; is re-applied directly (both directions of a symmetric kind are stored, so no +;; symmetry re-derivation is needed here). +(define host/blog-load-edges! + (fn () + (for-each + (fn (key) + (let ((body (substr key 5))) ;; drop "edge:" + (let ((p1 (index-of body "|"))) + (when (>= p1 0) + (let ((src (substr body 0 p1)) + (tail (substr body (+ p1 1)))) + (let ((p2 (index-of tail "|"))) + (when (>= p2 0) + (relations/relate + (host/blog--node src) + (host/blog--node (substr tail (+ p2 1))) + (string->symbol (substr tail 0 p2)))))))))) + (filter (fn (k) (starts-with? k "edge:")) + (persist/backend-kv-keys host/blog-store))))) ;; nodes -> existing blog slugs: strip "blog:", drop non-blog and deleted targets. ;; Existence is one kv-keys read (host/blog-slugs), NOT a perform per candidate — diff --git a/lib/host/serve.sh b/lib/host/serve.sh index c31c2dc4..6f2f9811 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -105,6 +105,12 @@ EPOCH=1 echo "(epoch $EPOCH)" echo "(eval \"(host/blog-use-store! (persist/durable-backend))\")" EPOCH=$((EPOCH+1)) + # Rebuild the relations graph from the durable edge store. lib/relations holds + # the graph in memory only, so without this, related/tags/types vanish on every + # restart even though the posts persist. + echo "(epoch $EPOCH)" + echo "(eval \"(host/blog-load-edges!)\")" + EPOCH=$((EPOCH+1)) # Session signing secret + admin login credentials, then grant the admin # principal "edit" on "blog" so a logged-in session passes the ACL gate on the # write routes. Sessions stay IN-MEMORY (default store) — logins reset on diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index bf78240c..da364f7a 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -314,6 +314,24 @@ "application/x-www-form-urlencoded" "other=beta-post")) (contains? (host/blog-out "alpha-post" "related") "beta-post")) true) +(host-bl-test "edges are durable: KV row written on relate" + (begin + (host/blog-relate! "alpha-post" "gamma-post" "tagged") + (persist/backend-kv-has? host/blog-store (host/blog--edge-key "alpha-post" "tagged" "gamma-post"))) + true) +(host-bl-test "replay rebuilds the graph after an in-memory wipe (restart sim)" + (begin + (relations/load! (list)) ;; simulate a fresh process + (host/blog-load-edges!) ;; replay from the durable store + (list (contains? (host/blog-out "alpha-post" "tagged") "gamma-post") + (contains? (host/blog-out "alpha-post" "related") "beta-post") + (contains? (host/blog-out "beta-post" "related") "alpha-post"))) + (list true true true)) +(host-bl-test "unrelate deletes the durable KV row" + (begin + (host/blog-unrelate! "alpha-post" "gamma-post" "tagged") + (persist/backend-kv-has? host/blog-store (host/blog--edge-key "alpha-post" "tagged" "gamma-post"))) + false) ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) From b0b0a0592ba5196165b4e43894778d4c76cab85f Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 16:37:26 +0000 Subject: [PATCH 036/138] =?UTF-8?q?host:=20durable=20lazy=20sessions=20?= =?UTF-8?q?=E2=80=94=20logins=20survive=20a=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sessions were in-memory, so a restart logged everyone out (same class as the relation wipe). Move them to the durable store, but LAZILY so anonymous/crawler traffic doesn't spam it: session/create mints a sid with no row; the row appears on the first session/set (a login). A per-boot epoch (one durable write at startup, host/session-init!) keeps sids unique across restarts without a write per request. - lib/host/session.sx: lazy backend (create = no row, set = create row, exists = row written) + epoch/in-memory-counter sid generation. - serve.sh: point the session store at the durable backend + host/session-init!. - blog.sx: host/current-principal is now a durable read, so host/auth-footer (home + post footers) had to move OUT of the quasiquote into let bindings — a perform during page-tree build raises VmSuspended (the whole site 500'd for a beat). Principal computed once per page. - 2 session tests: create writes no row, set creates the row. 249/249. Verified live: site renders (anon + authed), login + footer survive a container force-recreate. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 49 +++++++++++++++++++++------------------ lib/host/serve.sh | 17 ++++++++++---- lib/host/session.sx | 33 +++++++++++++++++--------- lib/host/tests/session.sx | 12 ++++++++++ 4 files changed, 73 insertions(+), 38 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index cdad9642..5e594eaf 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -326,26 +326,28 @@ (let ((slug (dream-param req "slug"))) (let ((r (host/blog-get slug))) (if r - ;; Compute the rendered body + related block in let bindings BEFORE the - ;; quasiquote — host/blog--related-block does durable reads, and IO must - ;; happen in the handler body, not while the page tree is being built. - (let ((body-html (host/blog-render r)) - (related-block (host/blog--related-block slug - (not (nil? (host/current-principal req)))))) - (dream-html - (host/blog--page (get r :title) - (quasiquote - (div - (article (raw! (unquote body-html))) - (unquote related-block) - (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" - (a :href (unquote (str "/" slug "/source")) "view source") - " · " - (a :href (unquote (str "/" slug "/edit")) "edit") - " · " - (a :href "/" "all posts") - " · " - (unquote (host/auth-footer req)))))))) + ;; Compute everything that does durable reads — body, related block, AND + ;; the auth footer (a durable session read now) — in let bindings BEFORE + ;; the quasiquote. IO must run in the handler body, never while the page + ;; tree is built (a perform there raises VmSuspended under http-listen). + (let ((principal (host/current-principal req))) + (let ((body-html (host/blog-render r)) + (related-block (host/blog--related-block slug (not (nil? principal)))) + (auth-foot (host/auth-footer req))) + (dream-html + (host/blog--page (get r :title) + (quasiquote + (div + (article (raw! (unquote body-html))) + (unquote related-block) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" + (a :href (unquote (str "/" slug "/source")) "view source") + " · " + (a :href (unquote (str "/" slug "/edit")) "edit") + " · " + (a :href "/" "all posts") + " · " + (unquote auth-foot)))))))) (dream-html-status 404 (host/blog--page "Not found" (quasiquote @@ -364,7 +366,10 @@ posts))) (let ((listing (if (> (len posts) 0) (list (quote ul) items) - (quote (p "No posts yet."))))) + (quote (p "No posts yet.")))) + ;; auth-footer does a durable session read — bind it BEFORE the + ;; quasiquote (a perform during tree-build raises VmSuspended). + (auth-foot (host/auth-footer req))) (dream-html (host/blog--page "Blog" (quasiquote @@ -372,7 +377,7 @@ (unquote listing) (p (a :href "/new" "+ New post")) (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" - (unquote (host/auth-footer req)))))))))))) + (unquote auth-foot))))))))))) (define host/blog-index (fn (req) (host/ok (host/blog-list)))) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 6f2f9811..1259d18b 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -111,11 +111,18 @@ EPOCH=1 echo "(epoch $EPOCH)" echo "(eval \"(host/blog-load-edges!)\")" EPOCH=$((EPOCH+1)) - # Session signing secret + admin login credentials, then grant the admin - # principal "edit" on "blog" so a logged-in session passes the ACL gate on the - # write routes. Sessions stay IN-MEMORY (default store) — logins reset on - # restart but the durable KV isn't spammed by anonymous/ crawler sessions - # (lazy session creation is a future lib/dream/session.sx improvement). + # Sessions on the DURABLE store, LAZILY: only a logged-in session (one that + # writes a field) persists, so a login survives a restart while anonymous / + # crawler traffic leaves no rows. host/session-init! bumps the per-boot epoch + # that keeps sids unique across restarts. Then the signing secret + admin + # credentials, and grant admin "edit" on "blog" so a logged-in session passes + # the ACL gate on the write routes. + echo "(epoch $EPOCH)" + echo "(eval \"(host/session-use-store! (persist/durable-backend))\")" + EPOCH=$((EPOCH+1)) + echo "(epoch $EPOCH)" + echo "(eval \"(host/session-init!)\")" + EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" echo "(eval \"(host/session-set-secret! \\\"$SESSION_SECRET\\\")\")" EPOCH=$((EPOCH+1)) diff --git a/lib/host/session.sx b/lib/host/session.sx index 5004617c..86cc5f69 100644 --- a/lib/host/session.sx +++ b/lib/host/session.sx @@ -20,26 +20,37 @@ ;; ── keys ──────────────────────────────────────────────────────────── (define host/-sess-key (fn (sid) (str "session:" sid))) -(define host/-sess-counter-key "session:-counter") +(define host/-sess-epoch-key "session:-epoch") -;; mint the next sid from a persisted counter (signature guards guessability) +;; sid generation: a per-BOOT epoch (one durable write at startup) + an in-memory +;; counter. The epoch keeps sids unique across restarts WITHOUT a write per +;; request, so anonymous traffic costs no disk. host/session-init! bumps the epoch +;; on boot (serve.sh); without it (e.g. tests) epoch 0 is fine within one process. +(define host/session-epoch 0) +(define host/session-ctr 0) +(define host/session-init! + (fn () + (let ((e (+ 1 (or (persist/backend-kv-get host/session-store host/-sess-epoch-key) 0)))) + (begin + (persist/backend-kv-put host/session-store host/-sess-epoch-key e) + (set! host/session-epoch e) + (set! host/session-ctr 0))))) (define host/-sess-next-sid (fn () - (let ((n (+ 1 (or (persist/backend-kv-get host/session-store host/-sess-counter-key) 0)))) - (begin - (persist/backend-kv-put host/session-store host/-sess-counter-key n) - (str "s" n))))) + (begin + (set! host/session-ctr (+ host/session-ctr 1)) + (str "s" host/session-epoch "-" host/session-ctr)))) ;; ── backend io fn: dispatch session/* ops onto the persist KV ─────── +;; LAZY: session/create mints a sid but writes NO row, so an anonymous request +;; (which never sets a field) leaves no durable trace — the store isn't spammed by +;; crawlers. The row appears on the first session/set (i.e. login), so a logged-in +;; session persists and survives a restart; session/exists is "has a written row". (define host/session-backend (fn (op) (let ((kind (get op :op))) (cond - ((= kind "session/create") - (let ((sid (host/-sess-next-sid))) - (begin - (persist/backend-kv-put host/session-store (host/-sess-key sid) {}) - sid))) + ((= kind "session/create") (host/-sess-next-sid)) ((= kind "session/exists") (persist/backend-kv-has? host/session-store (host/-sess-key (get op :sid)))) ((= kind "session/get") diff --git a/lib/host/tests/session.sx b/lib/host/tests/session.sx index 3040792d..0cda1b49 100644 --- a/lib/host/tests/session.sx +++ b/lib/host/tests/session.sx @@ -126,6 +126,18 @@ (dream-status (host-se-secure host-se-live-cookie))) 401) +;; ── lazy persistence: only a written (logged-in) session leaves a durable row ── +(host-se-test "session/create writes no row (anonymous leaves no durable trace)" + (host/session-backend {:op "session/exists" :sid (host/session-backend {:op "session/create"})}) + false) +(host-se-test "session/set creates the row (a login persists)" + (let ((sid (host/session-backend {:op "session/create"}))) + (begin + (host/session-backend {:op "session/set" :sid sid :key :principal :val "bob"}) + (list (host/session-backend {:op "session/exists" :sid sid}) + (host/session-backend {:op "session/get" :sid sid :key :principal})))) + (list true "bob")) + (define host-se-tests-run! (fn () {:total (+ host-se-pass host-se-fail) From cb2fc788d783a8609518e0344f7561de5634ffd2 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 16:49:00 +0000 Subject: [PATCH 037/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=202,=20type=20resolution=20with=20subsumption?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The spine: types ARE posts, and typing is transitive the right way. is-a (instance-of) does NOT chain on its own, but subsumption does — an instance of a subtype is an instance of the supertype. - registry gains "subtype-of" (directed, transitive). host/blog-types-of(slug) = declared is-a targets PLUS every subtype-of-ancestor of each (composed host-side over relations/descendants — no new Datalog rules). host/blog-is-a?(slug,type) is transitive through subtype-of. - host/blog-seed-types! seeds the root type-posts "type" and "tag" (real posts that document themselves) with tag subtype-of type, so anything is-a tag is transitively a type. Idempotent; wired into serve.sh. - gradual-validation seam: host/blog-type-schemas (empty) + host/blog-schema-of + host/blog-type-valid? (vacuously true with no schemas) wired into edit-submit alongside the parse check — enforcement is a one-line add later, not a retrofit. 6 tests: types-of = declared + all subtype-of supertypes; is-a? transitive through subtype-of; is-a alone does NOT chain; instance of tag is transitively a type; type-valid vacuous with no schemas. 255/255. Verified live: /type/ + /tag/ render as posts, tag subtype-of type survived a recreate (durable), ocaml is-a tag. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 61 +++++++++++++++++++++++++++++++++++++++++- lib/host/serve.sh | 4 +++ lib/host/tests/blog.sx | 36 +++++++++++++++++++++++++ 3 files changed, 100 insertions(+), 1 deletion(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 5e594eaf..55134566 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -99,6 +99,8 @@ {:kind "related" :label "Related posts" :symmetric true :candidates "all"} {:kind "is-a" :label "Types" :symmetric false :candidates "types" :inverse-label "Instances"} + {:kind "subtype-of" :label "Subtype of" :symmetric false :candidates "types" + :inverse-label "Subtypes"} {:kind "tagged" :label "Tags" :symmetric false :candidates "tags" :inverse-label "Tagged with this"})) @@ -184,6 +186,60 @@ ;; back-compat: "related posts" is just the symmetric "related" kind. (define host/blog-related (fn (slug) (host/blog-out slug "related"))) +;; ── typing: is-a + subtype-of with subsumption ────────────────────── +;; Typing is just relating to a type, and types ARE posts. A post DECLARES its +;; types with is-a edges; types form a hierarchy with subtype-of edges. is-a +;; (instance-of) is NOT transitive on its own, but subsumption is: an instance of +;; a subtype is an instance of the supertype. So a post's full type set is its +;; declared types PLUS every subtype-of-ancestor of each (relations/descendants +;; follows subtype-of transitively). Keeps the Datalog ruleset minimal — the +;; closure is composed host-side. +(define host/blog--uniq + (fn (xs) (reduce (fn (acc x) (if (contains? acc x) acc (concat acc (list x)))) (list) xs))) + +(define host/blog-types-of + (fn (slug) + (host/blog--uniq + (reduce + (fn (acc t) + (concat (concat acc (list t)) + (host/blog--edge-slugs + (relations/descendants (host/blog--node t) (string->symbol "subtype-of"))))) + (list) + (host/blog-out slug "is-a"))))) + +;; is this post (transitively) of the given type-slug? +(define host/blog-is-a? (fn (slug type) (contains? (host/blog-types-of slug) type))) + +;; ── gradual validation seam ───────────────────────────────────────── +;; A type-post optionally carries a schema: a predicate over content. The map is +;; empty for now — validation is gradual, types accrue schemas later — but the +;; hook lives here so enforcement is a one-line addition, never a retrofit. A post +;; is type-valid when every schema implied by its types accepts the content; with +;; no schemas this is vacuously true, so it costs nothing until a type opts in. +(define host/blog-type-schemas {}) +(define host/blog-schema-of (fn (type-slug) (get host/blog-type-schemas type-slug))) +(define host/blog-type-valid? + (fn (slug content) + (every? + (fn (t) (let ((s (host/blog-schema-of t))) (or (nil? s) (s content)))) + (host/blog-types-of slug)))) + +;; Seed the root type-posts: "type" (the root) and "tag" (a kind of type). Types +;; ARE posts, so these are real posts that document themselves; tag subtype-of +;; type means anything that is-a tag is, transitively, a type. Idempotent — safe +;; to call on every boot (host/blog-seed! no-ops if present, edges are sets). +(define host/blog-seed-types! + (fn () + (begin + (host/blog-seed! "type" "Type" + "(article (h1 \"Type\") (p \"The root type. Types are posts — so this is a post that documents the idea of a type. A post declares its types with is-a edges; types form a hierarchy with subtype-of edges.\"))" + "published") + (host/blog-seed! "tag" "Tag" + "(article (h1 \"Tag\") (p \"A tag is a kind of type (tag subtype-of type), so anything that is-a tag is also a type. A post is tagged with a tag; a tag post documents the tag and lists what is tagged with it.\"))" + "published") + (host/blog-relate! "tag" "type" "subtype-of")))) + ;; ── relate picker (filterable, paginated candidate list) ──────────── ;; Candidates to relate `slug` to: every post except itself and ones already ;; related, narrowed by `q` (case-insensitive substring of title or slug), @@ -604,7 +660,10 @@ (let ((title (or (dream-form-field req "title") (get r :title))) (sx-content (or (dream-form-field req "sx_content") "")) (status (or (dream-form-field req "status") (get r :status)))) - (if (host/blog-content-ok? sx-content) + ;; parse-valid AND type-valid (the post's types' schemas accept the + ;; content — vacuous until a type opts into a schema). + (if (and (host/blog-content-ok? sx-content) + (host/blog-type-valid? slug sx-content)) (begin (host/blog-put! slug title sx-content status) (dream-redirect (str "/" slug "/"))) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 1259d18b..b2a1090d 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -137,6 +137,10 @@ EPOCH=1 echo "(epoch $EPOCH)" echo "(eval \"(host/blog-seed! \\\"welcome\\\" \\\"Welcome to the SX host\\\" \\\"(article (h1 \\\\\\\"Welcome to the SX host\\\\\\\") (p \\\\\\\"Rendered by lib/host via render-to-html, from the durable SX store.\\\\\\\"))\\\" \\\"published\\\")\")" EPOCH=$((EPOCH+1)) + # Seed the root type-posts (type, tag) — types ARE posts. Idempotent. + echo "(epoch $EPOCH)" + echo "(eval \"(host/blog-seed-types!)\")" + EPOCH=$((EPOCH+1)) echo "(epoch $EPOCH)" # Anonymous reads (feed timeline + relations container reads + blog post detail) # plus the GUARDED blog write routes: POST /new (editor form ingest), POST/PUT/ diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index da364f7a..6b8f0f16 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -333,6 +333,42 @@ (persist/backend-kv-has? host/blog-store (host/blog--edge-key "alpha-post" "tagged" "gamma-post"))) false) +;; -- Phase 2: typing with subsumption (is-a + subtype-of) -- +;; ppost --is-a--> ptutorial ; ptutorial --subtype-of--> particle --subtype-of--> pdoc +(host/blog-put! "ptutorial" "P Tutorial" "(p \"t\")" "published") +(host/blog-put! "particle" "P Article" "(p \"a\")" "published") +(host/blog-put! "pdoc" "P Doc" "(p \"d\")" "published") +(host/blog-put! "ppost" "P Post" "(p \"p\")" "published") +(host/blog-relate! "ptutorial" "particle" "subtype-of") +(host/blog-relate! "particle" "pdoc" "subtype-of") +(host/blog-relate! "ppost" "ptutorial" "is-a") +(host-bl-test "types-of = declared type + ALL its subtype-of supertypes" + (list (contains? (host/blog-types-of "ppost") "ptutorial") + (contains? (host/blog-types-of "ppost") "particle") + (contains? (host/blog-types-of "ppost") "pdoc")) + (list true true true)) +(host-bl-test "is-a? is transitive THROUGH subtype-of (subsumption)" + (list (host/blog-is-a? "ppost" "ptutorial") + (host/blog-is-a? "ppost" "pdoc")) + (list true true)) +(host-bl-test "is-a? alone does NOT chain (instance-of is not transitive)" + (begin + (host/blog-put! "pmeta" "P Meta" "(p \"m\")" "published") + (host/blog-relate! "pmeta" "ppost" "is-a") ;; pmeta is-a ppost is-a ptutorial + (host/blog-is-a? "pmeta" "ptutorial")) ;; ... does NOT make pmeta is-a ptutorial + false) +(host-bl-test "is-a? false for an unrelated type" + (host/blog-is-a? "ppost" "particle") true) ;; sanity: this one IS reachable +(host-bl-test "seed-types: an instance of tag is, transitively, a type" + (begin + (host/blog-seed-types!) ;; type, tag, tag subtype-of type + (host/blog-put! "ocaml" "OCaml" "(p \"lang\")" "published") + (host/blog-relate! "ocaml" "tag" "is-a") ;; ocaml is-a tag + (list (host/blog-is-a? "ocaml" "tag") (host/blog-is-a? "ocaml" "type"))) + (list true true)) +(host-bl-test "type-valid? is vacuously true with no schemas (gradual)" + (host/blog-type-valid? "ppost" "(p \"anything\")") true) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 62b7fc1ff0a245cdac1b319053ca50da9dcc70f3 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 17:09:53 +0000 Subject: [PATCH 038/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=203,=20tags=20as=20posts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A tag is just a post that is-a tag; tagging is a "tagged" edge to it. End to end: mark a post a tag, tag posts with it, see a post's tags and a tag's members. - helpers: host/blog-is-tag? (= is-a? slug "tag"), host/blog-tags (out tagged), host/blog-tagged-with (in tagged), host/blog-instances-of (a type's members, O(#subtypes) not O(#posts) — the efficient candidate source). - picker generalised to be KIND-AWARE and MULTI-INSTANCE: relate-options takes &kind=, candidates come from the kind's registry :candidates (all/tags/types); /relate-picker.js wires every .relate-picker box by data-kind (a Related picker and a Tags picker now coexist on the edit page). - render: post page gains a "Tags" block; a tag post additionally lists "Tagged with this" (its members). edit page: a Related editor + a Tags editor + an "is this post a tag" toggle (reuses /relate kind=is-a — no new route). - GOTCHA (again): host/blog--relation-editor read host/blog-out INSIDE its quasiquote -> VmSuspended/500 under http-listen + durable edges; moved the read to a let before the quasiquote (conformance can't see it — in-memory store; the ephemeral Playwright run caught it). 6 conformance tests (is-tag?, instances-of, tag+tagged-with, tagged picker offers only tags, related picker still all, is-a-tag toggle) -> 261/261. Playwright multi-picker 4/4. Verified live: ocaml made a tag, welcome tagged ocaml, Tags block + Tagged-with-this both render. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 201 ++++++++++++++++------ lib/host/playwright/relate-picker.spec.js | 28 +-- lib/host/tests/blog.sx | 26 +++ 3 files changed, 193 insertions(+), 62 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 55134566..5e497819 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -211,6 +211,24 @@ ;; is this post (transitively) of the given type-slug? (define host/blog-is-a? (fn (slug type) (contains? (host/blog-types-of slug) type))) +;; all posts that are (transitively) instances of `type`: instances of the type +;; itself plus instances of any of its subtypes. Computed in O(#subtypes) relation +;; queries, NOT one type-resolution per post — the efficient way to enumerate a +;; type's members (e.g. "all tags") for the picker. +(define host/blog-instances-of + (fn (type) + (let ((subtypes + (concat (list type) + (host/blog--edge-slugs + (relations/ancestors (host/blog--node type) (string->symbol "subtype-of")))))) + (host/blog--uniq + (reduce (fn (acc t) (concat acc (host/blog-in t "is-a"))) (list) subtypes))))) + +;; ── tags (a tag is a post that is-a tag) ──────────────────────────── +(define host/blog-is-tag? (fn (slug) (host/blog-is-a? slug "tag"))) +(define host/blog-tags (fn (slug) (host/blog-out slug "tagged"))) ;; a post's tags +(define host/blog-tagged-with (fn (tag) (host/blog-in tag "tagged"))) ;; posts with a tag + ;; ── gradual validation seam ───────────────────────────────────────── ;; A type-post optionally carries a schema: a predicate over content. The map is ;; empty for now — validation is gradual, types accrue schemas later — but the @@ -245,57 +263,71 @@ ;; related, narrowed by `q` (case-insensitive substring of title or slug), ;; title-sorted. One page is `host/blog--picker-limit` rows from `offset`. (define host/blog--picker-limit 20) -(define host/blog--relate-candidates - (fn (slug q) - (let ((already (host/blog-related slug)) - (ql (lower (or q "")))) - (let ((cands - (filter - (fn (p) - (and (not (= (get p :slug) slug)) - (not (contains? already (get p :slug))) - (or (= ql "") - (contains? (lower (get p :title)) ql) - (contains? (get p :slug) ql)))) - (host/blog-list)))) - ;; title-sort via [title slug] pairs (sort compares the title first) - (map (fn (pair) {:slug (nth pair 1) :title (nth pair 0)}) - (sort (map (fn (p) (list (get p :title) (get p :slug))) cands))))))) +;; The candidate POOL for a kind comes from its registry :candidates: "all" posts, +;; or the members of a type ("tags" = instances of tag, "types" = instances of +;; type). Enumerating a type's members is O(#subtypes), not O(#posts). +(define host/blog--candidate-pool + (fn (candidates) + (cond + ((= candidates "tags") (host/blog-instances-of "tag")) + ((= candidates "types") (host/blog-instances-of "type")) + (else (host/blog-slugs))))) -;; One candidate row: a tiny form whose button adds the relation (POST /relate). +(define host/blog--relate-candidates + (fn (slug q kind) + (let ((spec (host/blog--kind-spec kind))) + (let ((pool (host/blog--candidate-pool (get spec :candidates))) + (already (host/blog-out slug kind)) + (ql (lower (or q "")))) + ;; pool is slugs; resolve titles, drop self + already-linked, filter by q + (let ((cands + (filter + (fn (p) + (or (= ql "") + (contains? (lower (get p :title)) ql) + (contains? (get p :slug) ql))) + (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (filter (fn (s) (and (not (= s slug)) (not (contains? already s)))) pool))))) + ;; title-sort via [title slug] pairs (sort compares the title first) + (map (fn (pair) {:slug (nth pair 1) :title (nth pair 0)}) + (sort (map (fn (p) (list (get p :title) (get p :slug))) cands)))))))) + +;; One candidate row: a tiny form whose button adds the relation under `kind`. (define host/blog--picker-item - (fn (slug p) + (fn (slug p kind) (quasiquote (li :style "border-bottom:1px solid #eee" (form :method "post" :style "margin:0" :action (unquote (str "/" slug "/relate")) (input :type "hidden" :name "other" :value (unquote (get p :slug))) + (input :type "hidden" :name "kind" :value (unquote kind)) (button :type "submit" :style "width:100%;text-align:left;background:none;border:none;padding:0.5em;cursor:pointer" (unquote (get p :title)))))))) -;; GET //relate-options?q=&offset= — one page of candidate rows as an HTML -;; fragment (the
    • s the picker script appends). Public read (same data as -;; /posts); the relate action itself stays guarded. +;; GET //relate-options?kind=&q=&offset= — one page of candidate rows for a +;; kind as an HTML fragment (the
    • s the picker script appends). Public read; the +;; relate action stays guarded. (define host/blog-relate-options (fn (req) (let ((slug (dream-param req "slug")) + (kind (or (dream-query-param req "kind") "related")) ;; dream's query parser does not %-decode values (its form parser does), - ;; so a filter like "Item 13" arrives as "Item%2013" — decode it with - ;; dream's own dr/url-decode before matching. + ;; so a filter like "Item 13" arrives as "Item%2013" — decode it. (q (dr/url-decode (or (dream-query-param req "q") ""))) (offset (host/query-int req "offset" 0))) - (let ((page (take (drop (host/blog--relate-candidates slug q) offset) + (let ((page (take (drop (host/blog--relate-candidates slug q kind) offset) host/blog--picker-limit))) (dream-html - (join "" (map (fn (p) (render-page (host/blog--picker-item slug p))) page))))))) + (join "" (map (fn (p) (render-page (host/blog--picker-item slug p kind))) page))))))) -;; GET /relate-picker.js — progressive-enhancement glue for the edit-page picker: -;; debounced live filter + scroll-to-load-more against //relate-options. The -;; host serves static HTML (no SX hydration), so the interactive layer is a small -;; vanilla script served from this route (read once, cached). +;; GET /relate-picker.js — progressive-enhancement glue. MULTI-INSTANCE: wires +;; every .relate-picker box on the page (a Related picker + a Tags picker can +;; coexist), reading data-slug + data-kind from each. Debounced live filter + +;; scroll-to-load-more against //relate-options. The host serves static HTML +;; (no SX hydration), so the interactive layer is this small cached script. (define host/blog-picker-js-src - "(function(){var f=document.getElementById('relate-filter');if(!f)return;var r=document.getElementById('relate-results');var slug=f.getAttribute('data-slug'),off=0,q='',busy=false,done=false,pending=false,t;function load(reset){if(busy){if(reset)pending=true;return;}if(!reset&&done)return;busy=true;if(reset){off=0;done=false;}fetch('/'+slug+'/relate-options?q='+encodeURIComponent(q)+'&offset='+off).then(function(x){return x.text();}).then(function(h){var d=document.createElement('div');d.innerHTML=h;var n=d.children.length;if(reset)r.innerHTML='';while(d.firstChild)r.appendChild(d.firstChild);off+=n;done=n<20;busy=false;if(pending){pending=false;load(true);}}).catch(function(){busy=false;if(pending){pending=false;load(true);}});}f.addEventListener('input',function(){clearTimeout(t);t=setTimeout(function(){q=f.value.trim();load(true);},200);});r.addEventListener('scroll',function(){if(r.scrollTop+r.clientHeight>=r.scrollHeight-40){load(false);}});load(true);})();") + "(function(){function wire(box){var f=box.querySelector('.rp-filter');if(!f)return;var r=box.querySelector('.rp-results');var slug=box.getAttribute('data-slug'),kind=box.getAttribute('data-kind')||'related',off=0,q='',busy=false,done=false,pending=false,t;function load(reset){if(busy){if(reset)pending=true;return;}if(!reset&&done)return;busy=true;if(reset){off=0;done=false;}fetch('/'+slug+'/relate-options?kind='+encodeURIComponent(kind)+'&q='+encodeURIComponent(q)+'&offset='+off).then(function(x){return x.text();}).then(function(h){var d=document.createElement('div');d.innerHTML=h;var n=d.children.length;if(reset)r.innerHTML='';while(d.firstChild)r.appendChild(d.firstChild);off+=n;done=n<20;busy=false;if(pending){pending=false;load(true);}}).catch(function(){busy=false;if(pending){pending=false;load(true);}});}f.addEventListener('input',function(){clearTimeout(t);t=setTimeout(function(){q=f.value.trim();load(true);},200);});r.addEventListener('scroll',function(){if(r.scrollTop+r.clientHeight>=r.scrollHeight-40){load(false);}});load(true);}var boxes=document.querySelectorAll('.relate-picker');for(var i=0;i (len rel) 0) + (let ((items (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + rel))) + (quasiquote + (div :style "margin-top:2em" + (h3 (unquote (get (host/blog--kind-spec kind) :label))) + (unquote (list (quote ul) items))))) + "")))) + +;; "Tagged with this" — the posts tagged with this (tag) post, for a tag's page. +(define host/blog--tagged-with-block (fn (slug) - (let ((rel (host/blog-related slug))) + (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (host/blog-tagged-with slug)))) + (if (> (len rel) 0) + (let ((items (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + rel))) + (quasiquote + (div :style "margin-top:2em" + (h3 "Tagged with this") + (unquote (list (quote ul) items))))) + "")))) + +;; Kind-aware relation editor for the edit page: current links (each with a +;; kind-scoped remove), plus a filterable picker (a .relate-picker box the shared +;; /relate-picker.js wires by data-kind). The picker's candidates come from the +;; kind's registry :candidates ("all" / tags / types). One editor per kind. +(define host/blog--relation-editor + (fn (slug kind) + ;; current edges read up front (a perform) — NOT inside the quasiquote, where + ;; a perform would raise VmSuspended under http-listen. + (let ((spec (host/blog--kind-spec kind)) + (current (host/blog-out slug kind))) (quasiquote (div :style "margin-top:2em;border-top:1px solid #ccc;padding-top:1em" - (h3 "Related posts") + (h3 (unquote (get spec :label))) (unquote - (if (> (len rel) 0) + (if (> (len current) 0) (list (quote ul) (map (fn (s) (quasiquote @@ -360,20 +433,33 @@ (form :method "post" :style "display:inline" :action (unquote (str "/" slug "/unrelate")) (input :type "hidden" :name "other" :value (unquote s)) + (input :type "hidden" :name "kind" :value (unquote kind)) (button :type "submit" "remove"))))) - rel)) + current)) (quote (p :style "opacity:0.7" "None yet.")))) - ;; add: a filterable, infinite-scrolling picker. The filter input + the - ;; results list are populated by /relate-picker.js (debounced filter, - ;; scroll-to-load) hitting //relate-options; each row's button - ;; POSTs /relate. data-slug carries the post to the script. - (h4 :style "margin-bottom:0.3em" "Add related") - (input :type "text" :id "relate-filter" :data-slug (unquote slug) - :placeholder "filter posts…" :autocomplete "off" - :style "width:100%;padding:0.4em;box-sizing:border-box") - (ul :id "relate-results" - :style "list-style:none;padding:0;margin:0.5em 0;max-height:240px;overflow:auto;border:1px solid #ddd") - (raw! "")))))) + (div :class "relate-picker" :data-slug (unquote slug) :data-kind (unquote kind) + (input :type "text" :class "rp-filter" :placeholder "filter…" :autocomplete "off" + :style "width:100%;padding:0.4em;box-sizing:border-box") + (ul :class "rp-results" + :style "list-style:none;padding:0;margin:0.5em 0;max-height:240px;overflow:auto;border:1px solid #ddd"))))))) + +;; "Is this post a tag?" toggle — marking a post a tag is just an is-a edge to the +;; "tag" type-post, so it reuses the relate/unrelate routes (no new endpoint). +(define host/blog--is-tag-toggle + (fn (slug) + (if (host/blog-is-tag? slug) + (quasiquote + (p (span "This post is a tag ✓ ") + (form :method "post" :style "display:inline" + :action (unquote (str "/" slug "/unrelate")) + (input :type "hidden" :name "other" :value "tag") + (input :type "hidden" :name "kind" :value "is-a") + (button :type "submit" "remove tag status")))) + (quasiquote + (form :method "post" :action (unquote (str "/" slug "/relate")) + (input :type "hidden" :name "other" :value "tag") + (input :type "hidden" :name "kind" :value "is-a") + (button :type "submit" "Make this a tag")))))) ;; ── read handlers ─────────────────────────────────────────────────── ;; Post body is rendered per-block (a guarded HTML string) then injected raw. @@ -389,12 +475,18 @@ (let ((principal (host/current-principal req))) (let ((body-html (host/blog-render r)) (related-block (host/blog--related-block slug (not (nil? principal)))) + (tags-block (host/blog--kind-block slug "tagged")) + ;; a tag post lists what's tagged with it (its members) + (members-block (if (host/blog-is-tag? slug) + (host/blog--tagged-with-block slug) "")) (auth-foot (host/auth-footer req))) (dream-html (host/blog--page (get r :title) (quasiquote (div (article (raw! (unquote body-html))) + (unquote tags-block) + (unquote members-block) (unquote related-block) (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" (a :href (unquote (str "/" slug "/source")) "view source") @@ -617,9 +709,11 @@ (host/blog--page "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (let ((status (get r :status))) - ;; related-editor does durable reads — compute it here, not in the - ;; quasiquote, so IO stays in the handler body. - (let ((related-editor (host/blog--related-editor slug)) + ;; the relation editors + tag toggle do durable reads — compute them + ;; here, not in the quasiquote, so IO stays in the handler body. + (let ((related-editor (host/blog--relation-editor slug "related")) + (tags-editor (host/blog--relation-editor slug "tagged")) + (tag-toggle (host/blog--is-tag-toggle slug)) (mk-opt (fn (val label) (if (= val status) @@ -641,7 +735,12 @@ (unquote (mk-opt "published" "Published"))) " " (button :type "submit" "Save"))) + (div :style "margin-top:2em;border-top:1px solid #ccc;padding-top:1em" + (unquote tag-toggle)) (unquote related-editor) + (unquote tags-editor) + ;; one shared picker script wires every .relate-picker box + (raw! "") (p :style "margin-top:1.5em" (a :href (unquote (str "/" slug "/")) "view post") " · " diff --git a/lib/host/playwright/relate-picker.spec.js b/lib/host/playwright/relate-picker.spec.js index 17f454a1..d1decede 100644 --- a/lib/host/playwright/relate-picker.spec.js +++ b/lib/host/playwright/relate-picker.spec.js @@ -9,6 +9,10 @@ const USER = process.env.SX_ADMIN_USER || 'admin'; const PASS = process.env.SX_ADMIN_PASSWORD || 'letmein'; const HOST = 'picker-host'; // the post whose edit page we drive const LIMIT = 20; // host/blog--picker-limit +// the Related picker box (the edit page now has one picker per kind) +const REL = '.relate-picker[data-kind="related"]'; +const RELF = `${REL} .rp-filter`; +const RELR = `${REL} .rp-results`; // Navigate to a guarded path; the host redirects to /login?next=…, so fill the // form and we should land back on the original path (exercises the auth flow). @@ -22,35 +26,37 @@ async function loginTo(page, path) { } test.describe('relate picker', () => { - test('login redirect returns to the edit page', async ({ page }) => { + test('edit page has Related + Tags pickers and an is-a-tag toggle', async ({ page }) => { await loginTo(page, `/${HOST}/edit`); await expect(page).toHaveURL(new RegExp(`/${HOST}/edit`)); - await expect(page.locator('#relate-filter')).toBeVisible(); + await expect(page.locator(RELF)).toBeVisible(); // Related picker + await expect(page.locator('.relate-picker[data-kind="tagged"] .rp-filter')).toBeVisible(); // Tags picker + await expect(page.getByRole('button', { name: 'Make this a tag' })).toBeVisible(); // toggle }); test('picker loads a page of candidates then loads more on scroll', async ({ page }) => { await loginTo(page, `/${HOST}/edit`); - const rows = page.locator('#relate-results li'); + const rows = page.locator(`${RELR} li`); // initial JS load fills exactly one page await expect.poll(() => rows.count(), { timeout: 8000 }).toBe(LIMIT); // scroll the results box to the bottom -> infinite scroll fetches the rest - await page.locator('#relate-results').evaluate((el) => el.scrollTo(0, el.scrollHeight)); + await page.locator(RELR).evaluate((el) => el.scrollTo(0, el.scrollHeight)); await expect.poll(() => rows.count(), { timeout: 8000 }).toBeGreaterThan(LIMIT); }); test('typing in the filter narrows the candidates', async ({ page }) => { await loginTo(page, `/${HOST}/edit`); - await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBeGreaterThan(0); - await page.fill('#relate-filter', 'Item 13'); - await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBe(1); - await expect(page.locator('#relate-results')).toContainText('Picker Item 13'); + await expect.poll(() => page.locator(`${RELR} li`).count(), { timeout: 8000 }).toBeGreaterThan(0); + await page.fill(RELF, 'Item 13'); + await expect.poll(() => page.locator(`${RELR} li`).count(), { timeout: 8000 }).toBe(1); + await expect(page.locator(RELR)).toContainText('Picker Item 13'); }); test('clicking a candidate relates it (and it shows on the post page)', async ({ page }) => { await loginTo(page, `/${HOST}/edit`); - await page.fill('#relate-filter', 'Item 07'); - await expect.poll(() => page.locator('#relate-results li').count(), { timeout: 8000 }).toBe(1); - await page.locator('#relate-results button').first().click(); + await page.fill(RELF, 'Item 07'); + await expect.poll(() => page.locator(`${RELR} li`).count(), { timeout: 8000 }).toBe(1); + await page.locator(`${RELR} button`).first().click(); // form POST -> 303 back to the edit page; the related list now links the slug await expect(page).toHaveURL(new RegExp(`/${HOST}/edit`)); await expect(page.locator('a[href="/picker-item-07/"]')).toHaveCount(1); diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 6b8f0f16..dfb30c46 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -369,6 +369,32 @@ (host-bl-test "type-valid? is vacuously true with no schemas (gradual)" (host/blog-type-valid? "ppost" "(p \"anything\")") true) +;; -- Phase 3: tags as posts -- (ocaml is-a tag, from the seed-types test above) +(host-bl-test "is-tag?: a post that is-a tag is a tag; others are not" + (list (host/blog-is-tag? "ocaml") (host/blog-is-tag? "ppost")) + (list true false)) +(host-bl-test "instances-of tag includes the tag posts" + (contains? (host/blog-instances-of "tag") "ocaml") true) +(host-bl-test "tag a post: it appears in tags + tagged-with (inverse)" + (begin + (host/blog-relate! "ppost" "ocaml" "tagged") ;; ppost tagged ocaml + (list (contains? (host/blog-tags "ppost") "ocaml") + (contains? (host/blog-tagged-with "ocaml") "ppost"))) + (list true true)) +(host-bl-test "tagged picker offers only tags (kind=tagged)" + (let ((body (dream-resp-body (host-bl-app (host-bl-req "/particle/relate-options?kind=tagged"))))) + (list (contains? body ">OCaml<") (contains? body ">P Article<"))) + (list true false)) +(host-bl-test "related picker still offers all posts (kind defaults to related)" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/particle/relate-options"))) ">P Doc<") + true) +(host-bl-test "is-a-tag toggle marks a post a tag via /relate kind=is-a" + (begin + (host-bl-wapp (host-bl-send "POST" "/pdoc/relate" "Bearer good" + "application/x-www-form-urlencoded" "other=tag&kind=is-a")) + (host/blog-is-tag? "pdoc")) + true) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 7e50d3d1bb64b8e696d615a443f05da6f5300ec0 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 17:29:58 +0000 Subject: [PATCH 039/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=204=20cleanup,=20registry-driven=20render=20+=20/tags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the hard-coded related/tagged blocks with iteration over the registry, so adding a kind renders automatically — no handler edit. - host/blog--relation-blocks: iterates host/blog-rel-kinds; each kind contributes its outgoing block (label) and, if it has an inverse, its incoming block (inverse-label, e.g. tagged -> "Tagged with this", is-a -> "Instances"). Empty blocks dropped; one kv-keys read up front, relation lookups in-memory. host/blog--relations-or-hint adds the logged-in "add some" hint when empty. - host/blog--relation-editors: one editor per registry kind on the edit page (Related / Types / Subtype of / Tags), replacing the hard-coded two. - GET /tags: index of every tag (a post that is-a tag), each linking its own page. - dropped host/blog--related-block / --kind-block / --tagged-with-block (folded into host/blog--edges-block + the registry iteration). - GOTCHA (4th time): host/blog-tags-index called host/blog-get INSIDE the item quasiquote -> VmSuspended/500 live (conformance in-memory store can't see it); pre-fetch records before the quasiquote. 5 tests (relations-section hint, registry render of Related+Tags, inverse block for a tag, /tags lists + 200). 265/265; Playwright 4/4. Verified live: /tags, post pages show registry blocks, tag page shows Types + Tagged-with-this, edit page has a picker per kind. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 164 ++++++++++++++++++++++++----------------- lib/host/tests/blog.sx | 24 +++++- 2 files changed, 116 insertions(+), 72 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 5e497819..6a13a841 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -347,70 +347,71 @@ (head (meta :charset "utf-8") (title (unquote title))) (body (unquote body)))))))) -;; "Related posts" block for the post page: a list of links when there are any; -;; a subtle "add some" hint when there are none AND the viewer is logged in (an -;; editor); nothing for an anonymous viewer. Records (slug+title) are fetched up -;; front so the SX tree is built from in-memory data — no durable read happens -;; while the page tree is rendered. -(define host/blog--related-block +;; ── registry-driven relation rendering (post page) ────────────────── +;; One labelled block of links from records ({:slug :title}), or "" when empty. +;; Records are pre-fetched, so the tree is built from in-memory data only. +(define host/blog--edges-block + (fn (records label) + (if (> (len records) 0) + (let ((items (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + records))) + (quasiquote + (div :style "margin-top:2em" + (h3 (unquote label)) + (unquote (list (quote ul) items))))) + ""))) + +;; nodes -> {:slug :title} records, existence-filtered against a shared key set. +(define host/blog--recs + (fn (existing nodes) + (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (filter (fn (s) (contains? existing s)) + (map (fn (n) (substr (symbol->string n) 5)) + (filter (fn (n) (starts-with? (symbol->string n) "blog:")) nodes)))))) + +;; ALL of a post's relation blocks, generated by ITERATING the registry: each +;; kind contributes its outgoing block (label) and, if it has an inverse, its +;; incoming block (inverse-label). Empty blocks are dropped. So adding a kind to +;; the registry makes it render automatically — no handler edit. One kv-keys read +;; up front; the relation lookups are in-memory. Returns a wrapper div, or "". +(define host/blog--relation-blocks + (fn (slug) + (let ((existing (host/blog-slugs)) + (node (host/blog--node slug))) + (let ((blocks + (reduce + (fn (acc spec) + (let ((k (string->symbol (get spec :kind)))) + (let ((out-b (host/blog--edges-block + (host/blog--recs existing (relations/children node k)) + (get spec :label))) + (in-b (if (get spec :inverse-label) + (host/blog--edges-block + (host/blog--recs existing (relations/parents node k)) + (get spec :inverse-label)) + ""))) + (concat acc (filter (fn (b) (not (= b ""))) (list out-b in-b)))))) + (list) + host/blog-rel-kinds))) + (if (> (len blocks) 0) (cons (quote div) blocks) ""))))) + +;; the relation section for the post page: the blocks, or — when empty and the +;; viewer is logged in — a subtle "add some" hint; nothing for anonymous viewers. +(define host/blog--relations-or-hint (fn (slug logged-in) - (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) - (host/blog-related slug)))) + (let ((blocks (host/blog--relation-blocks slug))) (cond - ((> (len rel) 0) - (let ((items - (map (fn (p) - (quasiquote - (li (a :href (unquote (str "/" (get p :slug) "/")) - (unquote (get p :title)))))) - rel))) - (quasiquote - (div :style "margin-top:2em" - (h3 "Related posts") - (unquote (list (quote ul) items)))))) + ((not (= blocks "")) blocks) (logged-in (quasiquote (p :style "margin-top:2em;font-size:0.9em;opacity:0.7" - "No related posts yet — " + "No relations yet — " (a :href (unquote (str "/" slug "/edit")) "add some") "."))) (else ""))))) -;; Generic "outgoing edges of a kind" block for the post page (e.g. "Tags"): a -;; labelled list of links, or "" when empty. Records fetched up front (no durable -;; read while the page tree is built). -(define host/blog--kind-block - (fn (slug kind) - (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) - (host/blog-out slug kind)))) - (if (> (len rel) 0) - (let ((items (map (fn (p) - (quasiquote - (li (a :href (unquote (str "/" (get p :slug) "/")) - (unquote (get p :title)))))) - rel))) - (quasiquote - (div :style "margin-top:2em" - (h3 (unquote (get (host/blog--kind-spec kind) :label))) - (unquote (list (quote ul) items))))) - "")))) - -;; "Tagged with this" — the posts tagged with this (tag) post, for a tag's page. -(define host/blog--tagged-with-block - (fn (slug) - (let ((rel (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) - (host/blog-tagged-with slug)))) - (if (> (len rel) 0) - (let ((items (map (fn (p) - (quasiquote - (li (a :href (unquote (str "/" (get p :slug) "/")) - (unquote (get p :title)))))) - rel))) - (quasiquote - (div :style "margin-top:2em" - (h3 "Tagged with this") - (unquote (list (quote ul) items))))) - "")))) - ;; Kind-aware relation editor for the edit page: current links (each with a ;; kind-scoped remove), plus a filterable picker (a .relate-picker box the shared ;; /relate-picker.js wires by data-kind). The picker's candidates come from the @@ -461,6 +462,14 @@ (input :type "hidden" :name "kind" :value "is-a") (button :type "submit" "Make this a tag")))))) +;; One editor per registry kind, wrapped in a div — the edit page's relation +;; section, generated by ITERATING the registry (add a kind -> it gets an editor). +(define host/blog--relation-editors + (fn (slug) + (cons (quote div) + (map (fn (spec) (host/blog--relation-editor slug (get spec :kind))) + host/blog-rel-kinds)))) + ;; ── read handlers ─────────────────────────────────────────────────── ;; Post body is rendered per-block (a guarded HTML string) then injected raw. (define host/blog-post @@ -474,20 +483,16 @@ ;; tree is built (a perform there raises VmSuspended under http-listen). (let ((principal (host/current-principal req))) (let ((body-html (host/blog-render r)) - (related-block (host/blog--related-block slug (not (nil? principal)))) - (tags-block (host/blog--kind-block slug "tagged")) - ;; a tag post lists what's tagged with it (its members) - (members-block (if (host/blog-is-tag? slug) - (host/blog--tagged-with-block slug) "")) + ;; all relation blocks (Related, Tags, Types, Tagged-with-this …) + ;; come from iterating the registry — one section, registry-driven. + (relations (host/blog--relations-or-hint slug (not (nil? principal)))) (auth-foot (host/auth-footer req))) (dream-html (host/blog--page (get r :title) (quasiquote (div (article (raw! (unquote body-html))) - (unquote tags-block) - (unquote members-block) - (unquote related-block) + (unquote relations) (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" (a :href (unquote (str "/" slug "/source")) "view source") " · " @@ -529,6 +534,30 @@ (define host/blog-index (fn (req) (host/ok (host/blog-list)))) +;; GET /tags — index of every tag (a post that is-a tag). Tags are posts, so each +;; links to its own page (which documents the tag + lists what's tagged with it). +(define host/blog-tags-index + (fn (req) + ;; pre-fetch records (slug+title) BEFORE the quasiquote — host/blog-get is a + ;; durable read; a perform during tree-build raises VmSuspended. + (let ((recs (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (sort (host/blog-instances-of "tag")))) + (auth-foot (host/auth-footer req))) + (let ((items (map (fn (p) + (quasiquote + (li (a :href (unquote (str "/" (get p :slug) "/")) + (unquote (get p :title)))))) + recs))) + (dream-html + (host/blog--page "Tags" + (quasiquote + (div (h1 "Tags") + (unquote (if (> (len recs) 0) + (list (quote ul) items) + (quote (p "No tags yet.")))) + (p :style "margin-top:2em;font-size:0.9em;opacity:0.8" + (a :href "/" "all posts") " · " (unquote auth-foot)))))))))) + ;; GET //source — the raw sx_content as text/plain. Posts ARE SX source, so ;; this just hands back the stored markup (public; a published post's source is ;; not secret). 404 if the post is absent. @@ -711,8 +740,7 @@ (let ((status (get r :status))) ;; the relation editors + tag toggle do durable reads — compute them ;; here, not in the quasiquote, so IO stays in the handler body. - (let ((related-editor (host/blog--relation-editor slug "related")) - (tags-editor (host/blog--relation-editor slug "tagged")) + (let ((relation-editors (host/blog--relation-editors slug)) (tag-toggle (host/blog--is-tag-toggle slug)) (mk-opt (fn (val label) @@ -737,8 +765,7 @@ (button :type "submit" "Save"))) (div :style "margin-top:2em;border-top:1px solid #ccc;padding-top:1em" (unquote tag-toggle)) - (unquote related-editor) - (unquote tags-editor) + (unquote relation-editors) ;; one shared picker script wires every .relate-picker box (raw! "") (p :style "margin-top:1.5em" @@ -779,6 +806,7 @@ (dream-get "/" host/blog-home) (dream-get "/posts" host/blog-index) (dream-get "/new" host/blog-new-form) + (dream-get "/tags" host/blog-tags-index) (dream-get "/relate-picker.js" host/blog-picker-js) (dream-get "/:slug/source" host/blog-source) (dream-get "/:slug/relate-options" host/blog-relate-options) diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index dfb30c46..03463d7c 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -276,10 +276,11 @@ "application/javascript; charset=utf-8") (host-bl-test "relate-picker.js carries the fetch glue" (contains? (dream-resp-body (host-bl-app (host-bl-req "/relate-picker.js"))) "relate-options") true) -(host-bl-test "related block: hint when logged-in + no relations" - (contains? (str (host/blog--related-block "gamma-post" true)) "add some") true) -(host-bl-test "related block: empty when anonymous + no relations" - (= (host/blog--related-block "gamma-post" false) "") true) +(host/blog-put! "hint-post" "Hint Post" "(p \"h\")" "published") +(host-bl-test "relations section: hint when logged-in + no relations" + (contains? (str (host/blog--relations-or-hint "hint-post" true)) "add some") true) +(host-bl-test "relations section: empty when anonymous + no relations" + (= (host/blog--relations-or-hint "hint-post" false) "") true) ;; -- Phase 1: relations carry a kind -- (host-bl-test "symmetric kind (related) reads from both sides" @@ -395,6 +396,21 @@ (host/blog-is-tag? "pdoc")) true) +;; -- Phase 4: registry-driven render + /tags index -- +(host-bl-test "relation-blocks renders Related + Tags from the registry" + (begin + (host/blog-relate! "hint-post" "ppost" "related") + (host/blog-relate! "hint-post" "ocaml" "tagged") + (let ((body (str (host/blog--relation-blocks "hint-post")))) + (list (contains? body "Related posts") (contains? body "Tags")))) + (list true true)) +(host-bl-test "relation-blocks shows an inverse block (Tagged with this) for a tag" + (contains? (str (host/blog--relation-blocks "ocaml")) "Tagged with this") true) +(host-bl-test "/tags lists the tag posts" + (contains? (dream-resp-body (host-bl-app (host-bl-req "/tags"))) "OCaml") true) +(host-bl-test "/tags is 200 (not shadowed by /:slug)" + (dream-status (host-bl-app (host-bl-req "/tags"))) 200) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From 0a2f1a61d1a9585e82dc0c2d815f678997cd716c Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 18:52:56 +0000 Subject: [PATCH 040/138] =?UTF-8?q?host:=20typed=20relations=20=E2=80=94?= =?UTF-8?q?=20Phase=206=20(schema=20validation)=20+=20post-page=20perf=20f?= =?UTF-8?q?ix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 6 — gradual schema validation made real: - host/blog-type-schemas now carries a declarative schema (a list of {:block :msg} required-element rules); "article" requires an h1. - host/blog--all-tags / --schema-issues / host/blog-type-issues walk the parsed content and report each missing required block; host/blog-type-valid? = no issues. A type with no schema imposes nothing (gradual). - seed an "article" type-post (article subtype-of type). edit-submit now lists the specific schema issues on a 400 ("an article needs a heading"), so a post that is-a article must satisfy it on save. Post-page performance (the unresponsiveness): a post page was ~1s even with no relations and no load — NOT CPU (render-page ~2ms, in-memory handler ~5ms) but the DURABLE read path: host/blog--relation-blocks called host/blog-out/in, each re-scanning the whole KV (host/blog-slugs + an all-edges scan), so a page did ~7 kv-keys performs deep in the call stack. Each durable perform routes through cek_run_with_io and is costly there. Fixes: - host/blog-out/in read DIRECT edges from the durable edge store (string scan), not lib/relations (whose queries re-saturate the Datalog ruleset, ~seconds). - host/blog--relation-blocks reads the KV key list ONCE and derives both the post set and the edges in memory (host/blog--edges-for / --recs-slugs), one kv-keys plus a host/blog-get per linked post. Post pages: ~1s -> ~0.02s (46x); live 11-135s -> ~0.15s. lib/relations stays for TRANSITIVE queries only. - conformance timeout 300 -> 600s: the relations-heavy blog suite is CPU-bound under shared-box contention and was tripping a false truncation at 300. 271/271 (blog 100). Verified live: post pages fast, Tags/Related/Tagged-with-this render, schema rejection works. Co-Authored-By: Claude Opus 4.8 --- lib/host/blog.sx | 203 +++++++++++++++++++++++++++++----------- lib/host/conformance.sh | 5 +- lib/host/tests/blog.sx | 31 ++++++ 3 files changed, 183 insertions(+), 56 deletions(-) diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 6a13a841..222e54f7 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -175,13 +175,47 @@ (map (fn (n) (substr (symbol->string n) 5)) (filter (fn (n) (starts-with? (symbol->string n) "blog:")) nodes)))))) -;; outgoing targets / incoming sources of `slug` under `kind`, as slug lists. +;; DIRECT edges come from the durable edge store, NOT lib/relations: each relations +;; query re-runs the (CEK-interpreted) ruleset — ~seconds even on a tiny graph — +;; whereas the edge:|| KV rows are a cheap string scan. lib/relations +;; is reserved for TRANSITIVE queries (descendants/ancestors). The two are always +;; in sync: host/blog-relate! writes both, and a plain blog edge has no derived +;; effective edges, so KV == relations/children for direct lookups. +(define host/blog--parse-edge-key + (fn (k) + (if (starts-with? k "edge:") + (let ((body (substr k 5))) + (let ((p1 (index-of body "|"))) + (if (< p1 0) nil + (let ((rest (substr body (+ p1 1)))) + (let ((p2 (index-of rest "|"))) + (if (< p2 0) nil + {:src (substr body 0 p1) + :kind (substr rest 0 p2) + :dst (substr rest (+ p2 1))})))))) + nil))) +(define host/blog--all-edges + (fn () + (filter (fn (e) (not (nil? e))) + (map host/blog--parse-edge-key (persist/backend-kv-keys host/blog-store))))) + +;; outgoing targets / incoming sources of `slug` under `kind`, as existing slugs. (define host/blog-out (fn (slug kind) - (host/blog--edge-slugs (relations/children (host/blog--node slug) (string->symbol kind))))) + (let ((existing (host/blog-slugs))) + (filter (fn (s) (contains? existing s)) + (reduce (fn (acc e) + (if (and (= (get e :src) slug) (= (get e :kind) kind)) + (concat acc (list (get e :dst))) acc)) + (list) (host/blog--all-edges)))))) (define host/blog-in (fn (slug kind) - (host/blog--edge-slugs (relations/parents (host/blog--node slug) (string->symbol kind))))) + (let ((existing (host/blog-slugs))) + (filter (fn (s) (contains? existing s)) + (reduce (fn (acc e) + (if (and (= (get e :dst) slug) (= (get e :kind) kind)) + (concat acc (list (get e :src))) acc)) + (list) (host/blog--all-edges)))))) ;; back-compat: "related posts" is just the symmetric "related" kind. (define host/blog-related (fn (slug) (host/blog-out slug "related"))) @@ -229,19 +263,45 @@ (define host/blog-tags (fn (slug) (host/blog-out slug "tagged"))) ;; a post's tags (define host/blog-tagged-with (fn (tag) (host/blog-in tag "tagged"))) ;; posts with a tag -;; ── gradual validation seam ───────────────────────────────────────── -;; A type-post optionally carries a schema: a predicate over content. The map is -;; empty for now — validation is gradual, types accrue schemas later — but the -;; hook lives here so enforcement is a one-line addition, never a retrofit. A post -;; is type-valid when every schema implied by its types accepts the content; with -;; no schemas this is vacuously true, so it costs nothing until a type opts in. -(define host/blog-type-schemas {}) +;; ── gradual validation: declarative type schemas ─────────────────── +;; A type may carry a SCHEMA: a list of rules {:block :msg }, each +;; requiring the content to contain (anywhere) an element of that tag. A post is +;; checked against the schema of every type it is-a; a type with no schema imposes +;; nothing (gradual). Schemas are declarative data (not opaque predicates) so they +;; yield a specific, human error — and could later be stored ON the type-post. +(define host/blog-type-schemas + {:article (list {:block "h1" :msg "an article needs a heading (h1)"})}) (define host/blog-schema-of (fn (type-slug) (get host/blog-type-schemas type-slug))) -(define host/blog-type-valid? + +;; every element tag in a parsed content tree, recursively (the heads of nested +;; lists) — so "requires h1" matches an h1 even inside an article/section wrapper. +(define host/blog--all-tags + (fn (tree) + (if (and (= (type-of tree) "list") (> (len tree) 0)) + (concat (list (str (first tree))) + (reduce (fn (acc c) (concat acc (host/blog--all-tags c))) (list) (rest tree))) + (list)))) + +;; the :msg of each required :block a schema asks for but the content lacks. +(define host/blog--schema-issues + (fn (schema content) + (let ((tags (host/blog--all-tags (parse-safe content)))) + (reduce + (fn (acc rule) + (if (contains? tags (get rule :block)) acc (concat acc (list (get rule :msg))))) + (list) schema)))) + +;; all schema issues for a post = the union over every type it is-a that carries a +;; schema. Empty = valid; vacuous (and cheap) when no type has a schema. +(define host/blog-type-issues (fn (slug content) - (every? - (fn (t) (let ((s (host/blog-schema-of t))) (or (nil? s) (s content)))) - (host/blog-types-of slug)))) + (reduce + (fn (acc t) + (let ((s (host/blog-schema-of t))) + (if s (concat acc (host/blog--schema-issues s content)) acc))) + (list) (host/blog-types-of slug)))) +(define host/blog-type-valid? + (fn (slug content) (= (len (host/blog-type-issues slug content)) 0))) ;; Seed the root type-posts: "type" (the root) and "tag" (a kind of type). Types ;; ARE posts, so these are real posts that document themselves; tag subtype-of @@ -256,7 +316,13 @@ (host/blog-seed! "tag" "Tag" "(article (h1 \"Tag\") (p \"A tag is a kind of type (tag subtype-of type), so anything that is-a tag is also a type. A post is tagged with a tag; a tag post documents the tag and lists what is tagged with it.\"))" "published") - (host/blog-relate! "tag" "type" "subtype-of")))) + (host/blog-relate! "tag" "type" "subtype-of") + ;; "article" — a type WITH a schema (requires a heading). Posts that is-a + ;; article are validated against it on save (gradual typing in action). + (host/blog-seed! "article" "Article" + "(article (h1 \"Article\") (p \"A kind of post that must have a heading. A post that is-a article is checked against this type's schema on save — gradual typing: declaring the type adds the requirement, and the next edit must satisfy it.\"))" + "published") + (host/blog-relate! "article" "type" "subtype-of")))) ;; ── relate picker (filterable, paginated candidate list) ──────────── ;; Candidates to relate `slug` to: every post except itself and ones already @@ -372,31 +438,53 @@ (map (fn (n) (substr (symbol->string n) 5)) (filter (fn (n) (starts-with? (symbol->string n) "blog:")) nodes)))))) -;; ALL of a post's relation blocks, generated by ITERATING the registry: each -;; kind contributes its outgoing block (label) and, if it has an inverse, its -;; incoming block (inverse-label). Empty blocks are dropped. So adding a kind to -;; the registry makes it render automatically — no handler edit. One kv-keys read -;; up front; the relation lookups are in-memory. Returns a wrapper div, or "". +;; The relation blocks shown on a POST page — a CURATED, fixed set: Related (out), +;; Tags (out), Tagged-with-this (in). PERFORMANCE: read the KV key list ONCE and +;; derive both the post set and the edges from it in memory, instead of letting +;; each host/blog-out/in re-scan the store. Every durable read is a perform routed +;; through cek_run_with_io (costly deep in the call stack), so the post page must +;; minimise them — this does ONE kv-keys plus a host/blog-get per linked post. +(define host/blog--post-relation-specs + (list {:kind "related" :dir "out" :label "Related posts"} + {:kind "tagged" :dir "out" :label "Tags"} + {:kind "tagged" :dir "in" :label "Tagged with this"})) +;; in-memory: the slug list (out: dst, in: src) for `slug` under `kind` from +;; pre-parsed edges — no perform. +(define host/blog--edges-for + (fn (edges slug kind dir) + (reduce + (fn (acc e) + (if (= (get e :kind) kind) + (if (= dir "out") + (if (= (get e :src) slug) (concat acc (list (get e :dst))) acc) + (if (= (get e :dst) slug) (concat acc (list (get e :src))) acc)) + acc)) + (list) edges))) +;; slug list -> {:slug :title} records (existence-filtered), one host/blog-get each. +(define host/blog--recs-slugs + (fn (existing slugs) + (map (fn (s) {:slug s :title (get (host/blog-get s) :title)}) + (filter (fn (s) (contains? existing s)) slugs)))) (define host/blog--relation-blocks (fn (slug) - (let ((existing (host/blog-slugs)) - (node (host/blog--node slug))) - (let ((blocks - (reduce - (fn (acc spec) - (let ((k (string->symbol (get spec :kind)))) - (let ((out-b (host/blog--edges-block - (host/blog--recs existing (relations/children node k)) - (get spec :label))) - (in-b (if (get spec :inverse-label) - (host/blog--edges-block - (host/blog--recs existing (relations/parents node k)) - (get spec :inverse-label)) - ""))) - (concat acc (filter (fn (b) (not (= b ""))) (list out-b in-b)))))) - (list) - host/blog-rel-kinds))) - (if (> (len blocks) 0) (cons (quote div) blocks) ""))))) + (let ((keys (persist/backend-kv-keys host/blog-store))) ;; ONE durable read + (let ((existing (reduce (fn (acc k) + (if (starts-with? k "blog:") + (concat acc (list (substr k 5))) acc)) + (list) keys)) + (edges (filter (fn (e) (not (nil? e))) + (map host/blog--parse-edge-key keys)))) + (let ((blocks + (reduce + (fn (acc spec) + (let ((b (host/blog--edges-block + (host/blog--recs-slugs existing + (host/blog--edges-for edges slug (get spec :kind) (get spec :dir))) + (get spec :label)))) + (if (= b "") acc (concat acc (list b))))) + (list) + host/blog--post-relation-specs))) + (if (> (len blocks) 0) (cons (quote div) blocks) "")))))) ;; the relation section for the post page: the blocks, or — when empty and the ;; viewer is logged in — a subtle "add some" hint; nothing for anonymous viewers. @@ -777,26 +865,31 @@ ;; create paths (unparseable body -> 400, post left intact). Slug is preserved. (define host/blog-edit-submit (fn (req) - (let ((slug (dream-param req "slug"))) - (let ((r (host/blog-get slug))) - (if (nil? r) - (dream-html-status 404 - (host/blog--page "Not found" - (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) - (let ((title (or (dream-form-field req "title") (get r :title))) - (sx-content (or (dream-form-field req "sx_content") "")) - (status (or (dream-form-field req "status") (get r :status)))) - ;; parse-valid AND type-valid (the post's types' schemas accept the - ;; content — vacuous until a type opts into a schema). - (if (and (host/blog-content-ok? sx-content) - (host/blog-type-valid? slug sx-content)) + (let ((slug (dream-param req "slug")) (r (host/blog-get (dream-param req "slug")))) + (if (nil? r) + (dream-html-status 404 + (host/blog--page "Not found" + (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) + (let ((title (or (dream-form-field req "title") (get r :title))) + (sx-content (or (dream-form-field req "sx_content") "")) + (status (or (dream-form-field req "status") (get r :status)))) + ;; collect issues up front (perform): unparseable markup, then each + ;; schema requirement the post's types impose. Empty = save. + (let ((issues (if (host/blog-content-ok? sx-content) + (host/blog-type-issues slug sx-content) + (list "Post body is not valid SX markup.")))) + (if (= (len issues) 0) (begin (host/blog-put! slug title sx-content status) (dream-redirect (str "/" slug "/"))) - (dream-html-status 400 - (host/blog--page "Error" - (quasiquote (div (h1 "Error") (p "Post body is not valid SX markup.") - (p (a :href (unquote (str "/" slug "/edit")) "Back"))))))))))))) + (let ((issue-items (map (fn (i) (quasiquote (li (unquote i)))) issues))) + (dream-html-status 400 + (host/blog--page "Cannot save" + (quasiquote + (div (h1 "Cannot save") + (p "This post can't be saved yet:") + (unquote (list (quote ul) issue-items)) + (p (a :href (unquote (str "/" slug "/edit")) "Back")))))))))))))) ;; ── routes ────────────────────────────────────────────────────────── ;; Public reads + the create form. /, /posts, /new BEFORE /:slug (catch-all). diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 0a4ad863..422cf9eb 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -113,7 +113,10 @@ emit_eval () { echo "(epoch $EPOCH)"; echo "(eval \"$1\")"; EPOCH=$((EPOCH+1)); done } > "$TMPFILE" -OUTPUT=$(timeout 300 "$SX_SERVER" < "$TMPFILE" 2>&1 || true) +# 600s: the blog suite drives the relations graph hard (every is-a/types-of/ +# instances-of query re-saturates the Datalog db), so it's CPU-bound and slower +# under shared-box contention. 300s was tripping a false truncation. +OUTPUT=$(timeout 600 "$SX_SERVER" < "$TMPFILE" 2>&1 || true) # Fail LOUD on any load/eval error. A test file that errors mid-load silently # truncates its suite — the runner returns only the tests that ran before the diff --git a/lib/host/tests/blog.sx b/lib/host/tests/blog.sx index 03463d7c..2434ec16 100644 --- a/lib/host/tests/blog.sx +++ b/lib/host/tests/blog.sx @@ -411,6 +411,37 @@ (host-bl-test "/tags is 200 (not shadowed by /:slug)" (dream-status (host-bl-app (host-bl-req "/tags"))) 200) +;; -- Phase 6: gradual schema validation -- +(host/blog-seed-types!) ;; ensures the "article" type + its schema (requires h1) +(host-bl-test "all-tags finds nested element tags" + (let ((tags (host/blog--all-tags (parse-safe "(article (h1 \"T\") (p \"x\"))")))) + (list (contains? tags "h1") (contains? tags "p") (contains? tags "section"))) + (list true true false)) +(host-bl-test "schema-issues: missing required block -> 1 issue; present -> 0" + (let ((sch (host/blog-schema-of "article"))) + (list (len (host/blog--schema-issues sch "(p \"no heading\")")) + (len (host/blog--schema-issues sch "(article (h1 \"yes\"))")))) + (list 1 0)) +(host-bl-test "type-valid? enforces an is-a article's schema" + (begin + (host/blog-put! "art1" "Art 1" "(p \"x\")" "published") + (host/blog-relate! "art1" "article" "is-a") + (list (host/blog-type-valid? "art1" "(p \"no heading\")") + (host/blog-type-valid? "art1" "(article (h1 \"H\") (p \"x\"))"))) + (list false true)) +(host-bl-test "a post with no schema'd type is vacuously valid" + (host/blog-type-valid? "ppost" "(p \"anything\")") true) +(host-bl-test "edit-submit rejects content violating the type schema (not saved)" + (begin + (host-bl-wapp (host-bl-send "POST" "/art1/edit" "Bearer good" + "application/x-www-form-urlencoded" "sx_content=(p+%22still+no+heading%22)")) + (contains? (dream-resp-body (host-bl-wapp (host-bl-req "/art1/"))) "still no heading")) + false) +(host-bl-test "edit-submit accepts content satisfying the schema -> 303" + (dream-status (host-bl-wapp (host-bl-send "POST" "/art1/edit" "Bearer good" + "application/x-www-form-urlencoded" "sx_content=(article+(h1+%22Heading%22)+(p+%22body%22))"))) + 303) + ;; -- experimental unguarded create-only route (POST /new, no auth) -- (define host-bl-oapp (host/make-app (list host/blog-open-create-routes host/blog-routes))) (host/blog-use-store! (persist/open)) From e6a1180d50b49d8cbf17296e8284e2aa56ef53b0 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 18:53:25 +0000 Subject: [PATCH 041/138] docs: serving-JIT handoff (from sx-vm-extensions) + host-loop correction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Carry the sx-vm-extensions loop's serving-JIT handoff notes, and add a correction: the post-page slowness was the durable read count (fixed in 0a2f1a61), not the (long-gone) Smalltalk render path — so SX_SERVING_JIT is an optional general speedup, not the perf blocker. Co-Authored-By: Claude Opus 4.8 --- plans/HANDOFF-enable-serving-jit.md | 98 +++++++++++++++++++++++++++++ plans/host-on-sx.md | 28 +++++++++ 2 files changed, 126 insertions(+) create mode 100644 plans/HANDOFF-enable-serving-jit.md diff --git a/plans/HANDOFF-enable-serving-jit.md b/plans/HANDOFF-enable-serving-jit.md new file mode 100644 index 00000000..a7848e1d --- /dev/null +++ b/plans/HANDOFF-enable-serving-jit.md @@ -0,0 +1,98 @@ +# Hand-off: enable serving-mode JIT for ~3–4× request CPU + +> From the **sx-vm-extensions** loop (2026-06-28). The serving-mode JIT is merged +> to `architecture` and is the host's real perf win — it just needs switching on. +> No further engine work is required from your side. + +## TL;DR + +Run the host server on the merged `architecture` binary with **`SX_SERVING_JIT=1`** +in its environment. Expected: **~3–4× lower per-request CPU** (measured ~9 ms → +~2.7 ms on the `/feed` pipeline). Already verified correct: full host conformance +is **181/181 under `SX_SERVING_JIT=1`**. + +## What changed (already merged to architecture) + +The bytecode JIT now works in the persistent/epoch serving mode, **opt-in via the +`SX_SERVING_JIT` env var (default OFF)**. Default-off means zero change until you +opt in — nothing regressed for any loop. Merge commit on `architecture`: +`089ed88f` (rebuild the shared binary from architecture to pick it up). + +The JIT is safe for the host's request pipeline because: +- The pipeline (dream router + feed/relations/blog handlers + JSON + render-to-html) + is pure SX with **no `call/cc`**; the only continuation-style code is `guard` + (Dream's `dream-catch-with` / `wrap-errors`), which the JIT **auto-detects and + runs interpreted** (recursive `PUSH_HANDLER` scan). So error handling stays + correct; everything else JITs. +- Proven end-to-end: combined host+JIT binary, full conformance under + `SX_SERVING_JIT=1` = **181/181, all 10 suites green** (handler 14, middleware 9, + sxtp 39, router 6, feed 14, relations 22, blog 27, page 8, server 13, ledger 29). + +## How to enable + +1. Rebuild the shared binary from `architecture` (it carries the merge): + `cd hosts/ocaml && dune build bin/sx_server.exe` +2. Launch the host server process with `SX_SERVING_JIT=1` set in its environment + (whatever wrapper/serve path you use — `lib/host/serve.sx` / the http-listen + entry). Default-off means you must set it explicitly. +3. One-time cost: JIT compiles hot functions on first call (~+1 s at startup / + first requests). Amortized immediately for a long-lived server. + +## Measurements (this is the evidence) + +In-process, full request pipeline (`host/native-handler (host/make-app …)` → +`/feed`, 2000 requests, in-memory persist backend): + +| | per-request CPU | total 2000 reqs | +|---|---|---| +| CEK (default, no JIT) | ~9 ms | ~15–20 s | +| **JIT (`SX_SERVING_JIT=1`)** | **~2.7 ms** | **~5–6 s** | + +JIT is also markedly *less* variable run-to-run. The cost is the pipeline +(routing + feed normalize/stream + handler + JSON), not rendering — +`render-to-html` alone is only ~50 µs/render and is already fast. + +## What was ruled out (don't chase these) + +The original kickoff framed the slowness as "interpreted Smalltalk (`content/html`) +in ~2 s". **The host does not load `lib/smalltalk` or `lib/content`** — that was a +different subsystem. We measured and confirmed: +- The host's render path is `render-to-html` (SX markup → HTML), already fast. +- The proposed big engine projects — **VM continuation-escape** and a + **compile-to-closures Smalltalk interpreter** — would *not* help the host + (wrong subsystem) and are **not needed**. (Scoping kept in the vm-extensions + loop under `plans/vm-continuation-escape.md` / `plans/smalltalk-dispatch-perf.md` + if a Smalltalk-backed workload ever needs them.) + +## Caveat — this is CPU only + +The ~3–4× is the in-process CPU path (which JIT controls). It does **not** touch +network/IO latency. If your production TTFB is dominated by a non-in-memory +`persist` backend, cross-service fetches, TLS/connection setup, or the known +homepage SSR-stepper issue, profile those separately — JIT won't move them. To +find your real split, break a live TTFB into: request parse → route → handler +(+ persist read) → render → serialize → network. The in-memory measurement above +says the *code path* is ~2.7 ms under JIT; anything beyond that in production is +infrastructure, not the SX engine. + +## One known residual (not host-affecting, for awareness) + +The serving hook re-runs a JIT'd function on the CEK if it fails mid-execution +(correct result, but could duplicate side effects for an impure function that +fails mid-run). The host conformance is clean (181/181), so nothing triggers it +on your paths today. The clean general fix (propagate-don't-rerun) is deferred in +the vm-extensions loop. + +## Correction (host loop, 2026-06-28) + +The premise above ("~2s interpreted-Smalltalk render") is STALE: the blog moved +off content-on-sx Smalltalk to `render-to-html` long ago (render-page ~2ms). The +actual post-page unresponsiveness was NOT CPU/render — it was the DURABLE READ +COUNT: host/blog--relation-blocks did ~7 `kv-keys` performs per page (each +host/blog-out/in re-scanned the KV). Collapsing to one shared kv-keys read fixed +it (~1s -> ~0.02s; commit 0a2f1a61). So serving-JIT was NOT the fix here. + +Serving-JIT may still be a worthwhile general speedup (the ~3-4× CPU claim, and +the Datalog `instances-of` on /tags is CPU-bound), but it requires running the +host on the merged `architecture` binary — this worktree's binary has no +SX_SERVING_JIT gate. Treat it as an optional future win, not the perf blocker. diff --git a/plans/host-on-sx.md b/plans/host-on-sx.md index d21e8f58..6d698e2a 100644 --- a/plans/host-on-sx.md +++ b/plans/host-on-sx.md @@ -425,3 +425,31 @@ Swap `host/blog-open-create-routes` → `host/blog-write-routes ` to g here even `sx_write_file` fails. Read-side sx-tree tools work. New `.sx` files were created with the `Write` tool (the .sx hook is inactive in this worktree) and each validated afterwards with `sx_validate` to keep the parse guarantee. + +## Action item — serving-JIT speedup is NOT a code merge; it's a one-line flag flip + +The ~2s interpreted-Smalltalk render (`/welcome/`, blog post pages) is being fixed +by the **`sx-vm-extensions`** loop — the JIT-bytecode-correctness handoff we kicked +off on 2026-06-19. **Do not wait for a code merge into `lib/host/**`** — the fix +lives entirely in the shared kernel (`hosts/ocaml/**`: `sx_server.ml`, `sx_vm.ml`, +extension modules) + shared guest runtimes (`lib/smalltalk/eval.sx`, +`lib/compiler.sx`, `lib/*/runtime.sx`). None of it is host code. The speedup is a +property of the shared `sx_server.exe` binary every loop already runs. + +The serving-mode JIT is **gated behind `SX_SERVING_JIT`** (vm-ext commit +`bf298684`), and host's `serve.sh` / `conformance.sh` currently do **not** set it. +So host's entire adoption step is: + +1. Wait for `sx-vm-extensions` → `architecture` (kernel + guest-runtime merge) and + the rebuilt shared binary. Watch its scoreboard: serving-JIT must be green across + ALL guest suites (Smalltalk, Datalog, Scheme, Haskell, Erlang, Prolog, APL, js) + with `SX_SERVING_JIT=1` — already done as of vm-ext `fed58b28` (js 148/148). +2. Gate locally: run `SX_SERVING_JIT=1 bash lib/host/conformance.sh` against the + rebuilt binary. Must stay green — this is the exact suite that first exposed the + miscompile (`router 3/6, feed 4/11, relations 9/16, blog 4/11` with the old JIT + on). If green, the residual exclusions in vm-ext covered host's workload. +3. Flip it on live: add `export SX_SERVING_JIT=1` to `lib/host/serve.sh` (the one + in-scope `lib/host/**` change). Commit as a feature. Live render should drop from + ~2s to tens of ms — highest-leverage perf win on the platform. + +Until step 1's binary is in, this is a no-op — leave `serve.sh` as is. From 389cf96838c609b2f4772f1673d4a82ad4bb5262 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 19:08:22 +0000 Subject: [PATCH 042/138] host: enable serving-mode JIT (SX_SERVING_JIT=1), host code excluded MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Datalog/relations saturation is CPU-bound and JITs cleanly: host conformance 271/271 under JIT, 5.4x faster (1m43s -> 19s, same binary); live /tags 2.5s -> 0.76s. loops/host now carries the merged sx-vm-extensions kernel (the JIT engine + gate), built into the binary the container bind-mounts. - docker-compose: SX_SERVING_JIT=1 (default-OFF gate; opt-in here). - serve.sh: when JIT is on, (jit-exclude! "host/*" "dream-*" "dr/*"). The host app + Dream framework MISCOMPILE on first call in the http-listen + cek_run_with_io path (map/rest emit wrong CALL_PRIM args -> 500; the JIT->CEK fallback marks the fn failed but does NOT recover the failed call). They're IO-bound, so CEK is no slower — but the miscompile is a real kernel-JIT bug to fix upstream (see plans/HANDOFF-jit-miscompile.md), after which this exclude can be dropped. Verified live: cold pages 200 (no first-hit 500), relate picker lists candidates, relate round-trip works, /tags fast, datalog still JITs (78 dl-* compiles). Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 4 ++++ lib/host/serve.sh | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 63536980..0e30e483 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -29,6 +29,10 @@ services: SX_ADMIN_USER: admin SX_ADMIN_PASSWORD: "sx-host-camper-van-2026" SX_SESSION_SECRET: "ra-host-sess-7c1f9b3e2a8d4056" + # Serving-mode JIT: bytecode-compile hot SX (esp. the Datalog/relations path) + # on the epoch serving channel. Validated: host conformance 271/271 under JIT, + # 5.4x faster (1m43s -> 19s). Default-OFF gate, opt in here. + SX_SERVING_JIT: "1" OCAMLRUNPARAM: "b" volumes: # SX source (hot-reload on container restart) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index b2a1090d..3a972938 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -99,6 +99,17 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done + # Serving-mode JIT: exclude the request-path SX (host app + Dream framework) from + # JIT. Those functions miscompile on first call in the http-listen + cek_run_with_io + # path (a map/rest arg bug → 500, then self-heals via CEK fallback — but the first + # hit fails). They're IO-bound anyway, so CEK is no slower. The JIT win is the + # Datalog/relations saturation (dl-*/relations-*), which JITs cleanly and stays on + # (e.g. /tags 2.5s -> 0.76s). + if [ "${SX_SERVING_JIT:-}" = "1" ]; then + echo "(epoch $EPOCH)" + echo "(eval \"(jit-exclude! \\\"host/*\\\" \\\"dream-*\\\" \\\"dr/*\\\")\")" + EPOCH=$((EPOCH+1)) + fi # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), # then idempotently seed a welcome post (sx_content = SX element markup, the # editor's content model). Re-seeding is a no-op if the slug already exists. From 1c487ebe0e9b8321124a67e0bb38c2a30bb5a0ad Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 19:09:26 +0000 Subject: [PATCH 043/138] docs: hand off serving-JIT host miscompile to sx-vm-extensions Co-Authored-By: Claude Opus 4.8 --- plans/HANDOFF-jit-miscompile.md | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 plans/HANDOFF-jit-miscompile.md diff --git a/plans/HANDOFF-jit-miscompile.md b/plans/HANDOFF-jit-miscompile.md new file mode 100644 index 00000000..705b51f1 --- /dev/null +++ b/plans/HANDOFF-jit-miscompile.md @@ -0,0 +1,64 @@ +# Hand-off: serving-mode JIT miscompiles host handlers (to sx-vm-extensions) + +> From the **host-on-sx** loop, 2026-06-28. We enabled `SX_SERVING_JIT=1` on the +> live host (blog.rose-ash.com) — the Datalog/relations saturation JITs cleanly +> and is the real win (host conformance 271/271 under JIT, 5.4× faster; live +> `/tags` 2.5s → 0.76s). BUT host app handlers MISCOMPILE in the serving path, so +> we had to `(jit-exclude! "host/*" "dream-*" "dr/*")` in serve.sh as a band-aid. +> Please fix the underlying bug so the exclude can be dropped. + +## Symptom + +Under `SX_SERVING_JIT=1`, the FIRST request to most pages 500s, then self-heals +(retries 200). stderr shows, paired: + +``` +[jit] host/blog--edges-block first-call fallback to CEK: Sx_types.Eval_error("map: expected (fn list) (in CALL_PRIM \"map\" with 2 args)") +[http-listen] handler error: Sx_types.Eval_error("map: expected (fn list) (in CALL_PRIM \"map\" with 2 args)") +``` +Also seen: `Sx_types.Eval_error("rest: 1 list arg")`. + +## Two distinct bugs + +**(A) codegen / VM-state.** A JIT'd function's bytecode runs `CALL_PRIM "map"` +(and `rest`) with args the primitive rejects (`expected (fn list)`, 2 args +pushed but wrong). KEY CLUE: **host conformance under `SX_SERVING_JIT=1` is +271/271** — the SAME functions (host/blog--edges-block etc.) JIT fine when driven +via the epoch `(eval ...)` path. It ONLY miscompiles in the **http-listen + +cek_run_with_io** serving path. So it is not pure codegen — it's triggered by the +serving/IO context. Strong hypothesis: a `perform`/`VmSuspended` earlier in the +request (the handler does durable kv reads) resumes the VM with a misaligned +stack, so the NEXT `CALL_PRIM` (often a `map`) gets wrong args. The map/rest are +just the first prim call after a resume. Worth a `vm-trace` of a handler that +suspends then maps. + +**(B) fallback doesn't recover the failed call.** `register_jit_hook` +(`hosts/ocaml/bin/sx_server.ml` ~L1607-1623): on first-call error it warns, sets +`l.l_compiled <- jit_failed_sentinel`, and returns `None` — intended to fall +through to CEK. But the error still escapes to the http-listen handler (→ 500) +instead of the call being re-run on CEK and returning a value. So even granting +(A), the request shouldn't 500: the fallback should recover THIS call, not just +mark the fn for next time. (Your own notes flagged this as the deferred +"propagate-don't-rerun" shared-CEK change — this is the same thing biting live.) + +Fixing EITHER (A) or (B) unblocks the host: (A) removes the miscompile; (B) makes +any miscompile self-heal on the first hit instead of 500ing. + +## Repro + +1. Build the merged binary (loops/host now carries sx-vm-extensions; the gate + + render-page coexist in sx_server.ml's persistent serving branch). +2. `SX_SERVING_JIT=1 bash lib/host/serve.sh` on a port (durable backend), but + FIRST remove the `(jit-exclude! "host/*" ...)` line from serve.sh so host code + JITs. +3. `curl http://127.0.0.1:PORT/welcome/` → first hit 500 (`map: expected (fn list)`), + retry 200. `curl /` (home, uses map+rest) likewise. + +Tooling: `(vm-trace "")`, `(bytecode-inspect "host/blog--edges-block")`, +`(prim-check "host/blog--edges-block")` (CLAUDE.md "VM/Bytecode Debugging"). + +## Current mitigation (host side, to remove once fixed) + +`lib/host/serve.sh`: when `SX_SERVING_JIT=1`, `(jit-exclude! "host/*" "dream-*" +"dr/*")`. Host app + Dream framework run on CEK (they're IO-bound — no perf loss); +Datalog (`dl-*`/`relations-*`) keeps JITting (the win). Drop this once (A)/(B) land. From 7172f0d775fa07e0be7760ca08a6a519639910c7 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 19:13:54 +0000 Subject: [PATCH 044/138] =?UTF-8?q?host:=20100%=20serving=20JIT=20?= =?UTF-8?q?=E2=80=94=20drop=20the=20host=20jit-exclude=20(surface=20miscom?= =?UTF-8?q?piles=20in=20dev)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per dev intent: don't mask JIT errors. Remove (jit-exclude! "host/*" "dream-*" "dr/*") so ALL request-path SX runs under JIT. Host handlers miscompile on first call in the http-listen path (map/rest arg bug → 500, self-heals on retry); that surfacing is the point — it exercises the JIT against real durable-IO traffic and gives the sx-vm-extensions loop the full miscompile list to fix (kernel bugs A/B in plans/HANDOFF-jit-miscompile.md). Datalog JIT win stays (/tags fast). Co-Authored-By: Claude Opus 4.8 --- lib/host/serve.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 3a972938..55bf96ab 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -99,17 +99,13 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done - # Serving-mode JIT: exclude the request-path SX (host app + Dream framework) from - # JIT. Those functions miscompile on first call in the http-listen + cek_run_with_io - # path (a map/rest arg bug → 500, then self-heals via CEK fallback — but the first - # hit fails). They're IO-bound anyway, so CEK is no slower. The JIT win is the - # Datalog/relations saturation (dl-*/relations-*), which JITs cleanly and stays on - # (e.g. /tags 2.5s -> 0.76s). - if [ "${SX_SERVING_JIT:-}" = "1" ]; then - echo "(epoch $EPOCH)" - echo "(eval \"(jit-exclude! \\\"host/*\\\" \\\"dream-*\\\" \\\"dr/*\\\")\")" - EPOCH=$((EPOCH+1)) - fi + # Serving-mode JIT runs at 100% — NO host jit-exclude. The request-path SX (host + # app + Dream framework) miscompiles on first call in the http-listen + + # cek_run_with_io path (map/rest arg bug → 500, self-heals on retry via CEK + # fallback). That's deliberate in DEV: surfacing every miscompile (the + # `[jit] … first-call fallback` log lines) exercises the JIT against real traffic + # and feeds the bug list to the sx-vm-extensions loop. Do NOT mask it with a + # jit-exclude — see plans/HANDOFF-jit-miscompile.md. # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), # then idempotently seed a welcome post (sx_content = SX element markup, the # editor's content model). Re-seeding is a no-op if the slug already exists. From a697904c7cba3d324dda4aa09909dc8411aa6c45 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 19:16:32 +0000 Subject: [PATCH 045/138] docs: refined serving-JIT miscompile data (3 fns, list-prim-after-perform) Co-Authored-By: Claude Opus 4.8 --- plans/HANDOFF-jit-miscompile.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/plans/HANDOFF-jit-miscompile.md b/plans/HANDOFF-jit-miscompile.md index 705b51f1..54f90fc8 100644 --- a/plans/HANDOFF-jit-miscompile.md +++ b/plans/HANDOFF-jit-miscompile.md @@ -62,3 +62,18 @@ Tooling: `(vm-trace "")`, `(bytecode-inspect "host/blog--edges-block")`, `lib/host/serve.sh`: when `SX_SERVING_JIT=1`, `(jit-exclude! "host/*" "dream-*" "dr/*")`. Host app + Dream framework run on CEK (they're IO-bound — no perf loss); Datalog (`dl-*`/`relations-*`) keeps JITting (the win). Drop this once (A)/(B) land. + +## Refined data (100% JIT, no exclude, 2026-06-28) + +Host now runs at 100% serving JIT (no jit-exclude). Out of **255 successful JIT +compiles, only ~3 functions miscompile**, all on a multi-arg LIST PRIMITIVE with +wrong CALL_PRIM args, all in the durable-read request path, all failing on the +FIRST list-prim call after a `perform` (kv read): +- `host/blog--edges-block` → `map: expected (fn list) (CALL_PRIM "map" 2 args)` +- a fn using `rest` → `rest: 1 list arg` +- `host/blog-relate-options` → `drop: list and number (CALL_PRIM "drop" 2 args)` + +Conformance (epoch eval, no http-listen/perform) is 271/271 under JIT — so it's +NOT the data-first swap alone; the **serving/perform path** is the trigger. +Strongly supports the OP_PERFORM-resume stack-misalignment theory: the prim that +fails is just the first CALL_PRIM after the resume. 252+ other fns JIT clean. From 83eaa1239347427c4e75e93328eb19227a564576 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 19:31:39 +0000 Subject: [PATCH 046/138] =?UTF-8?q?host:=20restore=20host=20jit-exclude=20?= =?UTF-8?q?=E2=80=94=20100%=20JIT=20silently=20CORRUPTS=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 100%-JIT experiment surfaced something worse than the 500s: the kernel miscompile also returns WRONG RESULTS with no error — blank pages (render map yields empty) and an empty relate picker (drop in relate-options yields []). Conformance (CEK) passes these, so the code is correct; the JIT silently produces garbage. Silent corruption is worse than a crash, so the request path runs on CEK again (IO-bound — no perf loss). Datalog/relations JIT stays on (/tags 0.16s). Restoring it brought back content + the 17-candidate picker. Go 100% JIT again once sx-vm-extensions fixes the OP_PERFORM-resume bug. Co-Authored-By: Claude Opus 4.8 --- lib/host/serve.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 55bf96ab..1b3bc0c9 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -99,13 +99,19 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done - # Serving-mode JIT runs at 100% — NO host jit-exclude. The request-path SX (host - # app + Dream framework) miscompiles on first call in the http-listen + - # cek_run_with_io path (map/rest arg bug → 500, self-heals on retry via CEK - # fallback). That's deliberate in DEV: surfacing every miscompile (the - # `[jit] … first-call fallback` log lines) exercises the JIT against real traffic - # and feeds the bug list to the sx-vm-extensions loop. Do NOT mask it with a - # jit-exclude — see plans/HANDOFF-jit-miscompile.md. + # Serving-mode JIT: exclude the request-path SX (host app + Dream framework). The + # 100%-JIT experiment surfaced the key finding — the kernel miscompile isn't just + # 500s, it SILENTLY returns wrong results (the `drop` in host/blog-relate-options + # yielded an empty candidate list → broken relate picker, NO error logged). Silent + # corruption is worse than a crash, so these run on CEK (they're IO-bound — no perf + # loss) while the kernel bug is fixed upstream (sx-vm-extensions, OP_PERFORM resume + # — see plans/HANDOFF-jit-miscompile.md). The Datalog/relations JIT (the real win) + # stays on. Drop this exclude once the resume bug lands, then go 100% JIT again. + if [ "${SX_SERVING_JIT:-}" = "1" ]; then + echo "(epoch $EPOCH)" + echo "(eval \"(jit-exclude! \\\"host/*\\\" \\\"dream-*\\\" \\\"dr/*\\\")\")" + EPOCH=$((EPOCH+1)) + fi # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), # then idempotently seed a welcome post (sx_content = SX element markup, the # editor's content model). Re-seeding is a no-op if the slug already exists. From d8d7663565fa14a805be1a33fe199ff72242ad0e Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 20:13:24 +0000 Subject: [PATCH 047/138] =?UTF-8?q?host:=20fix=20serving-JIT=20host=20misc?= =?UTF-8?q?ompile=20=E2=80=94=20install=20IO=20resolver=20for=20http-liste?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The serving-JIT perform-in-HO-callback miscompile (map/rest/drop wrong CALL_PRIM args → blank pages, empty picker) is now fully fixed, so the host runs 100% serving JIT with NO jit-exclude. sx-vm-extensions 81177d0e resolves a suspended HO-callback's IO inline (instead of unwinding the native map/filter loop and corrupting the stack), but ONLY when a synchronous resolver is installed (!_cek_io_resolver = Some). The host serves via the http-listen primitive, whose handler drove durable IO through cek_run_with_io with the resolver = None — so it hit the unwinding path the fix doesn't cover. (The vm-ext repro installed a resolver, so it never exercised the host's real no-resolver path.) Fix: extract cek_run_with_io's IO resolution into resolve_io_request, and have http-listen install _cek_io_resolver := Some (fun req _ -> resolve_io_request req) — byte-identical resolution, so the inline path resolves durable reads exactly as the CEK loop would. Verified: host conformance 271/271; ephemeral durable server at 100% JIT (no exclude) zero fallbacks + real content + related shown + picker 12 candidates; live blog.rose-ash.com home/post/tags 200 with related posts, zero error-log lines; relate-picker Playwright 4/4 (infinite-scroll + filter + relate). Co-Authored-By: Claude Opus 4.8 --- hosts/ocaml/bin/sx_server.ml | 111 +++++++++++++++++++------------- lib/host/serve.sh | 21 +++--- plans/HANDOFF-jit-miscompile.md | 29 +++++++++ 3 files changed, 102 insertions(+), 59 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 51859aff..4ecb34c7 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -522,9 +522,59 @@ let rec load_library_file path = Printf.eprintf "[load-library] %s: %s\n%!" (Filename.basename path) msg ) exprs -(** IO-aware CEK run — handles suspension by dispatching IO requests. - Import requests are handled locally (load .sx file). - Other IO requests are sent to the Python bridge. *) +(* IO-aware CEK run (cek_run_with_io, below) — handles suspension by dispatching + IO requests. Import requests are handled locally (load .sx file). *) +(** Resolve a single IO request value to its response. Shared by + cek_run_with_io's suspension loop AND the _cek_io_resolver installed for the + http-listen serving path, so the synchronous inline-resolve path (sx_vm.ml's + HO-callback suspend fix) resolves durable reads byte-identically to the + CEK-driven path. Without an installed resolver, a `perform` inside an HO + primitive callback (map/filter/…) unwinds the native loop and corrupts the + stack — the host's map/rest/drop serving-JIT miscompile. *) +and resolve_io_request request = + let op = match Sx_runtime.get_val request (String "op") with String s -> s | _ -> "" in + (match op with + | "import" -> + (* Resolve library locally — load the .sx file *) + let lib_spec = Sx_runtime.get_val request (String "library") in + let key = Sx_ref.library_name_key lib_spec in + if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then + (* Already loaded — just resume *) + Nil + else begin + (match resolve_library_path lib_spec with + | Some path -> load_library_file path + | None -> + Printf.eprintf "[import] WARNING: no file for library %s\n%!" + (Sx_runtime.value_to_str lib_spec)); + Nil + end + | "text-measure" -> + let args = let a = Sx_runtime.get_val request (String "args") in + (match a with List l -> l | _ -> [a]) in + let font = match args with String f :: _ -> f | _ -> "serif" in + let size = match args with + | [_font; Number sz; _text] -> sz + | [_font; Number sz] -> sz + | _ -> 16.0 in + let text = match args with + | [_font; _sz; String t] -> t + | _ -> "" in + let (w, h, asc, desc) = measure_text_otfm font size text in + let d = Hashtbl.create 4 in + Hashtbl.replace d "width" (Number w); + Hashtbl.replace d "height" (Number h); + Hashtbl.replace d "ascent" (Number asc); + Hashtbl.replace d "descent" (Number desc); + Dict d + | _ -> + let argsv = Sx_runtime.get_val request (String "args") in + (match Sx_persist_store.handle_op op argsv with + | Some resp -> resp + | None -> + let args = (match argsv with List l -> l | _ -> [argsv]) in + io_request op args)) + and cek_run_with_io state = let s = ref state in let is_terminal s = match Sx_ref.cek_terminal_p s with Bool true -> true | _ -> false in @@ -535,49 +585,7 @@ and cek_run_with_io state = done; if is_suspended !s then begin let request = Sx_runtime.get_val !s (String "request") in - let op = match Sx_runtime.get_val request (String "op") with String s -> s | _ -> "" in - let response = match op with - | "import" -> - (* Resolve library locally — load the .sx file *) - let lib_spec = Sx_runtime.get_val request (String "library") in - let key = Sx_ref.library_name_key lib_spec in - if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then - (* Already loaded — just resume *) - Nil - else begin - (match resolve_library_path lib_spec with - | Some path -> load_library_file path - | None -> - Printf.eprintf "[import] WARNING: no file for library %s\n%!" - (Sx_runtime.value_to_str lib_spec)); - Nil - end - | "text-measure" -> - let args = let a = Sx_runtime.get_val request (String "args") in - (match a with List l -> l | _ -> [a]) in - let font = match args with String f :: _ -> f | _ -> "serif" in - let size = match args with - | [_font; Number sz; _text] -> sz - | [_font; Number sz] -> sz - | _ -> 16.0 in - let text = match args with - | [_font; _sz; String t] -> t - | _ -> "" in - let (w, h, asc, desc) = measure_text_otfm font size text in - let d = Hashtbl.create 4 in - Hashtbl.replace d "width" (Number w); - Hashtbl.replace d "height" (Number h); - Hashtbl.replace d "ascent" (Number asc); - Hashtbl.replace d "descent" (Number desc); - Dict d - | _ -> - let argsv = Sx_runtime.get_val request (String "args") in - (match Sx_persist_store.handle_op op argsv with - | Some resp -> resp - | None -> - let args = (match argsv with List l -> l | _ -> [argsv]) in - io_request op args) - in + let response = resolve_io_request request in s := Sx_ref.cek_resume !s response; loop () end else @@ -755,6 +763,17 @@ let setup_evaluator_bridge env = Unix.bind sock (Unix.ADDR_INET (bind_addr, port)); Unix.listen sock 64; + (* Install the synchronous IO resolver for the serving path. Without it, a + `perform` (durable kv read) that fires inside an HO-primitive callback + (map/filter/reduce/…) during request handling suspends through the + native OCaml loop, dropping its iteration state and leaving the stack + misaligned — the serving-JIT host miscompile (map/rest/drop wrong args, + blank pages, empty picker). With a resolver installed, sx_vm.ml resolves + that callback's IO inline (byte-identically to cek_run_with_io) and the + loop is never unwound. Only set if one isn't already installed. *) + (if !Sx_types._cek_io_resolver = None then + Sx_types._cek_io_resolver := + Some (fun request _state -> resolve_io_request request)); (* SX runtime is shared across threads — serialize handler calls. *) let mtx = Mutex.create () in let reason = function diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 1b3bc0c9..472bc090 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -99,19 +99,14 @@ EPOCH=1 for M in "${MODULES[@]}"; do echo "(epoch $EPOCH)"; echo "(load \"$M\")"; EPOCH=$((EPOCH+1)) done - # Serving-mode JIT: exclude the request-path SX (host app + Dream framework). The - # 100%-JIT experiment surfaced the key finding — the kernel miscompile isn't just - # 500s, it SILENTLY returns wrong results (the `drop` in host/blog-relate-options - # yielded an empty candidate list → broken relate picker, NO error logged). Silent - # corruption is worse than a crash, so these run on CEK (they're IO-bound — no perf - # loss) while the kernel bug is fixed upstream (sx-vm-extensions, OP_PERFORM resume - # — see plans/HANDOFF-jit-miscompile.md). The Datalog/relations JIT (the real win) - # stays on. Drop this exclude once the resume bug lands, then go 100% JIT again. - if [ "${SX_SERVING_JIT:-}" = "1" ]; then - echo "(epoch $EPOCH)" - echo "(eval \"(jit-exclude! \\\"host/*\\\" \\\"dream-*\\\" \\\"dr/*\\\")\")" - EPOCH=$((EPOCH+1)) - fi + # 100% serving JIT — NO host exclude. The serving-JIT perform-in-HO-callback + # miscompile (map/rest/drop wrong args → blank pages, empty picker) is fixed by + # two composing pieces: sx-vm-extensions 81177d0e resolves a callback's IO + # inline (instead of unwinding the native HO loop) WHEN a synchronous resolver + # is installed, and sx_server.ml's http-listen now installs that resolver (it + # mirrors cek_run_with_io exactly). So the whole request path — host app + + # Dream + Datalog — runs under JIT with no exclude. Verified: ephemeral durable + # server, 100% JIT, zero fallbacks, real content, picker lists candidates. # Point the blog at the DURABLE file backend (persists under $SX_PERSIST_DIR), # then idempotently seed a welcome post (sx_content = SX element markup, the # editor's content model). Re-seeding is a no-op if the slug already exists. diff --git a/plans/HANDOFF-jit-miscompile.md b/plans/HANDOFF-jit-miscompile.md index 54f90fc8..d3d0a816 100644 --- a/plans/HANDOFF-jit-miscompile.md +++ b/plans/HANDOFF-jit-miscompile.md @@ -1,5 +1,34 @@ # Hand-off: serving-mode JIT miscompiles host handlers (to sx-vm-extensions) +> ## ✅ RESOLVED 2026-06-28 — host now runs 100% serving JIT, no exclude. +> +> Two composing pieces fixed it: +> 1. **sx-vm-extensions `81177d0e`** (`sx_vm.ml` `call_closure_reuse`): when an +> HO-primitive callback (map/filter/reduce/…) suspends on a `perform` AND a +> synchronous resolver is installed, resolve its IO inline and run it to +> completion instead of unwinding the native loop (which dropped iteration +> state and misaligned the stack → the next `CALL_PRIM` got wrong args). +> 2. **host side (`sx_server.ml`)**: that fix only engages when +> `!_cek_io_resolver = Some`. The host serves via the `http-listen` primitive, +> whose handler drove durable IO through `cek_run_with_io` with the resolver +> **= None**, so it hit the unwinding path the fix doesn't cover (the +> vm-extensions repro `repro_jit_resume.ml` *installed* a resolver, so it never +> exercised the host's real path). Fix: extracted `cek_run_with_io`'s IO +> resolution into `resolve_io_request`, and `http-listen` now installs +> `_cek_io_resolver := Some (fun req _ -> resolve_io_request req)` — byte- +> identical resolution, so the inline-resolve path resolves durable reads +> exactly as the CEK loop would. +> +> Verified: host conformance **271/271**; ephemeral durable server at 100% JIT +> (no exclude) — zero fallbacks, real content, related posts shown, picker lists +> 12 candidates; live blog.rose-ash.com home/post/tags 200 with related posts and +> zero error-log lines; relate-picker Playwright **4/4** (infinite-scroll + +> filter + relate, the `drop` path). `serve.sh` exclude dropped. +> +> Everything below is the original hand-off, kept for the record. + +--- + > From the **host-on-sx** loop, 2026-06-28. We enabled `SX_SERVING_JIT=1` on the > live host (blog.rose-ash.com) — the Datalog/relations saturation JITs cleanly > and is the real win (host conformance 271/271 under JIT, 5.4× faster; live From dbcbc39ebe0289a13cf3885d0b0e2315d542b818 Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 20:53:06 +0000 Subject: [PATCH 048/138] =?UTF-8?q?host:=20blog=20SPA=20scaffolding=20(WAS?= =?UTF-8?q?M=20kernel)=20=E2=80=94=20server=20side=20complete,=20boost=20b?= =?UTF-8?q?locked=20on=20bundle=20rebuild?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turn the blog into a SPA using the SX-htmx engine (web/engine.sx) booting the WASM OCaml kernel (same evaluator as the server) in-browser, with sx-boost fragment-swapping every link into #content. Server side DONE + verified: - lib/host/static.sx: GET /static/** serves shared/static via the file-read primitive (ctype by ext, traversal-guarded, 404 on missing). Wired into serve.sh (module + route group). Tested: kernel JS + .wasm binary-exact. - host/blog--page is now the SPA shell: full page = WASM boot scripts + sx-boost=#content wrapper + #content; on SX-Request:true returns ONLY the inner content fragment for the engine to swap. All 13 handlers thread req. - docker-compose mounts ./shared/static. - lib/host/playwright/spa-check.{spec.js,run-spa-check.sh}: boot/boost/swap/back. Client side: the WASM kernel BOOTS (SxKernel object, data-sx-ready=true, web stack loads). BLOCKER: the bundled .sxbc throw 'VM: unknown opcode 0' vs this worktree's kernel -> .sx source fallback -> boot.sx source fails 'Expected list, got string' -> process-boosted never binds links (boosted 0/N). Fix = rebuild a consistent WASM bundle (recompile .sxbc against the kernel via scripts/sx-build-all.sh); the browser wasm target isn't built here yet. See plans/host-spa.md. Live NOT redeployed (stays on pre-SPA process). Co-Authored-By: Claude Opus 4.8 --- docker-compose.dev-sx-host.yml | 3 ++ lib/host/blog.sx | 61 ++++++++++++++++-------- lib/host/playwright/run-spa-check.sh | 68 +++++++++++++++++++++++++++ lib/host/playwright/spa-check.spec.js | 65 +++++++++++++++++++++++++ lib/host/serve.sh | 3 +- lib/host/static.sx | 52 ++++++++++++++++++++ plans/host-spa.md | 67 ++++++++++++++++++++++++++ 7 files changed, 298 insertions(+), 21 deletions(-) create mode 100644 lib/host/playwright/run-spa-check.sh create mode 100644 lib/host/playwright/spa-check.spec.js create mode 100644 lib/host/static.sx create mode 100644 plans/host-spa.md diff --git a/docker-compose.dev-sx-host.yml b/docker-compose.dev-sx-host.yml index 0e30e483..9aad03ec 100644 --- a/docker-compose.dev-sx-host.yml +++ b/docker-compose.dev-sx-host.yml @@ -39,6 +39,9 @@ services: - ./spec:/app/spec:ro - ./lib:/app/lib:ro - ./web:/app/web:ro + # Client assets for the blog SPA: the WASM OCaml kernel + sx-platform + the + # web-stack modules, served by lib/host/static.sx at /static/**. + - ./shared/static:/app/shared/static:ro # OCaml server binary — this worktree's build (has the SX_HTTP_HOST bind fix) - ./hosts/ocaml/_build/default/bin/sx_server.exe:/app/bin/sx_server:ro # Durable persist store (the SX op-log/kv on disk) — survives restarts. diff --git a/lib/host/blog.sx b/lib/host/blog.sx index 222e54f7..8a668999 100644 --- a/lib/host/blog.sx +++ b/lib/host/blog.sx @@ -404,14 +404,35 @@ ;; builds the tree (running any dynamic logic in the full evaluator, e.g. a posts ;; loop) and render-page renders the static result — no embedded HTML strings, ;; only the doctype prefix render-to-html doesn't emit. `body` is an SX node. +;; SPA shell. The blog is a single-page app: the page boots the WASM OCaml kernel +;; (the SAME evaluator as the server) + the SX-htmx engine (web/engine.sx), and +;; `sx-boost="#content"` turns every in-page link/form into a fragment swap into +;; #content — no full reloads, history handled. A boosted request carries the +;; SX-Request:true header; we then return ONLY the inner content (so the engine +;; swaps it straight into #content). A direct / no-JS request gets the full shell, +;; so the blog degrades gracefully to plain server-rendered pages. +(define host/blog--spa-req? (fn (req) (= (dream-header req "sx-request") "true"))) + (define host/blog--page - (fn (title body) - (str "" - (render-page - (quasiquote - (html - (head (meta :charset "utf-8") (title (unquote title))) - (body (unquote body)))))))) + (fn (req title body) + (if (host/blog--spa-req? req) + ;; fragment: inner content only — engine swaps it into #content + (render-page body) + ;; full SPA shell: WASM kernel + platform + boosted #content + (str "" + (render-page + (quasiquote + (html + (head (meta :charset "utf-8") (title (unquote title)) + (script :src "/static/wasm/sx_browser.bc.wasm.js") + (script :src "/static/wasm/sx-platform.js")) + (body + ;; sx-boost must be on a DESCENDANT of (process-boosted + ;; queries [sx-boost] WITHIN the body, so it can't sit on body + ;; itself). The wrapper boosts every link/form inside, targeting + ;; #content; #content is the swap target. + (div :sx-boost "#content" + (div :id "content" (unquote body))))))))))) ;; ── registry-driven relation rendering (post page) ────────────────── ;; One labelled block of links from records ({:slug :title}), or "" when empty. @@ -576,7 +597,7 @@ (relations (host/blog--relations-or-hint slug (not (nil? principal)))) (auth-foot (host/auth-footer req))) (dream-html - (host/blog--page (get r :title) + (host/blog--page req (get r :title) (quasiquote (div (article (raw! (unquote body-html))) @@ -590,7 +611,7 @@ " · " (unquote auth-foot)))))))) (dream-html-status 404 - (host/blog--page "Not found" + (host/blog--page req "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No published post: " slug)))))))))))) @@ -612,7 +633,7 @@ ;; quasiquote (a perform during tree-build raises VmSuspended). (auth-foot (host/auth-footer req))) (dream-html - (host/blog--page "Blog" + (host/blog--page req "Blog" (quasiquote (div (h1 "Posts") (unquote listing) @@ -637,7 +658,7 @@ (unquote (get p :title)))))) recs))) (dream-html - (host/blog--page "Tags" + (host/blog--page req "Tags" (quasiquote (div (h1 "Tags") (unquote (if (> (len recs) 0) @@ -657,7 +678,7 @@ (dream-response 200 {:content-type "text/plain; charset=utf-8"} (or (get r :sx-content) "")) (dream-html-status 404 - (host/blog--page "Not found" + (host/blog--page req "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug)))))))))))) ;; ── create page (GET /new) — clean minimal form as an SX tree ─────── @@ -666,7 +687,7 @@ (define host/blog-new-form (fn (req) (dream-html - (host/blog--page "New post" + (host/blog--page req "New post" (quasiquote (div (h1 "New post") @@ -706,12 +727,12 @@ (cond ((or (nil? title) (= title "")) (dream-html-status 400 - (host/blog--page "Error" + (host/blog--page req "Error" (quasiquote (div (h1 "Error") (p "Title is required.") (p (a :href "/new" "Back"))))))) ((not (host/blog-content-ok? sx-content)) (dream-html-status 400 - (host/blog--page "Error" + (host/blog--page req "Error" (quasiquote (div (h1 "Error") (p "Post body is not valid SX markup.") (p (a :href "/new" "Back"))))))) (else @@ -793,7 +814,7 @@ (kind (or (dream-form-field req "kind") "related"))) (if (nil? (host/blog-get slug)) (dream-html-status 404 - (host/blog--page "Not found" + (host/blog--page req "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (begin (when (and other (not (= other "")) (not (= other slug)) @@ -823,7 +844,7 @@ (let ((r (host/blog-get slug))) (if (nil? r) (dream-html-status 404 - (host/blog--page "Not found" + (host/blog--page req "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (let ((status (get r :status))) ;; the relation editors + tag toggle do durable reads — compute them @@ -836,7 +857,7 @@ (quasiquote (option :value (unquote val) :selected "selected" (unquote label))) (quasiquote (option :value (unquote val) (unquote label))))))) (dream-html - (host/blog--page (str "Edit: " (get r :title)) + (host/blog--page req (str "Edit: " (get r :title)) (quasiquote (div (h1 (unquote (str "Edit: " (get r :title)))) @@ -868,7 +889,7 @@ (let ((slug (dream-param req "slug")) (r (host/blog-get (dream-param req "slug")))) (if (nil? r) (dream-html-status 404 - (host/blog--page "Not found" + (host/blog--page req "Not found" (quasiquote (div (h1 "404") (p (unquote (str "No post: " slug))))))) (let ((title (or (dream-form-field req "title") (get r :title))) (sx-content (or (dream-form-field req "sx_content") "")) @@ -884,7 +905,7 @@ (dream-redirect (str "/" slug "/"))) (let ((issue-items (map (fn (i) (quasiquote (li (unquote i)))) issues))) (dream-html-status 400 - (host/blog--page "Cannot save" + (host/blog--page req "Cannot save" (quasiquote (div (h1 "Cannot save") (p "This post can't be saved yet:") diff --git a/lib/host/playwright/run-spa-check.sh b/lib/host/playwright/run-spa-check.sh new file mode 100644 index 00000000..ff3044e3 --- /dev/null +++ b/lib/host/playwright/run-spa-check.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# Browser check for the blog SPA. Spins up an EPHEMERAL host server (this +# worktree's binary + lib, a temp persist dir), seeds a couple of posts, runs +# lib/host/playwright/spa-check.spec.js in the main worktree's Playwright, then +# tears everything down. Verifies the WASM OCaml kernel boots in-browser and +# sx-boost turns the blog into a SPA. No live-site dependency. +# +# bash lib/host/playwright/run-spa-check.sh +# +# Requires: the OCaml binary built (hosts/ocaml/_build/default/bin/sx_server.exe) +# and Playwright + chromium in /root/rose-ash (the architecture worktree). +set -uo pipefail +cd "$(git rev-parse --show-toplevel)" +ROOT=$(pwd) + +PORT="${SPA_PORT:-8914}" +PW_DIR="${PW_DIR:-/root/rose-ash}" # worktree that has node_modules + chromium +USER="admin" +PASS="spa-check-pw" +SECRET="spa-check-secret" +PDIR=$(mktemp -d) +JAR=$(mktemp) +SPEC_SRC="lib/host/playwright/spa-check.spec.js" +SPEC_DST="$PW_DIR/tests/playwright/_spa-check.spec.js" +SERVE_LOG=$(mktemp) + +cleanup() { + [ -n "${SVPID:-}" ] && kill "$SVPID" 2>/dev/null + local pid + pid=$(ss -lptn "sport = :$PORT" 2>/dev/null | grep -oE 'pid=[0-9]+' | head -1 | cut -d= -f2) + [ -n "$pid" ] && kill "$pid" 2>/dev/null + rm -f "$SPEC_DST" "$JAR" "$SERVE_LOG" + rm -rf "$PDIR" +} +trap cleanup EXIT + +echo "== starting ephemeral host server on :$PORT (persist=$PDIR) ==" +HOST_PORT="$PORT" SX_PERSIST_DIR="$PDIR" \ + SX_ADMIN_USER="$USER" SX_ADMIN_PASSWORD="$PASS" SX_SESSION_SECRET="$SECRET" \ + bash lib/host/serve.sh >"$SERVE_LOG" 2>&1 & +SVPID=$! + +for i in $(seq 1 60); do + curl -sf -o /dev/null "http://127.0.0.1:$PORT/health" 2>/dev/null && break + sleep 1 + [ "$i" = "60" ] && { echo "server never came up:"; cat "$SERVE_LOG"; exit 1; } +done +echo "== server up ==" + +echo "== seeding posts ==" +curl -s -c "$JAR" -o /dev/null -X POST "http://127.0.0.1:$PORT/login" \ + --data "username=$USER&password=$PASS" +for t in "Alpha Post" "Beta Post"; do + curl -s -b "$JAR" -o /dev/null -X POST "http://127.0.0.1:$PORT/new" \ + --data "title=$t&sx_content=(article (h1 \"$t\") (p \"body\"))&status=published" +done +echo "== seeded ($(curl -s "http://127.0.0.1:$PORT/posts" | grep -o '"slug"' | wc -l) posts) ==" + +echo "== running Playwright ==" +cp "$ROOT/$SPEC_SRC" "$SPEC_DST" +cd "$PW_DIR" +SX_TEST_URL="http://127.0.0.1:$PORT" \ + node_modules/.bin/playwright test _spa-check.spec.js --workers=1 \ + --config tests/playwright/playwright.config.js +RC=$? + +echo "== done (exit $RC) ==" +exit $RC diff --git a/lib/host/playwright/spa-check.spec.js b/lib/host/playwright/spa-check.spec.js new file mode 100644 index 00000000..428481c7 --- /dev/null +++ b/lib/host/playwright/spa-check.spec.js @@ -0,0 +1,65 @@ +// Browser check for the blog SPA (lib/host/blog.sx + lib/host/static.sx). Runs +// against an ephemeral host server seeded with a couple of posts by +// run-spa-check.sh, which copies this spec into the Playwright env and sets +// SX_TEST_URL. Verifies the WASM OCaml kernel boots in the browser, the SX-htmx +// engine activates sx-boost on #content's links, and clicking a link does a +// fragment swap (no full page reload) with history — i.e. it's a real SPA. +const { test, expect } = require('playwright/test'); + +// boot-init sets data-sx-ready="true" on once the WASM kernel + web stack +// have loaded and the page has been processed. WASM compile + ~25 asset fetches, +// so allow generous time. +async function waitReady(page) { + await expect(page.locator('html[data-sx-ready="true"]')).toHaveCount(1, { timeout: 45000 }); +} + +// a post link in the listing (trailing slash); skip /new, /login, /tags. +const POSTLINK = '#content a[href$="/"]'; + +test.describe('blog SPA', () => { + test('WASM kernel boots and marks the document ready', async ({ page }) => { + const errors = []; + page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); }); + page.on('pageerror', (e) => errors.push(String(e))); + await page.goto('/'); + await waitReady(page); + // the shell shipped the WASM loaders + expect(await page.locator('script[src*="sx_browser.bc.wasm.js"]').count()).toBe(1); + expect(await page.locator('script[src*="sx-platform.js"]').count()).toBe(1); + // no boot-time JS errors + expect(errors, errors.join('\n')).toEqual([]); + }); + + test('links inside #content get boosted', async ({ page }) => { + await page.goto('/'); + await waitReady(page); + // the engine marks a boosted element with data-sx-bound containing "boost" + await expect(page.locator(POSTLINK).first()).toHaveAttribute('data-sx-bound', /boost/, { timeout: 15000 }); + }); + + test('clicking a link does a fragment swap — no full reload, URL updates', async ({ page }) => { + await page.goto('/'); + await waitReady(page); + // sentinel survives ONLY if there is no full-page reload + await page.evaluate(() => { window.__noReload = true; }); + const link = page.locator(POSTLINK).first(); + const href = await link.getAttribute('href'); + await link.click(); + await page.waitForURL((u) => u.pathname === href, { timeout: 15000 }); + expect(await page.evaluate(() => window.__noReload)).toBe(true); // no reload + // content was swapped into #content (a post page carries the post footer) + await expect(page.locator('#content')).toContainText(/all posts/i, { timeout: 15000 }); + }); + + test('back button restores the listing', async ({ page }) => { + await page.goto('/'); + await waitReady(page); + const link = page.locator(POSTLINK).first(); + const href = await link.getAttribute('href'); + await link.click(); + await page.waitForURL((u) => u.pathname === href, { timeout: 15000 }); + await page.goBack(); + await page.waitForURL((u) => u.pathname === '/', { timeout: 15000 }); + await expect(page.locator('#content h1')).toContainText('Posts'); + }); +}); diff --git a/lib/host/serve.sh b/lib/host/serve.sh index 472bc090..21f0b302 100755 --- a/lib/host/serve.sh +++ b/lib/host/serve.sh @@ -81,6 +81,7 @@ MODULES=( "lib/host/auth.sx" "lib/host/sxtp.sx" "lib/host/router.sx" + "lib/host/static.sx" "lib/host/feed.sx" "lib/host/relations.sx" "lib/host/blog.sx" @@ -157,5 +158,5 @@ EPOCH=1 # middleware, so a browser logs in then publishes. The bearer resolver is a stub # (no API tokens configured) — browser session is the live auth path for now. # blog-routes LAST — its GET /:slug catch-all must not shadow the rest. - echo "(eval \"(host/serve $PORT (list host/feed-routes host/relations-routes (host/blog-write-routes (fn (tok) nil)) host/blog-routes))\")" + echo "(eval \"(host/serve $PORT (list host/static-routes host/feed-routes host/relations-routes (host/blog-write-routes (fn (tok) nil)) host/blog-routes))\")" } | exec "$SX_SERVER" diff --git a/lib/host/static.sx b/lib/host/static.sx new file mode 100644 index 00000000..eb176bb6 --- /dev/null +++ b/lib/host/static.sx @@ -0,0 +1,52 @@ +;; lib/host/static.sx — serve the client kernel + assets so the blog can boot the +;; SX-htmx hypermedia engine (web/engine.sx) and run as a SPA. The native +;; http-listen host reads files with the `file-read` primitive (no perform), so +;; GET /static/** maps to a file under the static root (default "shared/static", +;; resolved against the server cwd — mount ./shared/static there in the container). +;; Depends on lib/dream/types.sx (dream-response/-html-status/-param) + router. + +(define host/static-root "shared/static") +(define host/static-use-root! (fn (r) (set! host/static-root r))) + +;; content-type by file extension; default to octet-stream. +(define host/static--ctype + (fn (path) + (cond + ((ends-with? path ".js") "application/javascript; charset=utf-8") + ((ends-with? path ".mjs") "application/javascript; charset=utf-8") + ((ends-with? path ".css") "text/css; charset=utf-8") + ((ends-with? path ".json") "application/json; charset=utf-8") + ((ends-with? path ".map") "application/json; charset=utf-8") + ((ends-with? path ".svg") "image/svg+xml") + ((ends-with? path ".png") "image/png") + ((ends-with? path ".woff2") "font/woff2") + ((ends-with? path ".wasm") "application/wasm") + (true "application/octet-stream")))) + +;; reject empty, absolute, or traversal paths. +(define host/static--safe? + (fn (rel) + (and (> (len rel) 0) + (not (starts-with? rel "/")) + (not (string-contains? rel ".."))))) + +;; Serve one asset by its path relative to the static root. file-read THROWS on a +;; missing file, so gate on file-exists? first and return a 404 instead. +(define host/static-serve + (fn (rel) + (if (not (host/static--safe? rel)) + (dream-html-status 403 "Forbidden") + (let ((path (str host/static-root "/" rel))) + (if (not (file-exists? path)) + (dream-html-status 404 "Not Found") + (dream-response 200 + {:content-type (host/static--ctype rel) + :cache-control "public, max-age=3600"} + (file-read path))))))) + +;; Route group: GET /static/** -> file under the static root. A plain route LIST +;; (like host/feed-routes); host/serve combines + flattens the groups itself. +(define host/static-routes + (list + (dream-get "/static/**" + (fn (req) (host/static-serve (dream-param req "**")))))) diff --git a/plans/host-spa.md b/plans/host-spa.md new file mode 100644 index 00000000..c7533fd9 --- /dev/null +++ b/plans/host-spa.md @@ -0,0 +1,67 @@ +# Host blog → SPA via the SX-htmx engine (WASM OCaml kernel) + +Turn the blog (lib/host/blog.sx) into a single-page app using the in-repo SX +hypermedia engine (web/engine.sx — "our htmx"): boot the **WASM OCaml kernel** +(the same evaluator the server runs) in the browser, and `sx-boost` every +link/form into a fragment swap into `#content` — no full reloads, history kept, +graceful degradation to plain server-rendered pages with no JS. + +## Status + +**DONE — server side (verified, all green):** +- `lib/host/static.sx` — `GET /static/**` serves files under `shared/static` via + the `file-read` primitive (content-type by extension, path-traversal guarded, + 404 on missing). Mounted in serve.sh + the route list. Tested: kernel JS 200 + + correct ctype + exact bytes; `.wasm` binary-exact with `application/wasm`; + traversal/missing → 404. +- `lib/host/blog.sx` `host/blog--page` is now the SPA shell: full page = WASM boot + scripts (`/static/wasm/sx_browser.bc.wasm.js` + `sx-platform.js`) + a + `sx-boost="#content"` wrapper div + `#content`. On the `SX-Request: true` header + (a boosted nav) it returns ONLY the inner content (fragment) so the engine swaps + it into `#content`. All 13 page handlers thread `req`. Tested: full page carries + scripts+boost+#content; `SX-Request` returns the bare fragment. +- `docker-compose.dev-sx-host.yml` mounts `./shared/static` so the live container + can serve the kernel. +- `lib/host/playwright/spa-check.spec.js` + `run-spa-check.sh` — browser check + (boot, boost, fragment swap, back button). + +**DONE — client side, partial:** +- The WASM kernel BOOTS in a headless browser: `globalThis.SxKernel` is an object, + `` is set, the web-stack modules load. +- Fixed: this worktree's `shared/static/wasm/sx_browser.bc.wasm.assets/` was + missing 5 of 11 `.wasm` units (`sx-`, `unix-`, `re-`, `start-`, + `dune__exe__Sx_browser-`); copied the complete set from the main worktree. + +**BLOCKER — boost does not activate (`boosted links: 0 / N`):** +- The bundled `.sxbc` bytecode throws `VM: unknown opcode 0` against this + worktree's `sx_browser.bc.wasm.js` kernel, so sx-platform.js falls back to `.sx` + source for every web-stack module. Source fallback works for all modules EXCEPT + `boot.sx`, which then fails with `Expected list, got string` — so the boot + sequence that wires `process-elements → process-boosted` doesn't complete and no + link gets `_sxBoundboost`. +- Root cause: the `.sxbc` in `shared/static/wasm/sx/` are out of sync with the + WASM kernel (sx.rose-ash.com avoids this because its Docker image ships a + consistent bundle and it navigates via client-router page-routes, not boost). + +## Next step — rebuild a consistent WASM bundle + +`scripts/sx-build-all.sh` does: build the browser wasm target → sync web `.sx` +into `hosts/ocaml/browser/dist/sx/` → `node hosts/ocaml/browser/compile-modules.js` +(recompiles `.sxbc` via the native sx_server binary) → copy into +`shared/static/wasm/`. The browser wasm target is NOT built in this worktree +(`hosts/ocaml/_build/default/browser/` is empty), so this needs the +`wasm_of_ocaml` toolchain set up first. Once the `.sxbc` match the kernel, the +bytecode path loads (no source fallback), `boot.sx` runs, and `process-boosted` +binds the links — then the SPA Playwright check should pass. + +Alternatively: build the browser kernel in the main worktree (which has the +pipeline) and copy a consistent `sx_browser.bc.wasm.js` + assets + `.sxbc` set +into this worktree's `shared/static/wasm/`. + +## Deploy note + +The live container is NOT redeployed with the SPA shell yet — it keeps running the +pre-SPA `blog.sx` in memory (the native host doesn't hot-reload). Don't recreate +the container until the bundle is consistent and the SPA Playwright check is green, +to avoid shipping a kernel that boots but doesn't boost. (Even if it is recreated, +pages degrade gracefully: links still do normal full-page nav.) From 4df4de7f7969ed6c29de73d87e5e5925da2d659c Mon Sep 17 00:00:00 2001 From: giles Date: Sun, 28 Jun 2026 21:00:25 +0000 Subject: [PATCH 049/138] =?UTF-8?q?host:=20doc=20=E2=80=94=20SPA=20WASM=20?= =?UTF-8?q?bundle=20rebuild=20attempt=20failed=20(Char.chr=20crash),=20rev?= =?UTF-8?q?erted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- plans/host-spa.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plans/host-spa.md b/plans/host-spa.md index c7533fd9..67d19698 100644 --- a/plans/host-spa.md +++ b/plans/host-spa.md @@ -43,6 +43,20 @@ graceful degradation to plain server-rendered pages with no JS. WASM kernel (sx.rose-ash.com avoids this because its Docker image ships a consistent bundle and it navigates via client-router page-routes, not boost). +## Rebuild attempt (2026-06-28) — FAILED, reverted + +Tried it: `dune build browser/sx_browser.bc.wasm.js` succeeded (with many +`integer-overflow` warnings — "generated code might be incorrect"), and +`node hosts/ocaml/browser/compile-modules.js shared/static/wasm` recompiled all +35 `.sxbc` cleanly. But the freshly-built kernel **crashes on init** in the +browser: `Fatal error: exception Invalid_argument("Char.chr")` — so `SxKernel` +never initialises (worse than before). The integer-overflow truncation during +wasm codegen is the likely culprit (a SHA/char constant). Reverted +`shared/static/wasm/` to the main-worktree bundle (which boots cleanly — +verified SxKernel + data-sx-ready). So a naive in-worktree rebuild is NOT the +fix; the wasm build itself needs investigating (wasm_of_ocaml version? the merged +sx-vm-extensions/resolver changes interacting with codegen?). + ## Next step — rebuild a consistent WASM bundle `scripts/sx-build-all.sh` does: build the browser wasm target → sync web `.sx` From fce9e0c617069856d6d3e9b95f39977ebc912c8b Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 07:51:08 +0000 Subject: [PATCH 050/138] kernel: make the crypto/content-addressing stack actually WASM-safe (32-bit ints) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kernel's sha2/cbor/cid/ed25519 modules were labelled 'WASM-safe' but assumed 63-bit native int. On the web targets — js_of_ocaml (32-bit int) and wasm_of_ocaml (31-bit int) — they truncated, producing wrong digests/CIDs and a Char.chr crash at kernel INIT (ed25519 precomputes sqrtm1 + base_point at module load, driving the base-2^26 bignum). This is why a freshly-built browser kernel crashed on boot while the stale committed artifact (older toolchain) still ran. Fixes (all verified bit-identical to the 63-bit native build, conformance 271/271): - sx_sha2: SHA-256 round words via Int32 (were native int + land 0xFFFFFFFF, which is a no-op on 31-bit and overflows the constants); both SHA-256/512 length-encoding via Int64 shifts (native "lsr 32" is shift-mod-32 on js, which leaked the length byte into a higher word). NIST vectors pass native/js/wasm. - sx_cbor: write_head width selection + byte emission via Int64 (the 0x100000000 literal truncated to 0 on js, sending small ints to the 8-byte branch; and "v lsr (8*i)" with i>=4 was shift-mod-32). - sx_cid: base32_lower keeps acc bounded to the unconsumed low bits (it grew 8 bits/byte and overflowed). cid_from_sx now matches native<->js exactly. - sx_ed25519: bignum mul accumulates in Int64 (26x26=52-bit products overflow); div_small running remainder in Int64 (rem<<26 ~= 2^34). This was the boot gate — the browser kernel now boots (SxKernel live, crypto-sha256 correct on js). Co-Authored-By: Claude Opus 4.8 --- hosts/ocaml/lib/sx_cbor.ml | 32 ++++---- hosts/ocaml/lib/sx_cid.ml | 6 +- hosts/ocaml/lib/sx_ed25519.ml | 25 +++++-- hosts/ocaml/lib/sx_sha2.ml | 135 ++++++++++++++++++++-------------- 4 files changed, 121 insertions(+), 77 deletions(-) diff --git a/hosts/ocaml/lib/sx_cbor.ml b/hosts/ocaml/lib/sx_cbor.ml index b4ec7ba1..97affef6 100644 --- a/hosts/ocaml/lib/sx_cbor.ml +++ b/hosts/ocaml/lib/sx_cbor.ml @@ -15,25 +15,29 @@ exception Cbor_error of string let write_head buf major v = let m = major lsl 5 in + (* Width selection + big-endian byte emission via Int64, so the web targets + compute identically to native: on js_of_ocaml [int] is 32-bit, so the + literal 0x100000000 (2^32) truncates to 0 (sending small values to the + 8-byte branch) and [v lsr (8*i)] with i>=4 is shift-mod-32. Int64 has the + full 64-bit width and well-defined shifts on every target. *) + let v64 = Int64.of_int v in + let put_be nbytes = + for i = nbytes - 1 downto 0 do + Buffer.add_char buf + (Char.chr (Int64.to_int + (Int64.logand (Int64.shift_right_logical v64 (8 * i)) 0xFFL))) + done + in if v < 24 then Buffer.add_char buf (Char.chr (m lor v)) else if v < 0x100 then begin - Buffer.add_char buf (Char.chr (m lor 24)); - Buffer.add_char buf (Char.chr v) + Buffer.add_char buf (Char.chr (m lor 24)); put_be 1 end else if v < 0x10000 then begin - Buffer.add_char buf (Char.chr (m lor 25)); - Buffer.add_char buf (Char.chr ((v lsr 8) land 0xFF)); - Buffer.add_char buf (Char.chr (v land 0xFF)) - end else if v < 0x100000000 then begin - Buffer.add_char buf (Char.chr (m lor 26)); - for i = 3 downto 0 do - Buffer.add_char buf (Char.chr ((v lsr (8 * i)) land 0xFF)) - done + Buffer.add_char buf (Char.chr (m lor 25)); put_be 2 + end else if Int64.compare v64 0x100000000L < 0 then begin + Buffer.add_char buf (Char.chr (m lor 26)); put_be 4 end else begin - Buffer.add_char buf (Char.chr (m lor 27)); - for i = 7 downto 0 do - Buffer.add_char buf (Char.chr ((v lsr (8 * i)) land 0xFF)) - done + Buffer.add_char buf (Char.chr (m lor 27)); put_be 8 end (* dag-cbor map key order: shorter key first, then bytewise. *) diff --git a/hosts/ocaml/lib/sx_cid.ml b/hosts/ocaml/lib/sx_cid.ml index 380fef01..d31a5932 100644 --- a/hosts/ocaml/lib/sx_cid.ml +++ b/hosts/ocaml/lib/sx_cid.ml @@ -32,7 +32,11 @@ let base32_lower (s : string) : string = while !bits >= 5 do bits := !bits - 5; Buffer.add_char buf b32_alpha.[(!acc lsr !bits) land 0x1f] - done) s; + done; + (* Keep only the unconsumed low [bits] bits, so [acc] stays tiny (< 2^13). + Without this it grows by 8 bits per byte and overflows native [int] on + the 32-bit web targets, corrupting the emitted symbols. *) + acc := !acc land ((1 lsl !bits) - 1)) s; if !bits > 0 then Buffer.add_char buf b32_alpha.[(!acc lsl (5 - !bits)) land 0x1f]; Buffer.contents buf diff --git a/hosts/ocaml/lib/sx_ed25519.ml b/hosts/ocaml/lib/sx_ed25519.ml index 0b7a42bc..1a929a6e 100644 --- a/hosts/ocaml/lib/sx_ed25519.ml +++ b/hosts/ocaml/lib/sx_ed25519.ml @@ -68,15 +68,22 @@ let sub (a : bn) (b : bn) : bn = norm r let mul (a : bn) (b : bn) : bn = + (* Accumulate in Int64: a limb product is 26+26 = 52 bits, which overflows the + web targets' int (32-bit js_of_ocaml / 31-bit wasm_of_ocaml). Int64 is a + real 64-bit type on every target, so the carries are exact. *) let la = Array.length a and lb = Array.length b in let r = Array.make (la + lb) 0 in + let maskL = Int64.of_int mask in for i = 0 to la - 1 do - let carry = ref 0 in + let carry = ref 0L in + let ai = Int64.of_int a.(i) in for j = 0 to lb - 1 do - let s = r.(i + j) + a.(i) * b.(j) + !carry in - r.(i + j) <- s land mask; carry := s lsr bits + let s = Int64.add (Int64.add (Int64.of_int r.(i + j)) + (Int64.mul ai (Int64.of_int b.(j)))) !carry in + r.(i + j) <- Int64.to_int (Int64.logand s maskL); + carry := Int64.shift_right_logical s bits done; - r.(i + lb) <- r.(i + lb) + !carry + r.(i + lb) <- r.(i + lb) + Int64.to_int !carry done; norm r @@ -109,12 +116,16 @@ let bn_mod (a : bn) (m : bn) : bn = end let div_small (a : bn) (d : int) : bn = + (* [rem lsl bits] reaches ~2^34 (rem < d <= 256, bits = 26), past the web + targets' int width — accumulate the running remainder in Int64. *) let la = Array.length a in let q = Array.make la 0 in - let rem = ref 0 in + let rem = ref 0L in + let dL = Int64.of_int d in for i = la - 1 downto 0 do - let cur = (!rem lsl bits) lor a.(i) in - q.(i) <- cur / d; rem := cur mod d + let cur = Int64.logor (Int64.shift_left !rem bits) (Int64.of_int a.(i)) in + q.(i) <- Int64.to_int (Int64.div cur dL); + rem := Int64.rem cur dL done; norm q diff --git a/hosts/ocaml/lib/sx_sha2.ml b/hosts/ocaml/lib/sx_sha2.ml index 1ea6b8f8..2eb43e38 100644 --- a/hosts/ocaml/lib/sx_sha2.ml +++ b/hosts/ocaml/lib/sx_sha2.ml @@ -3,37 +3,40 @@ No C stubs, no external deps. Used by the fed-sx host primitives [crypto-sha256] / [crypto-sha512]. Reference: FIPS 180-4. *) -(* ---- SHA-256 (FIPS 180-4 §6.2). 32-bit words held in native int, - masked to 32 bits after every arithmetic op. ---- *) - -let mask32 = 0xFFFFFFFF +(* ---- SHA-256 (FIPS 180-4 §6.2). 32-bit words via Int32, NOT native int. + On the web targets the kernel is compiled by js_of_ocaml (32-bit int) and + wasm_of_ocaml (31-bit int), where native [int] silently truncates the 32-bit + round words — producing WRONG digests (and, downstream, bad CIDs and a + Char.chr crash at kernel init). Int32 has well-defined wrap-around mod 2^32 on + every target, so this matches the 63-bit native build exactly. ---- *) let k256 = [| - 0x428a2f98; 0x71374491; 0xb5c0fbcf; 0xe9b5dba5; - 0x3956c25b; 0x59f111f1; 0x923f82a4; 0xab1c5ed5; - 0xd807aa98; 0x12835b01; 0x243185be; 0x550c7dc3; - 0x72be5d74; 0x80deb1fe; 0x9bdc06a7; 0xc19bf174; - 0xe49b69c1; 0xefbe4786; 0x0fc19dc6; 0x240ca1cc; - 0x2de92c6f; 0x4a7484aa; 0x5cb0a9dc; 0x76f988da; - 0x983e5152; 0xa831c66d; 0xb00327c8; 0xbf597fc7; - 0xc6e00bf3; 0xd5a79147; 0x06ca6351; 0x14292967; - 0x27b70a85; 0x2e1b2138; 0x4d2c6dfc; 0x53380d13; - 0x650a7354; 0x766a0abb; 0x81c2c92e; 0x92722c85; - 0xa2bfe8a1; 0xa81a664b; 0xc24b8b70; 0xc76c51a3; - 0xd192e819; 0xd6990624; 0xf40e3585; 0x106aa070; - 0x19a4c116; 0x1e376c08; 0x2748774c; 0x34b0bcb5; - 0x391c0cb3; 0x4ed8aa4a; 0x5b9cca4f; 0x682e6ff3; - 0x748f82ee; 0x78a5636f; 0x84c87814; 0x8cc70208; - 0x90befffa; 0xa4506ceb; 0xbef9a3f7; 0xc67178f2 |] + 0x428a2f98l; 0x71374491l; 0xb5c0fbcfl; 0xe9b5dba5l; + 0x3956c25bl; 0x59f111f1l; 0x923f82a4l; 0xab1c5ed5l; + 0xd807aa98l; 0x12835b01l; 0x243185bel; 0x550c7dc3l; + 0x72be5d74l; 0x80deb1fel; 0x9bdc06a7l; 0xc19bf174l; + 0xe49b69c1l; 0xefbe4786l; 0x0fc19dc6l; 0x240ca1ccl; + 0x2de92c6fl; 0x4a7484aal; 0x5cb0a9dcl; 0x76f988dal; + 0x983e5152l; 0xa831c66dl; 0xb00327c8l; 0xbf597fc7l; + 0xc6e00bf3l; 0xd5a79147l; 0x06ca6351l; 0x14292967l; + 0x27b70a85l; 0x2e1b2138l; 0x4d2c6dfcl; 0x53380d13l; + 0x650a7354l; 0x766a0abbl; 0x81c2c92el; 0x92722c85l; + 0xa2bfe8a1l; 0xa81a664bl; 0xc24b8b70l; 0xc76c51a3l; + 0xd192e819l; 0xd6990624l; 0xf40e3585l; 0x106aa070l; + 0x19a4c116l; 0x1e376c08l; 0x2748774cl; 0x34b0bcb5l; + 0x391c0cb3l; 0x4ed8aa4al; 0x5b9cca4fl; 0x682e6ff3l; + 0x748f82eel; 0x78a5636fl; 0x84c87814l; 0x8cc70208l; + 0x90befffal; 0xa4506cebl; 0xbef9a3f7l; 0xc67178f2l |] -let rotr32 x n = ((x lsr n) lor (x lsl (32 - n))) land mask32 +let rotr32 (x : int32) (n : int) : int32 = + Int32.logor (Int32.shift_right_logical x n) (Int32.shift_left x (32 - n)) let sha256_hex (msg : string) : string = - let h = [| 0x6a09e667; 0xbb67ae85; 0x3c6ef372; 0xa54ff53a; - 0x510e527f; 0x9b05688c; 0x1f83d9ab; 0x5be0cd19 |] in + let h = [| 0x6a09e667l; 0xbb67ae85l; 0x3c6ef372l; 0xa54ff53al; + 0x510e527fl; 0x9b05688cl; 0x1f83d9abl; 0x5be0cd19l |] in let len = String.length msg in (* Padded length: multiple of 64 bytes. *) - let bitlen = len * 8 in + let bitlen = Int64.mul (Int64.of_int len) 8L in let padlen = let r = (len + 1) mod 64 in if r <= 56 then 56 - r else 120 - r @@ -42,60 +45,79 @@ let sha256_hex (msg : string) : string = let buf = Bytes.make total '\000' in Bytes.blit_string msg 0 buf 0 len; Bytes.set buf len '\x80'; - (* 64-bit big-endian bit length (we cap at OCaml int range). *) + (* 64-bit big-endian bit length. Int64 shifts so the high bytes (shift >= 32) + are correct on the 32-bit web targets — native int `lsr 32` is shift-mod-32 + on js_of_ocaml and would leak the low length byte into a higher word. *) for i = 0 to 7 do Bytes.set buf (total - 1 - i) - (Char.chr ((bitlen lsr (8 * i)) land 0xFF)) + (Char.chr (Int64.to_int + (Int64.logand (Int64.shift_right_logical bitlen (8 * i)) 0xFFL))) done; - let w = Array.make 64 0 in + let byte i = Int32.of_int (Char.code (Bytes.get buf i)) in + let w = Array.make 64 0l in let nblocks = total / 64 in for b = 0 to nblocks - 1 do let base = b * 64 in for t = 0 to 15 do let o = base + t * 4 in w.(t) <- - (Char.code (Bytes.get buf o) lsl 24) - lor (Char.code (Bytes.get buf (o + 1)) lsl 16) - lor (Char.code (Bytes.get buf (o + 2)) lsl 8) - lor (Char.code (Bytes.get buf (o + 3))) + Int32.logor + (Int32.logor + (Int32.shift_left (byte o) 24) + (Int32.shift_left (byte (o + 1)) 16)) + (Int32.logor + (Int32.shift_left (byte (o + 2)) 8) + (byte (o + 3))) done; for t = 16 to 63 do let s0 = - (rotr32 w.(t - 15) 7) lxor (rotr32 w.(t - 15) 18) - lxor (w.(t - 15) lsr 3) in + Int32.logxor + (Int32.logxor (rotr32 w.(t - 15) 7) (rotr32 w.(t - 15) 18)) + (Int32.shift_right_logical w.(t - 15) 3) in let s1 = - (rotr32 w.(t - 2) 17) lxor (rotr32 w.(t - 2) 19) - lxor (w.(t - 2) lsr 10) in - w.(t) <- (w.(t - 16) + s0 + w.(t - 7) + s1) land mask32 + Int32.logxor + (Int32.logxor (rotr32 w.(t - 2) 17) (rotr32 w.(t - 2) 19)) + (Int32.shift_right_logical w.(t - 2) 10) in + w.(t) <- + Int32.add (Int32.add w.(t - 16) s0) (Int32.add w.(t - 7) s1) done; let a = ref h.(0) and bb = ref h.(1) and c = ref h.(2) and d = ref h.(3) and e = ref h.(4) and f = ref h.(5) and g = ref h.(6) and hh = ref h.(7) in for t = 0 to 63 do let s1 = - (rotr32 !e 6) lxor (rotr32 !e 11) lxor (rotr32 !e 25) in - let ch = (!e land !f) lxor ((lnot !e land mask32) land !g) in - let t1 = (!hh + s1 + ch + k256.(t) + w.(t)) land mask32 in + Int32.logxor + (Int32.logxor (rotr32 !e 6) (rotr32 !e 11)) (rotr32 !e 25) in + let ch = + Int32.logxor (Int32.logand !e !f) + (Int32.logand (Int32.lognot !e) !g) in + let t1 = + Int32.add + (Int32.add (Int32.add !hh s1) (Int32.add ch k256.(t))) w.(t) in let s0 = - (rotr32 !a 2) lxor (rotr32 !a 13) lxor (rotr32 !a 22) in - let maj = (!a land !bb) lxor (!a land !c) lxor (!bb land !c) in - let t2 = (s0 + maj) land mask32 in + Int32.logxor + (Int32.logxor (rotr32 !a 2) (rotr32 !a 13)) (rotr32 !a 22) in + let maj = + Int32.logxor + (Int32.logxor (Int32.logand !a !bb) (Int32.logand !a !c)) + (Int32.logand !bb !c) in + let t2 = Int32.add s0 maj in hh := !g; g := !f; f := !e; - e := (!d + t1) land mask32; + e := Int32.add !d t1; d := !c; c := !bb; bb := !a; - a := (t1 + t2) land mask32 + a := Int32.add t1 t2 done; - h.(0) <- (h.(0) + !a) land mask32; - h.(1) <- (h.(1) + !bb) land mask32; - h.(2) <- (h.(2) + !c) land mask32; - h.(3) <- (h.(3) + !d) land mask32; - h.(4) <- (h.(4) + !e) land mask32; - h.(5) <- (h.(5) + !f) land mask32; - h.(6) <- (h.(6) + !g) land mask32; - h.(7) <- (h.(7) + !hh) land mask32 + h.(0) <- Int32.add h.(0) !a; + h.(1) <- Int32.add h.(1) !bb; + h.(2) <- Int32.add h.(2) !c; + h.(3) <- Int32.add h.(3) !d; + h.(4) <- Int32.add h.(4) !e; + h.(5) <- Int32.add h.(5) !f; + h.(6) <- Int32.add h.(6) !g; + h.(7) <- Int32.add h.(7) !hh done; let out = Buffer.create 64 in - Array.iter (fun x -> Buffer.add_string out (Printf.sprintf "%08x" x)) h; + Array.iter (fun x -> Buffer.add_string out (Printf.sprintf "%08lx" x)) h; Buffer.contents out (* ---- SHA-512 (FIPS 180-4 §6.4). 64-bit words via Int64. @@ -146,7 +168,7 @@ let sha512_hex (msg : string) : string = 0x510e527fade682d1L; 0x9b05688c2b3e6c1fL; 0x1f83d9abfb41bd6bL; 0x5be0cd19137e2179L |] in let len = String.length msg in - let bitlen = len * 8 in + let bitlen = Int64.mul (Int64.of_int len) 8L in (* Pad to a multiple of 128 bytes; 16-byte big-endian length. *) let padlen = let r = (len + 1) mod 128 in @@ -156,9 +178,12 @@ let sha512_hex (msg : string) : string = let buf = Bytes.make total '\000' in Bytes.blit_string msg 0 buf 0 len; Bytes.set buf len '\x80'; + (* Low 64 bits of the bit length (high 64 stay 0). Int64 shifts so the bytes + at shift >= 32 are correct on the 32-bit web targets (js shift-mod-32). *) for i = 0 to 7 do Bytes.set buf (total - 1 - i) - (Char.chr ((bitlen lsr (8 * i)) land 0xFF)) + (Char.chr (Int64.to_int + (Int64.logand (Int64.shift_right_logical bitlen (8 * i)) 0xFFL))) done; let w = Array.make 80 0L in let nblocks = total / 128 in From 0ca70eb4b5f42d735db2a61b8197b4fda9d28347 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 07:57:18 +0000 Subject: [PATCH 051/138] =?UTF-8?q?host:=20doc=20=E2=80=94=20wasm=20kernel?= =?UTF-8?q?=20boot=20crash=20fixed=20(crypto),=20boost=20still=20blocked?= =?UTF-8?q?=20on=20web-stack=20load?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- plans/host-spa.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/plans/host-spa.md b/plans/host-spa.md index 67d19698..aea518e1 100644 --- a/plans/host-spa.md +++ b/plans/host-spa.md @@ -43,7 +43,29 @@ graceful degradation to plain server-rendered pages with no JS. WASM kernel (sx.rose-ash.com avoids this because its Docker image ships a consistent bundle and it navigates via client-router page-routes, not boost). -## Rebuild attempt (2026-06-28) — FAILED, reverted +## UPDATE 2026-06-29 — kernel BOOT crash fixed (crypto WASM-safe) + +The boot crash was NOT the build pipeline — it was the kernel's crypto stack +assuming 63-bit native int. On the web targets (js_of_ocaml 32-bit, wasm_of_ocaml +31-bit) sha2/cbor/cid/ed25519 truncated, and ed25519 precomputes `sqrtm1` + +`base_point` AT MODULE INIT via a base-2^26 bignum whose 52-bit products overflow +→ `Char.chr(-4)` crash on load. Fixed in `fce9e0c6` (sx_sha2 Int32 rounds + +Int64 length, sx_cbor Int64 width-select, sx_cid bounded base32, sx_ed25519 Int64 +bignum mul/div_small). Verified: NIST/CID vectors match native↔js↔wasm; native +conformance 271/271; **the freshly-built browser kernel now BOOTS** (SxKernel +live, data-sx-ready=true, crypto-sha256 correct on js + wasm). + +REMAINING for boost (separate layer — web-stack loading, NOT crypto): +- `.sxbc` still fail `VM: unknown opcode 0` against the SX-level `vm.sx` + interpreter, even freshly recompiled — a bytecode-format mismatch (likely the + sx-vm-extensions merge changed sx_vm.ml's opcodes but the served `vm.sx` wasn't + regenerated). So the web stack falls back to `.sx` source. +- `boot.sx` SOURCE then fails `Expected list, got string` (fails on the old + main-worktree kernel too), so `process-boosted` never runs → boost 0/N. + Next: either regenerate `vm.sx` to match the compiler so `.sxbc` load, or fix + the `boot.sx` source-eval failure so source fallback completes. + +## Rebuild attempt (2026-06-28) — FAILED, reverted (superseded by the fix above) Tried it: `dune build browser/sx_browser.bc.wasm.js` succeeded (with many `integer-overflow` warnings — "generated code might be incorrect"), and From 05c0a0b01abe7b50cf949b93dfb4bab19ac6bbb0 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 09:01:12 +0000 Subject: [PATCH 052/138] =?UTF-8?q?host:=20doc=20=E2=80=94=20complete=20bo?= =?UTF-8?q?ost=20diagnosis=20(nil=20.sxbc=20bytecode=20+=20manifest-mapped?= =?UTF-8?q?=20lib=20resolution)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 --- plans/host-spa.md | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/plans/host-spa.md b/plans/host-spa.md index aea518e1..c76efd67 100644 --- a/plans/host-spa.md +++ b/plans/host-spa.md @@ -55,15 +55,33 @@ bignum mul/div_small). Verified: NIST/CID vectors match native↔js↔wasm; nati conformance 271/271; **the freshly-built browser kernel now BOOTS** (SxKernel live, data-sx-ready=true, crypto-sha256 correct on js + wasm). -REMAINING for boost (separate layer — web-stack loading, NOT crypto): -- `.sxbc` still fail `VM: unknown opcode 0` against the SX-level `vm.sx` - interpreter, even freshly recompiled — a bytecode-format mismatch (likely the - sx-vm-extensions merge changed sx_vm.ml's opcodes but the served `vm.sx` wasn't - regenerated). So the web stack falls back to `.sx` source. -- `boot.sx` SOURCE then fails `Expected list, got string` (fails on the old - main-worktree kernel too), so `process-boosted` never runs → boost 0/N. - Next: either regenerate `vm.sx` to match the compiler so `.sxbc` load, or fix - the `boot.sx` source-eval failure so source fallback completes. +REMAINING for boost (separate layer — web-stack loading, NOT crypto). Two +compounding roots, both fully diagnosed: + +1. **`.sxbc` carry NIL bytecode.** `compile-modules.js` (via the native binary) + emits `:bytecode (nil nil nil …)` placeholders, not real bytecode — so the + SX-level `vm.sx` interpreter reads nil → `VM: unknown opcode 0`, and the web + stack falls back to `.sx` source for every module. (Confirmed by inspecting a + freshly-compiled `dom.sxbc`.) The native compiler isn't producing bytecode in + this path. + +2. **Source-fallback can't resolve manifest-mapped libraries.** With imports + stripped, all 23 `boot.sx` body forms load clean — the `Expected list, got + string` is from an `import`. `boot.sx` imports `(sx signals-web)`, but that + library is *defined inside `signals.sx`* (the file→library names don't match; + the module-manifest maps `"sx signals-web" → signals.sxbc`). The `.sx` + source-fallback resolver maps a library to a like-named FILE, looks for a + non-existent `signals-web.sx`, and the failed resolution returns a string into + a list op → the error → `boot.sx` never loads → `process-boosted` never runs → + boost 0/N. (A `signals-web.sx` bridge that imports signals was NOT sufficient + — there is at least one more such mismatch among the imports.) + +THE CLEAN FIX is a proper bundle rebuild via `scripts/sx-build-all.sh` so the +`.sxbc` carry real bytecode and the manifest-driven path loads everything (no +source fallback, so root #2 never triggers) — gated on fixing root #1 (why +`compile-modules.js` emits nil bytecode). Alternatively, make the source-fallback +resolver manifest-aware. Neither is a quick edit; it's a web-stack build-tooling +sub-project. The kernel itself is now correct and boots. ## Rebuild attempt (2026-06-28) — FAILED, reverted (superseded by the fix above) From 689dae7d0c82f7fd600ce0902d29602505ed2a34 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 11:09:11 +0000 Subject: [PATCH 053/138] host+kernel: blog SPA boost works end-to-end on the WASM OCaml kernel (Playwright 4/4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking a blog link now fragment-swaps #content with URL push + working back button, no full reload — the SX-htmx engine driving the same OCaml kernel the server runs. Six bugs in the source-load + boost path, found by bisecting in chromium, all fixed: 1. Import double-apply (sx_server.ml x2, sx_browser.ml): the import suspension handlers computed `key = library_name_key lib_spec` then called `library_loaded_p key` — but library_loaded_p applies library_name_key itself, so it ran sx_to_list on a string and crashed ("Expected list, got string"). Only unloaded libs suspend, so it only bit lazy imports. Pass the spec, not the key. 2. Unloaded-import crash (spec/evaluator.sx + sx_ref.ml library_exports): an import of a not-yet-loaded library returned nil exports, and bind-import-set did (keys nil) -> crash. Return an empty dict so the import is a graceful no-op (lazy symbol resolution covers real usage). 3. value_to_js missing Integer (sx_browser.ml): integers passed to host methods were mishandled, so dom-query-all's (host-call node-list "item" i) ignored i and returned node 0 for every index — every element aliased the first, so only one link ever boosted. Add the Integer -> JS number case. 4. browser-same-origin? rejected relative URLs (browser.sx x2): it only did (starts-with? url origin), so "/alpha/" was treated as cross-origin and should-boost-link? refused every relative link. Accept scheme-less, non-protocol-relative URLs. 5. dom-query-in undefined (orchestration.sx x2): the swap path called a function that exists nowhere; it's just dom-query with a container arg. 6. Lazy-deps never loaded under source fallback (sx-platform.js): lazy symbol resolution only fires on the VM GLOBAL_GET path, but source-loaded swap callbacks run on the CEK and raise instead of lazy-loading, so the post-swap hs-boot-subtree!/htmx-boot-subtree! were undefined and aborted URL push. Preload the manifest's lazy-deps. Verified: native host conformance 271/271; lib/host/playwright/spa-check 4/4 (boot, boost, fragment swap + URL push, back button) in real chromium against an ephemeral durable host server. --- hosts/ocaml/bin/sx_server.ml | 11 +- hosts/ocaml/browser/sx_browser.ml | 6 +- hosts/ocaml/lib/sx_ref.ml | 2 +- lib/host/playwright/spa-check.spec.js | 6 +- shared/static/wasm/sx-platform.js | 13 + shared/static/wasm/sx/browser.sx | 5 +- shared/static/wasm/sx/orchestration.sx | 2 +- shared/static/wasm/sx_browser.bc.js | 18292 +++++++++++++++------ shared/static/wasm/sx_browser.bc.wasm.js | 2 +- spec/evaluator.sx | 4 +- web/lib/browser.sx | 5 +- web/orchestration.sx | 2 +- 12 files changed, 12987 insertions(+), 5363 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 4ecb34c7..4b8a2492 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -537,8 +537,10 @@ and resolve_io_request request = | "import" -> (* Resolve library locally — load the .sx file *) let lib_spec = Sx_runtime.get_val request (String "library") in - let key = Sx_ref.library_name_key lib_spec in - if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then + (* library_loaded_p takes the library SPEC and computes the key itself — + passing an already-computed key string double-applies library_name_key + and crashes (sx_to_list on a string). *) + if Sx_types.sx_truthy (Sx_ref.library_loaded_p lib_spec) then (* Already loaded — just resume *) Nil else begin @@ -1815,8 +1817,9 @@ let rec dispatch env cmd = | _ -> "" in let response = if op = "import" then begin let lib_spec = Sx_runtime.get_val request (String "library") in - let key = Sx_ref.library_name_key lib_spec in - if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then Nil + (* pass the SPEC, not a pre-computed key — library_loaded_p applies + library_name_key itself (a key string would crash sx_to_list). *) + if Sx_types.sx_truthy (Sx_ref.library_loaded_p lib_spec) then Nil else begin (match resolve_library_path lib_spec with | Some path -> load_library_file path | None -> ()); diff --git a/hosts/ocaml/browser/sx_browser.ml b/hosts/ocaml/browser/sx_browser.ml index 34d019ad..451d6ed3 100644 --- a/hosts/ocaml/browser/sx_browser.ml +++ b/hosts/ocaml/browser/sx_browser.ml @@ -73,6 +73,7 @@ let rec value_to_js (v : value) : Js.Unsafe.any = | Nil -> Js.Unsafe.inject Js.null | Bool b -> Js.Unsafe.inject (Js.bool b) | Number n -> Js.Unsafe.inject (Js.number_of_float n) + | Integer n -> Js.Unsafe.inject (Js.number_of_float (float_of_int n)) | String s -> Js.Unsafe.inject (Js.string s) | RawHTML s -> Js.Unsafe.inject (Js.string s) | Symbol s -> @@ -329,8 +330,9 @@ let handle_import_suspension request = let lib_spec = match request with | Dict d -> (match Hashtbl.find_opt d "library" with Some v -> v | _ -> Nil) | _ -> Nil in - let key = Sx_ref.library_name_key lib_spec in - if Sx_types.sx_truthy (Sx_ref.library_loaded_p key) then + (* library_loaded_p takes the SPEC and applies library_name_key itself — + passing a pre-computed key string double-applies it and crashes. *) + if Sx_types.sx_truthy (Sx_ref.library_loaded_p lib_spec) then Some Nil (* Already loaded — resume immediately *) else None (* Not loaded — JS platform must fetch it *) diff --git a/hosts/ocaml/lib/sx_ref.ml b/hosts/ocaml/lib/sx_ref.ml index 2b12cc22..7d1893fb 100644 --- a/hosts/ocaml/lib/sx_ref.ml +++ b/hosts/ocaml/lib/sx_ref.ml @@ -404,7 +404,7 @@ and library_loaded_p spec = (* library-exports *) and library_exports spec = - (get ((get (_library_registry_) ((library_name_key (spec))))) ((String "exports"))) + (let entry = (get (_library_registry_) ((library_name_key (spec)))) in (if sx_truthy (entry) then (get (entry) ((String "exports"))) else (Dict (Hashtbl.create 0)))) (* register-library *) and register_library spec exports = diff --git a/lib/host/playwright/spa-check.spec.js b/lib/host/playwright/spa-check.spec.js index 428481c7..ced6ca42 100644 --- a/lib/host/playwright/spa-check.spec.js +++ b/lib/host/playwright/spa-check.spec.js @@ -33,8 +33,10 @@ test.describe('blog SPA', () => { test('links inside #content get boosted', async ({ page }) => { await page.goto('/'); await waitReady(page); - // the engine marks a boosted element with data-sx-bound containing "boost" - await expect(page.locator(POSTLINK).first()).toHaveAttribute('data-sx-bound', /boost/, { timeout: 15000 }); + // the engine marks a boosted link with the _sxBoundboost JS property + await expect + .poll(() => page.locator(POSTLINK).first().evaluate((a) => !!a._sxBoundboost), { timeout: 15000 }) + .toBe(true); }); test('clicking a link does a fragment swap — no full reload, URL updates', async ({ page }) => { diff --git a/shared/static/wasm/sx-platform.js b/shared/static/wasm/sx-platform.js index 1b873404..8e3588d2 100644 --- a/shared/static/wasm/sx-platform.js +++ b/shared/static/wasm/sx-platform.js @@ -643,6 +643,19 @@ loadLibrary(entry.deps[i], loading); } + // Also eagerly load lazy-deps. Lazy symbol resolution (the _resolve-symbol + // hook) only fires on the VM GLOBAL_GET path, but source-loaded modules run + // their callbacks via the CEK, which raises "Undefined symbol" instead of + // lazy-loading. So when bytecode is unavailable (source fallback), the swap + // post-processing (hs-boot-subtree! / htmx-boot-subtree! in process-elements) + // would fail. Preload them to keep every symbol defined. + var lazyDeps = entry["lazy-deps"] || entry.lazyDeps; + if (lazyDeps) { + for (var li = 0; li < lazyDeps.length; li++) { + loadLibrary(lazyDeps[li], loading); + } + } + // Load entry point itself (boot.sx — not a library, just defines + init) loadBytecodeFile("sx/" + entry.file) || loadSxFile("sx/" + entry.file.replace(/\.sxbc$/, '.sx')); diff --git a/shared/static/wasm/sx/browser.sx b/shared/static/wasm/sx/browser.sx index c3fefe15..0b6c5380 100644 --- a/shared/static/wasm/sx/browser.sx +++ b/shared/static/wasm/sx/browser.sx @@ -49,7 +49,10 @@ (fn () (host-get (host-get (dom-window) "location") "origin"))) (define browser-same-origin? - (fn (url) (starts-with? url (browser-location-origin)))) + ;; A relative URL (no scheme, not protocol-relative "//host") is same-origin + ;; by definition; an absolute URL must start with our origin. The old check + ;; only did the latter, so it wrongly rejected every relative link ("/x"). + (fn (url) (or (starts-with? url (browser-location-origin)) (and (not (string-contains? url "://")) (not (starts-with? url "//")))))) (define url-pathname (fn diff --git a/shared/static/wasm/sx/orchestration.sx b/shared/static/wasm/sx/orchestration.sx index 31cd2a9b..d5c68d03 100644 --- a/shared/static/wasm/sx/orchestration.sx +++ b/shared/static/wasm/sx/orchestration.sx @@ -416,7 +416,7 @@ (post-swap t))) (hoist-head-elements container) (let - ((manifest-el (dom-query-in container "script[data-sx-manifest]"))) + ((manifest-el (dom-query container "script[data-sx-manifest]"))) (when manifest-el (host-call diff --git a/shared/static/wasm/sx_browser.bc.js b/shared/static/wasm/sx_browser.bc.js index a66eb9bd..01e9a5dd 100644 --- a/shared/static/wasm/sx_browser.bc.js +++ b/shared/static/wasm/sx_browser.bc.js @@ -9304,8 +9304,8 @@ (globalThis)); (function(a){"use strict";var -i=a.jsoo_runtime,c=i.caml_get_global_data(),d7="caml_unix_stat_64",d6="unix_lseek",l="caml_unix_inchannel_of_filedescr",d4="caml_unix_stat",d3="caml_unix_write_bigarray",fK="caml_nativeint_format",bh="caml_int64_of_nativeint",d2="caml_unix_closedir",bg="caml_unix_getgrnam",cB="caml_unix_truncate",cA="caml_unix_getcwd",fG="caml_unix_readlink",fH="caml_floatarray_set",be="caml_fill_bytes",bd="unix_error_message",cy="win_inchannel_of_filedescr",bc="caml_unix_time",cv="caml_unix_write",dY="unix_lstat",fC="unix_open",dW="unix_rename",fB="caml_unix_chmod",a_="unix_access",a8="caml_unix_lseek",a9="unix_fsync",dV="caml_unix_findnext",a6="caml_weak_get_copy",h="caml_array_set",dU="caml_unix_opendir",fz="caml_unix_lookup_file",a5="caml_unix_getegid",fy="caml_unix_getgid",cr="caml_js_from_nativeint",a1="caml_unix_gmtime",a2="caml_signbit_float",fw="caml_unix_close",fv="caml_js_from_int32",fu="caml_int64_to_int",cm="caml_check_bound_gen",p="caml_format_int",dO="unix_link",ci="unix_mkdir",aY="unix_rewinddir",aZ="unix_read",dK="caml_unix_unlink",aV="unix_getgid",dI="caml_unix_error_message",fq="caml_unix_findclose",aQ="caml_unix_lseek_64",fo="caml_array_get_float",cd="win_outchannel_of_filedescr",dF="caml_unix_fstat",cb="caml_unix_geteuid",dD="unix_lstat_64",aO="unix_inchannel_of_filedescr",b8="unix_getpwnam",b9="unix_geteuid",aN="caml_unix_getuid",dC="caml_unix_utimes",fi="caml_unix_getpwuid",fj="unix_getpwuid",o="caml_check_bound",fh="unix_ftruncate_64",aK="unix_isatty",b6="caml_unix_times",dA="caml_unix_exit",fg="unix_exit",aH="caml_unix_single_write",b5="caml_ephe_blit_key",dy="caml_nativeint_of_string",aG="unix_write",dw="caml_unix_ftruncate_64",dx="unix_close",fd="caml_js_to_int32",k="caml_sys_getcwd",dv="caml_unix_readdir",b2="win_findclose",aA="%int_mul",dt="caml_int32_format",e9="caml_weak_blit",dr="caml_unix_localtime",ds="unix_times",e8="caml_array_set_addr",dq="caml_unix_inet_addr_of_string",e7="unix_ftruncate",dp="caml_weak_check",e6="caml_unix_symlink",ax="unix_outchannel_of_filedescr",au="caml_unix_has_symlink",dl="unix_mktime",s="caml_int64_to_int32",bY="unix_fstat",e2="caml_unix_link",at="caml_unix_fchmod",bV="unix_symlink",as="unix_localtime",e0="unix_chdir",ar="unix_getgrgid",ap="caml_int32_compare",ao="caml_unix_mkdir",eX="win_startup",eW="caml_int32_bswap",an="caml_weak_get",eU="unix_readlink",al="caml_unix_rmdir",e="caml_array_get",ak="caml_unix_lstat_64",aj="unix_inet_addr_of_string",bO="caml_unix_gettimeofday",r="caml_unix_outchannel_of_filedescr",bL="unix_stat",df="caml_unix_chdir",ah="unix_closedir",ai="win_cleanup",bK="caml_nativeint_bswap",ae="caml_unix_mktime",af="caml_ephe_get_key",ag="%int_mod",bJ="unix_stat_64",db="unix_getegid",dc="caml_unix_access",c$="caml_unix_isatty",ad="caml_int32_mul",c_="caml_nativeint_compare",q="caml_int64_of_int32",ab="caml_unix_fsync",eP="win_findnext",Z="caml_nativeint_mul",eO="unix_single_write",Y="caml_int32_mod",n="caml_js_from_float",c6="unix_truncate_64",c5="caml_ephe_check_key",eM="unix_opendir",bI="caml_array_set_float",eK="caml_ephe_get_key_copy",U="unix_getuid",d="caml_mul",T="caml_fill_string",g="caml_div",c0="caml_int64_of_int",eH="caml_unix_read_bigarray",S="unix_getgrnam",eF="win_findfirst",eE="caml_unix_startup",bF="caml_unix_filedescr_of_fd",eD="caml_unix_ftruncate",f="caml_mod",cZ="caml_check_bound_float",bD="unix_utimes",bE="caml_unix_getgrgid",eB="caml_int64_to_nativeint",bC="unix_time",eA="unix_fstat_64",O="caml_unix_fstat_64",cW="unix_truncate",bA="unix_gmtime",bz="caml_unix_cleanup",ex="unix_getcwd",ew="unix_readdir",j="caml_sys_exit",K="caml_channel_descriptor",bv="unix_lseek_64",t="caml_int_compare",J="caml_array_get_addr",eo="unix_chmod",ep="caml_unix_lstat",en="caml_js_to_nativeint",I="caml_int32_div",cP="caml_unix_findfirst",H="caml_unix_truncate_64",G="caml_unix_rewinddir",F="unix_has_symlink",m="caml_int_of_string",ek="caml_unix_rename",bt="win_filedescr_of_channel",E="unix_gettimeofday",ej="win_handle_fd",b="caml_unix_getpwnam",cK="caml_int32_of_string",eh="caml_nativeint_mod",x="unix_rmdir",cH="caml_unix_read",cI="unix_read_bigarray",ea="caml_floatarray_get",w="unix_unlink",bn="caml_unix_open",d_="caml_signbit",v="unix_fchmod",bl="caml_nativeint_div",d9="%int_div";c.aliases=i.caml_list_of_js_array([[0,cm,o],[0,fu,s],[0,d9,g],[0,fv,n],[0,eF,cP],[0,bl,g],[0,v,at],[0,S,b],[0,ax,r],[0,c0,q],[0,cr,n],[0,d_,a2],[0,dp,c5],[0,T,be],[0,w,dK],[0,e7,eD],[0,ea,e],[0,e8,h],[0,U,aN],[0,cI,eH],[0,x,al],[0,ds,b6],[0,e9,b5],[0,dt,p],[0,fz,d3],[0,bI,h],[0,aA,d],[0,eM,dU],[0,b2,fq],[0,cK,m],[0,eh,f],[0,c6,H],[0,Y,f],[0,a6,eK],[0,Z,d],[0,eO,aH],[0,dx,fw],[0,a9,ab],[0,aG,cv],[0,dy,m],[0,a_,dc],[0,ej,bF],[0,eP,dV],[0,E,bO],[0,bt,K],[0,fg,j],[0,c_,t],[0,ad,d],[0,dA,j],[0,F,au],[0,dW,ek],[0,aK,c$],[0,fh,dw],[0,db,a5],[0,dY,ep],[0,fC,bn],[0,I,g],[0,fj,b],[0,fi,b],[0,bJ,d7],[0,en,fd],[0,ag,f],[0,bK,eW],[0,b9,cb],[0,b8,b],[0,ai,bz],[0,ah,d2],[0,cy,l],[0,eo,fB],[0,bL,d4],[0,J,e],[0,aO,l],[0,aj,dq],[0,dD,ak],[0,fH,h],[0,cA,k],[0,cd,r],[0,fo,e],[0,eU,fG],[0,an,af],[0,bg,b],[0,bv,aQ],[0,eX,eE],[0,ew,dv],[0,aV,fy],[0,dI,bd],[0,ap,t],[0,ex,k],[0,bA,a1],[0,bh,q],[0,ar,b],[0,cW,cB],[0,e0,df],[0,as,dr],[0,fK,p],[0,eA,O],[0,bV,e6],[0,bC,bc],[0,eB,s],[0,aZ,cH],[0,aY,G],[0,ci,ao],[0,bE,b],[0,dO,e2],[0,bD,dC],[0,cZ,o],[0,bY,dF],[0,d6,a8],[0,dl,ae]]);c.prim_count=952;var -d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0="Js_of_ocaml__Dom_svg",d1="Stdlib__Out_channel",fI="Match_failure",dZ=157,bf="Stdlib__Gc",fE="Re__Compile",fF="Stdlib__Unit",cz="Re__Posix_class",fD=136,cx="Jsoo_runtime__Runtime_version",cw="Stdlib__Map",bb="Sx_vm",dX="Stdlib__Parsing",ba="Stdlib__Effect",cu=108,a$="Stdlib__String",fA="Re_pcre",a7="Stdlib__BytesLabels",dT="Stdlib__Condition",ct=148,dS="Stdlib__Filename",a4="Stdlib__In_channel",dQ="Not_found",dR="Re__Fmt",cs=154,a3="CamlinternalLazy",fx="Sx_vm_ref",cq="Division_by_zero",cp="Js_of_ocaml__Effect_js",co="Re__Glob",dP="Re__Parse_buffer",a0=117,cn=104,ft="Js_of_ocaml__",cl="Stdlib__Either",ck=109,cj="Js_of_ocaml__MutationObserver",ch="Js_of_ocaml__Json",dN="Stdlib__Callback",dM=155,aX="Stdlib__Lexing",cg="Undefined_recursive_module",dL="Stdlib__Printf",fs=111,aW="Stdlib__Bool",cf="UnixLabels",dJ="Stdlib__Int",fr=153,dH="Stdlib__MoreLabels",aS=127,aT=103,aU="Sx_render",dG="Sys_error",aR=100,ce="Js_of_ocaml__Dom_events",fp="Stdlib__Digest",dE=101,cc=151,aP="Sx_compiler",ca="Js_of_ocaml__PerformanceObserver",fn="Re__View",b$="Stdlib__Queue",fm=110,b_="Stdlib__Set",fl="Stdlib__Stack",fk="Js_of_ocaml__File",dB="Stdlib__Complex",aM="Re__Dyn",aL="Jsoo_runtime__",b7="Re__Import",dz="Jsoo_runtime",ff=130,aI="Js_of_ocaml__WebSockets",aJ="Stdlib__Nativeint",fe=128,aF=113,b4=146,fc=156,b3="Re__Dense_map",du="Sys_blocked_io",aE="Stdlib__Random",fb="Js_of_ocaml__ResizeObserver",fa="Sx_runtime",aD=135,b1=144,e$="Js_of_ocaml",aB=106,aC="Stdlib__Marshal",az="Js_of_ocaml__Console",e_=140,b0="Sx_primitives",bZ="Stdlib__Ephemeron",ay="CamlinternalMod",dn="Re__Color_map",aw="Js_of_ocaml__Js",av="Js_of_ocaml__Url",e5="Stdlib__Fun",e4="Stdlib__Char",dm=125,e3="Re__Category",bW=138,bX=116,e1=126,aq="Re__Ast",dk="Dune__exe__Sx_browser",dj=150,eZ="CamlinternalFormatBasics",di="Stdlib__Weak",bU=105,dh="Stdlib__Format",eY="Stdlib__StdLabels",dg="Stdlib__Int64",eV="Re__Search",bT="Js_of_ocaml__Dom_html",am="Stdlib__ArrayLabels",bS=129,eT="Re__Cset",bR="Stdlib__Bigarray",bP=137,bQ="Re__Core",bM=132,bN="Re__Emacs",de="Re__Automata",dd="Re__Pmark",da="Js_of_ocaml__IntersectionObserver",ac=115,c9=131,eQ=122,eR="Stdlib",eS="Stdlib__StringLabels",aa="Stdlib__Atomic",$="Sx_cst",c8="Re__",_="Stdlib__ListLabels",c7="Stdlib__Seq",eN="Js_of_ocaml__CSS",X=134,c4="Js_of_ocaml__XmlHttpRequest",eL="Re__Bit_vector",W="Stdlib__Uchar",V=152,c3="Stdlib__Arg",c2="Js_of_ocaml__Form",c1="Stdlib__Scanf",eJ=112,eI="Re__Slice",eG="Js_of_ocaml__Intl",bH=107,bG="Stdlib__Printexc",R="Js_of_ocaml__Sys_js",eC="Js_of_ocaml__Import",Q="Re",cX=147,cY="Js_of_ocaml__Geolocation",ez="Re__Perl",P="Js_of_ocaml__Worker",bB="Stdlib__Dynarray",ey="Assert_failure",N="Re__Pcre",M=141,bx=121,by=118,bw=120,cV="Stdlib__Array",L="Js_of_ocaml__EventSource",cU="Stdlib__Obj",ev="Stdlib__Hashtbl",et="Stdlib__Domain",eu="Stdlib__Option",es=124,er="Std_exit",eq=149,cT="Re__Group",cS="Sx_ref",bu=145,cQ="Invalid_argument",cR="Stack_overflow",cO="End_of_file",cN="Js_of_ocaml__WebGL",em="Sx_types",el="Failure",D="Js_of_ocaml__Jstable",ei="Stdlib__Lazy",bs="Stdlib__Semaphore",cM="Out_of_memory",C="Js_of_ocaml__Lib_version",B="Js_of_ocaml__Regexp",cL="Js_of_ocaml__Dom",A="Stdlib__Bytes",br="Stdlib__Sys",eg=143,ef="CamlinternalOO",bq="Re__Posix",cJ="Stdlib__Int32",ee="Stdlib__Oo",bp=123,y="Re__Replace",z="Unix",eb="Re__Mark_infos",ec="Stdlib__Mutex",ed=119,bo="Stdlib__List",cG=139,bm="Sx_parser",d$="Stdlib__Float",bk=142,cF="CamlinternalFormat",u="Re__Str",d8="Js_of_ocaml__Typed_array",cE="Stdlib__Result";c.symbols=[0,[0,cf,fs],[0,z,fm],[0,cg,11],[0,dG,10],[0,du,9],[0,fx,ed],[0,bb,by],[0,em,eJ],[0,fa,bX],[0,aU,bw],[0,cS,a0],[0,b0,ac],[0,bm,cD],[0,$,aF],[0,aP,bx],[0,di,62],[0,fF,31],[0,W,26],[0,cC,17],[0,br,15],[0,eS,75],[0,a$,30],[0,eY,77],[0,fl,42],[0,b_,40],[0,c7,21],[0,bs,47],[0,c1,64],[0,cE,23],[0,aE,60],[0,b$,43],[0,dL,50],[0,bG,53],[0,dX,39],[0,d1,57],[0,eu,22],[0,ee,67],[0,cU,16],[0,aJ,37],[0,ec,45],[0,dH,76],[0,aC,32],[0,cw,41],[0,_,73],[0,bo,27],[0,aX,38],[0,ei,20],[0,dg,36],[0,cJ,35],[0,dJ,28],[0,a4,56],[0,ev,61],[0,bf,55],[0,e5,54],[0,dh,63],[0,d$,34],[0,dS,70],[0,bZ,69],[0,cl,14],[0,ba,78],[0,bB,51],[0,et,48],[0,fp,58],[0,dT,46],[0,dB,71],[0,e4,25],[0,dN,65],[0,a7,74],[0,A,29],[0,fJ,44],[0,aW,24],[0,bR,59],[0,aa,18],[0,am,72],[0,cV,33],[0,c3,52],[0,eR,13],[0,er,dZ],[0,cR,8],[0,fA,ck],[0,fn,93],[0,u,dE],[0,eI,95],[0,eV,97],[0,y,bj],[0,cz,cn],[0,bq,bH],[0,dd,89],[0,ez,bU],[0,N,aB],[0,dP,99],[0,eb,88],[0,b7,85],[0,bi,87],[0,cT,94],[0,co,aT],[0,dR,80],[0,bN,aR],[0,aM,82],[0,b3,84],[0,eT,86],[0,bQ,98],[0,fE,96],[0,dn,91],[0,e3,83],[0,eL,81],[0,de,90],[0,aq,92],[0,c8,79],[0,Q,cu],[0,cM,7],[0,dQ,6],[0,fI,5],[0,cx,bp],[0,aL,eQ],[0,dz,es],[0,c4,d5],[0,P,X],[0,aI,aD],[0,cN,fD],[0,av,bW],[0,d8,bS],[0,R,e_],[0,fb,M],[0,B,bP],[0,ca,bk],[0,cj,eg],[0,C,cG],[0,D,b1],[0,ch,bu],[0,aw,aS],[0,eG,cs],[0,da,fr],[0,eC,e1],[0,cY,V],[0,c2,bM],[0,fk,ff],[0,L,cc],[0,cp,dj],[0,d0,eq],[0,bT,c9],[0,ce,ct],[0,cL,fe],[0,az,cX],[0,eN,b4],[0,ft,dm],[0,e$,dM],[0,cQ,4],[0,el,3],[0,cO,2],[0,dk,fc],[0,cq,1],[0,ef,66],[0,ay,68],[0,a3,19],[0,eZ,12],[0,cF,49],[0,ey,0]];c.sections=[0,[0,158,[0,[0,[0,[0,[0,[0,[0,0,[0,ey],0,[0,0,[0,cF],49,0,1],2],[0,eZ],12,0,3],[0,a3],19,[0,[0,[0,0,[0,ay],68,0,1],[0,ef],66,0,2],[0,cq],1,[0,[0,0,[0,dk],fc,0,1],[0,cO],2,0,2],3],4],[0,el],3,[0,[0,[0,0,[0,cQ],4,[0,0,[0,e$],dM,0,1],2],[0,ft],dm,[0,0,[0,eN],b4,[0,0,[0,az],cX,0,1],2],3],[0,cL],fe,[0,[0,[0,0,[0,ce],ct,0,1],[0,bT],c9,0,2],[0,d0],eq,[0,[0,0,[0,cp],dj,[0,0,[0,L],cc,0,1],2],[0,fk],ff,[0,0,[0,c2],bM,[0,0,[0,cY],V,0,1],2],3],4],5],6],[0,eC],e1,[0,[0,[0,[0,[0,[0,0,[0,da],fr,[0,0,[0,eG],cs,0,1],2],[0,aw],aS,[0,[0,0,[0,ch],bu,0,1],[0,D],b1,0,2],3],[0,C],cG,[0,[0,0,[0,cj],eg,0,1],[0,ca],bk,0,2],4],[0,B],bP,[0,[0,0,[0,fb],M,0,1],[0,R],e_,0,2],5],[0,d8],bS,[0,[0,[0,[0,0,[0,av],bW,0,1],[0,cN],fD,0,2],[0,aI],aD,0,3],[0,P],X,[0,0,[0,c4],d5,0,1],4],6],[0,dz],es,[0,[0,[0,0,[0,aL],eQ,[0,0,[0,cx],bp,0,1],2],[0,fI],5,[0,0,[0,dQ],6,0,1],3],[0,cM],7,[0,[0,0,[0,Q],cu,0,1],[0,c8],79,[0,[0,0,[0,aq],92,0,1],[0,de],90,0,2],3],4],7],8],[0,eL],81,[0,[0,[0,[0,[0,0,[0,e3],83,0,1],[0,dn],91,[0,0,[0,fE],96,[0,0,[0,bQ],98,0,1],2],3],[0,eT],86,[0,0,[0,b3],84,0,1],4],[0,aM],82,[0,[0,[0,0,[0,bN],aR,0,1],[0,dR],80,[0,[0,[0,0,[0,co],aT,0,1],[0,cT],94,0,2],[0,bi],87,0,3],4],[0,b7],85,[0,[0,[0,0,[0,eb],88,0,1],[0,dP],99,[0,[0,0,[0,N],aB,0,1],[0,ez],bU,0,2],3],[0,dd],89,[0,[0,[0,[0,0,[0,bq],bH,0,1],[0,cz],cn,0,2],[0,y],bj,[0,0,[0,eV],97,0,1],3],[0,eI],95,[0,[0,0,[0,u],dE,0,1],[0,fn],93,[0,[0,0,[0,fA],ck,0,1],[0,cR],8,[0,0,[0,er],dZ,0,1],2],3],4],5],6],7],[0,eR],13,[0,[0,[0,[0,0,[0,c3],52,0,1],[0,cV],33,[0,0,[0,am],72,0,1],2],[0,aa],18,[0,0,[0,bR],59,0,1],3],[0,aW],24,[0,[0,[0,0,[0,fJ],44,0,1],[0,A],29,[0,[0,0,[0,a7],74,0,1],[0,dN],65,0,2],3],[0,e4],25,[0,[0,0,[0,dB],71,0,1],[0,dT],46,[0,[0,0,[0,fp],58,0,1],[0,et],48,[0,0,[0,bB],51,[0,0,[0,ba],78,0,1],2],3],4],5],6],8],9],[0,cl],14,[0,[0,[0,[0,[0,[0,0,[0,bZ],69,[0,0,[0,dS],70,0,1],2],[0,d$],34,[0,0,[0,dh],63,0,1],3],[0,e5],54,[0,0,[0,bf],55,[0,[0,0,[0,ev],61,0,1],[0,a4],56,0,2],3],4],[0,dJ],28,[0,0,[0,cJ],35,[0,0,[0,dg],36,0,1],2],5],[0,ei],20,[0,[0,[0,0,[0,aX],38,0,1],[0,bo],27,[0,[0,0,[0,_],73,0,1],[0,cw],41,0,2],3],[0,aC],32,[0,[0,[0,0,[0,dH],76,0,1],[0,ec],45,0,2],[0,aJ],37,0,3],4],6],[0,cU],16,[0,[0,[0,[0,[0,[0,0,[0,ee],67,0,1],[0,eu],22,[0,0,[0,d1],57,0,1],2],[0,dX],39,[0,[0,0,[0,bG],53,0,1],[0,dL],50,0,2],3],[0,b$],43,[0,[0,0,[0,aE],60,0,1],[0,cE],23,[0,[0,0,[0,c1],64,0,1],[0,bs],47,0,2],3],4],[0,c7],21,[0,[0,0,[0,b_],40,[0,0,[0,fl],42,[0,0,[0,eY],77,0,1],2],3],[0,a$],30,[0,0,[0,eS],75,0,1],4],5],[0,br],15,[0,[0,[0,[0,[0,0,[0,cC],17,0,1],[0,W],26,[0,0,[0,fF],31,0,1],2],[0,di],62,[0,[0,0,[0,aP],bx,0,1],[0,$],aF,0,2],3],[0,bm],cD,[0,[0,0,[0,b0],ac,[0,0,[0,cS],a0,[0,0,[0,aU],bw,0,1],2],3],[0,fa],bX,[0,0,[0,em],eJ,[0,0,[0,bb],by,[0,0,[0,fx],ed,0,1],2],3],4],5],[0,du],9,[0,[0,0,[0,dG],10,0,1],[0,cg],11,[0,0,[0,z],fm,[0,0,[0,cf],fs,0,1],2],3],6],7],8],10]],0,i.caml_list_of_js_array(["%caml_format_int_special","%direct_int_div","%direct_int_mod","%direct_int_mul","%direct_obj_tag","%int_add","%int_and","%int_asr",d9,"%int_lsl","%int_lsr",ag,aA,"%int_neg","%int_or","%int_sub","%int_xor","JsStringReader","MlBytes","MlChanid","MlFakeDevice","MlFakeFd","MlFakeFd_out","MlFakeFile","MlFile","MlInt64","MlMutex","MlNat","MlNodeDevice","MlNodeFd","MlObjectTable","Ml_Bigarray","Ml_Bigarray_c_1_1","UInt8ArrayReader","add_nat","bigstring_of_array_buffer","bigstring_of_typed_array","bigstring_to_array_buffer","bigstring_to_typed_array","blake2b","blit_nat","caml_MD5Final","caml_MD5Init","caml_MD5Transform","caml_MD5Update","caml_abs_float","caml_acos_float","caml_acosh_float","caml_add_float","caml_alloc_dummy","caml_alloc_dummy_float","caml_alloc_dummy_infix","caml_alloc_stack","caml_argv","caml_array_append","caml_array_blit","caml_array_bound_error","caml_array_concat","caml_array_fill",e,J,fo,"caml_array_make","caml_array_of_bytes","caml_array_of_string",h,e8,bI,"caml_array_sub","caml_array_unsafe_get","caml_array_unsafe_get_float","caml_array_unsafe_set","caml_array_unsafe_set_addr","caml_array_unsafe_set_float","caml_asin_float","caml_asinh_float","caml_atan2_float","caml_atan_float","caml_atanh_float","caml_atomic_cas","caml_atomic_exchange","caml_atomic_fetch_add","caml_atomic_load","caml_atomic_make_contended","caml_ba_blit","caml_ba_change_layout","caml_ba_compare","caml_ba_create","caml_ba_create_buffer","caml_ba_create_from","caml_ba_create_unsafe","caml_ba_custom_name","caml_ba_deserialize","caml_ba_dim","caml_ba_dim_1","caml_ba_dim_2","caml_ba_dim_3","caml_ba_fill","caml_ba_from_typed_array","caml_ba_get_1","caml_ba_get_2","caml_ba_get_3","caml_ba_get_generic","caml_ba_get_size","caml_ba_get_size_per_element","caml_ba_hash","caml_ba_init","caml_ba_kind","caml_ba_kind_of_typed_array","caml_ba_layout","caml_ba_map_file","caml_ba_map_file_bytecode","caml_ba_num_dims","caml_ba_reshape","caml_ba_serialize","caml_ba_set_1","caml_ba_set_2","caml_ba_set_3","caml_ba_set_generic","caml_ba_slice","caml_ba_sub","caml_ba_to_typed_array","caml_ba_uint8_get16","caml_ba_uint8_get32","caml_ba_uint8_get64","caml_ba_uint8_set16","caml_ba_uint8_set32","caml_ba_uint8_set64","caml_backtrace_status","caml_bigstring_blit_ba_to_ba","caml_bigstring_blit_ba_to_bytes","caml_bigstring_blit_bytes_to_ba","caml_bigstring_blit_string_to_ba","caml_bigstring_memcmp","caml_blake2_create","caml_blake2_final","caml_blake2_string","caml_blake2_update","caml_blit_bytes","caml_blit_string","caml_bswap16","caml_build_symbols","caml_bytes_bound_error","caml_bytes_compare","caml_bytes_equal","caml_bytes_get","caml_bytes_get16","caml_bytes_get32","caml_bytes_get64","caml_bytes_greaterequal","caml_bytes_greaterthan","caml_bytes_lessequal","caml_bytes_lessthan","caml_bytes_notequal","caml_bytes_of_array","caml_bytes_of_jsbytes","caml_bytes_of_string","caml_bytes_of_uint8_array","caml_bytes_of_utf16_jsstring","caml_bytes_set","caml_bytes_set16","caml_bytes_set32","caml_bytes_set64","caml_bytes_unsafe_get","caml_bytes_unsafe_set","caml_call_gen","caml_callback","caml_cbrt_float","caml_ceil_float",K,o,cZ,cm,"caml_classify_float","caml_compare","caml_compare_val","caml_compare_val_get_custom","caml_compare_val_number_custom","caml_compare_val_tag","caml_continuation_use_and_update_handler_noexc","caml_continuation_use_noexc","caml_convert_bytes_to_array","caml_convert_raw_backtrace","caml_convert_raw_backtrace_slot","caml_convert_string_to_bytes","caml_copysign_float","caml_cos_float","caml_cosh_float","caml_create_bytes","caml_create_file","caml_create_string","caml_current_dir","caml_custom_event_index","caml_custom_identifier","caml_custom_ops","caml_decompress_input",g,"caml_div_float","caml_domain_dls","caml_domain_dls_compare_and_set","caml_domain_dls_get","caml_domain_dls_set","caml_domain_id","caml_domain_spawn","caml_ephe_blit_data",b5,"caml_ephe_check_data",c5,"caml_ephe_create","caml_ephe_data_offset","caml_ephe_get_data","caml_ephe_get_data_copy",af,eK,"caml_ephe_key_offset","caml_ephe_none","caml_ephe_set_data","caml_ephe_set_data_opt","caml_ephe_set_key","caml_ephe_unset_data","caml_ephe_unset_key","caml_eq_float","caml_equal","caml_erf_float","caml_erfc_float","caml_executable_name","caml_exn_with_js_backtrace","caml_exp2_float","caml_exp_float","caml_expm1_float","caml_failwith","caml_fatal_uncaught_exception",be,T,"caml_final_register","caml_final_register_called_without_value","caml_final_release","caml_finish_formatting","caml_float_compare","caml_float_of_bytes","caml_float_of_int","caml_float_of_string","caml_floatarray_blit","caml_floatarray_create",ea,fH,"caml_floatarray_unsafe_get","caml_floatarray_unsafe_set","caml_floor_float","caml_fma_float","caml_fmod_float","caml_format_exception","caml_format_float",p,"caml_fresh_oo_id","caml_frexp_float","caml_fs_init","caml_gc_compaction","caml_gc_counters","caml_gc_full_major","caml_gc_get","caml_gc_major","caml_gc_major_slice","caml_gc_minor","caml_gc_minor_words","caml_gc_quick_stat","caml_gc_set","caml_gc_stat","caml_ge_float","caml_get_cached_method","caml_get_continuation_callstack","caml_get_current_callstack","caml_get_exception_backtrace","caml_get_exception_raw_backtrace","caml_get_global_data","caml_get_minor_free","caml_get_public_method","caml_get_root","caml_global_data","caml_gr_arc_aux","caml_gr_blit_image","caml_gr_clear_graph","caml_gr_close_graph","caml_gr_close_subwindow","caml_gr_create_image","caml_gr_current_x","caml_gr_current_y","caml_gr_display_mode","caml_gr_doc_of_state","caml_gr_draw_arc","caml_gr_draw_char","caml_gr_draw_image","caml_gr_draw_rect","caml_gr_draw_str","caml_gr_draw_string","caml_gr_dump_image","caml_gr_fill_arc","caml_gr_fill_poly","caml_gr_fill_rect","caml_gr_lineto","caml_gr_make_image","caml_gr_moveto","caml_gr_open_graph","caml_gr_open_subwindow","caml_gr_plot","caml_gr_point_color","caml_gr_remember_mode","caml_gr_resize_window","caml_gr_set_color","caml_gr_set_font","caml_gr_set_line_width","caml_gr_set_text_size","caml_gr_set_window_title","caml_gr_sigio_handler","caml_gr_sigio_signal","caml_gr_size_x","caml_gr_size_y","caml_gr_state","caml_gr_state_create","caml_gr_state_get","caml_gr_state_init","caml_gr_state_set","caml_gr_synchronize","caml_gr_text_size","caml_gr_wait_event","caml_gr_window_id","caml_greaterequal","caml_greaterthan","caml_gt_float","caml_hash","caml_hash_mix_bigstring","caml_hash_mix_bytes","caml_hash_mix_bytes_arr","caml_hash_mix_final","caml_hash_mix_float","caml_hash_mix_float16","caml_hash_mix_float32","caml_hash_mix_int","caml_hash_mix_int64","caml_hash_mix_jsbytes","caml_hash_mix_string","caml_hash_nat","caml_hexstring_of_float","caml_hypot_float","caml_input_value","caml_input_value_from_bytes","caml_input_value_from_reader","caml_input_value_to_outside_heap","caml_install_signal_handler","caml_int32_add","caml_int32_and","caml_int32_bits_of_float",eW,ap,I,"caml_int32_float_of_bits",dt,Y,ad,"caml_int32_neg","caml_int32_of_float","caml_int32_of_int",cK,"caml_int32_or","caml_int32_shift_left","caml_int32_shift_right","caml_int32_shift_right_unsigned","caml_int32_sub","caml_int32_to_float","caml_int32_to_int","caml_int32_unmarshal","caml_int32_xor","caml_int64_add","caml_int64_and","caml_int64_bits_of_float","caml_int64_bswap","caml_int64_compare","caml_int64_create_lo_hi","caml_int64_create_lo_mi_hi","caml_int64_div","caml_int64_float_of_bits","caml_int64_format","caml_int64_hash","caml_int64_hi32","caml_int64_is_negative","caml_int64_is_zero","caml_int64_lo32","caml_int64_marshal","caml_int64_mod","caml_int64_mul","caml_int64_neg","caml_int64_of_bytes","caml_int64_of_float",c0,q,bh,"caml_int64_of_string","caml_int64_offset","caml_int64_or","caml_int64_shift_left","caml_int64_shift_right","caml_int64_shift_right_unsigned","caml_int64_sub","caml_int64_to_bytes","caml_int64_to_float",fu,s,eB,"caml_int64_ult","caml_int64_unmarshal","caml_int64_xor",t,"caml_int_of_float",m,"caml_invalid_argument","caml_io_buffer_size","caml_is_continuation_tag","caml_is_js","caml_is_ml_bytes","caml_is_ml_string","caml_is_printable","caml_is_special_exception","caml_js_call","caml_js_delete","caml_js_equals","caml_js_error_of_exception","caml_js_error_option_of_exception","caml_js_eval_string","caml_js_expr","caml_js_from_array","caml_js_from_bool",n,fv,cr,"caml_js_from_string","caml_js_fun_call","caml_js_function_arity","caml_js_get","caml_js_get_console","caml_js_html_entities","caml_js_html_escape","caml_js_instanceof","caml_js_meth_call","caml_js_new","caml_js_object","caml_js_pure_expr","caml_js_set","caml_js_strict_equals","caml_js_to_array","caml_js_to_bool","caml_js_to_byte_string","caml_js_to_float",fd,en,"caml_js_to_string","caml_js_typeof","caml_js_var","caml_js_wrap_callback","caml_js_wrap_callback_arguments","caml_js_wrap_callback_strict","caml_js_wrap_callback_unsafe","caml_js_wrap_meth_callback","caml_js_wrap_meth_callback_arguments","caml_js_wrap_meth_callback_strict","caml_js_wrap_meth_callback_unsafe","caml_jsbytes_of_string","caml_jsoo_flags_effects","caml_jsoo_flags_use_js_string","caml_jsstring_of_string","caml_lazy_make_forward","caml_lazy_read_result","caml_lazy_reset_to_lazy","caml_lazy_update_to_forcing","caml_lazy_update_to_forward","caml_ldexp_float","caml_le_float","caml_lessequal","caml_lessthan","caml_lex_array","caml_lex_engine","caml_list_mount_point","caml_list_of_js_array","caml_list_to_js_array","caml_log10_float","caml_log1p_float","caml_log2_float","caml_log_float","caml_lt_float","caml_lxm_M","caml_lxm_daba","caml_lxm_next","caml_make_float_vect","caml_make_path","caml_make_vect","caml_marshal_constants","caml_marshal_data_size","caml_marshal_header_size","caml_maybe_attach_backtrace","caml_maybe_print_stats","caml_md5_bytes","caml_md5_chan","caml_md5_string","caml_memprof_discard","caml_memprof_start","caml_memprof_stop","caml_method_cache","caml_ml_bytes_content","caml_ml_bytes_length","caml_ml_channel_get","caml_ml_channel_redirect","caml_ml_channel_restore","caml_ml_channel_size","caml_ml_channel_size_64","caml_ml_channels","caml_ml_close_channel","caml_ml_condition_broadcast","caml_ml_condition_new","caml_ml_condition_signal","caml_ml_condition_wait","caml_ml_debug_info_status","caml_ml_domain_cpu_relax","caml_ml_domain_id","caml_ml_enable_runtime_warnings","caml_ml_flush","caml_ml_input","caml_ml_input_bigarray","caml_ml_input_block","caml_ml_input_char","caml_ml_input_int","caml_ml_input_scan_line","caml_ml_is_binary_mode","caml_ml_is_buffered","caml_ml_mutex_lock","caml_ml_mutex_new","caml_ml_mutex_try_lock","caml_ml_mutex_unlock","caml_ml_open_descriptor_in","caml_ml_open_descriptor_in_with_flags","caml_ml_open_descriptor_out","caml_ml_open_descriptor_out_with_flags","caml_ml_out_channels_list","caml_ml_output","caml_ml_output_bigarray","caml_ml_output_bytes","caml_ml_output_char","caml_ml_output_int","caml_ml_output_ta","caml_ml_pos_in","caml_ml_pos_in_64","caml_ml_pos_out","caml_ml_pos_out_64","caml_ml_runtime_events_are_active","caml_ml_runtime_events_pause","caml_ml_runtime_events_resume","caml_ml_runtime_events_start","caml_ml_runtime_warnings_enabled","caml_ml_seek_in","caml_ml_seek_in_64","caml_ml_seek_out","caml_ml_seek_out_64","caml_ml_set_binary_mode","caml_ml_set_buffered","caml_ml_set_channel_name","caml_ml_set_channel_output","caml_ml_set_channel_refill","caml_ml_string_length",f,"caml_modf_float","caml_mount_autoload",d,"caml_mul_float","caml_named_value","caml_named_values","caml_nativeint_add","caml_nativeint_and",bK,c_,bl,fK,eh,Z,"caml_nativeint_neg","caml_nativeint_of_float","caml_nativeint_of_int","caml_nativeint_of_int32",dy,"caml_nativeint_or","caml_nativeint_shift_left","caml_nativeint_shift_right","caml_nativeint_shift_right_unsigned","caml_nativeint_sub","caml_nativeint_to_float","caml_nativeint_to_int","caml_nativeint_to_int32","caml_nativeint_unmarshal","caml_nativeint_xor","caml_neg_float","caml_neq_float","caml_new_lex_engine","caml_new_string","caml_nextafter_float","caml_notequal","caml_obj_add_offset","caml_obj_block","caml_obj_compare_and_swap","caml_obj_dup","caml_obj_is_shared","caml_obj_raw_field","caml_obj_reachable_words","caml_obj_set_raw_field","caml_obj_tag","caml_obj_update_tag","caml_obj_with_tag","caml_ojs_new_arr","caml_oo_cache_id","caml_oo_last_id","caml_output_val","caml_output_value","caml_output_value_to_buffer","caml_output_value_to_bytes","caml_output_value_to_string","caml_packFloat16","caml_parse_digit","caml_parse_engine","caml_parse_format","caml_parse_sign_and_base","caml_parser_trace","caml_pos_in","caml_pos_out","caml_power_float","caml_pure_js_expr","caml_raise_constant","caml_raise_end_of_file","caml_raise_no_such_file","caml_raise_nodejs_error","caml_raise_not_found","caml_raise_sys_error","caml_raise_system_error","caml_raise_with_arg","caml_raise_with_args","caml_raise_with_string","caml_raise_zero_divide","caml_raw_backtrace_length","caml_raw_backtrace_next_slot","caml_raw_backtrace_slot","caml_read_file_content","caml_recommended_domain_count","caml_record_backtrace","caml_record_backtrace_env_flag","caml_record_backtrace_runtime_flag","caml_refill","caml_register_global","caml_register_named_value","caml_restore_raw_backtrace","caml_root","caml_round_float","caml_runtime_events_create_cursor","caml_runtime_events_free_cursor","caml_runtime_events_read_poll","caml_runtime_events_user_register","caml_runtime_events_user_resolve","caml_runtime_events_user_write","caml_runtime_parameters","caml_runtime_variant","caml_runtime_warnings","caml_seek_in","caml_seek_out","caml_set_oo_id","caml_set_parser_trace","caml_set_static_env",d_,a2,"caml_sin_float","caml_sinh_float","caml_sqrt_float","caml_str_repeat","caml_strerror","caml_string_bound_error","caml_string_compare","caml_string_concat","caml_string_equal","caml_string_get","caml_string_get16","caml_string_get32","caml_string_get64","caml_string_greaterequal","caml_string_greaterthan","caml_string_hash","caml_string_lessequal","caml_string_lessthan","caml_string_notequal","caml_string_of_array","caml_string_of_bytes","caml_string_of_jsbytes","caml_string_of_jsstring","caml_string_of_uint8_array","caml_string_set","caml_string_unsafe_get","caml_sub_float","caml_sub_uint8_array_to_jsbytes","caml_subarray_to_jsbytes","caml_sys_argv","caml_sys_chdir","caml_sys_close","caml_sys_const_backend_type","caml_sys_const_big_endian","caml_sys_const_int_size","caml_sys_const_max_wosize","caml_sys_const_naked_pointers_checked","caml_sys_const_ostype_cygwin","caml_sys_const_ostype_unix","caml_sys_const_ostype_win32","caml_sys_const_word_size","caml_sys_executable_name",j,"caml_sys_fds","caml_sys_file_exists","caml_sys_get_argv","caml_sys_get_config",k,"caml_sys_getenv","caml_sys_is_directory","caml_sys_is_regular_file","caml_sys_isatty","caml_sys_mkdir","caml_sys_modify_argv","caml_sys_open","caml_sys_open_for_node","caml_sys_random_seed","caml_sys_read_directory","caml_sys_remove","caml_sys_rename","caml_sys_rmdir","caml_sys_system_command","caml_sys_time","caml_sys_time_include_children","caml_sys_unsafe_getenv","caml_tan_float","caml_tanh_float","caml_throw_js_exception","caml_to_js_string","caml_trailing_slash","caml_trampoline","caml_trampoline_return","caml_trunc_float","caml_uint8_array_of_bytes","caml_uint8_array_of_string",dc,df,fB,bz,fw,d2,dI,dA,at,bF,fq,cP,dV,dF,O,ab,eD,dw,cA,a5,cb,fy,bE,bg,b,fi,bO,aN,a1,au,l,dq,c$,e2,dr,fz,a8,aQ,ep,ak,ao,ae,bn,dU,r,cH,eH,dv,fG,ek,G,al,aH,eE,d4,d7,e6,bc,b6,cB,H,dK,dC,cv,d3,"caml_unmount","caml_unpackFloat16","caml_update_dummy",e9,dp,"caml_weak_create",an,a6,"caml_weak_set","caml_wrap_exception","caml_xdg_defaults","caml_xmlhttprequest_create","caml_zstd_initialize","compare_digits_nat","compare_nat","complement_nat","create_nat","decr_nat","deserialize_nat","div_digit_nat","div_helper","div_nat","fs_node_supported","incr_nat","initialize_nat","is_digit_int","is_digit_normalized","is_digit_odd","is_digit_zero","jsoo_create_file","jsoo_create_file_extern","jsoo_dataview","jsoo_effect_not_supported","jsoo_is_ascii","jsoo_is_win32","jsoo_mount_point","jsoo_static_env","jsoo_sys_getenv","jsoo_text_decoder","jsoo_text_decoder_buff","jsoo_text_encoder","jsoo_toplevel_reloc","land_digit_nat","length_nat","lor_digit_nat","lxor_digit_nat","make_unix_err_args","mult_digit_nat","mult_nat","nat_of_array","nth_digit_nat","nth_digit_nat_native","num_digits_nat","num_leading_zero_bits_in_digit","ocaml_stats_from_node_stats","os_type","path_is_absolute","re_match","re_partial_match","re_replacement_text","re_search_backward","re_search_forward","re_string_match","resolve_fs_device","serialize_nat","set_digit_nat","set_digit_nat_native","set_to_zero_nat","shift_left_nat","shift_right_nat","square_nat","sub_nat",a_,e0,eo,dx,ah,"unix_error",bd,fg,v,bY,eA,a9,e7,fh,ex,db,b9,aV,ar,S,b8,fj,E,U,bA,F,aO,aj,aK,dO,as,d6,bv,dY,dD,ci,dl,fC,eM,ax,aZ,cI,ew,eU,dW,aY,x,eO,bL,bJ,bV,bC,ds,cW,c6,w,bD,aG,ai,bt,b2,eF,eP,ej,cy,cd,eX,"zstd_decompress"]),0];return}(globalThis)); +i=a.jsoo_runtime,c=i.caml_get_global_data(),eo="caml_unix_stat_64",en="unix_lseek",l="caml_unix_inchannel_of_filedescr",el="caml_unix_stat",ek="caml_unix_write_bigarray",f6="caml_nativeint_format",bo="caml_int64_of_nativeint",ej="caml_unix_closedir",bn="caml_unix_getgrnam",cK="caml_unix_truncate",cJ="caml_unix_getcwd",f2="caml_unix_readlink",f3="caml_floatarray_set",bl="caml_fill_bytes",bk="unix_error_message",cH="win_inchannel_of_filedescr",bj="caml_unix_time",cE="caml_unix_write",ee="unix_lstat",fY="unix_open",ec="unix_rename",fX="caml_unix_chmod",bf="unix_access",bd="caml_unix_lseek",be="unix_fsync",eb="caml_unix_findnext",bb="caml_weak_get_copy",h="caml_array_set",ea="caml_unix_opendir",fU="caml_unix_lookup_file",a$="caml_unix_getegid",fT="caml_unix_getgid",cA="caml_js_from_nativeint",a6="caml_unix_gmtime",a7="caml_signbit_float",fR="caml_unix_close",fQ="caml_js_from_int32",fP="caml_int64_to_int",cv="caml_check_bound_gen",p="caml_format_int",d4="unix_link",cr="unix_mkdir",a3="unix_rewinddir",a4="unix_read",dZ="caml_unix_unlink",a0="unix_getgid",dX="caml_unix_error_message",fL="caml_unix_findclose",aU="caml_unix_lseek_64",fJ="caml_array_get_float",cm="win_outchannel_of_filedescr",dU="caml_unix_fstat",ck="caml_unix_geteuid",dS="unix_lstat_64",aS="unix_inchannel_of_filedescr",cf="unix_getpwnam",cg="unix_geteuid",aR="caml_unix_getuid",dQ="caml_unix_utimes",fD="caml_unix_getpwuid",fE="unix_getpwuid",o="caml_check_bound",fC="unix_ftruncate_64",aO="unix_isatty",cd="caml_unix_times",dO="caml_unix_exit",fB="unix_exit",aL="caml_unix_single_write",cc="caml_ephe_blit_key",dM="caml_nativeint_of_string",aK="unix_write",dJ="caml_unix_ftruncate_64",dK="unix_close",fy="caml_js_to_int32",k="caml_sys_getcwd",dI="caml_unix_readdir",b_="win_findclose",aD="%int_mul",dG="caml_int32_format",fs="caml_weak_blit",dE="caml_unix_localtime",dF="unix_times",fr="caml_array_set_addr",dD="caml_unix_inet_addr_of_string",fq="unix_ftruncate",dC="caml_weak_check",fp="caml_unix_symlink",aA="unix_outchannel_of_filedescr",ax="caml_unix_has_symlink",dz="unix_mktime",s="caml_int64_to_int32",b6="unix_fstat",fl="caml_unix_link",aw="caml_unix_fchmod",b3="unix_symlink",av="unix_localtime",fj="unix_chdir",au="unix_getgrgid",as="caml_int32_compare",ar="caml_unix_mkdir",fg="win_startup",ff="caml_int32_bswap",aq="caml_weak_get",fd="unix_readlink",ao="caml_unix_rmdir",e="caml_array_get",am="caml_unix_lstat_64",al="unix_inet_addr_of_string",bW="caml_unix_gettimeofday",r="caml_unix_outchannel_of_filedescr",bT="unix_stat",ds="caml_unix_chdir",aj="unix_closedir",ak="win_cleanup",bS="caml_nativeint_bswap",ag="caml_unix_mktime",ah="caml_ephe_get_key",ai="%int_mod",bR="unix_stat_64",dn="unix_getegid",dp="caml_unix_access",dl="caml_unix_isatty",af="caml_int32_mul",dk="caml_nativeint_compare",q="caml_int64_of_int32",ad="caml_unix_fsync",e_="win_findnext",$="caml_nativeint_mul",e9="unix_single_write",_="caml_int32_mod",n="caml_js_from_float",dg="unix_truncate_64",df="caml_ephe_check_key",e7="unix_opendir",bP="caml_array_set_float",e5="caml_ephe_get_key_copy",W="unix_getuid",d="caml_mul",V="caml_fill_string",g="caml_div",da="caml_int64_of_int",e2="caml_unix_read_bigarray",U="unix_getgrnam",eZ="win_findfirst",eY="caml_unix_startup",bM="caml_unix_filedescr_of_fd",eX="caml_unix_ftruncate",f="caml_mod",c$="caml_check_bound_float",bK="unix_utimes",bL="caml_unix_getgrgid",eV="caml_int64_to_nativeint",bJ="unix_time",eU="unix_fstat_64",P="caml_unix_fstat_64",c8="unix_truncate",bH="unix_gmtime",bG="caml_unix_cleanup",eR="unix_getcwd",eQ="unix_readdir",j="caml_sys_exit",L="caml_channel_descriptor",bC="unix_lseek_64",t="caml_int_compare",J="caml_array_get_addr",eI="unix_chmod",eJ="caml_unix_lstat",eH="caml_js_to_nativeint",I="caml_int32_div",c1="caml_unix_findfirst",H="caml_unix_truncate_64",G="caml_unix_rewinddir",F="unix_has_symlink",m="caml_int_of_string",eE="caml_unix_rename",bA="win_filedescr_of_channel",E="unix_gettimeofday",eD="win_handle_fd",b="caml_unix_getpwnam",cV="caml_int32_of_string",eB="caml_nativeint_mod",x="unix_rmdir",cR="caml_unix_read",cS="unix_read_bigarray",eu="caml_floatarray_get",w="unix_unlink",bu="caml_unix_open",er="caml_signbit",v="unix_fchmod",bs="caml_nativeint_div",eq="%int_div";c.aliases=i.caml_list_of_js_array([[0,cv,o],[0,fP,s],[0,eq,g],[0,fQ,n],[0,eZ,c1],[0,bs,g],[0,v,aw],[0,U,b],[0,aA,r],[0,da,q],[0,cA,n],[0,er,a7],[0,dC,df],[0,V,bl],[0,w,dZ],[0,fq,eX],[0,eu,e],[0,fr,h],[0,W,aR],[0,cS,e2],[0,x,ao],[0,dF,cd],[0,fs,cc],[0,dG,p],[0,fU,ek],[0,bP,h],[0,aD,d],[0,e7,ea],[0,b_,fL],[0,cV,m],[0,eB,f],[0,dg,H],[0,_,f],[0,bb,e5],[0,$,d],[0,e9,aL],[0,dK,fR],[0,be,ad],[0,aK,cE],[0,dM,m],[0,bf,dp],[0,eD,bM],[0,e_,eb],[0,E,bW],[0,bA,L],[0,fB,j],[0,dk,t],[0,af,d],[0,dO,j],[0,F,ax],[0,ec,eE],[0,aO,dl],[0,fC,dJ],[0,dn,a$],[0,ee,eJ],[0,fY,bu],[0,I,g],[0,fE,b],[0,fD,b],[0,bR,eo],[0,eH,fy],[0,ai,f],[0,bS,ff],[0,cg,ck],[0,cf,b],[0,ak,bG],[0,aj,ej],[0,cH,l],[0,eI,fX],[0,bT,el],[0,J,e],[0,aS,l],[0,al,dD],[0,dS,am],[0,f3,h],[0,cJ,k],[0,cm,r],[0,fJ,e],[0,fd,f2],[0,aq,ah],[0,bn,b],[0,bC,aU],[0,fg,eY],[0,eQ,dI],[0,a0,fT],[0,dX,bk],[0,as,t],[0,eR,k],[0,bH,a6],[0,bo,q],[0,au,b],[0,c8,cK],[0,fj,ds],[0,av,dE],[0,f6,p],[0,eU,P],[0,b3,fp],[0,bJ,bj],[0,eV,s],[0,a4,cR],[0,a3,G],[0,cr,ar],[0,bL,b],[0,d4,fl],[0,bK,dQ],[0,c$,o],[0,b6,dU],[0,en,bd],[0,dz,ag]]);c.prim_count=952;var +em=133,bq=102,bp="Re__Hash_set",cM="Stdlib__Type",cN=114,f5="Stdlib__Buffer",eh="Js_of_ocaml__Dom_svg",ei="Stdlib__Out_channel",f4="Match_failure",cL=165,eg=157,bm="Stdlib__Gc",ef="Sx_rsa",f0="Re__Compile",f1="Stdlib__Unit",cI="Re__Posix_class",fZ=136,cG="Jsoo_runtime__Runtime_version",cF="Stdlib__Map",bi="Sx_vm",ed="Stdlib__Parsing",bh="Stdlib__Effect",cD=108,bg="Stdlib__String",fW="Re_pcre",bc="Stdlib__BytesLabels",fV=160,ba=162,d$="Stdlib__Condition",cC=148,d_="Stdlib__Filename",a_="Stdlib__In_channel",d8="Not_found",d9="Re__Fmt",cB=154,d7=164,a9=163,a8="CamlinternalLazy",fS="Sx_vm_ref",cz="Division_by_zero",cy="Js_of_ocaml__Effect_js",cx="Re__Glob",d5=159,d6="Re__Parse_buffer",a5=117,cw=104,fO="Js_of_ocaml__",cu="Stdlib__Either",ct=109,cs="Js_of_ocaml__MutationObserver",d3="Erlang_ext",cq="Js_of_ocaml__Json",d2="Stdlib__Callback",d1=155,a2="Stdlib__Lexing",cp="Undefined_recursive_module",d0="Stdlib__Printf",fN=111,a1="Stdlib__Bool",co="UnixLabels",dY="Stdlib__Int",fM=153,dW="Stdlib__MoreLabels",aX=103,aY="Sx_render",aZ=127,dV="Sys_error",aW=100,aV="Sx_ed25519",cn="Js_of_ocaml__Dom_events",fK="Stdlib__Digest",dT=101,cl=151,aT="Sx_compiler",cj="Js_of_ocaml__PerformanceObserver",fI="Re__View",ci="Stdlib__Queue",dR="Sx_vm_extensions",fH=110,ch="Stdlib__Set",fG="Stdlib__Stack",fF="Js_of_ocaml__File",dP="Stdlib__Complex",aQ="Re__Dyn",aP="Jsoo_runtime__",ce="Re__Import",dN="Jsoo_runtime",fA=130,aM="Js_of_ocaml__WebSockets",aN="Stdlib__Nativeint",fz=128,cb="Sx_cid",dL=167,aJ=113,ca=146,fx=156,b$="Re__Dense_map",dH="Sys_blocked_io",aH=168,aI="Stdlib__Random",fw="Js_of_ocaml__ResizeObserver",fv="Sx_runtime",aG=135,b9=144,fu="Js_of_ocaml",aE=106,aF="Stdlib__Marshal",aC="Js_of_ocaml__Console",ft=140,b8="Sx_primitives",b7="Stdlib__Ephemeron",aB="CamlinternalMod",dB="Re__Color_map",az="Js_of_ocaml__Js",ay="Js_of_ocaml__Url",fo="Stdlib__Fun",fn="Stdlib__Char",dA=125,fm="Re__Category",b4=138,b5=116,fk=126,dy="Sx_vm_extension",at="Re__Ast",dx="Dune__exe__Sx_browser",dw=150,fi="CamlinternalFormatBasics",dv="Stdlib__Weak",b2=105,du="Stdlib__Format",fh="Stdlib__StdLabels",dt="Stdlib__Int64",fe="Re__Search",b1="Js_of_ocaml__Dom_html",ap="Stdlib__ArrayLabels",b0=129,fc="Re__Cset",an="Sx_sha2",bZ="Stdlib__Bigarray",bX=137,bY="Re__Core",bU=132,bV="Re__Emacs",dr="Re__Automata",dq="Re__Pmark",dm="Js_of_ocaml__IntersectionObserver",ae=115,dj=131,e$="Stdlib",fa="Stdlib__StringLabels",fb=122,ac="Stdlib__Atomic",ab="Sx_cst",di="Re__",aa="Stdlib__ListLabels",dh="Stdlib__Seq",bQ=158,e8="Js_of_ocaml__CSS",Z=134,de="Js_of_ocaml__XmlHttpRequest",e6="Re__Bit_vector",Y="Stdlib__Uchar",X=152,dd="Stdlib__Arg",dc="Js_of_ocaml__Form",db="Stdlib__Scanf",e4=112,e3="Re__Slice",e1="Js_of_ocaml__Intl",e0="Sx_sha3",bO=107,bN="Stdlib__Printexc",T="Js_of_ocaml__Sys_js",eW="Js_of_ocaml__Import",S="Re",R="Sx_cbor",c9="Js_of_ocaml__Geolocation",c_=147,eT="Re__Perl",Q="Js_of_ocaml__Worker",bI="Stdlib__Dynarray",eS="Assert_failure",O="Re__Pcre",N=141,bE=118,bF=121,bD=120,c7="Stdlib__Array",M="Js_of_ocaml__EventSource",c6="Stdlib__Obj",eP="Stdlib__Hashtbl",eN="Stdlib__Domain",eO="Stdlib__Option",eM=124,eL="Std_exit",eK=149,c5="Re__Group",K=166,c4="Sx_ref",bB=145,c2="Invalid_argument",c3="Stack_overflow",c0="End_of_file",cZ="Js_of_ocaml__WebGL",eG="Sx_types",eF="Failure",D="Js_of_ocaml__Jstable",cY="Test_ext",eC="Stdlib__Lazy",bz="Stdlib__Semaphore",cX="Out_of_memory",C="Js_of_ocaml__Lib_version",B="Js_of_ocaml__Regexp",cW="Js_of_ocaml__Dom",A="Stdlib__Bytes",by="Stdlib__Sys",eA=143,ez="CamlinternalOO",bx="Re__Posix",cT="Stdlib__Int32",cU="Sx_persist_store",ey="Stdlib__Oo",bw=123,y="Re__Replace",z="Unix",ev="Re__Mark_infos",ew="Stdlib__Mutex",ex=119,bv="Stdlib__List",cQ=139,et=161,bt="Sx_parser",es="Stdlib__Float",br=142,cP="CamlinternalFormat",u="Re__Str",ep="Js_of_ocaml__Typed_array",cO="Stdlib__Result";c.symbols=[0,[0,co,fN],[0,z,fH],[0,cp,11],[0,cY,aZ],[0,dV,10],[0,dH,9],[0,fS,fz],[0,dR,fk],[0,dy,dA],[0,bi,eM],[0,eG,e4],[0,e0,bD],[0,an,cN],[0,fv,fb],[0,ef,ex],[0,aY,b0],[0,c4,bw],[0,b8,bF],[0,cU,fA],[0,bt,bE],[0,aV,a5],[0,ab,b5],[0,aT,dj],[0,cb,ae],[0,R,aJ],[0,dv,62],[0,f1,31],[0,Y,26],[0,cM,17],[0,by,15],[0,fa,75],[0,bg,30],[0,fh,77],[0,fG,42],[0,ch,40],[0,dh,21],[0,bz,47],[0,db,64],[0,cO,23],[0,aI,60],[0,ci,43],[0,d0,50],[0,bN,53],[0,ed,39],[0,ei,57],[0,eO,22],[0,ey,67],[0,c6,16],[0,aN,37],[0,ew,45],[0,dW,76],[0,aF,32],[0,cF,41],[0,aa,73],[0,bv,27],[0,a2,38],[0,eC,20],[0,dt,36],[0,cT,35],[0,dY,28],[0,a_,56],[0,eP,61],[0,bm,55],[0,fo,54],[0,du,63],[0,es,34],[0,d_,70],[0,b7,69],[0,cu,14],[0,bh,78],[0,bI,51],[0,eN,48],[0,fK,58],[0,d$,46],[0,dP,71],[0,fn,25],[0,d2,65],[0,bc,74],[0,A,29],[0,f5,44],[0,a1,24],[0,bZ,59],[0,ac,18],[0,ap,72],[0,c7,33],[0,dd,52],[0,e$,13],[0,eL,aH],[0,c3,8],[0,fW,ct],[0,fI,93],[0,u,dT],[0,e3,95],[0,fe,97],[0,y,bq],[0,cI,cw],[0,bx,bO],[0,dq,89],[0,eT,b2],[0,O,aE],[0,d6,99],[0,ev,88],[0,ce,85],[0,bp,87],[0,c5,94],[0,cx,aX],[0,d9,80],[0,bV,aW],[0,aQ,82],[0,b$,84],[0,fc,86],[0,bY,98],[0,f0,96],[0,dB,91],[0,fm,83],[0,e6,81],[0,dr,90],[0,at,92],[0,di,79],[0,S,cD],[0,cX,7],[0,d8,6],[0,f4,5],[0,cG,Z],[0,aP,em],[0,dN,aG],[0,de,b9],[0,Q,bB],[0,aM,ca],[0,cZ,c_],[0,ay,eK],[0,ep,ft],[0,T,cl],[0,fw,X],[0,B,cC],[0,cj,fM],[0,cs,cB],[0,C,dw],[0,D,d1],[0,cq,fx],[0,az,b4],[0,e1,cL],[0,dm,d7],[0,eW,bX],[0,c9,a9],[0,dc,eA],[0,fF,N],[0,M,ba],[0,cy,et],[0,eh,fV],[0,b1,br],[0,cn,d5],[0,cW,cQ],[0,aC,bQ],[0,e8,eg],[0,fO,fZ],[0,fu,K],[0,c2,4],[0,eF,3],[0,d3,bU],[0,c0,2],[0,dx,dL],[0,cz,1],[0,ez,66],[0,aB,68],[0,a8,19],[0,fi,12],[0,cP,49],[0,eS,0]];c.sections=[0,[0,169,[0,[0,[0,[0,[0,[0,[0,0,[0,eS],0,[0,0,[0,cP],49,0,1],2],[0,fi],12,0,3],[0,a8],19,[0,[0,[0,0,[0,aB],68,0,1],[0,ez],66,0,2],[0,cz],1,[0,[0,0,[0,dx],dL,0,1],[0,c0],2,[0,0,[0,d3],bU,0,1],2],3],4],[0,eF],3,[0,[0,[0,0,[0,c2],4,[0,0,[0,fu],K,0,1],2],[0,fO],fZ,[0,0,[0,e8],eg,[0,0,[0,aC],bQ,0,1],2],3],[0,cW],cQ,[0,[0,[0,0,[0,cn],d5,0,1],[0,b1],br,0,2],[0,eh],fV,[0,[0,0,[0,cy],et,[0,0,[0,M],ba,0,1],2],[0,fF],N,[0,0,[0,dc],eA,[0,0,[0,c9],a9,0,1],2],3],4],5],6],[0,eW],bX,[0,[0,[0,[0,[0,[0,0,[0,dm],d7,[0,0,[0,e1],cL,0,1],2],[0,az],b4,[0,[0,0,[0,cq],fx,0,1],[0,D],d1,0,2],3],[0,C],dw,[0,[0,0,[0,cs],cB,0,1],[0,cj],fM,0,2],4],[0,B],cC,[0,[0,0,[0,fw],X,0,1],[0,T],cl,0,2],5],[0,ep],ft,[0,[0,[0,[0,0,[0,ay],eK,0,1],[0,cZ],c_,0,2],[0,aM],ca,0,3],[0,Q],bB,[0,0,[0,de],b9,0,1],4],6],[0,dN],aG,[0,[0,[0,0,[0,aP],em,[0,0,[0,cG],Z,0,1],2],[0,f4],5,[0,0,[0,d8],6,0,1],3],[0,cX],7,[0,[0,0,[0,S],cD,0,1],[0,di],79,[0,[0,0,[0,at],92,0,1],[0,dr],90,0,2],3],4],7],8],[0,e6],81,[0,[0,[0,[0,[0,0,[0,fm],83,0,1],[0,dB],91,[0,0,[0,f0],96,[0,0,[0,bY],98,0,1],2],3],[0,fc],86,[0,0,[0,b$],84,0,1],4],[0,aQ],82,[0,[0,[0,0,[0,bV],aW,0,1],[0,d9],80,[0,[0,[0,0,[0,cx],aX,0,1],[0,c5],94,0,2],[0,bp],87,0,3],4],[0,ce],85,[0,[0,[0,0,[0,ev],88,0,1],[0,d6],99,[0,[0,0,[0,O],aE,0,1],[0,eT],b2,0,2],3],[0,dq],89,[0,[0,[0,[0,0,[0,bx],bO,0,1],[0,cI],cw,0,2],[0,y],bq,[0,0,[0,fe],97,0,1],3],[0,e3],95,[0,[0,0,[0,u],dT,0,1],[0,fI],93,[0,[0,0,[0,fW],ct,0,1],[0,c3],8,[0,0,[0,eL],aH,0,1],2],3],4],5],6],7],[0,e$],13,[0,[0,[0,[0,0,[0,dd],52,0,1],[0,c7],33,[0,0,[0,ap],72,0,1],2],[0,ac],18,[0,0,[0,bZ],59,0,1],3],[0,a1],24,[0,[0,[0,0,[0,f5],44,0,1],[0,A],29,[0,[0,0,[0,bc],74,0,1],[0,d2],65,0,2],3],[0,fn],25,[0,[0,0,[0,dP],71,0,1],[0,d$],46,[0,[0,0,[0,fK],58,0,1],[0,eN],48,[0,0,[0,bI],51,[0,0,[0,bh],78,0,1],2],3],4],5],6],8],9],[0,cu],14,[0,[0,[0,[0,[0,[0,0,[0,b7],69,[0,0,[0,d_],70,0,1],2],[0,es],34,[0,0,[0,du],63,0,1],3],[0,fo],54,[0,0,[0,bm],55,[0,[0,0,[0,eP],61,0,1],[0,a_],56,0,2],3],4],[0,dY],28,[0,0,[0,cT],35,[0,0,[0,dt],36,0,1],2],5],[0,eC],20,[0,[0,[0,0,[0,a2],38,0,1],[0,bv],27,[0,[0,0,[0,aa],73,0,1],[0,cF],41,0,2],3],[0,aF],32,[0,[0,[0,0,[0,dW],76,0,1],[0,ew],45,0,2],[0,aN],37,0,3],4],6],[0,c6],16,[0,[0,[0,[0,[0,[0,0,[0,ey],67,0,1],[0,eO],22,[0,0,[0,ei],57,0,1],2],[0,ed],39,[0,[0,0,[0,bN],53,0,1],[0,d0],50,0,2],3],[0,ci],43,[0,[0,0,[0,aI],60,0,1],[0,cO],23,[0,[0,0,[0,db],64,0,1],[0,bz],47,0,2],3],4],[0,dh],21,[0,[0,0,[0,ch],40,[0,0,[0,fG],42,[0,0,[0,fh],77,0,1],2],3],[0,bg],30,[0,0,[0,fa],75,0,1],4],5],[0,by],15,[0,[0,[0,[0,[0,0,[0,cM],17,0,1],[0,Y],26,[0,0,[0,f1],31,0,1],2],[0,dv],62,[0,[0,0,[0,R],aJ,0,1],[0,cb],ae,[0,0,[0,aT],dj,0,1],2],3],[0,ab],b5,[0,[0,[0,0,[0,aV],a5,0,1],[0,bt],bE,[0,0,[0,cU],fA,0,1],2],[0,b8],bF,[0,[0,0,[0,c4],bw,[0,0,[0,aY],b0,0,1],2],[0,ef],ex,[0,0,[0,fv],fb,0,1],3],4],5],[0,an],cN,[0,[0,[0,0,[0,e0],bD,0,1],[0,eG],e4,[0,[0,0,[0,bi],eM,0,1],[0,dy],dA,[0,0,[0,dR],fk,[0,0,[0,fS],fz,0,1],2],3],4],[0,dH],9,[0,[0,0,[0,dV],10,[0,0,[0,cY],aZ,0,1],2],[0,cp],11,[0,0,[0,z],fH,[0,0,[0,co],fN,0,1],2],3],5],6],7],8],10]],0,i.caml_list_of_js_array(["%caml_format_int_special","%direct_int_div","%direct_int_mod","%direct_int_mul","%direct_obj_tag","%int_add","%int_and","%int_asr",eq,"%int_lsl","%int_lsr",ai,aD,"%int_neg","%int_or","%int_sub","%int_xor","JsStringReader","MlBytes","MlChanid","MlFakeDevice","MlFakeFd","MlFakeFd_out","MlFakeFile","MlFile","MlInt64","MlMutex","MlNat","MlNodeDevice","MlNodeFd","MlObjectTable","Ml_Bigarray","Ml_Bigarray_c_1_1","UInt8ArrayReader","add_nat","bigstring_of_array_buffer","bigstring_of_typed_array","bigstring_to_array_buffer","bigstring_to_typed_array","blake2b","blit_nat","caml_MD5Final","caml_MD5Init","caml_MD5Transform","caml_MD5Update","caml_abs_float","caml_acos_float","caml_acosh_float","caml_add_float","caml_alloc_dummy","caml_alloc_dummy_float","caml_alloc_dummy_infix","caml_alloc_stack","caml_argv","caml_array_append","caml_array_blit","caml_array_bound_error","caml_array_concat","caml_array_fill",e,J,fJ,"caml_array_make","caml_array_of_bytes","caml_array_of_string",h,fr,bP,"caml_array_sub","caml_array_unsafe_get","caml_array_unsafe_get_float","caml_array_unsafe_set","caml_array_unsafe_set_addr","caml_array_unsafe_set_float","caml_asin_float","caml_asinh_float","caml_atan2_float","caml_atan_float","caml_atanh_float","caml_atomic_cas","caml_atomic_exchange","caml_atomic_fetch_add","caml_atomic_load","caml_atomic_make_contended","caml_ba_blit","caml_ba_change_layout","caml_ba_compare","caml_ba_create","caml_ba_create_buffer","caml_ba_create_from","caml_ba_create_unsafe","caml_ba_custom_name","caml_ba_deserialize","caml_ba_dim","caml_ba_dim_1","caml_ba_dim_2","caml_ba_dim_3","caml_ba_fill","caml_ba_from_typed_array","caml_ba_get_1","caml_ba_get_2","caml_ba_get_3","caml_ba_get_generic","caml_ba_get_size","caml_ba_get_size_per_element","caml_ba_hash","caml_ba_init","caml_ba_kind","caml_ba_kind_of_typed_array","caml_ba_layout","caml_ba_map_file","caml_ba_map_file_bytecode","caml_ba_num_dims","caml_ba_reshape","caml_ba_serialize","caml_ba_set_1","caml_ba_set_2","caml_ba_set_3","caml_ba_set_generic","caml_ba_slice","caml_ba_sub","caml_ba_to_typed_array","caml_ba_uint8_get16","caml_ba_uint8_get32","caml_ba_uint8_get64","caml_ba_uint8_set16","caml_ba_uint8_set32","caml_ba_uint8_set64","caml_backtrace_status","caml_bigstring_blit_ba_to_ba","caml_bigstring_blit_ba_to_bytes","caml_bigstring_blit_bytes_to_ba","caml_bigstring_blit_string_to_ba","caml_bigstring_memcmp","caml_blake2_create","caml_blake2_final","caml_blake2_string","caml_blake2_update","caml_blit_bytes","caml_blit_string","caml_bswap16","caml_build_symbols","caml_bytes_bound_error","caml_bytes_compare","caml_bytes_equal","caml_bytes_get","caml_bytes_get16","caml_bytes_get32","caml_bytes_get64","caml_bytes_greaterequal","caml_bytes_greaterthan","caml_bytes_lessequal","caml_bytes_lessthan","caml_bytes_notequal","caml_bytes_of_array","caml_bytes_of_jsbytes","caml_bytes_of_string","caml_bytes_of_uint8_array","caml_bytes_of_utf16_jsstring","caml_bytes_set","caml_bytes_set16","caml_bytes_set32","caml_bytes_set64","caml_bytes_unsafe_get","caml_bytes_unsafe_set","caml_call_gen","caml_callback","caml_cbrt_float","caml_ceil_float",L,o,c$,cv,"caml_classify_float","caml_compare","caml_compare_val","caml_compare_val_get_custom","caml_compare_val_number_custom","caml_compare_val_tag","caml_continuation_use_and_update_handler_noexc","caml_continuation_use_noexc","caml_convert_bytes_to_array","caml_convert_raw_backtrace","caml_convert_raw_backtrace_slot","caml_convert_string_to_bytes","caml_copysign_float","caml_cos_float","caml_cosh_float","caml_create_bytes","caml_create_file","caml_create_string","caml_current_dir","caml_custom_event_index","caml_custom_identifier","caml_custom_ops","caml_decompress_input",g,"caml_div_float","caml_domain_dls","caml_domain_dls_compare_and_set","caml_domain_dls_get","caml_domain_dls_set","caml_domain_id","caml_domain_spawn","caml_ephe_blit_data",cc,"caml_ephe_check_data",df,"caml_ephe_create","caml_ephe_data_offset","caml_ephe_get_data","caml_ephe_get_data_copy",ah,e5,"caml_ephe_key_offset","caml_ephe_none","caml_ephe_set_data","caml_ephe_set_data_opt","caml_ephe_set_key","caml_ephe_unset_data","caml_ephe_unset_key","caml_eq_float","caml_equal","caml_erf_float","caml_erfc_float","caml_executable_name","caml_exn_with_js_backtrace","caml_exp2_float","caml_exp_float","caml_expm1_float","caml_failwith","caml_fatal_uncaught_exception",bl,V,"caml_final_register","caml_final_register_called_without_value","caml_final_release","caml_finish_formatting","caml_float_compare","caml_float_of_bytes","caml_float_of_int","caml_float_of_string","caml_floatarray_blit","caml_floatarray_create",eu,f3,"caml_floatarray_unsafe_get","caml_floatarray_unsafe_set","caml_floor_float","caml_fma_float","caml_fmod_float","caml_format_exception","caml_format_float",p,"caml_fresh_oo_id","caml_frexp_float","caml_fs_init","caml_gc_compaction","caml_gc_counters","caml_gc_full_major","caml_gc_get","caml_gc_major","caml_gc_major_slice","caml_gc_minor","caml_gc_minor_words","caml_gc_quick_stat","caml_gc_set","caml_gc_stat","caml_ge_float","caml_get_cached_method","caml_get_continuation_callstack","caml_get_current_callstack","caml_get_exception_backtrace","caml_get_exception_raw_backtrace","caml_get_global_data","caml_get_minor_free","caml_get_public_method","caml_get_root","caml_global_data","caml_gr_arc_aux","caml_gr_blit_image","caml_gr_clear_graph","caml_gr_close_graph","caml_gr_close_subwindow","caml_gr_create_image","caml_gr_current_x","caml_gr_current_y","caml_gr_display_mode","caml_gr_doc_of_state","caml_gr_draw_arc","caml_gr_draw_char","caml_gr_draw_image","caml_gr_draw_rect","caml_gr_draw_str","caml_gr_draw_string","caml_gr_dump_image","caml_gr_fill_arc","caml_gr_fill_poly","caml_gr_fill_rect","caml_gr_lineto","caml_gr_make_image","caml_gr_moveto","caml_gr_open_graph","caml_gr_open_subwindow","caml_gr_plot","caml_gr_point_color","caml_gr_remember_mode","caml_gr_resize_window","caml_gr_set_color","caml_gr_set_font","caml_gr_set_line_width","caml_gr_set_text_size","caml_gr_set_window_title","caml_gr_sigio_handler","caml_gr_sigio_signal","caml_gr_size_x","caml_gr_size_y","caml_gr_state","caml_gr_state_create","caml_gr_state_get","caml_gr_state_init","caml_gr_state_set","caml_gr_synchronize","caml_gr_text_size","caml_gr_wait_event","caml_gr_window_id","caml_greaterequal","caml_greaterthan","caml_gt_float","caml_hash","caml_hash_mix_bigstring","caml_hash_mix_bytes","caml_hash_mix_bytes_arr","caml_hash_mix_final","caml_hash_mix_float","caml_hash_mix_float16","caml_hash_mix_float32","caml_hash_mix_int","caml_hash_mix_int64","caml_hash_mix_jsbytes","caml_hash_mix_string","caml_hash_nat","caml_hexstring_of_float","caml_hypot_float","caml_input_value","caml_input_value_from_bytes","caml_input_value_from_reader","caml_input_value_to_outside_heap","caml_install_signal_handler","caml_int32_add","caml_int32_and","caml_int32_bits_of_float",ff,as,I,"caml_int32_float_of_bits",dG,_,af,"caml_int32_neg","caml_int32_of_float","caml_int32_of_int",cV,"caml_int32_or","caml_int32_shift_left","caml_int32_shift_right","caml_int32_shift_right_unsigned","caml_int32_sub","caml_int32_to_float","caml_int32_to_int","caml_int32_unmarshal","caml_int32_xor","caml_int64_add","caml_int64_and","caml_int64_bits_of_float","caml_int64_bswap","caml_int64_compare","caml_int64_create_lo_hi","caml_int64_create_lo_mi_hi","caml_int64_div","caml_int64_float_of_bits","caml_int64_format","caml_int64_hash","caml_int64_hi32","caml_int64_is_negative","caml_int64_is_zero","caml_int64_lo32","caml_int64_marshal","caml_int64_mod","caml_int64_mul","caml_int64_neg","caml_int64_of_bytes","caml_int64_of_float",da,q,bo,"caml_int64_of_string","caml_int64_offset","caml_int64_or","caml_int64_shift_left","caml_int64_shift_right","caml_int64_shift_right_unsigned","caml_int64_sub","caml_int64_to_bytes","caml_int64_to_float",fP,s,eV,"caml_int64_ult","caml_int64_unmarshal","caml_int64_xor",t,"caml_int_of_float",m,"caml_invalid_argument","caml_io_buffer_size","caml_is_continuation_tag","caml_is_js","caml_is_ml_bytes","caml_is_ml_string","caml_is_printable","caml_is_special_exception","caml_js_call","caml_js_delete","caml_js_equals","caml_js_error_of_exception","caml_js_error_option_of_exception","caml_js_eval_string","caml_js_expr","caml_js_from_array","caml_js_from_bool",n,fQ,cA,"caml_js_from_string","caml_js_fun_call","caml_js_function_arity","caml_js_get","caml_js_get_console","caml_js_html_entities","caml_js_html_escape","caml_js_instanceof","caml_js_meth_call","caml_js_new","caml_js_object","caml_js_pure_expr","caml_js_set","caml_js_strict_equals","caml_js_to_array","caml_js_to_bool","caml_js_to_byte_string","caml_js_to_float",fy,eH,"caml_js_to_string","caml_js_typeof","caml_js_var","caml_js_wrap_callback","caml_js_wrap_callback_arguments","caml_js_wrap_callback_strict","caml_js_wrap_callback_unsafe","caml_js_wrap_meth_callback","caml_js_wrap_meth_callback_arguments","caml_js_wrap_meth_callback_strict","caml_js_wrap_meth_callback_unsafe","caml_jsbytes_of_string","caml_jsoo_flags_effects","caml_jsoo_flags_use_js_string","caml_jsstring_of_string","caml_lazy_make_forward","caml_lazy_read_result","caml_lazy_reset_to_lazy","caml_lazy_update_to_forcing","caml_lazy_update_to_forward","caml_ldexp_float","caml_le_float","caml_lessequal","caml_lessthan","caml_lex_array","caml_lex_engine","caml_list_mount_point","caml_list_of_js_array","caml_list_to_js_array","caml_log10_float","caml_log1p_float","caml_log2_float","caml_log_float","caml_lt_float","caml_lxm_M","caml_lxm_daba","caml_lxm_next","caml_make_float_vect","caml_make_path","caml_make_vect","caml_marshal_constants","caml_marshal_data_size","caml_marshal_header_size","caml_maybe_attach_backtrace","caml_maybe_print_stats","caml_md5_bytes","caml_md5_chan","caml_md5_string","caml_memprof_discard","caml_memprof_start","caml_memprof_stop","caml_method_cache","caml_ml_bytes_content","caml_ml_bytes_length","caml_ml_channel_get","caml_ml_channel_redirect","caml_ml_channel_restore","caml_ml_channel_size","caml_ml_channel_size_64","caml_ml_channels","caml_ml_close_channel","caml_ml_condition_broadcast","caml_ml_condition_new","caml_ml_condition_signal","caml_ml_condition_wait","caml_ml_debug_info_status","caml_ml_domain_cpu_relax","caml_ml_domain_id","caml_ml_enable_runtime_warnings","caml_ml_flush","caml_ml_input","caml_ml_input_bigarray","caml_ml_input_block","caml_ml_input_char","caml_ml_input_int","caml_ml_input_scan_line","caml_ml_is_binary_mode","caml_ml_is_buffered","caml_ml_mutex_lock","caml_ml_mutex_new","caml_ml_mutex_try_lock","caml_ml_mutex_unlock","caml_ml_open_descriptor_in","caml_ml_open_descriptor_in_with_flags","caml_ml_open_descriptor_out","caml_ml_open_descriptor_out_with_flags","caml_ml_out_channels_list","caml_ml_output","caml_ml_output_bigarray","caml_ml_output_bytes","caml_ml_output_char","caml_ml_output_int","caml_ml_output_ta","caml_ml_pos_in","caml_ml_pos_in_64","caml_ml_pos_out","caml_ml_pos_out_64","caml_ml_runtime_events_are_active","caml_ml_runtime_events_pause","caml_ml_runtime_events_resume","caml_ml_runtime_events_start","caml_ml_runtime_warnings_enabled","caml_ml_seek_in","caml_ml_seek_in_64","caml_ml_seek_out","caml_ml_seek_out_64","caml_ml_set_binary_mode","caml_ml_set_buffered","caml_ml_set_channel_name","caml_ml_set_channel_output","caml_ml_set_channel_refill","caml_ml_string_length",f,"caml_modf_float","caml_mount_autoload",d,"caml_mul_float","caml_named_value","caml_named_values","caml_nativeint_add","caml_nativeint_and",bS,dk,bs,f6,eB,$,"caml_nativeint_neg","caml_nativeint_of_float","caml_nativeint_of_int","caml_nativeint_of_int32",dM,"caml_nativeint_or","caml_nativeint_shift_left","caml_nativeint_shift_right","caml_nativeint_shift_right_unsigned","caml_nativeint_sub","caml_nativeint_to_float","caml_nativeint_to_int","caml_nativeint_to_int32","caml_nativeint_unmarshal","caml_nativeint_xor","caml_neg_float","caml_neq_float","caml_new_lex_engine","caml_new_string","caml_nextafter_float","caml_notequal","caml_obj_add_offset","caml_obj_block","caml_obj_compare_and_swap","caml_obj_dup","caml_obj_is_shared","caml_obj_raw_field","caml_obj_reachable_words","caml_obj_set_raw_field","caml_obj_tag","caml_obj_update_tag","caml_obj_with_tag","caml_ojs_new_arr","caml_oo_cache_id","caml_oo_last_id","caml_output_val","caml_output_value","caml_output_value_to_buffer","caml_output_value_to_bytes","caml_output_value_to_string","caml_packFloat16","caml_parse_digit","caml_parse_engine","caml_parse_format","caml_parse_sign_and_base","caml_parser_trace","caml_pos_in","caml_pos_out","caml_power_float","caml_pure_js_expr","caml_raise_constant","caml_raise_end_of_file","caml_raise_no_such_file","caml_raise_nodejs_error","caml_raise_not_found","caml_raise_sys_error","caml_raise_system_error","caml_raise_with_arg","caml_raise_with_args","caml_raise_with_string","caml_raise_zero_divide","caml_raw_backtrace_length","caml_raw_backtrace_next_slot","caml_raw_backtrace_slot","caml_read_file_content","caml_recommended_domain_count","caml_record_backtrace","caml_record_backtrace_env_flag","caml_record_backtrace_runtime_flag","caml_refill","caml_register_global","caml_register_named_value","caml_restore_raw_backtrace","caml_root","caml_round_float","caml_runtime_events_create_cursor","caml_runtime_events_free_cursor","caml_runtime_events_read_poll","caml_runtime_events_user_register","caml_runtime_events_user_resolve","caml_runtime_events_user_write","caml_runtime_parameters","caml_runtime_variant","caml_runtime_warnings","caml_seek_in","caml_seek_out","caml_set_oo_id","caml_set_parser_trace","caml_set_static_env",er,a7,"caml_sin_float","caml_sinh_float","caml_sqrt_float","caml_str_repeat","caml_strerror","caml_string_bound_error","caml_string_compare","caml_string_concat","caml_string_equal","caml_string_get","caml_string_get16","caml_string_get32","caml_string_get64","caml_string_greaterequal","caml_string_greaterthan","caml_string_hash","caml_string_lessequal","caml_string_lessthan","caml_string_notequal","caml_string_of_array","caml_string_of_bytes","caml_string_of_jsbytes","caml_string_of_jsstring","caml_string_of_uint8_array","caml_string_set","caml_string_unsafe_get","caml_sub_float","caml_sub_uint8_array_to_jsbytes","caml_subarray_to_jsbytes","caml_sys_argv","caml_sys_chdir","caml_sys_close","caml_sys_const_backend_type","caml_sys_const_big_endian","caml_sys_const_int_size","caml_sys_const_max_wosize","caml_sys_const_naked_pointers_checked","caml_sys_const_ostype_cygwin","caml_sys_const_ostype_unix","caml_sys_const_ostype_win32","caml_sys_const_word_size","caml_sys_executable_name",j,"caml_sys_fds","caml_sys_file_exists","caml_sys_get_argv","caml_sys_get_config",k,"caml_sys_getenv","caml_sys_is_directory","caml_sys_is_regular_file","caml_sys_isatty","caml_sys_mkdir","caml_sys_modify_argv","caml_sys_open","caml_sys_open_for_node","caml_sys_random_seed","caml_sys_read_directory","caml_sys_remove","caml_sys_rename","caml_sys_rmdir","caml_sys_system_command","caml_sys_time","caml_sys_time_include_children","caml_sys_unsafe_getenv","caml_tan_float","caml_tanh_float","caml_throw_js_exception","caml_to_js_string","caml_trailing_slash","caml_trampoline","caml_trampoline_return","caml_trunc_float","caml_uint8_array_of_bytes","caml_uint8_array_of_string",dp,ds,fX,bG,fR,ej,dX,dO,aw,bM,fL,c1,eb,dU,P,ad,eX,dJ,cJ,a$,ck,fT,bL,bn,b,fD,bW,aR,a6,ax,l,dD,dl,fl,dE,fU,bd,aU,eJ,am,ar,ag,bu,ea,r,cR,e2,dI,f2,eE,G,ao,aL,eY,el,eo,fp,bj,cd,cK,H,dZ,dQ,cE,ek,"caml_unmount","caml_unpackFloat16","caml_update_dummy",fs,dC,"caml_weak_create",aq,bb,"caml_weak_set","caml_wrap_exception","caml_xdg_defaults","caml_xmlhttprequest_create","caml_zstd_initialize","compare_digits_nat","compare_nat","complement_nat","create_nat","decr_nat","deserialize_nat","div_digit_nat","div_helper","div_nat","fs_node_supported","incr_nat","initialize_nat","is_digit_int","is_digit_normalized","is_digit_odd","is_digit_zero","jsoo_create_file","jsoo_create_file_extern","jsoo_dataview","jsoo_effect_not_supported","jsoo_is_ascii","jsoo_is_win32","jsoo_mount_point","jsoo_static_env","jsoo_sys_getenv","jsoo_text_decoder","jsoo_text_decoder_buff","jsoo_text_encoder","jsoo_toplevel_reloc","land_digit_nat","length_nat","lor_digit_nat","lxor_digit_nat","make_unix_err_args","mult_digit_nat","mult_nat","nat_of_array","nth_digit_nat","nth_digit_nat_native","num_digits_nat","num_leading_zero_bits_in_digit","ocaml_stats_from_node_stats","os_type","path_is_absolute","re_match","re_partial_match","re_replacement_text","re_search_backward","re_search_forward","re_string_match","resolve_fs_device","serialize_nat","set_digit_nat","set_digit_nat_native","set_to_zero_nat","shift_left_nat","shift_right_nat","square_nat","sub_nat",bf,fj,eI,dK,aj,"unix_error",bk,fB,v,b6,eU,be,fq,fC,eR,dn,cg,a0,au,U,cf,fE,E,W,bH,F,aS,al,aO,d4,av,en,bC,ee,dS,cr,dz,fY,e7,aA,a4,cS,eQ,fd,ec,a3,x,e9,bT,bR,b3,bJ,dF,c8,dg,w,bK,aK,ak,bA,b_,eZ,e_,eD,cH,cm,fg,"zstd_decompress"]),0];return}(globalThis)); //# 4 "../.js/default/stdlib/stdlib.cma.js" //# shape: CamlinternalFormatBasics:[F(2),F(1),F(2)] @@ -28215,6 +28215,1669 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); +//# 21918 "../.js/default/stdlib/stdlib.cma.js" +//# shape: Stdlib__Scanf:[N,N,F(2),F(2),F(2),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(2),F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_get = runtime.caml_bytes_get, + caml_int_of_string = runtime.caml_int_of_string, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_string_get = runtime.caml_string_get, + caml_trampoline = runtime.caml_trampoline, + caml_trampoline_return = runtime.caml_trampoline_return, + caml_wrap_exception = runtime.caml_wrap_exception; + function caml_call1(f, a0){ + return (f.l >= 0 ? f.l : f.l = f.length) === 1 + ? f(a0) + : runtime.caml_call_gen(f, [a0]); + } + function caml_call2(f, a0, a1){ + return (f.l >= 0 ? f.l : f.l = f.length) === 2 + ? f(a0, a1) + : runtime.caml_call_gen(f, [a0, a1]); + } + function caml_call3(f, a0, a1, a2){ + return (f.l >= 0 ? f.l : f.l = f.length) === 3 + ? f(a0, a1, a2) + : runtime.caml_call_gen(f, [a0, a1, a2]); + } + var + global_data = runtime.caml_get_global_data(), + CamlinternalFormat = global_data.CamlinternalFormat, + CamlinternalFormatBasics = global_data.CamlinternalFormatBasics, + Stdlib_String = global_data.Stdlib__String, + Stdlib = global_data.Stdlib, + Assert_failure = global_data.Assert_failure, + Stdlib_Printf = global_data.Stdlib__Printf, + Stdlib_Int = global_data.Stdlib__Int, + Stdlib_Buffer = global_data.Stdlib__Buffer, + null_char = 0; + function next_char(ib){ + try{ + var c = caml_call1(ib[7], 0); + ib[2] = c; + ib[3] = 1; + ib[4] = ib[4] + 1 | 0; + if(10 === c) ib[5] = ib[5] + 1 | 0; + return c; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[12]) throw caml_maybe_attach_backtrace(exn, 0); + ib[2] = null_char; + ib[3] = 0; + ib[1] = 1; + return null_char; + } + } + function peek_char(ib){return ib[3] ? ib[2] : next_char(ib);} + function checked_peek_char(ib){ + var c = peek_char(ib); + if(ib[1]) throw caml_maybe_attach_backtrace(Stdlib[12], 1); + return c; + } + function end_of_input(ib){peek_char(ib); return ib[1];} + function beginning_of_input(ib){return 0 === ib[4] ? 1 : 0;} + function name_of_input(ib){ + var match = ib[9]; + if(typeof match === "number") + return 0 === match ? "unnamed function" : "unnamed character string"; + if(0 === match[0]) return "unnamed Stdlib input channel"; + var fname = match[1]; + return fname; + } + function char_count(ib){return ib[3] ? ib[4] - 1 | 0 : ib[4];} + function invalidate_current_char(ib){ib[3] = 0; return 0;} + function token_string(ib){ + var token_buffer = ib[8], tok = Stdlib_Buffer[2].call(null, token_buffer); + Stdlib_Buffer[8].call(null, token_buffer); + ib[6] = ib[6] + 1 | 0; + return tok; + } + function ignore_char(width, ib){ + var width$0 = width - 1 | 0; + invalidate_current_char(ib); + return width$0; + } + function store_char(width, ib, c){ + Stdlib_Buffer[12].call(null, ib[8], c); + return ignore_char(width, ib); + } + function create(iname, next){ + return [0, + 0, + null_char, + 0, + 0, + 0, + 0, + next, + Stdlib_Buffer[1].call(null, 1024), + iname]; + } + function from_string(s){ + var len = caml_ml_string_length(s), i = [0, 0]; + function next(param){ + if(len <= i[1]) throw caml_maybe_attach_backtrace(Stdlib[12], 1); + var c = caml_string_get(s, i[1]); + i[1]++; + return c; + } + return create(1, next); + } + function from_function(a){return create(0, a);} + function scan_close_at_end(ic){ + Stdlib[93].call(null, ic); + throw caml_maybe_attach_backtrace(Stdlib[12], 1); + } + function scan_raise_at_end(ic){ + throw caml_maybe_attach_backtrace(Stdlib[12], 1); + } + function from_ic(scan_close_ic, iname, ic){ + var + buf = runtime.caml_create_bytes(1024), + i = [0, 0], + lim = [0, 0], + eof = [0, 0]; + function next(param){ + if(i[1] < lim[1]){var c = caml_bytes_get(buf, i[1]); i[1]++; return c;} + if(eof[1]) throw caml_maybe_attach_backtrace(Stdlib[12], 1); + lim[1] = Stdlib[84].call(null, ic, buf, 0, 1024); + return 0 === lim[1] + ? (eof[1] = 1, caml_call1(scan_close_ic, ic)) + : (i[1] = 1, caml_bytes_get(buf, 0)); + } + return create(iname, next); + } + var + cst$0 = "-", + stdin = from_ic(scan_raise_at_end, [1, cst$0, Stdlib[38]], Stdlib[38]); + function open_in_file(open_in, fname){ + if(fname === cst$0) return stdin; + var ic = caml_call1(open_in, fname); + return from_ic(scan_close_at_end, [1, fname, ic], ic); + } + var a = Stdlib[79]; + function open_in(b){return open_in_file(a, b);} + var b = Stdlib[80]; + function open_in_bin(a){return open_in_file(b, a);} + function from_channel(ic){return from_ic(scan_raise_at_end, [0, ic], ic);} + function close_in(ib){ + var match = ib[9]; + if(typeof match === "number") return 0; + if(0 === match[0]){var ic = match[1]; return Stdlib[93].call(null, ic);} + var ic$0 = match[2]; + return Stdlib[93].call(null, ic$0); + } + var + Scan_failure = + [248, "Stdlib.Scanf.Scan_failure", runtime.caml_fresh_oo_id(0)]; + function bad_input(s){ + throw caml_maybe_attach_backtrace([0, Scan_failure, s], 1); + } + var + c = + [0, + [11, "illegal escape character ", [1, 0]], + "illegal escape character %C"]; + function bad_input_escape(c$0){ + return bad_input(caml_call1(Stdlib_Printf[4].call(null, c), c$0)); + } + var + cst_scanning_of = "scanning of ", + d = + [0, + [11, + cst_scanning_of, + [2, + 0, + [11, " failed: the specified length was too short for token", 0]]], + "scanning of %s failed: the specified length was too short for token"]; + function bad_token_length(message){ + return bad_input(caml_call1(Stdlib_Printf[4].call(null, d), message)); + } + var + cst_not_a_valid_float_in_hexad = + "not a valid float in hexadecimal notation"; + function bad_hex_float(param){ + return bad_input(cst_not_a_valid_float_in_hexad); + } + var + f = + [0, + [11, "looking for ", [1, [11, ", found ", [1, 0]]]], + "looking for %C, found %C"]; + function character_mismatch(c, ci){ + return bad_input(caml_call2(Stdlib_Printf[4].call(null, f), c, ci)); + } + function check_char(ib, c$0){ + if(10 === c$0){ + var ci = checked_peek_char(ib); + return 10 === ci + ? invalidate_current_char(ib) + : 13 + === ci + ? (invalidate_current_char(ib), check_this_char(ib, 10)) + : character_mismatch(10, ci); + } + if(32 !== c$0) return check_this_char(ib, c$0); + for(;;){ + var c = peek_char(ib), b = 1 - ib[1]; + if(! b) return b; + var a = c - 9 | 0; + a: + { + if(4 < a >>> 0){ + if(23 !== a) break a; + } + else if(1 >= a - 2 >>> 0) break a; + invalidate_current_char(ib); + continue; + } + return 0; + } + } + function check_this_char(ib, c){ + var ci = checked_peek_char(ib); + return ci === c ? invalidate_current_char(ib) : character_mismatch(c, ci); + } + function token_char(ib){return caml_string_get(token_string(ib), 0);} + var + g = + [0, + [11, "invalid boolean '", [2, 0, [12, 39, 0]]], + "invalid boolean '%s'"]; + function token_bool(ib){ + var s = token_string(ib); + return s !== "false" + ? s + !== "true" + ? bad_input(caml_call1(Stdlib_Printf[4].call(null, g), s)) + : 1 + : 0; + } + var cst_scanf_ml = "scanf.ml", h = [0, cst_scanf_ml, 516, 9]; + function integer_conversion_of_char(param){ + var switcher = param - 88 | 0; + if(32 >= switcher >>> 0) + switch(switcher){ + case 10: + return 0; + case 12: + return 1; + case 17: + return 2; + case 23: + return 3; + case 29: + return 4; + case 0: + case 32: + return 5; + } + throw caml_maybe_attach_backtrace([0, Assert_failure, h], 1); + } + function token_int_literal(conv, ib){ + switch(conv){ + case 0: + var a = token_string(ib), tok = Stdlib[28].call(null, "0b", a); break; + case 3: + var b = token_string(ib), tok = Stdlib[28].call(null, "0o", b); break; + case 4: + var c = token_string(ib), tok = Stdlib[28].call(null, "0u", c); break; + case 5: + var d = token_string(ib), tok = Stdlib[28].call(null, "0x", d); break; + default: var tok = token_string(ib); + } + var l = caml_ml_string_length(tok); + if(0 !== l && 43 === caml_string_get(tok, 0)) + return Stdlib_String[16].call(null, tok, 1, l - 1 | 0); + return tok; + } + function token_float(ib){ + return runtime.caml_float_of_string(token_string(ib)); + } + function scan_decimal_digit_star(width$2, ib){ + var width = width$2; + for(;;){ + if(0 === width) return width; + var c = peek_char(ib); + if(ib[1]) return width; + if(58 <= c){ + if(95 === c){ + var width$0 = ignore_char(width, ib); + width = width$0; + continue; + } + } + else if(48 <= c){ + var width$1 = store_char(width, ib, c); + width = width$1; + continue; + } + return width; + } + } + var + cst_character = "character ", + i = + [0, + [11, cst_character, [1, [11, " is not a decimal digit", 0]]], + "character %C is not a decimal digit"]; + function scan_decimal_digit_plus(width, ib){ + if(0 === width) return bad_token_length("decimal digits"); + var c = checked_peek_char(ib); + if(9 < c - 48 >>> 0) + return bad_input(caml_call1(Stdlib_Printf[4].call(null, i), c)); + var width$0 = store_char(width, ib, c); + return scan_decimal_digit_star(width$0, ib); + } + var + j = + [0, + [11, + cst_character, + [1, [11, " is not a valid ", [2, 0, [11, " digit", 0]]]]], + "character %C is not a valid %s digit"]; + function scan_digit_plus(basis, digitp, width$2, ib){ + if(0 === width$2) return bad_token_length("digits"); + var c$0 = checked_peek_char(ib); + if(! caml_call1(digitp, c$0)) + return bad_input(caml_call2(Stdlib_Printf[4].call(null, j), c$0, basis)); + var width$3 = store_char(width$2, ib, c$0), width = width$3; + for(;;){ + if(0 === width) return width; + var c = peek_char(ib); + if(ib[1]) return width; + if(caml_call1(digitp, c)){ + var width$0 = store_char(width, ib, c); + width = width$0; + } + else{ + if(95 !== c) return width; + var width$1 = ignore_char(width, ib); + width = width$1; + } + } + } + function is_binary_digit(param){return 1 < param - 48 >>> 0 ? 0 : 1;} + function is_octal_digit(param){return 7 < param - 48 >>> 0 ? 0 : 1;} + function is_hexa_digit(param){ + var a = param - 48 | 0; + a: + { + if(22 < a >>> 0){ + if(5 < a - 49 >>> 0) break a; + } + else if(6 >= a - 10 >>> 0) break a; + return 1; + } + return 0; + } + function scan_sign(width, ib){ + var c = checked_peek_char(ib), switcher = c - 43 | 0; + if(2 >= switcher >>> 0 && 1 !== switcher) return store_char(width, ib, c); + return width; + } + function scan_optionally_signed_decimal(width, ib){ + var width$0 = scan_sign(width, ib); + return scan_decimal_digit_plus(width$0, ib); + } + var cst_hexadecimal = "hexadecimal"; + function scan_int_conversion(conv, width$1, ib){ + var cst_binary = "binary", cst_octal = "octal"; + switch(conv){ + case 0: + return scan_digit_plus(cst_binary, is_binary_digit, width$1, ib); + case 1: + return scan_optionally_signed_decimal(width$1, ib); + case 2: + var width$0 = scan_sign(width$1, ib), c = checked_peek_char(ib); + if(48 !== c) return scan_decimal_digit_plus(width$0, ib); + var width = store_char(width$0, ib, c); + if(0 === width) return width; + var c$0 = peek_char(ib); + if(ib[1]) return width; + a: + { + if(99 <= c$0){ + if(111 === c$0) + return scan_digit_plus + (cst_octal, is_octal_digit, store_char(width, ib, c$0), ib); + if(120 !== c$0) break a; + } + else if(88 !== c$0){ + if(98 <= c$0) + return scan_digit_plus + (cst_binary, + is_binary_digit, + store_char(width, ib, c$0), + ib); + break a; + } + return scan_digit_plus + (cst_hexadecimal, + is_hexa_digit, + store_char(width, ib, c$0), + ib); + } + return scan_decimal_digit_star(width, ib); + case 3: + return scan_digit_plus(cst_octal, is_octal_digit, width$1, ib); + case 4: + return scan_decimal_digit_plus(width$1, ib); + default: + return scan_digit_plus(cst_hexadecimal, is_hexa_digit, width$1, ib); + } + } + function scan_fractional_part(width, ib){ + if(0 === width) return width; + var c = peek_char(ib); + return ib[1] + ? width + : 9 + < c - 48 >>> 0 + ? width + : scan_decimal_digit_star(store_char(width, ib, c), ib); + } + function scan_exponent_part(width, ib){ + if(0 === width) return width; + var c = peek_char(ib); + if(ib[1]) return width; + if(69 !== c && 101 !== c) return width; + return scan_optionally_signed_decimal(store_char(width, ib, c), ib); + } + function scan_float(width$1, precision, ib){ + var + width = scan_sign(width$1, ib), + width$0 = scan_decimal_digit_star(width, ib); + if(0 === width$0) return [0, width$0, precision]; + var c = peek_char(ib); + if(ib[1]) return [0, width$0, precision]; + if(46 !== c) return [0, scan_exponent_part(width$0, ib), precision]; + var + width$2 = store_char(width$0, ib, c), + precision$0 = Stdlib_Int[10].call(null, width$2, precision), + width$3 = + width$2 - (precision$0 - scan_fractional_part(precision$0, ib) | 0) | 0; + return [0, scan_exponent_part(width$3, ib), precision$0]; + } + function check_case_insensitive_string(width, ib, error, str){ + function lowercase(c){ + return 25 < c - 65 >>> 0 + ? c + : Stdlib[29].call(null, (c - 65 | 0) + 97 | 0); + } + var len = caml_ml_string_length(str), a = len - 1 | 0; + if(a < 0) + var width$1 = width; + else{ + var width$0 = width, i = 0; + for(;;){ + var c = peek_char(ib), d = lowercase(caml_string_get(str, i)); + if(lowercase(c) !== d) caml_call1(error, 0); + if(0 === width$0) caml_call1(error, 0); + var b = store_char(width$0, ib, c), e = i + 1 | 0; + if(a === i){var width$1 = b; break;} + width$0 = b; + i = e; + } + } + return width$1; + } + function scan_hex_float(width, precision, ib){ + var b = 0 === width, d = b || end_of_input(ib); + if(d) bad_input(cst_not_a_valid_float_in_hexad); + var + width$0 = scan_sign(width, ib), + e = 0 === width$0, + f = e || end_of_input(ib); + if(f) bad_input(cst_not_a_valid_float_in_hexad); + var c = peek_char(ib); + a: + { + if(78 <= c){ + var switcher = c - 79 | 0; + if(30 < switcher >>> 0){ + if(32 <= switcher) break a; + var + width$1 = store_char(width$0, ib, c), + g = 0 === width$1, + h = g || end_of_input(ib); + if(h) bad_input(cst_not_a_valid_float_in_hexad); + return check_case_insensitive_string(width$1, ib, bad_hex_float, "an"); + } + if(26 !== switcher) break a; + } + else{ + if(48 === c){ + var + width$3 = store_char(width$0, ib, c), + k = 0 === width$3, + l = k || end_of_input(ib); + if(l) bad_input(cst_not_a_valid_float_in_hexad); + var + width$4 = + check_case_insensitive_string(width$3, ib, bad_hex_float, "x"); + if(0 !== width$4 && ! end_of_input(ib)){ + var a = peek_char(ib) - 46 | 0; + b: + { + if(34 < a >>> 0){ + if(66 === a){var width$5 = width$4; break b;} + } + else if(32 < a - 1 >>> 0){var width$5 = width$4; break b;} + var + width$5 = + scan_digit_plus(cst_hexadecimal, is_hexa_digit, width$4, ib); + } + if(0 !== width$5 && ! end_of_input(ib)){ + var c$0 = peek_char(ib); + if(46 === c$0){ + var width$6 = store_char(width$5, ib, c$0); + if(0 === width$6) + var width$7 = width$6; + else if(end_of_input(ib)) + var width$7 = width$6; + else{ + var match = peek_char(ib); + if(80 === match || 112 === match) + var width$7 = width$6; + else + var + precision$0 = Stdlib_Int[10].call(null, width$6, precision), + width$7 = + width$6 + - + (precision$0 + - + scan_digit_plus + (cst_hexadecimal, is_hexa_digit, precision$0, ib) + | 0) + | 0; + } + } + else + var width$7 = width$5; + if(0 !== width$7 && ! end_of_input(ib)){ + var c$1 = peek_char(ib); + if(80 !== c$1 && 112 !== c$1) return width$7; + var + width$8 = store_char(width$7, ib, c$1), + m = 0 === width$8, + n = m || end_of_input(ib); + if(n) bad_input(cst_not_a_valid_float_in_hexad); + return scan_optionally_signed_decimal(width$8, ib); + } + return width$7; + } + return width$5; + } + return width$4; + } + if(73 !== c) break a; + } + var + width$2 = store_char(width$0, ib, c), + i = 0 === width$2, + j = i || end_of_input(ib); + if(j) bad_input(cst_not_a_valid_float_in_hexad); + return check_case_insensitive_string + (width$2, ib, bad_hex_float, "nfinity"); + } + return bad_input(cst_not_a_valid_float_in_hexad); + } + var + cst_no_dot_or_exponent_part_fo = + "no dot or exponent part found in float token"; + function scan_caml_float_rest(width, precision, ib){ + var a = 0 === width, b = a || end_of_input(ib); + if(b) bad_input(cst_no_dot_or_exponent_part_fo); + var + width$0 = scan_decimal_digit_star(width, ib), + d = 0 === width$0, + e = d || end_of_input(ib); + if(e) bad_input(cst_no_dot_or_exponent_part_fo); + var c = peek_char(ib), switcher = c - 69 | 0; + if(32 < switcher >>> 0){ + if(-23 === switcher){ + var + width$1 = store_char(width$0, ib, c), + precision$0 = Stdlib_Int[10].call(null, width$1, precision), + width_precision = scan_fractional_part(precision$0, ib), + frac_width = precision$0 - width_precision | 0, + width$2 = width$1 - frac_width | 0; + return scan_exponent_part(width$2, ib); + } + } + else if(30 < switcher - 1 >>> 0) return scan_exponent_part(width$0, ib); + return bad_input(cst_no_dot_or_exponent_part_fo); + } + function scan_caml_float(width, precision, ib){ + var a = 0 === width, b = a || end_of_input(ib); + if(b) bad_input(cst_no_dot_or_exponent_part_fo); + var + width$0 = scan_sign(width, ib), + d = 0 === width$0, + e = d || end_of_input(ib); + if(e) bad_input(cst_no_dot_or_exponent_part_fo); + var c = peek_char(ib); + if(49 <= c){ + if(58 > c){ + var + width$1 = store_char(width$0, ib, c), + f = 0 === width$1, + g = f || end_of_input(ib); + if(g) bad_input(cst_no_dot_or_exponent_part_fo); + return scan_caml_float_rest(width$1, precision, ib); + } + } + else if(48 <= c){ + var + width$2 = store_char(width$0, ib, c), + h = 0 === width$2, + i = h || end_of_input(ib); + if(i) bad_input(cst_no_dot_or_exponent_part_fo); + var c$0 = peek_char(ib); + if(88 !== c$0 && 120 !== c$0) + return scan_caml_float_rest(width$2, precision, ib); + var + width$3 = store_char(width$2, ib, c$0), + j = 0 === width$3, + k = j || end_of_input(ib); + if(k) bad_input(cst_no_dot_or_exponent_part_fo); + var + width$7 = scan_digit_plus(cst_hexadecimal, is_hexa_digit, width$3, ib), + l = 0 === width$7, + m = l || end_of_input(ib); + if(m) bad_input(cst_no_dot_or_exponent_part_fo); + var c$1 = peek_char(ib), switcher = c$1 - 80 | 0; + a: + { + if(32 < switcher >>> 0){ + if(-34 === switcher){ + var width$4 = store_char(width$7, ib, c$1); + if(0 === width$4){var width$5 = width$4; break a;} + if(end_of_input(ib)){var width$5 = width$4; break a;} + var match = peek_char(ib); + if(80 === match){var width$5 = width$4; break a;} + if(112 === match){var width$5 = width$4; break a;} + var + precision$0 = Stdlib_Int[10].call(null, width$4, precision), + width$5 = + width$4 + - + (precision$0 + - scan_digit_plus(cst_hexadecimal, is_hexa_digit, precision$0, ib) + | 0) + | 0; + break a; + } + } + else if(30 < switcher - 1 >>> 0){var width$5 = width$7; break a;} + var width$5 = bad_input(cst_no_dot_or_exponent_part_fo); + } + if(0 !== width$5 && ! end_of_input(ib)){ + var c$2 = peek_char(ib); + if(80 !== c$2 && 112 !== c$2) return width$5; + var + width$6 = store_char(width$5, ib, c$2), + n = 0 === width$6, + o = n || end_of_input(ib); + if(o) bad_input(cst_not_a_valid_float_in_hexad); + return scan_optionally_signed_decimal(width$6, ib); + } + return width$5; + } + return bad_input(cst_no_dot_or_exponent_part_fo); + } + function scan_string(stp, width, ib){ + var width$0 = width; + for(;;){ + if(0 === width$0) return width$0; + var c = peek_char(ib); + if(ib[1]) return width$0; + if(stp){ + var c$0 = stp[1]; + if(c === c$0){invalidate_current_char(ib); return width$0;} + var width$1 = store_char(width$0, ib, c); + width$0 = width$1; + } + else{ + var a = c - 9 | 0; + a: + { + if(4 < a >>> 0){ + if(23 !== a) break a; + } + else if(1 >= a - 2 >>> 0) break a; + return width$0; + } + var width$2 = store_char(width$0, ib, c); + width$0 = width$2; + } + } + } + function hexadecimal_value_of_char(c){ + return 97 <= c ? c - 87 | 0 : 65 <= c ? c - 55 | 0 : c - 48 | 0; + } + var + e = + [0, + [11, + cst_scanning_of, + [2, + 0, + [11, + " failed: premature end of file occurred before end of token", + 0]]], + "scanning of %s failed: premature end of file occurred before end of token"]; + function check_next_char(message, width, ib){ + if(0 === width) return bad_token_length(message); + var c = peek_char(ib); + return ib[1] + ? bad_input(caml_call1(Stdlib_Printf[4].call(null, e), message)) + : c; + } + var + cst_a_Char = "a Char", + k = + [0, + [11, "bad character decimal encoding \\", [0, [0, [0, 0]]]], + "bad character decimal encoding \\%c%c%c"], + l = + [0, + [11, "bad character hexadecimal encoding \\", [0, [0, 0]]], + "bad character hexadecimal encoding \\%c%c"]; + function scan_backslash_char(width, ib){ + var c0 = check_next_char(cst_a_Char, width, ib); + a: + { + if(40 <= c0){ + if(58 > c0){ + if(48 > c0) break a; + var + get_digit$0 = + function(param){ + var c = next_char(ib); + return 9 < c - 48 >>> 0 ? bad_input_escape(c) : c; + }, + c1$0 = get_digit$0(0), + c2$0 = get_digit$0(0), + c = + ((100 * (c0 - 48 | 0) | 0) + (10 * (c1$0 - 48 | 0) | 0) | 0) + + (c2$0 - 48 | 0) + | 0; + b: + { + if(0 <= c && 255 >= c){var d = Stdlib[29].call(null, c); break b;} + var + d = + bad_input + (caml_call3(Stdlib_Printf[4].call(null, k), c0, c1$0, c2$0)); + } + return store_char(width - 2 | 0, ib, d); + } + var switcher = c0 - 92 | 0; + if(28 < switcher >>> 0) break a; + switch(switcher){ + case 28: + var + get_digit = + function(param){ + var c = next_char(ib), a = c - 48 | 0; + a: + { + if(22 < a >>> 0){ + if(5 < a - 49 >>> 0) break a; + } + else if(6 >= a - 10 >>> 0) break a; + return c; + } + return bad_input_escape(c); + }, + c1 = get_digit(0), + c2 = get_digit(0), + e = hexadecimal_value_of_char(c2), + c$0 = (16 * hexadecimal_value_of_char(c1) | 0) + e | 0; + b: + { + if(0 <= c$0 && 255 >= c$0){ + var b = Stdlib[29].call(null, c$0); + break b; + } + var + b = bad_input(caml_call2(Stdlib_Printf[4].call(null, l), c1, c2)); + } + return store_char(width - 2 | 0, ib, b); + case 0: + case 6: + case 18: + case 22: + case 24: break; + default: break a; + } + } + else if(34 !== c0 && 39 > c0) break a; + if(110 <= c0) + if(117 <= c0) + var a = c0; + else + switch(c0 - 110 | 0){ + case 0: + var a = 10; break; + case 4: + var a = 13; break; + case 6: + var a = 9; break; + default: var a = c0; + } + else + var a = 98 === c0 ? 8 : c0; + return store_char(width, ib, a); + } + return bad_input_escape(c0); + } + function scan_caml_string(width, ib){ + var cst_a_String = "a String"; + function find_stop$0(counter, width$5){ + var width = width$5; + for(;;){ + var c = check_next_char(cst_a_String, width, ib); + if(34 === c) return ignore_char(width, ib); + if(92 === c){ + var + width$0 = ignore_char(width, ib), + match = check_next_char(cst_a_String, width$0, ib); + if(10 === match){ + var a = ignore_char(width$0, ib); + return counter < 50 + ? skip_spaces(counter + 1 | 0, a) + : caml_trampoline_return(skip_spaces, [0, a]); + } + if(13 === match){ + var width$2 = ignore_char(width$0, ib); + if(10 === check_next_char(cst_a_String, width$2, ib)){ + var b = ignore_char(width$2, ib); + return counter < 50 + ? skip_spaces(counter + 1 | 0, b) + : caml_trampoline_return(skip_spaces, [0, b]); + } + var width$4 = store_char(width$2, ib, 13); + width = width$4; + } + else{var width$3 = scan_backslash_char(width$0, ib); width = width$3;} + } + else{var width$1 = store_char(width, ib, c); width = width$1;} + } + } + function find_stop(width){return caml_trampoline(find_stop$0(0, width));} + function skip_spaces(counter, width$1){ + var width = width$1; + for(;;){ + if(32 !== check_next_char(cst_a_String, width, ib)) + return counter < 50 + ? find_stop$0(counter + 1 | 0, width) + : caml_trampoline_return(find_stop$0, [0, width]); + var width$0 = ignore_char(width, ib); + width = width$0; + } + } + var c = checked_peek_char(ib); + return 34 === c + ? find_stop(ignore_char(width, ib)) + : character_mismatch(34, c); + } + function scan_chars_in_char_set(char_set, scan_indic, width, ib){ + function scan_chars(i$1, stp){ + var i = i$1; + for(;;){ + var c = peek_char(ib), b = 0 < i ? 1 : 0; + if(b){ + var d = 1 - ib[1]; + if(d) + var + e = CamlinternalFormat[1].call(null, char_set, c), + a = e ? c !== stp ? 1 : 0 : e; + else + var a = d; + } + else + var a = b; + if(! a) return a; + store_char(Stdlib[19], ib, c); + var i$0 = i - 1 | 0; + i = i$0; + } + } + if(! scan_indic) return scan_chars(width, -1); + var c = scan_indic[1]; + scan_chars(width, c); + var a = 1 - ib[1]; + if(! a) return a; + var ci = peek_char(ib); + return c === ci ? invalidate_current_char(ib) : character_mismatch(c, ci); + } + var + n = + [0, + [11, + "scanf: bad input at char number ", + [4, 3, 0, 0, [11, ": ", [2, 0, 0]]]], + "scanf: bad input at char number %i: %s"]; + function scanf_bad_input(ib, x){ + if(x[1] === Scan_failure) + var s = x[2]; + else{ + if(x[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(x, 1); + var s = x[2]; + } + var i = char_count(ib); + return bad_input(caml_call2(Stdlib_Printf[4].call(null, n), i, s)); + } + function width_of_pad_opt(pad_opt){ + if(! pad_opt) return Stdlib[19]; + var width = pad_opt[1]; + return width; + } + var o = [0, 37, ""]; + function stopper_of_formatting_lit(fmting){ + if(6 === fmting) return o; + var + str = CamlinternalFormat[17].call(null, fmting), + stp = caml_string_get(str, 1), + sub_str = + Stdlib_String[16].call + (null, str, 2, caml_ml_string_length(str) - 2 | 0); + return [0, stp, sub_str]; + } + function take_format_readers$0(counter, k, fmt$4){ + a: + { + var fmt = fmt$4; + b: + for(;;){ + if(typeof fmt === "number") return caml_call1(k, 0); + switch(fmt[0]){ + case 14: + var + rest$3 = fmt[3], + fmtty = fmt[2], + c = CamlinternalFormat[21].call(null, fmtty), + b = CamlinternalFormatBasics[2].call(null, c); + return counter < 50 + ? take_fmtty_format_readers$0(counter + 1 | 0, k, b, rest$3) + : caml_trampoline_return + (take_fmtty_format_readers$0, [0, k, b, rest$3]); + case 18: + var a = fmt[1]; + if(0 === a[0]){ + var + rest$4 = fmt[2], + fmt$0 = a[1][1], + fmt$1 = CamlinternalFormatBasics[3].call(null, fmt$0, rest$4); + fmt = fmt$1; + } + else{ + var + rest$5 = fmt[2], + fmt$2 = a[1][1], + fmt$3 = CamlinternalFormatBasics[3].call(null, fmt$2, rest$5); + fmt = fmt$3; + } + break; + case 19: + break a; + case 23: + var rest$6 = fmt[2], ign = fmt[1]; + if(typeof ign === "number"){ + if(2 === ign) break b; + fmt = rest$6; + } + else{ + if(9 === ign[0]){ + var fmtty$0 = ign[2]; + return counter < 50 + ? take_fmtty_format_readers$0 + (counter + 1 | 0, k, fmtty$0, rest$6) + : caml_trampoline_return + (take_fmtty_format_readers$0, [0, k, fmtty$0, rest$6]); + } + fmt = rest$6; + } + break; + case 13: + case 20: + case 24: + var rest$2 = fmt[3]; fmt = rest$2; break; + case 4: + case 5: + case 6: + case 7: + case 8: + var rest$1 = fmt[4]; fmt = rest$1; break; + case 0: + case 1: + case 10: + case 15: + case 16: + case 22: + var rest = fmt[1]; fmt = rest; break; + default: var rest$0 = fmt[2]; fmt = rest$0; + } + } + return function(reader){ + function new_k(readers_rest){ + return caml_call1(k, [0, reader, readers_rest]); + } + return take_format_readers(new_k, rest$6);}; + } + var fmt_rest = fmt[1]; + return function(reader){ + function new_k(readers_rest){ + return caml_call1(k, [0, reader, readers_rest]); + } + return take_format_readers(new_k, fmt_rest);}; + } + function take_format_readers(k, fmt){ + return caml_trampoline(take_format_readers$0(0, k, fmt)); + } + function take_fmtty_format_readers$0(counter, k, fmtty$3, fmt){ + a: + { + var fmtty = fmtty$3; + b: + for(;;){ + if(typeof fmtty === "number") + return counter < 50 + ? take_format_readers$0(counter + 1 | 0, k, fmt) + : caml_trampoline_return(take_format_readers$0, [0, k, fmt]); + switch(fmtty[0]){ + case 8: + var fmtty$1 = fmtty[2]; fmtty = fmtty$1; break; + case 9: + var + rest = fmtty[3], + ty2 = fmtty[2], + ty1 = fmtty[1], + a = CamlinternalFormat[21].call(null, ty1), + ty = CamlinternalFormat[22].call(null, a, ty2), + fmtty$2 = CamlinternalFormatBasics[1].call(null, ty, rest); + fmtty = fmtty$2; + break; + case 13: + break a; + case 14: + break b; + default: var fmtty$0 = fmtty[1]; fmtty = fmtty$0; + } + } + var fmt_rest$0 = fmtty[1]; + return function(reader){ + function new_k(readers_rest){ + return caml_call1(k, [0, reader, readers_rest]); + } + return take_fmtty_format_readers(new_k, fmt_rest$0, fmt);}; + } + var fmt_rest = fmtty[1]; + return function(reader){ + function new_k(readers_rest){ + return caml_call1(k, [0, reader, readers_rest]); + } + return take_fmtty_format_readers(new_k, fmt_rest, fmt);}; + } + function take_fmtty_format_readers(k, fmtty, fmt){ + return caml_trampoline(take_fmtty_format_readers$0(0, k, fmtty, fmt)); + } + var + m = + [0, + [11, "the character ", [1, [11, " cannot start a boolean", 0]]], + "the character %C cannot start a boolean"], + p = [0, 123], + q = [0, 91], + r = [0, cst_scanf_ml, 1414, 13]; + function make_scanf(ib, fmt$13, readers){ + a: + { + b: + { + c: + { + d: + { + e: + { + f: + { + g: + { + h: + { + i: + { + var fmt = fmt$13; + j: + for(;;){ + if(typeof fmt === "number") return 0; + switch(fmt[0]){ + case 0: + var rest = fmt[1]; + store_char(0, ib, checked_peek_char(ib)); + var c$0 = token_char(ib); + return [0, c$0, make_scanf(ib, rest, readers)]; + case 1: + break a; + case 2: + break b; + case 3: + break c; + case 4: + break d; + case 5: + break e; + case 6: + break f; + case 7: + break g; + case 8: + switch(fmt[1][2]){ + case 5: + case 8: + var rest$11 = fmt[4], prec$4 = fmt[3], pad$6 = fmt[2]; + return pad_prec_scanf + (ib, + rest$11, + readers, + pad$6, + prec$4, + scan_caml_float, + token_float); + case 6: + case 7: + var rest$12 = fmt[4], prec$5 = fmt[3], pad$7 = fmt[2]; + return pad_prec_scanf + (ib, + rest$12, + readers, + pad$7, + prec$5, + scan_hex_float, + token_float); + default: + var rest$10 = fmt[4], prec$3 = fmt[3], pad$5 = fmt[2]; + return pad_prec_scanf + (ib, + rest$10, + readers, + pad$5, + prec$3, + scan_float, + token_float); + } + case 9: + break h; + case 10: + var rest$14 = fmt[1]; + if(! end_of_input(ib)) + return bad_input("end of input not found"); + fmt = rest$14; + break; + case 11: + var rest$15 = fmt[2], str$0 = fmt[1]; + Stdlib_String[30].call + (null, function(a){return check_char(ib, a);}, str$0); + fmt = rest$15; + break; + case 12: + var rest$16 = fmt[2], chr = fmt[1]; + check_char(ib, chr); + fmt = rest$16; + break; + case 13: + var rest$17 = fmt[3], fmtty = fmt[2], pad_opt = fmt[1]; + scan_caml_string(width_of_pad_opt(pad_opt), ib); + var s = token_string(ib); + try{ + var + e = CamlinternalFormat[14].call(null, s, fmtty), + fmt$2 = e; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[7]) + throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], fmt$2 = bad_input(msg); + } + return [0, fmt$2, make_scanf(ib, rest$17, readers)]; + case 14: + break i; + case 15: + return Stdlib[1].call(null, 'scanf: bad conversion "%a"'); + case 16: + return Stdlib[1].call(null, 'scanf: bad conversion "%t"'); + case 17: + var + rest$19 = fmt[2], + formatting_lit = fmt[1], + j = CamlinternalFormat[17].call(null, formatting_lit); + Stdlib_String[30].call + (null, function(a){return check_char(ib, a);}, j); + fmt = rest$19; + break; + case 18: + var b = fmt[1]; + if(0 === b[0]){ + var rest$20 = fmt[2], fmt$8 = b[1][1]; + check_char(ib, 64); + check_char(ib, 123); + var + fmt$9 = + CamlinternalFormatBasics[3].call(null, fmt$8, rest$20); + fmt = fmt$9; + } + else{ + var rest$21 = fmt[2], fmt$10 = b[1][1]; + check_char(ib, 64); + check_char(ib, 91); + var + fmt$11 = + CamlinternalFormatBasics[3].call(null, fmt$10, rest$21); + fmt = fmt$11; + } + break; + case 19: + var fmt_rest = fmt[1]; + if(! readers) + return Stdlib[1].call(null, "scanf: missing reader"); + var + readers_rest = readers[2], + reader = readers[1], + x = caml_call1(reader, ib); + return [0, x, make_scanf(ib, fmt_rest, readers_rest)]; + case 20: + break j; + case 21: + var rest$24 = fmt[2], counter = fmt[1]; + switch(counter){ + case 0: + var count = ib[5]; break; + case 1: + var count = char_count(ib); break; + default: var count = ib[6]; + } + return [0, count, make_scanf(ib, rest$24, readers)]; + case 22: + var rest$25 = fmt[1], c$2 = checked_peek_char(ib); + return [0, c$2, make_scanf(ib, rest$25, readers)]; + case 23: + var + rest$26 = fmt[2], + ign = fmt[1], + fmt$12 = CamlinternalFormat[6].call(null, ign, rest$26)[1], + match$3 = make_scanf(ib, fmt$12, readers); + if(! match$3) + throw caml_maybe_attach_backtrace([0, Assert_failure, r], 1); + var arg_rest = match$3[2]; + return arg_rest; + default: + return Stdlib[1].call + (null, 'scanf: bad conversion "%?" (custom converter)'); + } + } + var width_opt = fmt[1], match$1 = fmt[3]; + if(typeof match$1 !== "number" && 17 === match$1[0]){ + var + rest$23 = match$1[2], + fmting_lit$0 = match$1[1], + char_set$0 = fmt[2], + match$2 = stopper_of_formatting_lit(fmting_lit$0), + str$1 = match$2[2], + stp$0 = match$2[1], + width$1 = width_of_pad_opt(width_opt); + scan_chars_in_char_set(char_set$0, [0, stp$0], width$1, ib); + var s$2 = token_string(ib); + return [0, s$2, make_scanf(ib, [11, str$1, rest$23], readers)]; + } + var + rest$22 = fmt[3], + char_set = fmt[2], + width$0 = width_of_pad_opt(width_opt); + scan_chars_in_char_set(char_set, 0, width$0, ib); + var s$1 = token_string(ib); + return [0, s$1, make_scanf(ib, rest$22, readers)]; + } + var rest$18 = fmt[3], fmtty$0 = fmt[2], pad_opt$0 = fmt[1]; + scan_caml_string(width_of_pad_opt(pad_opt$0), ib); + var s$0 = token_string(ib); + try{ + var + fmt$5 = CamlinternalFormat[13].call(null, 0, s$0)[1], + fmt$6 = CamlinternalFormat[13].call(null, 0, s$0)[1], + f = CamlinternalFormat[21].call(null, fmtty$0), + g = CamlinternalFormatBasics[2].call(null, f), + fmt$7 = CamlinternalFormat[12].call(null, fmt$6, g), + h = CamlinternalFormatBasics[2].call(null, fmtty$0), + i = CamlinternalFormat[12].call(null, fmt$5, h), + fmt$4 = fmt$7, + fmt$3 = i; + } + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0[1] !== Stdlib[7]) + throw caml_maybe_attach_backtrace(exn$0, 0); + var + msg$0 = exn$0[2], + d = bad_input(msg$0), + fmt$4 = d[2], + fmt$3 = d[1]; + } + return [0, + [0, fmt$3, s$0], + make_scanf + (ib, + CamlinternalFormatBasics[3].call(null, fmt$4, rest$18), + readers)]; + } + var + rest$13 = fmt[2], + pad$8 = fmt[1], + scan$8 = + function(a, param, ib){ + var + c = checked_peek_char(ib), + m$0 = + 102 === c + ? 5 + : 116 + === c + ? 4 + : bad_input(caml_call1(Stdlib_Printf[4].call(null, m), c)); + return scan_string(0, m$0, ib); + }; + return pad_prec_scanf + (ib, rest$13, readers, pad$8, 0, scan$8, token_bool); + } + var + rest$9 = fmt[4], + prec$2 = fmt[3], + pad$4 = fmt[2], + iconv$2 = fmt[1], + conv$2 = + integer_conversion_of_char + (CamlinternalFormat[16].call(null, iconv$2)), + scan$7 = + function(width, param, ib){ + return scan_int_conversion(conv$2, width, ib); + }; + return pad_prec_scanf + (ib, + rest$9, + readers, + pad$4, + prec$2, + scan$7, + function(ib){ + return runtime.caml_int64_of_string + (token_int_literal(conv$2, ib)); + }); + } + var + rest$8 = fmt[4], + prec$1 = fmt[3], + pad$3 = fmt[2], + iconv$1 = fmt[1], + conv$1 = + integer_conversion_of_char + (CamlinternalFormat[16].call(null, iconv$1)), + scan$6 = + function(width, param, ib){ + return scan_int_conversion(conv$1, width, ib); + }; + return pad_prec_scanf + (ib, + rest$8, + readers, + pad$3, + prec$1, + scan$6, + function(ib){ + return caml_int_of_string(token_int_literal(conv$1, ib)); + }); + } + var + rest$7 = fmt[4], + prec$0 = fmt[3], + pad$2 = fmt[2], + iconv$0 = fmt[1], + conv$0 = + integer_conversion_of_char + (CamlinternalFormat[16].call(null, iconv$0)), + scan$5 = + function(width, param, ib){ + return scan_int_conversion(conv$0, width, ib); + }; + return pad_prec_scanf + (ib, + rest$7, + readers, + pad$2, + prec$0, + scan$5, + function(ib){ + return caml_int_of_string(token_int_literal(conv$0, ib)); + }); + } + var + rest$6 = fmt[4], + prec = fmt[3], + pad$1 = fmt[2], + iconv = fmt[1], + conv = + integer_conversion_of_char(CamlinternalFormat[16].call(null, iconv)), + scan$4 = + function(width, param, ib){ + return scan_int_conversion(conv, width, ib); + }; + return pad_prec_scanf + (ib, + rest$6, + readers, + pad$1, + prec, + scan$4, + function(ib){ + return caml_int_of_string(token_int_literal(conv, ib)); + }); + } + var + rest$5 = fmt[2], + pad$0 = fmt[1], + scan$3 = + function(width, param, ib){return scan_caml_string(width, ib);}; + return pad_prec_scanf + (ib, rest$5, readers, pad$0, 0, scan$3, token_string); + } + var pad = fmt[1], match = fmt[2]; + if(typeof match !== "number") + switch(match[0]){ + case 17: + var + rest$2 = match[2], + fmting_lit = match[1], + match$0 = stopper_of_formatting_lit(fmting_lit), + str = match$0[2], + stp = match$0[1], + scan$0 = + function(width, param, ib){ + return scan_string([0, stp], width, ib); + }; + return pad_prec_scanf + (ib, + [11, str, rest$2], + readers, + pad, + 0, + scan$0, + token_string); + case 18: + var a = match[1]; + if(0 === a[0]){ + var + rest$3 = match[2], + fmt$0 = a[1][1], + scan$1 = + function(width, param, ib){return scan_string(p, width, ib);}; + return pad_prec_scanf + (ib, + CamlinternalFormatBasics[3].call(null, fmt$0, rest$3), + readers, + pad, + 0, + scan$1, + token_string); + } + var + rest$4 = match[2], + fmt$1 = a[1][1], + scan$2 = + function(width, param, ib){return scan_string(q, width, ib);}; + return pad_prec_scanf + (ib, + CamlinternalFormatBasics[3].call(null, fmt$1, rest$4), + readers, + pad, + 0, + scan$2, + token_string); + } + var + rest$1 = fmt[2], + scan = function(width, param, ib){return scan_string(0, width, ib);}; + return pad_prec_scanf(ib, rest$1, readers, pad, 0, scan, token_string); + } + var rest$0 = fmt[1]; + function find_stop(width){ + var c = check_next_char(cst_a_Char, width, ib); + return 39 === c ? ignore_char(width, ib) : character_mismatch(39, c); + } + var c = checked_peek_char(ib); + if(39 === c){ + var + width = ignore_char(0, ib), + c$3 = check_next_char(cst_a_Char, width, ib); + if(92 === c$3) + find_stop(scan_backslash_char(ignore_char(width, ib), ib)); + else + find_stop(store_char(width, ib, c$3)); + } + else + character_mismatch(39, c); + var c$1 = token_char(ib); + return [0, c$1, make_scanf(ib, rest$0, readers)]; + } + function pad_prec_scanf(ib, fmt, readers, pad, prec, scan, token){ + var cst_scanf_bad_conversion = 'scanf: bad conversion "%*"'; + if(typeof pad === "number"){ + if(typeof prec !== "number"){ + var p = prec[1]; + caml_call3(scan, Stdlib[19], p, ib); + var x$0 = caml_call1(token, ib); + return [0, x$0, make_scanf(ib, fmt, readers)]; + } + if(prec) return Stdlib[1].call(null, cst_scanf_bad_conversion); + caml_call3(scan, Stdlib[19], Stdlib[19], ib); + var x = caml_call1(token, ib); + return [0, x, make_scanf(ib, fmt, readers)]; + } + if(0 !== pad[0]) return Stdlib[1].call(null, cst_scanf_bad_conversion); + if(! pad[1]) return Stdlib[1].call(null, 'scanf: bad conversion "%-"'); + var w = pad[2]; + if(typeof prec !== "number"){ + var p$0 = prec[1]; + caml_call3(scan, w, p$0, ib); + var x$2 = caml_call1(token, ib); + return [0, x$2, make_scanf(ib, fmt, readers)]; + } + if(prec) return Stdlib[1].call(null, cst_scanf_bad_conversion); + caml_call3(scan, w, Stdlib[19], ib); + var x$1 = caml_call1(token, ib); + return [0, x$1, make_scanf(ib, fmt, readers)]; + } + var cst = '"'; + function kscanf_gen(ib, ef, af, param){ + var str = param[2], fmt = param[1]; + function k(readers, f$1){ + Stdlib_Buffer[9].call(null, ib[8]); + try{var args$1 = make_scanf(ib, fmt, readers), f = f$1, args = args$1;} + catch(exc$0){ + var exc = caml_wrap_exception(exc$0); + if + (exc[1] !== Scan_failure && exc[1] !== Stdlib[7] && exc !== Stdlib[12]){ + if(exc[1] !== Stdlib[6]) throw caml_maybe_attach_backtrace(exc, 0); + var + msg = exc[2], + a = Stdlib_String[25].call(null, str), + b = Stdlib[28].call(null, a, cst), + c = Stdlib[28].call(null, ' in format "', b), + d = Stdlib[28].call(null, msg, c); + return Stdlib[1].call(null, d); + } + return caml_call2(ef, ib, exc); + } + for(;;){ + if(! args) return caml_call1(af, f); + var args$0 = args[2], x = args[1], f$0 = caml_call1(f, x); + f = f$0; + args = args$0; + } + } + return take_format_readers(k, fmt); + } + function kscanf(ib, ef, fmt){ + return kscanf_gen(ib, ef, function(x){return x;}, fmt); + } + function kscanf_opt(ib, fmt){ + return kscanf_gen + (ib, + function(a, param){return 0;}, + function(x){return [0, x];}, + fmt); + } + function bscanf(ib, fmt){return kscanf(ib, scanf_bad_input, fmt);} + function bscanf_opt(ib, fmt){return kscanf_opt(ib, fmt);} + function ksscanf(s, ef, fmt){return kscanf(from_string(s), ef, fmt);} + function sscanf(s, fmt){ + return kscanf(from_string(s), scanf_bad_input, fmt); + } + function sscanf_opt(s, fmt){return kscanf_opt(from_string(s), fmt);} + function scanf(fmt){return kscanf(stdin, scanf_bad_input, fmt);} + function scanf_opt(fmt){return kscanf_opt(stdin, fmt);} + function bscanf_format(ib, format, f){ + scan_caml_string(Stdlib[19], ib); + var str = token_string(ib); + try{var a = CamlinternalFormat[15].call(null, str, format), fmt = a;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[7]) throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], fmt = bad_input(msg); + } + return caml_call1(f, fmt); + } + function sscanf_format(s, format, f){ + return bscanf_format(from_string(s), format, f); + } + function format_from_string(s, fmt){ + var + a = Stdlib_String[25].call(null, s), + b = Stdlib[28].call(null, a, cst); + return sscanf_format + (Stdlib[28].call(null, cst, b), fmt, function(x){return x;}); + } + var s = [0, [3, 0, [10, 0]], "%S%!"]; + function unescaped(s$0){ + var a = Stdlib[28].call(null, s$0, cst); + return caml_call1 + (sscanf(Stdlib[28].call(null, cst, a), s), function(x){return x;}); + } + runtime.caml_register_global + (64, + [0, + [0, + stdin, + open_in, + open_in_bin, + close_in, + open_in, + open_in_bin, + from_string, + from_function, + from_channel, + end_of_input, + beginning_of_input, + name_of_input], + Scan_failure, + bscanf, + bscanf_opt, + sscanf, + sscanf_opt, + scanf, + scanf_opt, + kscanf, + ksscanf, + bscanf_format, + sscanf_format, + format_from_string, + unescaped], + "Stdlib__Scanf"); + return; + } + (globalThis)); + //# 23582 "../.js/default/stdlib/stdlib.cma.js" //# shape: Stdlib__Callback:[F(2),F(2)] (function @@ -36757,7 +38420,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (globalThis)); //# 5 "../lib/.sx.objs/jsoo/default/sx.cma.js" -//# shape: Sx_types:[N,N,N,F(1),F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),F(1),N,N,N,N,F(3),F(2),F(2),F(3),F(2),F(3),F(3),F(2),F(1),F(1),F(1),F(1)*,F(1)*,F(1),N,F(1),F(3),N,N,N,N,N,N,N,F(1)*,F(6),F(5),F(5),F(2),F(1),F(1),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1)*,F(2),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(3),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(2),F(1),F(1),F(1)] +//# shape: Sx_types:[N,N,N,F(1),F(1),N,N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),F(1),N,N,N,N,F(3),F(2),F(2),F(3),F(2),F(3),F(3),F(2),F(1),F(1),F(1),F(1)*,F(1)*,F(1),N,F(1),F(3),N,N,N,N,N,N,F(1),N,N,N,N,F(1)*,F(6),F(5),F(5),F(2),F(1),F(1),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(1),F(1)*,F(2),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(3),F(2),F(1)*,F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(2),F(1),F(1),F(2),F(1)] (function (globalThis){ "use strict"; @@ -36787,9 +38450,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= global_data = runtime.caml_get_global_data(), Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib = global_data.Stdlib, - Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_Buffer = global_data.Stdlib__Buffer, Stdlib_String = global_data.Stdlib__String, + Stdlib_Printf = global_data.Stdlib__Printf, Stdlib_List = global_data.Stdlib__List, Stdlib_Array = global_data.Stdlib__Array, Stdlib_Uchar = global_data.Stdlib__Uchar, @@ -36969,11 +38632,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ? caml_call1(Stdlib_Printf[4].call(null, a), n) : caml_call1(Stdlib_Printf[4].call(null, b), n); } - var cst$1 = "", cst_false = "false", cst_true = "true"; + var cst = "", cst_false = "false", cst_true = "true"; function value_to_string(param){ - if(typeof param === "number"){ - if(0 === param) return cst$1; - } + if(typeof param === "number"){if(0 === param) return cst;} else switch(param[0]){ case 0: @@ -37037,7 +38698,38 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = next_lambda_uid(0); return [8, [0, ps, body, unwrap_env_val(closure), 0, 0, 0, a]]; } - var jit_cache_queue = Stdlib_Queue[2].call(null, 0); + var + jit_excluded = Stdlib_Hashtbl[1].call(null, 0, 64), + jit_excluded_prefixes = [0, 0]; + function jit_name_excluded(name){ + var a = Stdlib_Hashtbl[9].call(null, jit_excluded, name); + return a + ? a + : Stdlib_List + [34].call + (null, + function(p){ + var + a = + caml_ml_string_length(p) <= caml_ml_string_length(name) + ? 1 + : 0, + b = + a + ? Stdlib_String + [16].call + (null, name, 0, caml_ml_string_length(p)) + === p + ? 1 + : 0 + : a; + return b; + }, + jit_excluded_prefixes[1]); + } + var + jit_excluded_caller_names = Stdlib_Hashtbl[1].call(null, 0, 16), + jit_cache_queue = Stdlib_Queue[2].call(null, 0); function jit_cache_size(param){ return Stdlib_Queue[14].call(null, jit_cache_queue); } @@ -37152,6 +38844,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return "regexp"; case 37: return "bytevector"; + case 38: + var a = param[1]; return a[1]; default: return "list"; } } @@ -37781,80 +39475,52 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(param, v, acc){return [0, v, acc];}, d, 0); } var - cst = ")>", - cst_s_s = "<%s(%s)>", - cst$0 = '>"', - p = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], - q = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], - r = - [0, - [11, ""], - s = - [0, - [11, ""], - t = [0, [12, 60, [2, 0, [12, 40, [2, 0, [11, cst, 0]]]]], cst_s_s], - u = [0, [11, ""], - v = - [0, - [11, '""'], - w = - [0, [11, '""'], - x = [0, [11, ""], - y = [0, [11, ""], - z = + p = [0, [11, ""], - A = + q = [0, [11, ""], - B = [0, [2, 0, [12, 61, [2, 0, 0]]], "%s=%s"], - C = - [0, - [11, ""], - D = [0, [11, ""], - E = [0, [11, "#(", [2, 0, [12, 41, 0]]], "#(%s)"], - F = + r = [0, [11, ""], - G = + s = [0, [11, ""], - H = + t = [0, [11, ""], - I = + u = [0, [11, ""], - J = [0, [4, 0, 0, 0, [12, 47, [4, 0, 0, 0, 0]]], "%d/%d"], - K = [0, [11, ""], - L = [0, [11, "#/", [2, 0, [12, 47, [2, 0, 0]]]], "#/%s/%s"], - M = [0, [11, "#u8(", [2, 0, [12, 41, 0]]], "#u8(%s)"]; - function inspect(param){ - if(typeof param === "number") return 0 === param ? cst_nil : "#!eof"; - var cst = " ", cst$0 = ", "; + v = [0, [11, ""]; + function inspect_into(buf, param){ + if(typeof param === "number") + return 0 === param + ? Stdlib_Buffer[16].call(null, buf, cst_nil) + : Stdlib_Buffer[16].call(null, buf, "#!eof"); + var cst$1 = ")>", cst$0 = ", ", cst$2 = '>"'; switch(param[0]){ case 0: - return param[1] ? cst_true : cst_false; + return param[1] + ? Stdlib_Buffer[16].call(null, buf, cst_true) + : Stdlib_Buffer[16].call(null, buf, cst_false); case 1: - var n = param[1]; return Stdlib[33].call(null, n); + var n = param[1], h = Stdlib[33].call(null, n); + return Stdlib_Buffer[16].call(null, buf, h); case 2: - var n$0 = param[1]; return format_number(n$0); + var n$0 = param[1], j = format_number(n$0); + return Stdlib_Buffer[16].call(null, buf, j); case 3: - var - s$0 = param[1], - buf = Stdlib_Buffer[1].call(null, caml_ml_string_length(s$0) + 2 | 0); + var s$0 = param[1]; Stdlib_Buffer[12].call(null, buf, 34); Stdlib_String[30].call (null, @@ -37875,205 +39541,287 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return Stdlib_Buffer[12].call(null, buf, c); }, s$0); - Stdlib_Buffer[12].call(null, buf, 34); - return Stdlib_Buffer[2].call(null, buf); + return Stdlib_Buffer[12].call(null, buf, 34); case 4: - var s$1 = param[1]; return s$1; + var s$1 = param[1]; return Stdlib_Buffer[16].call(null, buf, s$1); case 5: - var k = param[1]; return Stdlib[28].call(null, ":", k); + var k = param[1]; + Stdlib_Buffer[12].call(null, buf, 58); + return Stdlib_Buffer[16].call(null, buf, k); case 6: var items = param[1]; break; case 7: - var - d = param[1], - pairs = - Stdlib_Hashtbl[14].call - (null, - function(k, v, acc){ - var a = inspect(v); - return [0, caml_call2(Stdlib_Printf[4].call(null, p), k, a), acc]; - }, - d, - 0), - j = Stdlib_String[7].call(null, cst, pairs), - o = Stdlib[28].call(null, j, "}"); - return Stdlib[28].call(null, "{", o); + var d = param[1]; + Stdlib_Buffer[12].call(null, buf, 123); + var first = [0, 1]; + Stdlib_Hashtbl[12].call + (null, + function(k, v){ + if(first[1]) + first[1] = 0; + else + Stdlib_Buffer[12].call(null, buf, 32); + Stdlib_Buffer[12].call(null, buf, 58); + Stdlib_Buffer[16].call(null, buf, k); + Stdlib_Buffer[12].call(null, buf, 32); + return inspect_into(buf, v); + }, + d); + return Stdlib_Buffer[12].call(null, buf, 125); case 8: var l = param[1], match = l[4]; if(match) var n$1 = match[1], tag = n$1; else var tag = cst_lambda; - var N = Stdlib_String[7].call(null, cst$0, l[1]); - return caml_call2(Stdlib_Printf[4].call(null, q), tag, N); + Stdlib_Buffer[12].call(null, buf, 60); + Stdlib_Buffer[16].call(null, buf, tag); + Stdlib_Buffer[12].call(null, buf, 40); + var o = Stdlib_String[7].call(null, cst$0, l[1]); + Stdlib_Buffer[16].call(null, buf, o); + return Stdlib_Buffer[16].call(null, buf, cst$1); case 9: - var - c = param[1], - O = Stdlib_String[7].call(null, cst$0, c[2]), - P = c[1]; - return caml_call2(Stdlib_Printf[4].call(null, r), P, O); + var c = param[1]; + Stdlib_Buffer[16].call(null, buf, ""; + return Stdlib_Buffer[16].call(null, buf, ""); case 13: - return ""; + return Stdlib_Buffer[16].call(null, buf, ""); case 14: - return ""; + return Stdlib_Buffer[16].call(null, buf, ""); case 15: var name = param[1]; - return caml_call1(Stdlib_Printf[4].call(null, u), name); + Stdlib_Buffer[16].call(null, buf, ""; + return Stdlib_Buffer[16].call(null, buf, ""); case 17: var s$2 = param[1]; - return caml_call1 - (Stdlib_Printf[4].call(null, v), caml_ml_string_length(s$2)); + Stdlib_Buffer[16].call(null, buf, '""; + return Stdlib_Buffer[16].call(null, buf, ""); case 19: var s$3 = param[1]; - return caml_call1 - (Stdlib_Printf[4].call(null, w), caml_ml_string_length(s$3)); + Stdlib_Buffer[16].call(null, buf, '""; + return Stdlib_Buffer[16].call(null, buf, ""); case 21: var items = param[1][1]; break; case 22: - return ""; + return Stdlib_Buffer[16].call(null, buf, ""); case 23: - var f = param[1], T = f[1]; - return caml_call1(Stdlib_Printf[4].call(null, x), T); + var f = param[1]; + Stdlib_Buffer[16].call(null, buf, "= 0){ + var i$0 = 0; + for(;;){ + if(0 < i$0) Stdlib_Buffer[12].call(null, buf, 32); + var + X = runtime.caml_bytes_get(b$1, i$0), + Y = Stdlib[33].call(null, X); + Stdlib_Buffer[16].call(null, buf, Y); + var Z = i$0 + 1 | 0; + if(g === i$0) break; + i$0 = Z; + } + } + return Stdlib_Buffer[12].call(null, buf, 41); default: - var - b = param[1], - ak = - Stdlib_List[11].call - (null, - runtime.caml_ml_bytes_length(b), - function(i){ - var a = runtime.caml_bytes_get(b, i); - return Stdlib[33].call(null, a); - }), - al = Stdlib_String[7].call(null, cst, ak); - return caml_call1(Stdlib_Printf[4].call(null, M), al); + var a = param[1]; + Stdlib_Buffer[12].call(null, buf, 40); + Stdlib_Buffer[16].call(null, buf, a[2]); + Stdlib_Array[12].call + (null, + function(v){ + Stdlib_Buffer[12].call(null, buf, 32); + return inspect_into(buf, v); + }, + a[3]); + return Stdlib_Buffer[12].call(null, buf, 41); } - var - e = Stdlib_List[20].call(null, inspect, items), - g = Stdlib_String[7].call(null, cst, e), - h = Stdlib[28].call(null, g, ")"); - return Stdlib[28].call(null, "(", h); + Stdlib_Buffer[12].call(null, buf, 40); + if(items){ + var rest = items[2], x = items[1]; + inspect_into(buf, x); + Stdlib_List[18].call + (null, + function(v){ + Stdlib_Buffer[12].call(null, buf, 32); + return inspect_into(buf, v); + }, + rest); + } + return Stdlib_Buffer[12].call(null, buf, 41); + } + function inspect(v){ + var buf = Stdlib_Buffer[1].call(null, 64); + inspect_into(buf, v); + return Stdlib_Buffer[2].call(null, buf); } runtime.caml_register_global - (188, + (179, [0, sym_to_id, id_to_sym, @@ -38121,6 +39869,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [0, 0], [0, 0], [0, 0], + jit_excluded, + jit_excluded_prefixes, + jit_name_excluded, + jit_excluded_caller_names, [0, 5000], [0, 0], jit_cache_queue, @@ -38186,13 +39938,932 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= dict_delete, dict_keys, dict_vals, + inspect_into, inspect], "Sx_types"); return; } (globalThis)); -//# 1442 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# 1532 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_cbor:[N,F(3),F(2)*,F(2),F(1),F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + caml_ml_string_length = runtime.caml_ml_string_length, + global_data = runtime.caml_get_global_data(), + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, + Stdlib_List = global_data.Stdlib__List, + Sx_types = global_data.Sx_types, + Stdlib = global_data.Stdlib, + Stdlib_String = global_data.Stdlib__String, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Int64 = global_data.Stdlib__Int64, + Cbor_error = [248, "Sx_cbor.Cbor_error", runtime.caml_fresh_oo_id(0)], + a = caml_int64_create_lo_mi_hi(255, 0, 0), + b = caml_int64_create_lo_mi_hi(0, 256, 0); + function write_head(buf, major, v){ + var m = major << 5, v64 = runtime.caml_int64_of_int32(v); + function put_be(nbytes){ + var b = nbytes - 1 | 0; + if(b >= 0){ + var i = b; + for(;;){ + var + c = + Stdlib_Char[1].call + (null, + runtime.caml_int64_to_int32 + (runtime.caml_int64_and + (runtime.caml_int64_shift_right_unsigned(v64, 8 * i | 0), a))); + Stdlib_Buffer[12].call(null, buf, c); + var d = i - 1 | 0; + if(0 === i) break; + i = d; + } + } + return 0; + } + if(24 > v){ + var g = Stdlib_Char[1].call(null, m | v); + return Stdlib_Buffer[12].call(null, buf, g); + } + if(256 > v){ + var f = Stdlib_Char[1].call(null, m | 24); + Stdlib_Buffer[12].call(null, buf, f); + return put_be(1); + } + if(65536 > v){ + var e = Stdlib_Char[1].call(null, m | 25); + Stdlib_Buffer[12].call(null, buf, e); + return put_be(2); + } + if(0 <= Stdlib_Int64[15].call(null, v64, b)){ + var c = Stdlib_Char[1].call(null, m | 27); + Stdlib_Buffer[12].call(null, buf, c); + return put_be(8); + } + var d = Stdlib_Char[1].call(null, m | 26); + Stdlib_Buffer[12].call(null, buf, d); + return put_be(4); + } + function key_order(a, b){ + var la = caml_ml_string_length(a), lb = caml_ml_string_length(b); + return la !== lb + ? runtime.caml_int_compare(la, lb) + : runtime.caml_string_compare(a, b); + } + function encode_into(buf, v){ + if(typeof v === "number"){ + if(0 === v) return Stdlib_Buffer[12].call(null, buf, 246); + } + else + switch(v[0]){ + case 0: + return v[1] + ? Stdlib_Buffer[12].call(null, buf, 245) + : Stdlib_Buffer[12].call(null, buf, 244); + case 1: + var n = v[1]; + return 0 <= n ? write_head(buf, 0, n) : write_head(buf, 1, -1 - n | 0); + case 2: + throw caml_maybe_attach_backtrace + ([0, + Cbor_error, + "cbor-encode: floats unsupported (dag-cbor subset)"], + 1); + case 3: + var s = v[1]; + write_head(buf, 3, caml_ml_string_length(s)); + return Stdlib_Buffer[16].call(null, buf, s); + case 6: + var items = v[1]; + write_head(buf, 4, Stdlib_List[1].call(null, items)); + return Stdlib_List[18].call + (null, function(a){return encode_into(buf, a);}, items); + case 7: + var + d = v[1], + keys = + Stdlib_Hashtbl[14].call + (null, function(k, param, acc){return [0, k, acc];}, d, 0), + keys$0 = Stdlib_List[62].call(null, key_order, keys); + write_head(buf, 5, Stdlib_List[1].call(null, keys$0)); + return Stdlib_List[18].call + (null, + function(k){ + write_head(buf, 3, caml_ml_string_length(k)); + Stdlib_Buffer[16].call(null, buf, k); + return encode_into(buf, Stdlib_Hashtbl[6].call(null, d, k)); + }, + keys$0); + case 4: + case 5: + var s$0 = v[1]; + write_head(buf, 3, caml_ml_string_length(s$0)); + return Stdlib_Buffer[16].call(null, buf, s$0); + } + var a = Sx_types[61].call(null, v); + throw caml_maybe_attach_backtrace + ([0, + Cbor_error, + Stdlib[28].call(null, "cbor-encode: unencodable value ", a)], + 1); + } + function encode(v){ + var buf = Stdlib_Buffer[1].call(null, 64); + encode_into(buf, v); + return Stdlib_Buffer[2].call(null, buf); + } + var c = [0, 0], d = [0, 1]; + function decode(s){ + var + len = caml_ml_string_length(s), + cst_cbor_decode_truncated = "cbor-decode: truncated", + pos = [0, 0]; + function byte(param){ + if(len <= pos[1]) + throw caml_maybe_attach_backtrace + ([0, Cbor_error, cst_cbor_decode_truncated], 1); + var c = runtime.caml_string_get(s, pos[1]); + pos[1]++; + return c; + } + function read_uint(ai){ + if(24 > ai) return ai; + if(24 === ai) return byte(0); + if(25 === ai){var a = byte(0), b = byte(0); return a << 8 | b;} + if(26 === ai){ + var v$1 = 0, for$ = 0; + for(;;){ + var v = v$1 << 8 | byte(0), c = for$ + 1 | 0; + if(3 === for$) return v; + v$1 = v; + for$ = c; + } + } + else{ + if(27 !== ai) + throw caml_maybe_attach_backtrace + ([0, Cbor_error, "cbor-decode: bad additional info"], 1); + var v$2 = 0, for$0 = 0; + for(;;){ + var v$0 = v$2 << 8 | byte(0), d = for$0 + 1 | 0; + if(7 === for$0) return v$0; + v$2 = v$0; + for$0 = d; + } + } + } + function item(param){ + a: + { + b: + for(;;){ + var b = byte(0), major = b >>> 5 | 0, ai = b & 31; + if(7 < major >>> 0) + throw caml_maybe_attach_backtrace + ([0, Cbor_error, "cbor-decode: bad major type"], 1); + switch(major){ + case 0: + return [1, read_uint(ai)]; + case 1: + return [1, -1 - read_uint(ai) | 0]; + case 4: + break a; + case 5: + break b; + case 6: + read_uint(ai); break; + case 7: + var switcher = ai - 20 | 0; + if(3 < switcher >>> 0) + throw caml_maybe_attach_backtrace + ([0, + Cbor_error, + "cbor-decode: floats/simple unsupported (dag-cbor subset)"], + 1); + switch(switcher){ + case 0: + return c; + case 1: + return d; + default: return 0; + } + default: + var n = read_uint(ai); + if(len < (pos[1] + n | 0)) + throw caml_maybe_attach_backtrace + ([0, Cbor_error, cst_cbor_decode_truncated], 1); + var r = Stdlib_String[16].call(null, s, pos[1], n); + pos[1] = pos[1] + n | 0; + return [3, r]; + } + } + var n$1 = read_uint(ai), d$0 = Sx_types[109].call(null, 0); + if(n$1 >= 1){ + var for$ = 1; + for(;;){ + var match = item(0); + if(typeof match !== "number" && 3 === match[0]){ + var k = match[1], a = item(0); + Stdlib_Hashtbl[11].call(null, d$0, k, a); + var e = for$ + 1 | 0; + if(n$1 === for$) break; + for$ = e; + continue; + } + throw caml_maybe_attach_backtrace + ([0, Cbor_error, "cbor-decode: non-string map key"], 1); + } + } + return [7, d$0]; + } + var n$0 = read_uint(ai); + return [6, + Stdlib_List[11].call(null, n$0, function(param){return item(0);})]; + } + var v = item(0); + return v; + } + runtime.caml_register_global + (21, + [0, Cbor_error, write_head, key_order, encode_into, encode, decode], + "Sx_cbor"); + return; + } + (globalThis)); + +//# 1787 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_sha2:[N,F(2)*,F(1),N,F(2)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_get = runtime.caml_bytes_get, + caml_bytes_set = runtime.caml_bytes_set, + caml_check_bound = runtime.caml_check_bound, + caml_int64_add = runtime.caml_int64_add, + caml_int64_and = runtime.caml_int64_and, + caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, + caml_int64_mul = runtime.caml_int64_mul, + caml_int64_of_int32 = runtime.caml_int64_of_int32, + caml_int64_or = runtime.caml_int64_or, + caml_int64_shift_left = runtime.caml_int64_shift_left, + caml_int64_shift_right_unsigne = runtime.caml_int64_shift_right_unsigned, + caml_int64_to_int32 = runtime.caml_int64_to_int32, + caml_int64_xor = runtime.caml_int64_xor, + caml_make_vect = runtime.caml_make_vect, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_obj_dup = runtime.caml_obj_dup; + function caml_call1(f, a0){ + return (f.l >= 0 ? f.l : f.l = f.length) === 1 + ? f(a0) + : runtime.caml_call_gen(f, [a0]); + } + var + global_data = runtime.caml_get_global_data(), + Stdlib_Printf = global_data.Stdlib__Printf, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Array = global_data.Stdlib__Array, + Stdlib_Int32 = global_data.Stdlib__Int32, + Stdlib_Int64 = global_data.Stdlib__Int64, + k256 = + caml_obj_dup + ([0, + 1116352408, + 1899447441, + -1245643825, + -373957723, + 961987163, + 1508970993, + -1841331548, + -1424204075, + -670586216, + 310598401, + 607225278, + 1426881987, + 1925078388, + -2132889090, + -1680079193, + -1046744716, + -459576895, + -272742522, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + -1740746414, + -1473132947, + -1341970488, + -1084653625, + -958395405, + -710438585, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + -2117940946, + -1838011259, + -1564481375, + -1474664885, + -1035236496, + -949202525, + -778901479, + -694614492, + -200395387, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + -2067236844, + -1933114872, + -1866530822, + -1538233109, + -1090935817, + -965641998]), + b = caml_int64_create_lo_mi_hi(8, 0, 0), + d = caml_int64_create_lo_mi_hi(255, 0, 0); + function rotr32(x, n){return x >>> n | 0 | x << (32 - n | 0);} + var + a = + [0, + 1779033703, + -1150833019, + 1013904242, + -1521486534, + 1359893119, + -1694144372, + 528734635, + 1541459225], + c = [0, [5, 6, [0, 2, 8], 0, 0], "%08lx"]; + function sha256_hex(msg){ + var + h = caml_obj_dup(a), + len = caml_ml_string_length(msg), + bitlen = caml_int64_mul(caml_int64_of_int32(len), b), + r = (len + 1 | 0) % 64 | 0, + padlen = 56 < r ? 120 - r | 0 : 56 - r | 0, + total = ((len + 1 | 0) + padlen | 0) + 8 | 0, + buf = Stdlib_Bytes[1].call(null, total, 0); + Stdlib_Bytes[12].call(null, msg, 0, buf, 0, len); + caml_bytes_set(buf, len, 128); + var i = 0; + for(;;){ + caml_bytes_set + (buf, + (total - 1 | 0) - i | 0, + Stdlib_Char[1].call + (null, + caml_int64_to_int32 + (caml_int64_and + (caml_int64_shift_right_unsigne(bitlen, 8 * i | 0), d)))); + var V = i + 1 | 0; + if(7 === i) break; + i = V; + } + function byte(i){return caml_bytes_get(buf, i);} + var + w = caml_make_vect(64, 0), + nblocks = total / 64 | 0, + g = nblocks - 1 | 0; + if(g >= 0){ + var b$0 = 0; + for(;;){ + var base = b$0 * 64 | 0, t$1 = 0; + for(;;){ + var + o = base + (t$1 * 4 | 0) | 0, + Q = byte(o + 3 | 0), + R = byte(o + 2 | 0) << 8 | Q, + S = byte(o + 1 | 0) << 16, + T = byte(o) << 24 | S | R; + caml_check_bound(w, t$1)[t$1 + 1] = T; + var U = t$1 + 1 | 0; + if(15 === t$1) break; + t$1 = U; + } + var t$0 = 16; + for(;;){ + var + j = t$0 - 15 | 0, + k = t$0 - 15 | 0, + J = caml_check_bound(w, j)[j + 1] >>> 3 | 0, + l = t$0 - 15 | 0, + K = rotr32(caml_check_bound(w, k)[k + 1], 18), + s0$0 = rotr32(caml_check_bound(w, l)[l + 1], 7) ^ K ^ J, + m = t$0 - 2 | 0, + n = t$0 - 2 | 0, + L = caml_check_bound(w, m)[m + 1] >>> 10 | 0, + p = t$0 - 2 | 0, + M = rotr32(caml_check_bound(w, n)[n + 1], 19), + s1$0 = rotr32(caml_check_bound(w, p)[p + 1], 17) ^ M ^ L, + q = t$0 - 7 | 0, + s = t$0 - 16 | 0, + N = caml_check_bound(w, q)[q + 1] + s1$0 | 0, + O = (caml_check_bound(w, s)[s + 1] + s0$0 | 0) + N | 0; + caml_check_bound(w, t$0)[t$0 + 1] = O; + var P = t$0 + 1 | 0; + if(63 === t$0) break; + t$0 = P; + } + var + u = caml_check_bound(h, 0)[1], + v = caml_check_bound(h, 1)[2], + x = caml_check_bound(h, 2)[3], + y = caml_check_bound(h, 3)[4], + z = caml_check_bound(h, 4)[5], + A = caml_check_bound(h, 5)[6], + B = caml_check_bound(h, 6)[7], + hh$0 = caml_check_bound(h, 7)[8], + hh = B, + f = A, + e$0 = z, + d$0 = y, + c$0 = x, + bb$0 = v, + bb = u, + t = 0; + for(;;){ + var + D = rotr32(e$0, 25), + E = rotr32(e$0, 11), + s1 = rotr32(e$0, 6) ^ E ^ D, + ch = e$0 & f ^ Stdlib_Int32[11].call(null, e$0) & hh, + F = caml_check_bound(w, t)[t + 1], + t1 = + ((hh$0 + s1 | 0) + (ch + caml_check_bound(k256, t)[t + 1] | 0) | 0) + + F + | 0, + G = rotr32(bb, 22), + H = rotr32(bb, 13), + s0 = rotr32(bb, 2) ^ H ^ G, + maj = bb & bb$0 ^ bb & c$0 ^ bb$0 & c$0, + t2 = s0 + maj | 0, + e = d$0 + t1 | 0, + a$0 = t1 + t2 | 0, + I = t + 1 | 0; + if(63 === t) break; + hh$0 = hh; + hh = f; + f = e$0; + e$0 = e; + d$0 = c$0; + c$0 = bb$0; + bb$0 = bb; + bb = a$0; + t = I; + } + h[1] = caml_check_bound(h, 0)[1] + a$0 | 0; + h[2] = caml_check_bound(h, 1)[2] + bb | 0; + h[3] = caml_check_bound(h, 2)[3] + bb$0 | 0; + h[4] = caml_check_bound(h, 3)[4] + c$0 | 0; + h[5] = caml_check_bound(h, 4)[5] + e | 0; + h[6] = caml_check_bound(h, 5)[6] + e$0 | 0; + h[7] = caml_check_bound(h, 6)[7] + f | 0; + h[8] = caml_check_bound(h, 7)[8] + hh | 0; + var C = b$0 + 1 | 0; + if(g === b$0) break; + b$0 = C; + } + } + var out = Stdlib_Buffer[1].call(null, 64); + Stdlib_Array[12].call + (null, + function(x){ + var a = caml_call1(Stdlib_Printf[4].call(null, c), x); + return Stdlib_Buffer[16].call(null, out, a); + }, + h); + return Stdlib_Buffer[2].call(null, out); + } + var + k512 = + caml_obj_dup + ([0, + caml_int64_create_lo_mi_hi(2666018, 3119319, 17034), + caml_int64_create_lo_mi_hi(15689165, 4493603, 28983), + caml_int64_create_lo_mi_hi(5061423, 16502764, 46528), + caml_int64_create_lo_mi_hi(9034684, 14394753, 59829), + caml_int64_create_lo_mi_hi(4764984, 12737523, 14678), + caml_int64_create_lo_mi_hi(380953, 1175990, 23025), + caml_int64_create_lo_mi_hi(1658779, 8561839, 37439), + caml_int64_create_lo_mi_hi(7176472, 6215130, 43804), + caml_int64_create_lo_mi_hi(197186, 11180195, 55303), + caml_int64_create_lo_mi_hi(7368638, 5964101, 4739), + caml_int64_create_lo_mi_hi(14987916, 8765006, 9265), + caml_int64_create_lo_mi_hi(16757986, 8242133, 21772), + caml_int64_create_lo_mi_hi(8096111, 6124786, 29374), + caml_int64_create_lo_mi_hi(1480369, 11664955, 32990), + caml_int64_create_lo_mi_hi(13046325, 436005, 39900), + caml_int64_create_lo_mi_hi(6891156, 15824079, 49563), + caml_int64_create_lo_mi_hi(15813330, 6930846, 58523), + caml_int64_create_lo_mi_hi(5187043, 4687416, 61374), + caml_int64_create_lo_mi_hi(9229749, 10339979, 4033), + caml_int64_create_lo_mi_hi(11312229, 10603639, 9228), + caml_int64_create_lo_mi_hi(2818677, 2912089, 11753), + caml_int64_create_lo_mi_hi(10937475, 8694382, 19060), + caml_int64_create_lo_mi_hi(4324308, 11132093, 23728), + caml_int64_create_lo_mi_hi(1135541, 8968835, 30457), + caml_int64_create_lo_mi_hi(6741931, 5329646, 38974), + caml_int64_create_lo_mi_hi(11809296, 13004077, 43057), + caml_int64_create_lo_mi_hi(16458047, 2607256, 45059), + caml_int64_create_lo_mi_hi(15666916, 8374206, 48985), + caml_int64_create_lo_mi_hi(11046850, 783165, 50912), + caml_int64_create_lo_mi_hi(698149, 9521043, 54695), + caml_int64_create_lo_mi_hi(229999, 6509024, 1738), + caml_int64_create_lo_mi_hi(945776, 2713354, 5161), + caml_int64_create_lo_mi_hi(13774844, 689478, 10167), + caml_int64_create_lo_mi_hi(2541862, 2177116, 11803), + caml_int64_create_lo_mi_hi(12856045, 7208026, 19756), + caml_int64_create_lo_mi_hi(9810911, 856989, 21304), + caml_int64_create_lo_mi_hi(11494366, 7558283, 25866), + caml_int64_create_lo_mi_hi(7844520, 703292, 30314), + caml_int64_create_lo_mi_hi(15576806, 13184583, 33218), + caml_int64_create_lo_mi_hi(8533307, 2917652, 37490), + caml_int64_create_lo_mi_hi(15795044, 15245644, 41663), + caml_int64_create_lo_mi_hi(4337665, 6704060, 43034), + caml_int64_create_lo_mi_hi(16291729, 9138384, 49739), + caml_int64_create_lo_mi_hi(5553712, 5350150, 51052), + caml_int64_create_lo_mi_hi(15684120, 15210966, 53650), + caml_int64_create_lo_mi_hi(6662416, 402517, 54937), + caml_int64_create_lo_mi_hi(7413802, 3507543, 62478), + caml_int64_create_lo_mi_hi(12308920, 10514482, 4202), + caml_int64_create_lo_mi_hi(13816008, 12654264, 6564), + caml_int64_create_lo_mi_hi(4303699, 7080017, 7735), + caml_int64_create_lo_mi_hi(9366425, 7818463, 10056), + caml_int64_create_lo_mi_hi(10176680, 12367329, 13488), + caml_int64_create_lo_mi_hi(13195875, 832453, 14620), + caml_int64_create_lo_mi_hi(4295371, 11160291, 20184), + caml_int64_create_lo_mi_hi(6546291, 13258615, 23452), + caml_int64_create_lo_mi_hi(11712675, 7336918, 26670), + caml_int64_create_lo_mi_hi(15708924, 8580701, 29839), + caml_int64_create_lo_mi_hi(1519456, 6516547, 30885), + caml_int64_create_lo_mi_hi(15772530, 7869601, 33992), + caml_int64_create_lo_mi_hi(6568428, 133146, 36039), + caml_int64_create_lo_mi_hi(6495784, 16775715, 37054), + caml_int64_create_lo_mi_hi(8568297, 7138270, 42064), + caml_int64_create_lo_mi_hi(13007125, 10745778, 48889), + caml_int64_create_lo_mi_hi(7492395, 7926499, 50801), + caml_int64_create_lo_mi_hi(2515356, 4116202, 51751), + caml_int64_create_lo_mi_hi(12632583, 12109601, 53638), + caml_int64_create_lo_mi_hi(14740254, 8246989, 60122), + caml_int64_create_lo_mi_hi(7262584, 5210094, 62845), + caml_int64_create_lo_mi_hi(1535930, 6793842, 1776), + caml_int64_create_lo_mi_hi(13146278, 8242594, 2659), + caml_int64_create_lo_mi_hi(16321966, 9962686, 4415), + caml_int64_create_lo_mi_hi(1853211, 734483, 7025), + caml_int64_create_lo_mi_hi(294276, 7861539, 10459), + caml_int64_create_lo_mi_hi(13051027, 11238208, 13002), + caml_int64_create_lo_mi_hi(13221564, 12454421, 15518), + caml_int64_create_lo_mi_hi(1051980, 6800540, 17181), + caml_int64_create_lo_mi_hi(4080310, 13942475, 19653), + caml_int64_create_lo_mi_hi(6651434, 2727164, 22911), + caml_int64_create_lo_mi_hi(14088940, 7318330, 24523), + caml_int64_create_lo_mi_hi(4675607, 1674314, 27716)]), + lnot64 = Stdlib_Int64[11], + e = + [0, + caml_int64_create_lo_mi_hi(12372232, 15099891, 27145), + caml_int64_create_lo_mi_hi(13281083, 11437444, 47975), + caml_int64_create_lo_mi_hi(9762859, 15954686, 15470), + caml_int64_create_lo_mi_hi(1914609, 16071263, 42319), + caml_int64_create_lo_mi_hi(15106769, 5406637, 20750), + caml_int64_create_lo_mi_hi(4090911, 6851627, 39685), + caml_int64_create_lo_mi_hi(4308331, 14265339, 8067), + caml_int64_create_lo_mi_hi(8266105, 13441299, 23520)], + f = caml_int64_create_lo_mi_hi(8, 0, 0), + g = caml_int64_create_lo_mi_hi(0, 0, 0), + i = caml_int64_create_lo_mi_hi(0, 0, 0), + j = caml_int64_create_lo_mi_hi(255, 0, 0); + function rotr64(x, n){ + return caml_int64_or + (caml_int64_shift_right_unsigne(x, n), + caml_int64_shift_left(x, 64 - n | 0)); + } + var h = [0, [7, 6, [0, 2, 16], 0, 0], "%016Lx"]; + function sha512_hex(msg){ + var + h$0 = caml_obj_dup(e), + len = caml_ml_string_length(msg), + bitlen = caml_int64_mul(caml_int64_of_int32(len), f), + r = (len + 1 | 0) % 128 | 0, + padlen = 112 < r ? 240 - r | 0 : 112 - r | 0, + total = ((len + 1 | 0) + padlen | 0) + 16 | 0, + buf = Stdlib_Bytes[1].call(null, total, 0); + Stdlib_Bytes[12].call(null, msg, 0, buf, 0, len); + caml_bytes_set(buf, len, 128); + var i$0 = 0; + for(;;){ + caml_bytes_set + (buf, + (total - 1 | 0) - i$0 | 0, + Stdlib_Char[1].call + (null, + caml_int64_to_int32 + (caml_int64_and + (caml_int64_shift_right_unsigne(bitlen, 8 * i$0 | 0), j)))); + var Q = i$0 + 1 | 0; + if(7 === i$0) break; + i$0 = Q; + } + var + w = caml_make_vect(80, g), + nblocks = total / 128 | 0, + k = nblocks - 1 | 0; + if(k >= 0){ + var b = 0; + for(;;){ + var base = b * 128 | 0, t$1 = 0; + for(;;){ + var o = base + (t$1 * 8 | 0) | 0, v$0 = i, j$0 = 0; + for(;;){ + var + v = + caml_int64_or + (caml_int64_shift_left(v$0, 8), + caml_int64_of_int32(caml_bytes_get(buf, o + j$0 | 0))), + P = j$0 + 1 | 0; + if(7 === j$0) break; + v$0 = v; + j$0 = P; + } + caml_check_bound(w, t$1)[t$1 + 1] = v; + var O = t$1 + 1 | 0; + if(15 === t$1) break; + t$1 = O; + } + var t$0 = 16; + for(;;){ + var + l = t$0 - 15 | 0, + m = t$0 - 15 | 0, + K = caml_int64_shift_right_unsigne(caml_check_bound(w, l)[l + 1], 7), + n = t$0 - 15 | 0, + V = caml_int64_xor(rotr64(caml_check_bound(w, m)[m + 1], 8), K), + s0$0 = caml_int64_xor(rotr64(caml_check_bound(w, n)[n + 1], 1), V), + p = t$0 - 2 | 0, + q = t$0 - 2 | 0, + L = caml_int64_shift_right_unsigne(caml_check_bound(w, p)[p + 1], 6), + s = t$0 - 2 | 0, + U = caml_int64_xor(rotr64(caml_check_bound(w, q)[q + 1], 61), L), + s1$0 = caml_int64_xor(rotr64(caml_check_bound(w, s)[s + 1], 19), U), + u = t$0 - 7 | 0, + x = t$0 - 16 | 0, + M = caml_check_bound(w, u)[u + 1], + T = + caml_int64_add + (caml_int64_add + (caml_int64_add(caml_check_bound(w, x)[x + 1], s0$0), M), + s1$0); + caml_check_bound(w, t$0)[t$0 + 1] = T; + var N = t$0 + 1 | 0; + if(79 === t$0) break; + t$0 = N; + } + var + y = caml_check_bound(h$0, 0)[1], + z = caml_check_bound(h$0, 1)[2], + A = caml_check_bound(h$0, 2)[3], + B = caml_check_bound(h$0, 3)[4], + C = caml_check_bound(h$0, 4)[5], + D = caml_check_bound(h$0, 5)[6], + E = caml_check_bound(h$0, 6)[7], + hh$0 = caml_check_bound(h$0, 7)[8], + hh = E, + f$0 = D, + e$1 = C, + d = B, + c = A, + bb$0 = z, + bb = y, + t = 0; + for(;;){ + var + G = rotr64(e$1, 41), + S = caml_int64_xor(rotr64(e$1, 18), G), + s1 = caml_int64_xor(rotr64(e$1, 14), S), + ch = + caml_int64_xor + (caml_int64_and(e$1, f$0), caml_int64_and(lnot64(e$1), hh)), + H = caml_check_bound(w, t)[t + 1], + t1 = + caml_int64_add + (caml_int64_add + (caml_int64_add(caml_int64_add(hh$0, s1), ch), + caml_check_bound(k512, t)[t + 1]), + H), + I = rotr64(bb, 39), + R = caml_int64_xor(rotr64(bb, 34), I), + s0 = caml_int64_xor(rotr64(bb, 28), R), + maj = + caml_int64_xor + (caml_int64_and(bb, bb$0), + caml_int64_xor(caml_int64_and(bb, c), caml_int64_and(bb$0, c))), + t2 = caml_int64_add(s0, maj), + e$0 = caml_int64_add(d, t1), + a = caml_int64_add(t1, t2), + J = t + 1 | 0; + if(79 === t) break; + hh$0 = hh; + hh = f$0; + f$0 = e$1; + e$1 = e$0; + d = c; + c = bb$0; + bb$0 = bb; + bb = a; + t = J; + } + h$0[1] = caml_int64_add(caml_check_bound(h$0, 0)[1], a); + h$0[2] = caml_int64_add(caml_check_bound(h$0, 1)[2], bb); + h$0[3] = caml_int64_add(caml_check_bound(h$0, 2)[3], bb$0); + h$0[4] = caml_int64_add(caml_check_bound(h$0, 3)[4], c); + h$0[5] = caml_int64_add(caml_check_bound(h$0, 4)[5], e$0); + h$0[6] = caml_int64_add(caml_check_bound(h$0, 5)[6], e$1); + h$0[7] = caml_int64_add(caml_check_bound(h$0, 6)[7], f$0); + h$0[8] = caml_int64_add(caml_check_bound(h$0, 7)[8], hh); + var F = b + 1 | 0; + if(k === b) break; + b = F; + } + } + var out = Stdlib_Buffer[1].call(null, 128); + Stdlib_Array[12].call + (null, + function(x){ + var a = caml_call1(Stdlib_Printf[4].call(null, h), x); + return Stdlib_Buffer[16].call(null, out, a); + }, + h$0); + return Stdlib_Buffer[2].call(null, out); + } + runtime.caml_register_global + (20, + [0, + k256, + rotr32, + sha256_hex, + k512, + caml_int64_and, + caml_int64_or, + caml_int64_xor, + caml_int64_add, + lnot64, + rotr64, + sha512_hex], + "Sx_sha2"); + return; + } + (globalThis)); + +//# 2327 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_cid:[F(1),N,F(1),F(1),F(2),F(2),N,N,F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_string_get = runtime.caml_string_get, + global_data = runtime.caml_get_global_data(), + Sx_cbor = global_data.Sx_cbor, + Sx_sha2 = global_data.Sx_sha2, + Stdlib = global_data.Stdlib, + Stdlib_String = global_data.Stdlib__String, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Buffer = global_data.Stdlib__Buffer; + function varint(n){ + var buf = Stdlib_Buffer[1].call(null, 4), cont = 1, n$1 = n; + for(;;){ + if(! cont) return Stdlib_Buffer[2].call(null, buf); + var b = n$1 & 127, n$0 = n$1 >>> 7 | 0; + if(0 === n$0){ + var a = Stdlib_Char[1].call(null, b); + Stdlib_Buffer[12].call(null, buf, a); + cont = 0; + n$1 = n$0; + } + else{ + var c = Stdlib_Char[1].call(null, b | 128); + Stdlib_Buffer[12].call(null, buf, c); + n$1 = n$0; + } + } + } + var cst_abcdefghijklmnopqrstuvwxyz = "abcdefghijklmnopqrstuvwxyz234567"; + function base32_lower(s){ + var + buf = + Stdlib_Buffer[1].call + (null, ((caml_ml_string_length(s) * 8 | 0) + 4 | 0) / 5 | 0), + acc = [0, 0], + bits = [0, 0]; + Stdlib_String[30].call + (null, + function(c){ + acc[1] = acc[1] << 8 | c; + bits[1] = bits[1] + 8 | 0; + for(;;){ + if(5 > bits[1]){acc[1] = acc[1] & ((1 << bits[1]) - 1 | 0); return 0;} + bits[1] = bits[1] - 5 | 0; + var + a = + caml_string_get + (cst_abcdefghijklmnopqrstuvwxyz, (acc[1] >>> bits[1] | 0) & 31); + Stdlib_Buffer[12].call(null, buf, a); + } + }, + s); + if(0 < bits[1]){ + var + a = + caml_string_get + (cst_abcdefghijklmnopqrstuvwxyz, acc[1] << (5 - bits[1] | 0) & 31); + Stdlib_Buffer[12].call(null, buf, a); + } + return Stdlib_Buffer[2].call(null, buf); + } + function unhex(h){ + var + n = caml_ml_string_length(h) / 2 | 0, + b = runtime.caml_create_bytes(n), + a = n - 1 | 0; + if(a >= 0){ + var i = 0; + for(;;){ + var + c = Stdlib_String[16].call(null, h, 2 * i | 0, 2), + d = runtime.caml_int_of_string(Stdlib[28].call(null, "0x", c)); + runtime.caml_bytes_set(b, i, Stdlib_Char[1].call(null, d)); + var e = i + 1 | 0; + if(a === i) break; + i = e; + } + } + return Stdlib_Bytes[44].call(null, b); + } + function multihash(code, digest){ + var + a = varint(caml_ml_string_length(digest)), + b = Stdlib[28].call(null, a, digest), + c = varint(code); + return Stdlib[28].call(null, c, b); + } + function cidv1(codec, mh){ + var + a = varint(codec), + b = Stdlib[28].call(null, a, mh), + c = base32_lower(Stdlib[28].call(null, "\x01", b)); + return Stdlib[28].call(null, "b", c); + } + var codec_dag_cbor = 113, mh_sha2_256 = 18; + function cid_from_sx(v){ + var + cbor = Sx_cbor[5].call(null, v), + digest = unhex(Sx_sha2[3].call(null, cbor)); + return cidv1(codec_dag_cbor, multihash(mh_sha2_256, digest)); + } + runtime.caml_register_global + (11, + [0, + varint, + cst_abcdefghijklmnopqrstuvwxyz, + base32_lower, + unhex, + multihash, + cidv1, + codec_dag_cbor, + mh_sha2_256, + cid_from_sx], + "Sx_cid"); + return; + } + (globalThis)); + +//# 2453 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_cst:[F(1),F(1),F(1),F(2),F(1),F(2),F(2),F(3)] (function (globalThis){ @@ -38291,7 +40962,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= default: var children$0 = param[2], - d = Sx_types[105].call(null, 0), + d = Sx_types[109].call(null, 0), param$0 = children$0; for(;;){ if(param$0){ @@ -38307,7 +40978,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else var k$0 = match$0[1], key_str = k$0; var a = cst_to_ast(v); - Sx_types[108].call(null, d, key_str, a); + Sx_types[112].call(null, d, key_str, a); param$0 = rest; continue; } @@ -38354,10 +41025,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= match = offset_to_loc(src, span$0[1]), col = match[2], line = match[1], - d = Sx_types[105].call(null, 0); - Sx_types[108].call(null, d, "form", value); - Sx_types[108].call(null, d, "line", [2, line]); - Sx_types[108].call(null, d, "col", [2, col]); + d = Sx_types[109].call(null, 0); + Sx_types[112].call(null, d, "form", value); + Sx_types[112].call(null, d, "line", [2, line]); + Sx_types[112].call(null, d, "col", [2, col]); return [7, d]; }, nodes); @@ -38440,7 +41111,517 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 1691 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# 2702 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_ed25519:[N,N,N,F(1),N,F(1),F(1),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(3),F(1),F(2),N,F(1),F(2),F(2),F(2),F(2),F(1),N,N,N,N,F(2),F(2),F(1),F(1),F(1),N,F(1),F(1),F(3)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_set = runtime.caml_bytes_set, + caml_check_bound = runtime.caml_check_bound, + caml_int64_add = runtime.caml_int64_add, + caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, + caml_int64_of_int32 = runtime.caml_int64_of_int32, + caml_int64_to_int32 = runtime.caml_int64_to_int32, + caml_int_compare = runtime.caml_int_compare, + caml_make_vect = runtime.caml_make_vect, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_string_get = runtime.caml_string_get, + global_data = runtime.caml_get_global_data(), + b = caml_int64_create_lo_mi_hi(0, 0, 0), + Stdlib_String = global_data.Stdlib__String, + Stdlib = global_data.Stdlib, + Sx_sha2 = global_data.Sx_sha2, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_List = global_data.Stdlib__List, + Stdlib_Array = global_data.Stdlib__Array; + function norm(a){ + var n = a.length - 1; + for(;;){ + if(1 < n){ + var b = n - 1 | 0; + if(0 === caml_check_bound(a, b)[b + 1]){ + var n$0 = n - 1 | 0; + n = n$0; + continue; + } + } + return n === a.length - 1 ? a : Stdlib_Array[6].call(null, a, 0, n); + } + } + var c = caml_int64_create_lo_mi_hi(0, 0, 0), bzero = [0, 0]; + function of_int(n){ + if(0 === n) return bzero; + var n$0 = n, r = 0; + for(;;){ + if(0 >= n$0){ + var b = Stdlib_List[10].call(null, r); + return norm(Stdlib_Array[11].call(null, b)); + } + var a = [0, n$0 & 67108863, r]; + n$0 = n$0 >>> 26 | 0; + r = a; + } + } + function is_zero(a){ + var + b = 1 === a.length - 1 ? 1 : 0, + c = b ? 0 === caml_check_bound(a, 0)[1] ? 1 : 0 : b; + return c; + } + function cmp(a, b){ + var + a$0 = norm(a), + b$0 = norm(b), + la = a$0.length - 1, + lb = b$0.length - 1; + if(la !== lb) return caml_int_compare(la, lb); + var i = la - 1 | 0, r = 0; + for(;;){ + if(0 === r && 0 <= i){ + var c = caml_check_bound(b$0, i)[i + 1]; + if(caml_check_bound(a$0, i)[i + 1] !== c) + var + d = caml_check_bound(b$0, i)[i + 1], + r$0 = caml_int_compare(caml_check_bound(a$0, i)[i + 1], d); + else + var r$0 = r; + var i$0 = i - 1 | 0; + i = i$0; + r = r$0; + continue; + } + return r; + } + } + function add(a, b){ + var + la = a.length - 1, + lb = b.length - 1, + n = Stdlib[17].call(null, la, lb) + 1 | 0, + r = caml_make_vect(n, 0), + c = n - 1 | 0; + if(c >= 0){ + var carry = 0, i = 0; + for(;;){ + var + d = i < lb ? caml_check_bound(b, i)[i + 1] : 0, + e = i < la ? caml_check_bound(a, i)[i + 1] : 0, + s = (carry + e | 0) + d | 0; + caml_check_bound(r, i)[i + 1] = s & 67108863; + var f = s >>> 26 | 0, g = i + 1 | 0; + if(c === i) break; + carry = f; + i = g; + } + } + return norm(r); + } + function sub(a, b){ + var + la = a.length - 1, + lb = b.length - 1, + r = caml_make_vect(la, 0), + c = la - 1 | 0; + if(c >= 0){ + var borrow = 0, i = 0; + for(;;){ + var + d = i < lb ? caml_check_bound(b, i)[i + 1] : 0, + s = (caml_check_bound(a, i)[i + 1] - borrow | 0) - d | 0, + borrow$0 = + 0 <= s + ? (caml_check_bound(r, i)[i + 1] = s, 0) + : (caml_check_bound(r, i)[i + 1] = s + 67108864 | 0, 1), + e = i + 1 | 0; + if(c === i) break; + borrow = borrow$0; + i = e; + } + } + return norm(r); + } + function mul(a, b$0){ + var + la = a.length - 1, + lb = b$0.length - 1, + r = caml_make_vect(la + lb | 0, 0), + maskL = caml_int64_create_lo_mi_hi(16777215, 3, 0), + c = la - 1 | 0; + if(c >= 0){ + var i = 0; + for(;;){ + var + ai = caml_int64_of_int32(caml_check_bound(a, i)[i + 1]), + d = lb - 1 | 0; + if(d < 0) + var carry$0 = b; + else{ + var carry = b, j = 0; + for(;;){ + var + g = i + j | 0, + n = + runtime.caml_int64_mul + (ai, caml_int64_of_int32(caml_check_bound(b$0, j)[j + 1])), + s = + caml_int64_add + (caml_int64_add + (caml_int64_of_int32(caml_check_bound(r, g)[g + 1]), n), + carry), + h = i + j | 0; + caml_check_bound(r, h)[h + 1] = + caml_int64_to_int32(runtime.caml_int64_and(s, maskL)); + var k = runtime.caml_int64_shift_right_unsigned(s, 26), o = j + 1 | 0; + if(d === j){var carry$0 = k; break;} + carry = k; + j = o; + } + } + var + e = i + lb | 0, + f = i + lb | 0, + l = caml_check_bound(r, e)[e + 1] + caml_int64_to_int32(carry$0) | 0; + caml_check_bound(r, f)[f + 1] = l; + var m = i + 1 | 0; + if(c === i) break; + i = m; + } + } + return norm(r); + } + function numbits(a){ + var a$0 = norm(a), hi = a$0.length - 2 | 0; + if(0 === hi && 0 === caml_check_bound(a$0, 0)[1]) return 0; + var v = caml_check_bound(a$0, hi)[hi + 1], b = 0; + for(;;){ + if(0 >= v) return (hi * 26 | 0) + b | 0; + var b$0 = b + 1 | 0; + v = v >>> 1 | 0; + b = b$0; + } + } + function bit(a, i){ + var limb = i / 26 | 0, off = i % 26 | 0; + return a.length - 1 <= limb + ? 0 + : (caml_check_bound(a, limb)[limb + 1] >>> off | 0) & 1; + } + function bn_mod(a, m){ + if(0 > cmp(a, m)) return norm(a); + var b = numbits(a) - 1 | 0; + if(b < 0) + var r$3 = bzero; + else{ + var r$0 = bzero, i = b; + for(;;){ + var + r = add(r$0, r$0), + r$1 = 1 === bit(a, i) ? add(r, [0, 1]) : r, + r$2 = 0 <= cmp(r$1, m) ? sub(r$1, m) : r$1, + c = i - 1 | 0; + if(0 === i){var r$3 = r$2; break;} + r$0 = r$2; + i = c; + } + } + return r$3; + } + function div_small(a, d){ + var + la = a.length - 1, + q = caml_make_vect(la, 0), + dL = caml_int64_of_int32(d), + b = la - 1 | 0; + if(b >= 0){ + var rem = c, i = b; + for(;;){ + var + cur = + runtime.caml_int64_or + (runtime.caml_int64_shift_left(rem, 26), + caml_int64_of_int32(caml_check_bound(a, i)[i + 1])), + e = caml_int64_to_int32(runtime.caml_int64_div(cur, dL)); + caml_check_bound(q, i)[i + 1] = e; + var f = runtime.caml_int64_mod(cur, dL), g = i - 1 | 0; + if(0 === i) break; + rem = f; + i = g; + } + } + return norm(q); + } + function powmod(b0, e, m){ + var d = bn_mod(b0, m), nb = numbits(e), c = nb - 1 | 0, a = [0, 1]; + if(c < 0) + var result$1 = a; + else{ + var b = d, result = a, i = 0; + for(;;){ + var + result$0 = 1 === bit(e, i) ? bn_mod(mul(result, b), m) : result, + f = bn_mod(mul(b, b), m), + g = i + 1 | 0; + if(c === i){var result$1 = result$0; break;} + b = f; + result = result$0; + i = g; + } + } + return result$1; + } + function of_bytes_le(s){ + var a = caml_ml_string_length(s) - 1 | 0; + if(a < 0) + var acc$0 = bzero; + else{ + var acc = bzero, i = a; + for(;;){ + var + c = of_int(caml_string_get(s, i)), + b = add(mul(acc, of_int(256)), c), + d = i - 1 | 0; + if(0 === i){var acc$0 = b; break;} + acc = b; + i = d; + } + } + return acc$0; + } + function to_bytes_le(a, n){ + var b = Stdlib_Bytes[1].call(null, n, 0), c = n - 1 | 0, e = norm(a); + if(c >= 0){ + var cur = e, i = 0; + for(;;){ + var + q = div_small(cur, 256), + qm = mul(q, of_int(256)), + d = sub(cur, qm), + r = is_zero(d) ? 0 : caml_check_bound(d, 0)[1]; + caml_bytes_set(b, i, Stdlib_Char[1].call(null, r)); + var f = i + 1 | 0; + if(c === i) break; + cur = q; + i = f; + } + } + return Stdlib_Bytes[44].call(null, b); + } + var twop255 = caml_make_vect(11, 0); + caml_check_bound(twop255, 9)[10] = 2097152; + var d = of_int(19), p = sub(norm(twop255), d); + function fmod(a){return bn_mod(a, p);} + function fadd(a, b){var a$0 = add(a, b); return bn_mod(a$0, p);} + function fsub(a, b){ + var a$0 = add(a, sub(p, bn_mod(b, p))); + return bn_mod(a$0, p); + } + function fmul(a, b){var a$0 = mul(a, b); return bn_mod(a$0, p);} + function fpow(a, e){return powmod(a, e, p);} + function finv(a){var e = sub(p, of_int(2)); return powmod(a, e, p);} + var + ell = + of_bytes_le + ("\xed\xd3\xf5\\\x1ac\x12X\xd6\x9c\xf7\xa2\xde\xf9\xde\x14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x10"), + inv666 = finv(of_int(121666)), + f = of_int(121665), + a = mul(fsub(of_int(0), f), inv666), + dconst = bn_mod(a, p), + e = div_small(sub(p, of_int(1)), 4), + a$0 = of_int(2), + sqrtm1 = powmod(a$0, e, p), + g = of_int(1), + identity = [0, bzero, of_int(1), g, bzero]; + function padd(p1, p2){ + var + d = fsub(p2[2], p2[1]), + a = fmul(fsub(p1[2], p1[1]), d), + i = fadd(p2[2], p2[1]), + b = fmul(fadd(p1[2], p1[1]), i), + j = p2[4], + k = fmul(of_int(2), dconst), + c = fmul(fmul(p1[4], k), j), + l = p2[3], + m = of_int(2), + dd = fmul(fmul(p1[3], m), l), + e = fsub(b, a), + f = fsub(dd, c), + g = fadd(dd, c), + h = fadd(b, a), + n = fmul(e, h), + o = fmul(f, g), + p = fmul(g, h); + return [0, fmul(e, f), p, o, n]; + } + function scalar_mul(n, q){ + var a = numbits(n) - 1 | 0; + if(a < 0) + var r$2 = identity; + else{ + var r$0 = identity, i = a; + for(;;){ + var + r = padd(r$0, r$0), + r$1 = 1 === bit(n, i) ? padd(r, q) : r, + b = i - 1 | 0; + if(0 === i){var r$2 = r$1; break;} + r$0 = r$1; + i = b; + } + } + return r$2; + } + function pnegate(q){ + var a = q[4], b = fsub(of_int(0), a), c = q[3], d = q[2], e = q[1]; + return [0, fsub(of_int(0), e), d, c, b]; + } + function decompress(s){ + if(32 !== caml_ml_string_length(s)) return 0; + var + sign = (caml_string_get(s, 31) >>> 7 | 0) & 1, + s$0 = Stdlib_Bytes[5].call(null, s), + b = caml_string_get(s, 31) & 127; + caml_bytes_set(s$0, 31, Stdlib_Char[1].call(null, b)); + var y = of_bytes_le(Stdlib_Bytes[44].call(null, s$0)); + if(0 <= cmp(y, p)) return 0; + var + y2 = fmul(y, y), + u = fsub(y2, of_int(1)), + c = of_int(1), + v = fadd(fmul(dconst, y2), c), + v3 = fmul(fmul(v, v), v), + v7 = fmul(fmul(v3, v3), v), + exp = div_small(sub(p, of_int(5)), 8), + a = fmul(u, v7), + e = powmod(a, exp, p), + x0 = fmul(fmul(u, v3), e), + vx2 = fmul(v, fmul(x0, x0)), + x = + 0 === cmp(vx2, u) + ? [0, x0] + : 0 === cmp(vx2, fsub(of_int(0), u)) ? [0, fmul(x0, sqrtm1)] : 0; + if(! x) return 0; + var x$0 = x[1]; + if(is_zero(x$0) && 1 === sign) return 0; + var + x$1 = bit(x$0, 0) !== sign ? fsub(of_int(0), x$0) : x$0, + d = fmul(x$1, y); + return [0, [0, x$1, y, of_int(1), d]]; + } + function encode(q){ + var + zi = finv(q[3]), + x = fmul(q[1], zi), + y = fmul(q[2], zi), + a = to_bytes_le(y, 32), + b = Stdlib_Bytes[5].call(null, a), + c = bit(x, 0) << 7, + last = runtime.caml_bytes_get(b, 31) | c; + caml_bytes_set(b, 31, Stdlib_Char[1].call(null, last)); + return Stdlib_Bytes[44].call(null, b); + } + var + h = finv(of_int(5)), + by = fmul(of_int(4), h), + match = decompress(to_bytes_le(by, 32)); + if(match) + var pt = match[1], base_point = pt; + else + var + base_point = + Stdlib[2].call(null, "ed25519: base point decompress failed"); + function unhex(h){ + var + n = caml_ml_string_length(h) / 2 | 0, + b = runtime.caml_create_bytes(n), + a = n - 1 | 0; + if(a >= 0){ + var i = 0; + for(;;){ + var + c = Stdlib_String[16].call(null, h, 2 * i | 0, 2), + d = runtime.caml_int_of_string(Stdlib[28].call(null, "0x", c)); + caml_bytes_set(b, i, Stdlib_Char[1].call(null, d)); + var e = i + 1 | 0; + if(a === i) break; + i = e; + } + } + return Stdlib_Bytes[44].call(null, b); + } + function sha512_bytes(s){return unhex(Sx_sha2[11].call(null, s));} + function verify(pubkey, msg, sig){ + if + (32 === caml_ml_string_length(pubkey) + && 64 === caml_ml_string_length(sig)){ + var + rb = Stdlib_String[16].call(null, sig, 0, 32), + sb = Stdlib_String[16].call(null, sig, 32, 32), + s = of_bytes_le(sb); + if(0 <= cmp(s, ell)) return 0; + var match = decompress(pubkey); + if(! match) return 0; + var + a = match[1], + b = Stdlib[28].call(null, pubkey, msg), + h = sha512_bytes(Stdlib[28].call(null, rb, b)), + k = bn_mod(of_bytes_le(h), ell), + sb_pt = scalar_mul(s, base_point), + ka = scalar_mul(k, a), + chk = padd(sb_pt, pnegate(ka)); + try{var c = encode(chk) === rb ? 1 : 0; return c;}catch(exn){return 0;} + } + return 0; + } + var + Sx_ed25519 = + [0, + 26, + 67108864, + 67108863, + norm, + bzero, + of_int, + is_zero, + cmp, + add, + sub, + mul, + numbits, + bit, + bn_mod, + div_small, + powmod, + of_bytes_le, + to_bytes_le, + p, + fmod, + fadd, + fsub, + fmul, + fpow, + finv, + ell, + dconst, + sqrtm1, + identity, + padd, + scalar_mul, + pnegate, + decompress, + encode, + base_point, + unhex, + sha512_bytes, + verify]; + runtime.caml_register_global(12, Sx_ed25519, "Sx_ed25519"); + return; + } + (globalThis)); + +//# 3213 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_parser:[F(1)*,F(1),F(1),F(1)*,F(1),F(1)*,F(1)*,F(1)*,F(1),F(1),F(2),F(2),F(1),F(1),F(2),F(1),F(1),F(1),F(1),F(1),F(5),F(3),F(1),F(1),F(1)] (function (globalThis){ @@ -38927,7 +42108,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cst_Unterminated_dict = "Unterminated dict"; function read_dict(s){ advance(s); - var d = Sx_types[105].call(null, 0); + var d = Sx_types[109].call(null, 0); for(;;){ skip_whitespace_and_comments(s); if(at_end(s)) @@ -38937,7 +42118,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var key = read_value(s); if(typeof key !== "number" && key[0] - 3 >>> 0 < 3){ var key_str = key[1], v = read_value(s); - Sx_types[108].call(null, d, key_str, v); + Sx_types[112].call(null, d, key_str, v); continue; } throw caml_maybe_attach_backtrace @@ -39392,7 +42573,727 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 2644 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# 4166 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_rsa:[N,N,N,F(1),N,F(1),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(3),F(1),F(2),F(2),N,F(2),F(1),N,F(1),F(3)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_set = runtime.caml_bytes_set, + caml_check_bound = runtime.caml_check_bound, + caml_int_compare = runtime.caml_int_compare, + caml_make_vect = runtime.caml_make_vect, + caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, + caml_ml_string_length = runtime.caml_ml_string_length, + caml_string_get = runtime.caml_string_get, + global_data = runtime.caml_get_global_data(), + Sx_sha2 = global_data.Sx_sha2, + Stdlib = global_data.Stdlib, + Stdlib_String = global_data.Stdlib__String, + Stdlib_Char = global_data.Stdlib__Char, + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Array = global_data.Stdlib__Array; + function norm(a){ + var n = a.length - 1; + for(;;){ + if(1 < n){ + var b = n - 1 | 0; + if(0 === caml_check_bound(a, b)[b + 1]){ + var n$0 = n - 1 | 0; + n = n$0; + continue; + } + } + return n === a.length - 1 ? a : Stdlib_Array[6].call(null, a, 0, n); + } + } + function is_zero(a){ + var + b = 1 === a.length - 1 ? 1 : 0, + c = b ? 0 === caml_check_bound(a, 0)[1] ? 1 : 0 : b; + return c; + } + function cmp(a, b){ + var + a$0 = norm(a), + b$0 = norm(b), + la = a$0.length - 1, + lb = b$0.length - 1; + if(la !== lb) return caml_int_compare(la, lb); + var i = la - 1 | 0, r = 0; + for(;;){ + if(0 === r && 0 <= i){ + var c = caml_check_bound(b$0, i)[i + 1]; + if(caml_check_bound(a$0, i)[i + 1] !== c) + var + d = caml_check_bound(b$0, i)[i + 1], + r$0 = caml_int_compare(caml_check_bound(a$0, i)[i + 1], d); + else + var r$0 = r; + var i$0 = i - 1 | 0; + i = i$0; + r = r$0; + continue; + } + return r; + } + } + function add(a, b){ + var + la = a.length - 1, + lb = b.length - 1, + n = Stdlib[17].call(null, la, lb) + 1 | 0, + r = caml_make_vect(n, 0), + c = n - 1 | 0; + if(c >= 0){ + var carry = 0, i = 0; + for(;;){ + var + d = i < lb ? caml_check_bound(b, i)[i + 1] : 0, + e = i < la ? caml_check_bound(a, i)[i + 1] : 0, + s = (carry + e | 0) + d | 0; + caml_check_bound(r, i)[i + 1] = s & 67108863; + var f = s >>> 26 | 0, g = i + 1 | 0; + if(c === i) break; + carry = f; + i = g; + } + } + return norm(r); + } + function sub(a, b){ + var + la = a.length - 1, + lb = b.length - 1, + r = caml_make_vect(la, 0), + c = la - 1 | 0; + if(c >= 0){ + var borrow = 0, i = 0; + for(;;){ + var + d = i < lb ? caml_check_bound(b, i)[i + 1] : 0, + s = (caml_check_bound(a, i)[i + 1] - borrow | 0) - d | 0, + borrow$0 = + 0 <= s + ? (caml_check_bound(r, i)[i + 1] = s, 0) + : (caml_check_bound(r, i)[i + 1] = s + 67108864 | 0, 1), + e = i + 1 | 0; + if(c === i) break; + borrow = borrow$0; + i = e; + } + } + return norm(r); + } + function mul(a, b){ + var + la = a.length - 1, + lb = b.length - 1, + r = caml_make_vect(la + lb | 0, 0), + c = la - 1 | 0; + if(c >= 0){ + var i = 0; + for(;;){ + var e = lb - 1 | 0, d = 0; + if(e < 0) + var carry$0 = d; + else{ + var carry = d, j = 0; + for(;;){ + var + o = caml_check_bound(b, j)[j + 1], + h = i + j | 0, + p = runtime.caml_mul(caml_check_bound(a, i)[i + 1], o), + s = (caml_check_bound(r, h)[h + 1] + p | 0) + carry | 0, + k = i + j | 0; + caml_check_bound(r, k)[k + 1] = s & 67108863; + var l = s >>> 26 | 0, q = j + 1 | 0; + if(e === j){var carry$0 = l; break;} + carry = l; + j = q; + } + } + var + f = i + lb | 0, + g = i + lb | 0, + m = caml_check_bound(r, f)[f + 1] + carry$0 | 0; + caml_check_bound(r, g)[g + 1] = m; + var n = i + 1 | 0; + if(c === i) break; + i = n; + } + } + return norm(r); + } + function numbits(a){ + var a$0 = norm(a), hi = a$0.length - 2 | 0; + if(0 === hi && 0 === caml_check_bound(a$0, 0)[1]) return 0; + var v = caml_check_bound(a$0, hi)[hi + 1], b = 0; + for(;;){ + if(0 >= v) return (hi * 26 | 0) + b | 0; + var b$0 = b + 1 | 0; + v = v >>> 1 | 0; + b = b$0; + } + } + function bit(a, i){ + var limb = i / 26 | 0, off = i % 26 | 0; + return a.length - 1 <= limb + ? 0 + : (caml_check_bound(a, limb)[limb + 1] >>> off | 0) & 1; + } + var bzero = [0, 0]; + function bn_mod(a, m){ + if(0 > cmp(a, m)) return norm(a); + var b = numbits(a) - 1 | 0; + if(b < 0) + var r$3 = bzero; + else{ + var r$0 = bzero, i = b; + for(;;){ + var + r = add(r$0, r$0), + r$1 = 1 === bit(a, i) ? add(r, [0, 1]) : r, + r$2 = 0 <= cmp(r$1, m) ? sub(r$1, m) : r$1, + c = i - 1 | 0; + if(0 === i){var r$3 = r$2; break;} + r$0 = r$2; + i = c; + } + } + return r$3; + } + function powmod(b0, e, m){ + var d = bn_mod(b0, m), c = numbits(e) - 1 | 0, a = [0, 1]; + if(c < 0) + var result$1 = a; + else{ + var b = d, result = a, i = 0; + for(;;){ + var + result$0 = 1 === bit(e, i) ? bn_mod(mul(result, b), m) : result, + f = bn_mod(mul(b, b), m), + g = i + 1 | 0; + if(c === i){var result$1 = result$0; break;} + b = f; + result = result$0; + i = g; + } + } + return result$1; + } + function of_bytes_be(s){ + var a = caml_ml_string_length(s) - 1 | 0; + if(a < 0) + var acc$0 = bzero; + else{ + var acc = bzero, i = 0; + for(;;){ + var + c = [0, caml_string_get(s, i)], + b = add(mul(acc, [0, 256]), c), + d = i + 1 | 0; + if(a === i){var acc$0 = b; break;} + acc = b; + i = d; + } + } + return acc$0; + } + function div_small(a, d){ + var la = a.length - 1, q = caml_make_vect(la, 0), b = la - 1 | 0; + if(b >= 0){ + var rem = 0, i = b; + for(;;){ + var + cur = rem << 26 | caml_check_bound(a, i)[i + 1], + c = runtime.caml_div(cur, d); + caml_check_bound(q, i)[i + 1] = c; + var e = runtime.caml_mod(cur, d), f = i - 1 | 0; + if(0 === i) break; + rem = e; + i = f; + } + } + return norm(q); + } + function to_bytes_be(a, n){ + var b = Stdlib_Bytes[1].call(null, n, 0), c = n - 1 | 0, e = norm(a); + if(c >= 0){ + var cur = e, i = c; + for(;;){ + var + q = div_small(cur, 256), + d = sub(cur, mul(q, [0, 256])), + r = is_zero(d) ? 0 : caml_check_bound(d, 0)[1]; + caml_bytes_set(b, i, Stdlib_Char[1].call(null, r)); + var f = i - 1 | 0; + if(0 === i) break; + cur = q; + i = f; + } + } + return Stdlib_Bytes[44].call(null, b); + } + var Der = [248, "Sx_rsa.Der", runtime.caml_fresh_oo_id(0)]; + function der_tlv(s, pos){ + if(caml_ml_string_length(s) < (pos + 2 | 0)) + throw caml_maybe_attach_backtrace([0, Der, "short"], 1); + var tag = caml_string_get(s, pos), l0 = caml_string_get(s, pos + 1 | 0); + if(128 <= l0){ + var nb = l0 & 127; + if(caml_ml_string_length(s) < ((pos + 2 | 0) + nb | 0)) + throw caml_maybe_attach_backtrace([0, Der, "short len"], 1); + var b = nb - 1 | 0, a = 0; + if(b < 0) + var v$0 = a; + else{ + var v = a, i = 0; + for(;;){ + var + c = v << 8 | caml_string_get(s, (pos + 2 | 0) + i | 0), + d = i + 1 | 0; + if(b === i){var v$0 = c; break;} + v = c; + i = d; + } + } + var hdr = 2 + nb | 0, hdr$0 = hdr, len = v$0; + } + else + var hdr$0 = 2, len = l0; + return [0, tag, pos + hdr$0 | 0, len, (pos + hdr$0 | 0) + len | 0]; + } + function parse_spki(der){ + var match = der_tlv(der, 0), c = match[2]; + if(48 !== match[1]) + throw caml_maybe_attach_backtrace + ([0, Der, "spki: outer not SEQUENCE"], 1); + var + after_alg = der_tlv(der, c)[4], + match$0 = der_tlv(der, after_alg), + bc = match$0[2], + bt = match$0[1]; + if(3 !== bt) + throw caml_maybe_attach_backtrace + ([0, Der, "spki: expected BIT STRING"], 1); + var + rpk_start = bc + 1 | 0, + match$1 = der_tlv(der, rpk_start), + sc = match$1[2], + st = match$1[1]; + if(48 !== st) + throw caml_maybe_attach_backtrace + ([0, Der, "spki: RSAPublicKey not SEQUENCE"], 1); + var + match$2 = der_tlv(der, sc), + after_n = match$2[4], + nl = match$2[3], + nc = match$2[2], + nt = match$2[1]; + if(2 !== nt) + throw caml_maybe_attach_backtrace + ([0, Der, "spki: modulus not INTEGER"], 1); + var + match$3 = der_tlv(der, after_n), + el = match$3[3], + ec = match$3[2], + et = match$3[1]; + if(2 !== et) + throw caml_maybe_attach_backtrace + ([0, Der, "spki: exponent not INTEGER"], 1); + var + n = of_bytes_be(Stdlib_String[16].call(null, der, nc, nl)), + e = of_bytes_be(Stdlib_String[16].call(null, der, ec, el)); + return [0, n, e]; + } + function unhex(h){ + var + n = caml_ml_string_length(h) / 2 | 0, + b = runtime.caml_create_bytes(n), + a = n - 1 | 0; + if(a >= 0){ + var i = 0; + for(;;){ + var + c = Stdlib_String[16].call(null, h, 2 * i | 0, 2), + d = runtime.caml_int_of_string(Stdlib[28].call(null, "0x", c)); + caml_bytes_set(b, i, Stdlib_Char[1].call(null, d)); + var e = i + 1 | 0; + if(a === i) break; + i = e; + } + } + return Stdlib_Bytes[44].call(null, b); + } + var + sha256_digestinfo_prefix = + "010\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\0\x04 "; + function verify(spki, msg, sig){ + try{ + var + match = parse_spki(spki), + e = match[2], + n = match[1], + k = (numbits(n) + 7 | 0) / 8 | 0; + if(caml_ml_string_length(sig) !== k) + var a = 0; + else{ + var s = of_bytes_be(sig); + if(0 <= cmp(s, n)) + var a = 0; + else{ + var + m = powmod(s, e, n), + em = to_bytes_be(m, k), + h = unhex(Sx_sha2[3].call(null, msg)), + t = Stdlib[28].call(null, sha256_digestinfo_prefix, h), + tlen = caml_ml_string_length(t); + if(k < (tlen + 11 | 0)) + var a = 0; + else{ + var + b = 0 === caml_string_get(em, 0) ? 1 : 0, + c = b ? 1 === caml_string_get(em, 1) ? 1 : 0 : b, + ps_end = (k - tlen | 0) - 1 | 0, + d = ps_end - 1 | 0; + if(d < 2) + var ok$1 = c; + else{ + var ok = c, i = 2; + for(;;){ + var ok$0 = 255 !== caml_string_get(em, i) ? 0 : ok, f = i + 1 | 0; + if(d === i){var ok$1 = ok$0; break;} + ok = ok$0; + i = f; + } + } + var + ok$2 = 0 !== caml_string_get(em, ps_end) ? 0 : ok$1, + a = + Stdlib_String[16].call(null, em, ps_end + 1 | 0, tlen) !== t + ? 0 + : ok$2; + } + } + } + return a; + } + catch(exn){return 0;} + } + runtime.caml_register_global + (16, + [0, + 26, + 67108864, + 67108863, + norm, + bzero, + is_zero, + cmp, + add, + sub, + mul, + numbits, + bit, + bn_mod, + powmod, + of_bytes_be, + div_small, + to_bytes_be, + Der, + der_tlv, + parse_spki, + sha256_digestinfo_prefix, + unhex, + verify], + "Sx_rsa"); + return; + } + (globalThis)); + +//# 4607 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_sha3:[F(2)*,F(2)*,F(1)*,F(2)*,N,N,F(1),F(1)] +(function + (globalThis){ + "use strict"; + var + runtime = globalThis.jsoo_runtime, + caml_bytes_set = runtime.caml_bytes_set, + caml_check_bound = runtime.caml_check_bound, + caml_int64_and = runtime.caml_int64_and, + caml_int64_create_lo_mi_hi = runtime.caml_int64_create_lo_mi_hi, + caml_int64_shift_left = runtime.caml_int64_shift_left, + caml_int64_shift_right_unsigne = runtime.caml_int64_shift_right_unsigned, + caml_int64_xor = runtime.caml_int64_xor, + caml_make_vect = runtime.caml_make_vect, + caml_obj_dup = runtime.caml_obj_dup; + function caml_call1(f, a0){ + return (f.l >= 0 ? f.l : f.l = f.length) === 1 + ? f(a0) + : runtime.caml_call_gen(f, [a0]); + } + var + global_data = runtime.caml_get_global_data(), + Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Buffer = global_data.Stdlib__Buffer, + Stdlib_Printf = global_data.Stdlib__Printf, + Stdlib_Int64 = global_data.Stdlib__Int64, + lnot64 = Stdlib_Int64[11]; + function rotl64(x, n){ + return 0 === n + ? x + : runtime.caml_int64_or + (caml_int64_shift_left(x, n), + caml_int64_shift_right_unsigne(x, 64 - n | 0)); + } + var + rho = + caml_obj_dup + ([0, + 0, + 1, + 62, + 28, + 27, + 36, + 44, + 6, + 55, + 20, + 3, + 10, + 43, + 25, + 39, + 41, + 45, + 15, + 21, + 8, + 18, + 2, + 61, + 56, + 14]), + rc = + caml_obj_dup + ([0, + caml_int64_create_lo_mi_hi(1, 0, 0), + caml_int64_create_lo_mi_hi(32898, 0, 0), + caml_int64_create_lo_mi_hi(32906, 0, 32768), + caml_int64_create_lo_mi_hi(32768, 128, 32768), + caml_int64_create_lo_mi_hi(32907, 0, 0), + caml_int64_create_lo_mi_hi(1, 128, 0), + caml_int64_create_lo_mi_hi(32897, 128, 32768), + caml_int64_create_lo_mi_hi(32777, 0, 32768), + caml_int64_create_lo_mi_hi(138, 0, 0), + caml_int64_create_lo_mi_hi(136, 0, 0), + caml_int64_create_lo_mi_hi(32777, 128, 0), + caml_int64_create_lo_mi_hi(10, 128, 0), + caml_int64_create_lo_mi_hi(32907, 128, 0), + caml_int64_create_lo_mi_hi(139, 0, 32768), + caml_int64_create_lo_mi_hi(32905, 0, 32768), + caml_int64_create_lo_mi_hi(32771, 0, 32768), + caml_int64_create_lo_mi_hi(32770, 0, 32768), + caml_int64_create_lo_mi_hi(128, 0, 32768), + caml_int64_create_lo_mi_hi(32778, 0, 0), + caml_int64_create_lo_mi_hi(10, 128, 32768), + caml_int64_create_lo_mi_hi(32897, 128, 32768), + caml_int64_create_lo_mi_hi(32896, 0, 32768), + caml_int64_create_lo_mi_hi(1, 128, 0), + caml_int64_create_lo_mi_hi(32776, 128, 32768)]), + a = caml_int64_create_lo_mi_hi(0, 0, 0), + b = caml_int64_create_lo_mi_hi(0, 0, 0), + c = caml_int64_create_lo_mi_hi(0, 0, 0), + d = caml_int64_create_lo_mi_hi(0, 0, 0), + e = caml_int64_create_lo_mi_hi(255, 0, 0); + function keccak_f(a$0){ + var + c$0 = caml_make_vect(5, a), + d = caml_make_vect(5, b), + b$0 = caml_make_vect(25, c), + round = 0; + for(;;){ + var x$3 = 0; + for(;;){ + var + p = x$3 + 20 | 0, + q = x$3 + 15 | 0, + J = caml_check_bound(a$0, p)[p + 1], + r = x$3 + 10 | 0, + S = caml_int64_xor(caml_check_bound(a$0, q)[q + 1], J), + s = x$3 + 5 | 0, + R = caml_int64_xor(caml_check_bound(a$0, r)[r + 1], S), + Q = caml_int64_xor(caml_check_bound(a$0, s)[s + 1], R), + P = caml_int64_xor(caml_check_bound(a$0, x$3)[x$3 + 1], Q); + caml_check_bound(c$0, x$3)[x$3 + 1] = P; + var K = x$3 + 1 | 0; + if(4 === x$3) break; + x$3 = K; + } + var x$2 = 0; + for(;;){ + var + n = (x$2 + 1 | 0) % 5 | 0, + o = (x$2 + 4 | 0) % 5 | 0, + H = rotl64(caml_check_bound(c$0, n)[n + 1], 1), + O = caml_int64_xor(caml_check_bound(c$0, o)[o + 1], H); + caml_check_bound(d, x$2)[x$2 + 1] = O; + var I = x$2 + 1 | 0; + if(4 === x$2) break; + x$2 = I; + } + var x$1 = 0; + for(;;){ + var y$1 = 0; + for(;;){ + var + l = x$1 + (5 * y$1 | 0) | 0, + F = caml_check_bound(d, x$1)[x$1 + 1], + m = x$1 + (5 * y$1 | 0) | 0, + N = caml_int64_xor(caml_check_bound(a$0, l)[l + 1], F); + caml_check_bound(a$0, m)[m + 1] = N; + var G = y$1 + 1 | 0; + if(4 === y$1) break; + y$1 = G; + } + var E = x$1 + 1 | 0; + if(4 === x$1) break; + x$1 = E; + } + var x$0 = 0; + for(;;){ + var y$0 = 0; + for(;;){ + var + ny = ((2 * x$0 | 0) + (3 * y$0 | 0) | 0) % 5 | 0, + i = x$0 + (5 * y$0 | 0) | 0, + j = x$0 + (5 * y$0 | 0) | 0, + B = caml_check_bound(rho, i)[i + 1], + k = y$0 + (5 * ny | 0) | 0, + C = rotl64(caml_check_bound(a$0, j)[j + 1], B); + caml_check_bound(b$0, k)[k + 1] = C; + var D = y$0 + 1 | 0; + if(4 === y$0) break; + y$0 = D; + } + var A = x$0 + 1 | 0; + if(4 === x$0) break; + x$0 = A; + } + var y = 0; + a: + for(;;){ + var x = 0; + for(;;){ + var + e = ((x + 2 | 0) % 5 | 0) + (5 * y | 0) | 0, + f = ((x + 1 | 0) % 5 | 0) + (5 * y | 0) | 0, + w = caml_check_bound(b$0, e)[e + 1], + g = x + (5 * y | 0) | 0, + M = caml_int64_and(lnot64(caml_check_bound(b$0, f)[f + 1]), w), + h = x + (5 * y | 0) | 0, + L = caml_int64_xor(caml_check_bound(b$0, g)[g + 1], M); + caml_check_bound(a$0, h)[h + 1] = L; + var z = x + 1 | 0; + if(4 === x){ + var v = y + 1 | 0; + if(4 !== y){y = v; break;} + var t = caml_check_bound(rc, round)[round + 1]; + a$0[1] = caml_int64_xor(caml_check_bound(a$0, 0)[1], t); + var u = round + 1 | 0; + if(23 === round) return 0; + round = u; + break a; + } + x = z; + } + } + } + } + var f = [0, [4, 6, [0, 2, 2], 0, 0], "%02x"]; + function sha3_256_hex(msg){ + var + len = runtime.caml_ml_string_length(msg), + q = 136 - (len % 136 | 0) | 0, + padded = Stdlib_Bytes[1].call(null, len + q | 0, 0); + Stdlib_Bytes[12].call(null, msg, 0, padded, 0, len); + if(1 === q) + caml_bytes_set(padded, len, 134); + else{ + caml_bytes_set(padded, len, 6); + caml_bytes_set(padded, (len + q | 0) - 1 | 0, 128); + } + var + total = runtime.caml_ml_bytes_length(padded), + a = caml_make_vect(25, d), + nblocks = total / 136 | 0, + b = nblocks - 1 | 0; + if(b >= 0){ + var blk = 0; + a: + for(;;){ + var base = blk * 136 | 0, j$0 = 0; + for(;;){ + var + lane$0 = j$0 / 8 | 0, + sh$0 = (j$0 % 8 | 0) * 8 | 0, + byte$0 = + runtime.caml_int64_of_int32 + (runtime.caml_bytes_get(padded, base + j$0 | 0)); + a[lane$0 + 1] = + caml_int64_xor + (caml_check_bound(a, lane$0)[lane$0 + 1], + caml_int64_shift_left(byte$0, sh$0)); + var i = j$0 + 1 | 0; + if(135 === j$0){ + keccak_f(a); + var h = blk + 1 | 0; + if(b === blk) break a; + blk = h; + break; + } + j$0 = i; + } + } + } + var out = Stdlib_Buffer[1].call(null, 64), j = 0; + for(;;){ + var + lane = j / 8 | 0, + sh = (j % 8 | 0) * 8 | 0, + byte = + runtime.caml_int64_to_int32 + (caml_int64_and + (caml_int64_shift_right_unsigne + (caml_check_bound(a, lane)[lane + 1], sh), + e)), + c = caml_call1(Stdlib_Printf[4].call(null, f), byte); + Stdlib_Buffer[16].call(null, out, c); + var g = j + 1 | 0; + if(31 === j) return Stdlib_Buffer[2].call(null, out); + j = g; + } + } + runtime.caml_register_global + (12, + [0, + caml_int64_xor, + caml_int64_and, + lnot64, + rotl64, + rho, + rc, + keccak_f, + sha3_256_hex], + "Sx_sha3"); + return; + } + (globalThis)); + +//# 4888 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_primitives:[N,N,N,N,N,N,N,F(1),F(1),F(1),N,F(1),F(2),F(1),F(1),N,F(1),F(1),F(1),F(1),F(1),F(1)*,F(1),N,F(2),F(2),F(1),F(1),F(1),F(2),F(2),F(2),F(2),F(1),F(1)] (function (globalThis){ @@ -39416,6 +43317,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= caml_obj_dup = runtime.caml_obj_dup, caml_round_float = runtime.caml_round_float, caml_string_get = runtime.caml_string_get, + caml_sys_file_exists = runtime.caml_sys_file_exists, + caml_sys_read_directory = runtime.caml_sys_read_directory, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ return (f.l >= 0 ? f.l : f.l = f.length) === 1 @@ -39433,6 +43336,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= : runtime.caml_call_gen(f, [a0, a1, a2]); } var + dummy = 0, global_data = runtime.caml_get_global_data(), Stdlib = global_data.Stdlib, Stdlib_Float = global_data.Stdlib__Float, @@ -39443,15 +43347,22 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_String = global_data.Stdlib__String, Stdlib_Char = global_data.Stdlib__Char, Stdlib_List = global_data.Stdlib__List, + Sx_rsa = global_data.Sx_rsa, + Sx_ed25519 = global_data.Sx_ed25519, + Sx_cid = global_data.Sx_cid, + Sx_cbor = global_data.Sx_cbor, + Sx_sha3 = global_data.Sx_sha3, + Sx_sha2 = global_data.Sx_sha2, Stdlib_Queue = global_data.Stdlib__Queue, Unix = global_data.Unix, - Stdlib_Filename = global_data.Stdlib__Filename, Stdlib_Array = global_data.Stdlib__Array, Stdlib_Bytes = global_data.Stdlib__Bytes, + Stdlib_Filename = global_data.Stdlib__Filename, Sx_parser = global_data.Sx_parser, Re = global_data.Re, Re_Pcre = global_data.Re__Pcre, Stdlib_Uchar = global_data.Stdlib__Uchar, + Stdlib_Scanf = global_data.Stdlib__Scanf, primitives = Stdlib_Hashtbl[1].call(null, 0, 128), sx_call_fn = [0, @@ -39502,7 +43413,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var n$0 = v[1]; return n$0 | 0; } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, cst_Expected_number_got, a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -39514,6 +43425,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function all_ints(c){return b(a, c);} var cst = "", + cst$0 = ": ", cst_signal = "__signal", cst_dict = "dict", cst_value = "value"; @@ -39562,8 +43474,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = cst_dict; } var - c = Stdlib[28].call(null, ": ", a), - e = Sx_types[57].call(null, t), + c = Stdlib[28].call(null, cst$0, a), + e = Sx_types[61].call(null, t), f = Stdlib[28].call(null, e, c), g = Stdlib[28].call(null, cst_Expected_number_got, f); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); @@ -39571,7 +43483,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function as_string(v){ if(typeof v !== "number" && 3 === v[0]){var s = v[1]; return s;} var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, "Expected string, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -39589,14 +43501,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var r = t[1]; return r[1]; } var - a = Sx_types[57].call(null, t), + a = Sx_types[61].call(null, t), b = Stdlib[28].call(null, "Expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } } function as_bool(v){ if(typeof v !== "number" && 0 === v[0]){var b = v[1]; return b;} - return Sx_types[67].call(null, v); + return Sx_types[71].call(null, v); } var cst_false = "false", cst_true = "true"; function to_string(t$1){ @@ -39620,7 +43532,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 19: var s = t[1]; return s; } - return Sx_types[112].call(null, t); + return Sx_types[117].call(null, t); } } function rat_gcd(a, b){ @@ -39658,7 +43570,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var d = v[2], n$0 = v[1]; return [0, n$0, d]; } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, "expected integer or rational, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -39700,7 +43612,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return make_rat(caml_mul(an, bd), caml_mul(ad, bn)); } var - cst$0 = " ", + cst$1 = " ", cst_d_d = "%d/%d", cst_g = "%g", c = [0, [8, [0, 0, 3], 0, 0, 0], cst_g], @@ -39765,11 +43677,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 34: var d$0 = v[2], n$2 = v[1]; return caml_call2(Stdlib_Printf[4].call(null, e), n$2, d$0); - default: return Sx_types[112].call(null, v); + default: return Sx_types[117].call(null, v); } var a = Stdlib_List[20].call(null, sx_write_val, items), - b = Stdlib_String[7].call(null, cst$0, a), + b = Stdlib_String[7].call(null, cst$1, a), f = Stdlib[28].call(null, b, ")"); return Stdlib[28].call(null, "(", f); } @@ -39818,9 +43730,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[26].call (null, function(acc, a){return acc + as_number(a);}, 0., args)]; }); - var cst$3 = "-", g = [2, 0.], h = [1, 0], i = [1, 0]; + var cst$5 = "-", g = [2, 0.], h = [1, 0], i = [1, 0]; register - (cst$3, + (cst$5, function(args){ if(! args) return i; var a$0 = args[1]; @@ -39914,8 +43826,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[26].call (null, function(acc, a){return acc * as_number(a);}, 1., args)]; }); + var cst$6 = "/"; register - ("/", + (cst$6, function(args){ a: if(args){ @@ -40766,13 +44679,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace([0, Sx_types[9], "lcm: 2 args"], 1); }); var + cst_0 = "0", t = [0, [8, [0, 0, 3], 0, 0, 0], cst_g], u = [0, [4, 0, 0, 0, [12, 47, [4, 0, 0, 0, 0]]], cst_d_d]; register ("number->string", function(args){ function int_to_radix(n, r){ - if(0 === n) return "0"; + if(0 === n) return cst_0; var neg = n < 0, buf = Stdlib_Buffer[1].call(null, 16); function go(n){ var a = 0 < n ? 1 : 0; @@ -40785,7 +44699,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return Stdlib_Buffer[12].call(null, buf, b); } go(Stdlib[18].call(null, n)); - var a = Stdlib_Buffer[2].call(null, buf), b = neg ? cst$3 : cst; + var a = Stdlib_Buffer[2].call(null, buf), b = neg ? cst$5 : cst; return Stdlib[28].call(null, b, a); } if(args){ @@ -40990,6 +44904,481 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "denominator: expected rational or integer"], 1); }); + var + cst_s$0 = "%s", + y = [0, [8, [0, 0, 2], 0, 0, 0], "%E"], + z = [0, [8, [0, 0, 4], 0, 0, 0], "%G"], + A = [0, [4, 8, 0, 0, 0], "%X"], + B = [0, [2, 0, 0], cst_s$0], + C = [0, [4, 0, 0, 0, 0], "%d"], + D = [0, [8, [0, 0, 1], 0, 0, 0], "%e"], + E = [0, [8, [0, 0, 0], 0, 0, 0], "%f"], + F = [0, [8, [0, 0, 3], 0, 0, 0], cst_g], + G = [0, [4, 10, 0, 0, 0], "%o"], + H = [0, [2, 0, 0], cst_s$0], + I = [0, [4, 12, 0, 0, 0], "%u"], + J = [0, [4, 6, 0, 0, 0], "%x"]; + register + ("printf-spec", + function(args){ + if(args){ + var c = args[1]; + if(typeof c !== "number" && 3 === c[0]){ + var d = args[2]; + if(d && ! d[2]){ + var + arg = d[1], + spec_str = c[1], + n = caml_ml_string_length(spec_str), + g = n < 2, + h = g || 37 !== caml_string_get(spec_str, 0); + if(h){ + var + j = Stdlib[28].call(null, "printf-spec: invalid spec ", spec_str); + throw caml_maybe_attach_backtrace([0, Sx_types[9], j], 1); + } + var + type_char = caml_string_get(spec_str, n - 1 | 0), + to_int = + function(v){ + if(typeof v !== "number") + switch(v[0]){ + case 0: + return v[1] ? 1 : 0; + case 1: + var i = v[1]; return i; + case 2: + var f = v[1]; return f | 0; + case 3: + var s = v[1], s$0 = Stdlib_String[24].call(null, s); + try{var b = caml_int_of_string(s$0); return b;} + catch(exn){ + try{var a = caml_float_of_string(s$0) | 0; return a;} + catch(exn){return 0;} + } + } + return 0; + }, + to_float = + function(v){ + if(typeof v !== "number") + switch(v[0]){ + case 1: + var i = v[1]; return i; + case 2: + var f = v[1]; return f; + case 3: + var s = v[1], s$0 = Stdlib_String[24].call(null, s); + try{var a = caml_float_of_string(s$0); return a;} + catch(exn){return 0.;} + } + return 0.; + }; + try{ + var switcher = type_char - 69 | 0; + a: + if(51 >= switcher >>> 0){ + switch(switcher){ + case 0: + var + fmt = Stdlib_Scanf[13].call(null, spec_str, y), + o = to_float(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt), o)]; + break; + case 2: + var + fmt$0 = Stdlib_Scanf[13].call(null, spec_str, z), + p = to_float(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$0), p)]; + break; + case 19: + var + fmt$1 = Stdlib_Scanf[13].call(null, spec_str, A), + q = to_int(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$1), q)]; + break; + case 30: + var + n_val = to_int(arg), + body = Stdlib_String[16].call(null, spec_str, 0, n - 1 | 0), + r = Stdlib[28].call(null, body, "s"), + fmt$2 = Stdlib_Scanf[13].call(null, r, B), + t = Stdlib_Char[1].call(null, n_val & 255), + u = Stdlib_String[1].call(null, 1, t), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$2), u)]; + break; + case 32: + var + fmt$4 = Stdlib_Scanf[13].call(null, spec_str, D), + w = to_float(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$4), w)]; + break; + case 33: + var + fmt$5 = Stdlib_Scanf[13].call(null, spec_str, E), + x = to_float(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$5), x)]; + break; + case 34: + var + fmt$6 = Stdlib_Scanf[13].call(null, spec_str, F), + K = to_float(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$6), K)]; + break; + case 42: + var + fmt$7 = Stdlib_Scanf[13].call(null, spec_str, G), + L = to_int(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$7), L)]; + break; + case 46: + var fmt$8 = Stdlib_Scanf[13].call(null, spec_str, H); + b: + { + if(typeof arg === "number"){ + if(0 === arg){var b = cst; break b;} + } + else + switch(arg[0]){ + case 0: + if(arg[1]){var b = "1"; break b;} var b = cst_0; break b; + case 1: + var i = arg[1], b = Stdlib[33].call(null, i); break b; + case 2: + var f = arg[1], b = Sx_types[34].call(null, f); break b; + case 3: + var s = arg[1], b = s; break b; + } + var b = Sx_types[117].call(null, arg); + } + var a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$8), b)]; + break; + case 48: + var + fmt$9 = Stdlib_Scanf[13].call(null, spec_str, I), + M = to_int(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$9), M)]; + break; + case 51: + var + fmt$10 = Stdlib_Scanf[13].call(null, spec_str, J), + N = to_int(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$10), N)]; + break; + case 31: + case 36: + var + fmt$3 = Stdlib_Scanf[13].call(null, spec_str, C), + v = to_int(arg), + a = [3, caml_call1(Stdlib_Printf[4].call(null, fmt$3), v)]; + break; + default: break a; + } + return a; + } + var + l = Stdlib_String[1].call(null, 1, type_char), + m = + Stdlib[28].call(null, "printf-spec: unsupported conversion ", l); + throw caml_maybe_attach_backtrace([0, Sx_types[9], m], 1); + } + catch(e$0){ + var e = caml_wrap_exception(e$0); + if(e[1] === Sx_types[9]) throw caml_maybe_attach_backtrace(e, 0); + var + k = Stdlib[28].call(null, "printf-spec: invalid format ", spec_str); + throw caml_maybe_attach_backtrace([0, Sx_types[9], k], 1); + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "printf-spec: (spec arg)"], 1); + }); + register + ("scan-spec", + function(args){ + if(args){ + var b = args[1]; + if(typeof b !== "number" && 3 === b[0]){ + var c = args[2]; + if(c){ + var f = c[1]; + if(typeof f !== "number" && 3 === f[0] && ! c[2]){ + var + input = f[1], + spec_str = b[1], + n = caml_ml_string_length(spec_str), + r = n < 2, + s = r || 37 !== caml_string_get(spec_str, 0); + if(s){ + var + t = Stdlib[28].call(null, "scan-spec: invalid spec ", spec_str); + throw caml_maybe_attach_backtrace([0, Sx_types[9], t], 1); + } + var + type_char = caml_string_get(spec_str, n - 1 | 0), + len = caml_ml_string_length(input), + i = [0, 0]; + if(99 !== type_char) + for(;;){ + if(i[1] >= len) break; + if + (32 !== caml_string_get(input, i[1]) + && + 9 !== caml_string_get(input, i[1]) + && 10 !== caml_string_get(input, i[1])) + break; + i[1]++; + } + var start = i[1]; + try{ + var switcher = type_char - 88 | 0; + a: + if(32 >= switcher >>> 0){ + var cst_consumed = "consumed"; + switch(switcher){ + case 11: + if(i[1] < len){ + var + d$0 = Stdlib_Hashtbl[1].call(null, 0, 2), + x = [1, caml_string_get(input, i[1])]; + Stdlib_Hashtbl[11].call(null, d$0, cst_value, x); + Stdlib_Hashtbl[11].call + (null, d$0, cst_consumed, [1, i[1] + 1 | 0]); + var a = [7, d$0]; + } + else + var a = 0; + break; + case 23: + var j$14 = i[1]; + for(;;){ + if + (j$14 < len + && + 48 <= caml_string_get(input, j$14) + && 55 >= caml_string_get(input, j$14)){ + var j$15 = j$14 + 1 | 0; + j$14 = j$15; + continue; + } + if(start < j$14){ + var + C = + Stdlib_String[16].call(null, input, start, j$14 - start | 0), + n_val$1 = caml_int_of_string(Stdlib[28].call(null, "0o", C)), + d$3 = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d$3, cst_value, [1, n_val$1]); + Stdlib_Hashtbl[11].call(null, d$3, cst_consumed, [1, j$14]); + var a = [7, d$3]; + break; + } + var a = 0; + break; + } + break; + case 27: + var j$16 = i[1]; + for(;;){ + if + (j$16 < len + && + 32 !== caml_string_get(input, j$16) + && + 9 !== caml_string_get(input, j$16) + && 10 !== caml_string_get(input, j$16)){ + var j$17 = j$16 + 1 | 0; + j$16 = j$17; + continue; + } + if(start < j$16){ + var + d$4 = Stdlib_Hashtbl[1].call(null, 0, 2), + D = + [3, + Stdlib_String[16].call(null, input, start, j$16 - start | 0)]; + Stdlib_Hashtbl[11].call(null, d$4, cst_value, D); + Stdlib_Hashtbl[11].call(null, d$4, cst_consumed, [1, j$16]); + var a = [7, d$4]; + break; + } + var a = 0; + break; + } + break; + case 0: + case 32: + var j$1 = i[1]; + for(;;){ + b: + if(j$1 < len){ + c: + { + if + (48 <= caml_string_get(input, j$1) + && 57 >= caml_string_get(input, j$1)) + break c; + if + (97 <= caml_string_get(input, j$1) + && 102 >= caml_string_get(input, j$1)) + break c; + if + (65 > caml_string_get(input, j$1) + || 70 < caml_string_get(input, j$1)) + break b; + } + var j$2 = j$1 + 1 | 0; + j$1 = j$2; + continue; + } + if(start < j$1){ + var + w = + Stdlib_String[16].call(null, input, start, j$1 - start | 0), + n_val = caml_int_of_string(Stdlib[28].call(null, "0x", w)), + d = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d, cst_value, [1, n_val]); + Stdlib_Hashtbl[11].call(null, d, cst_consumed, [1, j$1]); + var a = [7, d]; + break; + } + var a = 0; + break; + } + break; + case 12: + case 17: + var j = i[1], g = j < len; + if(g) + var + y = 45 === caml_string_get(input, j), + h = y || 43 === caml_string_get(input, j); + else + var h = g; + if(h) var j$3 = j + 1 | 0, j$4 = j$3; else var j$4 = j; + for(;;){ + if(j$4 >= len) break; + if(48 > caml_string_get(input, j$4)) break; + if(57 < caml_string_get(input, j$4)) break; + var j$5 = j$4 + 1 | 0; + j$4 = j$5; + } + b: + if(start < j$4){ + c: + { + if + (48 <= caml_string_get(input, start) + && 57 >= caml_string_get(input, start)) + break c; + if + ((start + 1 | 0) >= j$4 + || + 45 !== caml_string_get(input, start) + && 43 !== caml_string_get(input, start)) + break b; + } + var + n_val$0 = + caml_int_of_string + (Stdlib_String[16].call(null, input, start, j$4 - start | 0)), + d$1 = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d$1, cst_value, [1, n_val$0]); + Stdlib_Hashtbl[11].call(null, d$1, cst_consumed, [1, j$4]); + var a = [7, d$1]; + break; + } + var a = 0; + break; + case 13: + case 14: + case 15: + var j$0 = i[1], k = j$0 < len; + if(k) + var + z = 45 === caml_string_get(input, j$0), + l = z || 43 === caml_string_get(input, j$0); + else + var l = k; + if(l) var j$6 = j$0 + 1 | 0, j$7 = j$6; else var j$7 = j$0; + for(;;){ + if(j$7 >= len) break; + b: + { + if + (48 <= caml_string_get(input, j$7) + && 57 >= caml_string_get(input, j$7)) + break b; + if(46 !== caml_string_get(input, j$7)) break; + } + var j$8 = j$7 + 1 | 0; + j$7 = j$8; + } + var m = j$7 < len; + if(m) + var + A = 101 === caml_string_get(input, j$7), + o = A || 69 === caml_string_get(input, j$7); + else + var o = m; + if(o){ + var j$9 = j$7 + 1 | 0, p = j$9 < len; + if(p) + var + B = 45 === caml_string_get(input, j$9), + q = B || 43 === caml_string_get(input, j$9); + else + var q = p; + if(q) + var j$10 = j$9 + 1 | 0, j$11 = j$10; + else + var j$11 = j$9; + for(;;){ + if(j$11 >= len){var j$13 = j$11; break;} + if(48 > caml_string_get(input, j$11)){var j$13 = j$11; break;} + if(57 < caml_string_get(input, j$11)){var j$13 = j$11; break;} + var j$12 = j$11 + 1 | 0; + j$11 = j$12; + } + } + else + var j$13 = j$7; + if(start < j$13){ + var + f_val = + caml_float_of_string + (Stdlib_String[16].call + (null, input, start, j$13 - start | 0)), + d$2 = Stdlib_Hashtbl[1].call(null, 0, 2); + Stdlib_Hashtbl[11].call(null, d$2, cst_value, [2, f_val]); + Stdlib_Hashtbl[11].call(null, d$2, cst_consumed, [1, j$13]); + var a = [7, d$2]; + } + else + var a = 0; + break; + default: break a; + } + return a; + } + var + u = Stdlib_String[1].call(null, 1, type_char), + v = Stdlib[28].call(null, "scan-spec: unsupported conversion ", u); + throw caml_maybe_attach_backtrace([0, Sx_types[9], v], 1); + } + catch(e$0){ + var e = caml_wrap_exception(e$0); + if(e[1] === Sx_types[9]) throw caml_maybe_attach_backtrace(e, 0); + return 0; + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "scan-spec: (spec input)"], 1); + }); register ("parse-int", function(args){ @@ -41294,8 +45683,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } throw caml_maybe_attach_backtrace([0, Sx_types[9], "!=: 2 args"], 1); }); + var cst$7 = "<"; register - ("<", + (cst$7, function(args){ a: if(args){ @@ -41318,8 +45708,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } throw caml_maybe_attach_backtrace([0, Sx_types[9], "<: 2 args"], 1); }); + var cst$8 = ">"; register - (">", + (cst$8, function(args){ a: if(args){ @@ -41395,7 +45786,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var a = args[1]; - return [0, 1 - Sx_types[67].call(null, a)]; + return [0, 1 - Sx_types[71].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "not: 1 arg"], 1); }); @@ -41404,23 +45795,23 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var a = args[1]; - return [0, Sx_types[58].call(null, a)]; + return [0, Sx_types[62].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "nil?: 1 arg"], 1); }); - var y = [0, 0], z = [0, 1]; + var K = [0, 0], L = [0, 1]; register ("number?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && a[0] - 1 >>> 0 < 2){if(args[2]) break a; return z;} - if(! args[2]) return y; + if(typeof a !== "number" && a[0] - 1 >>> 0 < 2){if(args[2]) break a; return L;} + if(! args[2]) return K; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "number?: 1 arg"], 1); }); - var A = [0, 0], B = [0, 1]; + var M = [0, 0], N = [0, 1]; register ("integer?", function(args){ @@ -41430,55 +45821,55 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number") switch(a[0]){ case 1: - if(args[2]) break a; return B; + if(args[2]) break a; return N; case 2: if(args[2]) break a; var f = a[1]; return [0, Stdlib_Float[18].call(null, f)]; } - if(! args[2]) return A; + if(! args[2]) return M; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "integer?: 1 arg"], 1); }); - var C = [0, 0], D = [0, 1]; + var O = [0, 0], P = [0, 1]; register ("float?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 2 === a[0]){if(args[2]) break a; return D;} - if(! args[2]) return C; + if(typeof a !== "number" && 2 === a[0]){if(args[2]) break a; return P;} + if(! args[2]) return O; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "float?: 1 arg"], 1); }); - var E = [0, 0], F = [0, 1]; + var Q = [0, 0], R = [0, 1]; register ("string?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 3 === a[0]){if(args[2]) break a; return F;} - if(! args[2]) return E; + if(typeof a !== "number" && 3 === a[0]){if(args[2]) break a; return R;} + if(! args[2]) return Q; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "string?: 1 arg"], 1); }); - var G = [0, 0], H = [0, 1]; + var S = [0, 0], T = [0, 1]; register ("boolean?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 0 === a[0]){if(args[2]) break a; return H;} - if(! args[2]) return G; + if(typeof a !== "number" && 0 === a[0]){if(args[2]) break a; return T;} + if(! args[2]) return S; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "boolean?: 1 arg"], 1); }); - var I = [0, 0], J = [0, 1]; + var U = [0, 0], V = [0, 1]; register ("list?", function(args){ @@ -41486,49 +45877,73 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(args){ var a = args[1]; if(typeof a !== "number") - switch(a[0]){case 6:case 21: if(args[2]) break a; return J;} - if(! args[2]) return I; + switch(a[0]){case 6:case 21: if(args[2]) break a; return V;} + if(! args[2]) return U; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "list?: 1 arg"], 1); }); - var K = [0, 0], L = [0, 1]; + var W = [0, 0], X = [0, 1], Y = [0, 1]; register ("dict?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 7 === a[0]){if(args[2]) break a; return L;} - if(! args[2]) return K; + if(typeof a !== "number") + switch(a[0]){ + case 7: + if(args[2]) break a; return X; + case 38: + if(args[2]) break a; return Y; + } + if(! args[2]) return W; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "dict?: 1 arg"], 1); }); - var M = [0, 0], N = [0, 1]; + var Z = [0, 0], _ = [0, 1]; + register + ("adt?", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 38 === a[0]){if(args[2]) break a; return _;} + if(! args[2]) return Z; + } + throw caml_maybe_attach_backtrace([0, Sx_types[9], "adt?: 1 arg"], 1); + }); + var $ = [0, 0], aa = [0, 1]; register ("symbol?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 4 === a[0]){if(args[2]) break a; return N;} - if(! args[2]) return M; + if(typeof a !== "number" && 4 === a[0]){if(args[2]) break a; return aa;} + if(! args[2]) return $; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "symbol?: 1 arg"], 1); }); - var O = [0, 0], P = [0, 1]; + var ab = [0, 0], ac = [0, 1]; register ("keyword?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 5 === a[0]){if(args[2]) break a; return P;} - if(! args[2]) return O; + if(typeof a !== "number" && 5 === a[0]){if(args[2]) break a; return ac;} + if(! args[2]) return ab; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "keyword?: 1 arg"], 1); }); - var Q = [0, 1], R = [0, 0], S = [0, 0], T = [0, 1], U = [0, 0], V = [0, 1]; + var + ad = [0, 1], + ae = [0, 0], + af = [0, 0], + ag = [0, 1], + ah = [0, 0], + ai = [0, 1]; register ("empty?", function(args){ @@ -41542,9 +45957,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= { switch(a[0]){ case 3: - if(a[1] !== cst){if(args[2]) break a; return S;} + if(a[1] !== cst){if(args[2]) break a; return af;} if(args[2]) break a; - return T; + return ag; case 6: if(a[1]){if(args[2]) break a; break c;} if(args[2]) break a; @@ -41559,13 +45974,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= break; default: break b; } - return V; + return ai; } - return U; + return ah; } - if(0 === a){if(args[2]) break a; return Q;} + if(0 === a){if(args[2]) break a; return ad;} } - if(! args[2]) return R; + if(! args[2]) return ae; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "empty?: 1 arg"], 1); }); @@ -41694,7 +46109,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "string-contains?: 2 string args"], 1); }); - var W = [0, 0]; + var aj = [0, 0]; register ("starts-with?", function(args){ @@ -41724,9 +46139,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } } } - return W; + return aj; }); - var X = [0, 0]; + var ak = [0, 0]; register ("ends-with?", function(args){ @@ -41757,9 +46172,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } } } - return X; + return ak; }); - var Y = [2, -1.]; + var al = [2, -1.]; register ("index-of", function(args){ @@ -41782,7 +46197,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= hl = caml_ml_string_length(haystack), i = 0; for(;;){ - if(hl < (i + nl | 0)) return Y; + if(hl < (i + nl | 0)) return al; if(Stdlib_String[16].call(null, haystack, i, nl) === needle) return [2, i]; var i$0 = i + 1 | 0; @@ -41996,7 +46411,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } throw caml_maybe_attach_backtrace([0, Sx_types[9], "join: 2 args"], 1); }); - var Z = [0, [8, [0, 0, 3], 0, 0, 0], cst_g]; + var am = [0, [8, [0, 0, 3], 0, 0, 0], cst_g]; register ("replace", function(args){ @@ -42012,7 +46427,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var n$0 = t[1]; return Stdlib_Float[18].call(null, n$0) ? Stdlib[33].call(null, n$0 | 0) - : caml_call1(Stdlib_Printf[4].call(null, Z), n$0); + : caml_call1(Stdlib_Printf[4].call(null, am), n$0); case 12: var v = caml_call1(sx_trampoline_fn[1], t); if(typeof v !== "number" && 3 === v[0]){var s$0 = v[1]; return s$0;} @@ -42145,7 +46560,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "parse-number: 1 string arg"], 1); }); - var _ = [0, 0, 0]; + var an = [0, 0, 0]; register ("regex-match", function(args){ @@ -42180,7 +46595,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var exn = caml_wrap_exception(exn$0); if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); - groups[1] = Stdlib[37].call(null, groups[1], _); + groups[1] = Stdlib[37].call(null, groups[1], an); } var g = i + 1 | 0; if(d === i) break; @@ -42201,7 +46616,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "regex-match: pattern and input strings"], 1); }); - var $ = [0, 0]; + var ao = [0, 0]; register ("regex-match?", function(args){ @@ -42220,7 +46635,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= f = [0, Re[7].call(null, 0, 0, e, input)]; return f; } - catch(exn){return $;} + catch(exn){return ao;} } } } @@ -42386,11 +46801,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cst_args = " args", cst_len = "len", - aa = [0, [11, "len: ", [4, 0, 0, 0, [11, cst_args, 0]]], "len: %d args"], - ab = [1, 0], - ac = [1, 1], - ad = [1, 1], - ae = [1, 0]; + ap = [0, [11, "len: ", [4, 0, 0, 0, [11, cst_args, 0]]], "len: %d args"], + aq = [1, 0], + ar = [1, 1], + as = [1, 1], + at = [1, 0]; register (cst_len, function(args){ @@ -42402,7 +46817,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number"){ switch(a[0]){ case 0: - if(a[1]){if(args[2]) break a; return ac;} + if(a[1]){if(args[2]) break a; return ar;} if(args[2]) break a; break b; case 3: @@ -42431,7 +46846,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var e = a[1][1]; if(args[2]) break a; var l = e; break; case 1: case 2: - if(args[2]) break a; return ad; + if(args[2]) break a; return as; case 4: case 5: case 8: @@ -42440,18 +46855,18 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 11: case 12: case 15: - if(args[2]) break a; return ae; + if(args[2]) break a; return at; default: break a; } return [1, Stdlib_List[1].call(null, l)]; } if(0 !== a || args[2]) break a; } - return ab; + return aq; } var b = Stdlib_List[1].call(null, args), - c = caml_call1(Stdlib_Printf[4].call(null, aa), b); + c = caml_call1(Stdlib_Printf[4].call(null, ap), b); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); }); register("length", Stdlib_Hashtbl[6].call(null, primitives, cst_len)); @@ -42487,7 +46902,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } if(! args[2]){ var - c = Sx_types[112].call(null, x), + c = Sx_types[117].call(null, x), d = Stdlib[28].call(null, "first: expected list, got ", c); throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); } @@ -42495,7 +46910,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "first: 1 list arg"], 1); }); - var af = [6, 0], ag = [6, 0]; + var au = [6, 0], av = [6, 0]; register ("rest", function(args){ @@ -42518,11 +46933,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= break; default: break a; } - return ag; + return av; } return [6, xs]; } - if(0 === a && ! args[2]) return af; + if(0 === a && ! args[2]) return au; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "rest: 1 list arg"], 1); @@ -42550,7 +46965,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "last: 1 list arg"], 1); }); - var ah = [6, 0]; + var aw = [6, 0]; register ("init", function(args){ @@ -42566,7 +46981,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= default: break a; } var match = Stdlib_List[10].call(null, l); - if(! match) return ah; + if(! match) return aw; var rest = match[2]; return [6, Stdlib_List[10].call(null, rest)]; } @@ -42955,7 +47370,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "contains?: 2 args"], 1); }); - var ai = [6, 0], aj = [6, 0]; + var ax = [6, 0], ay = [6, 0]; register ("range", function(args){ @@ -42986,7 +47401,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= && 1 === stop_v[0] && typeof step_v !== "number" && 1 === step_v[0]){ var st$0 = step_v[1], e$0 = stop_v[1], s$0 = start_v[1]; - if(0 === st$0) return aj; + if(0 === st$0) return ay; var b = 0; if(0 < st$0){ var i = s$0, items = b; @@ -43012,7 +47427,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= s = as_number(start_v), e = as_number(stop_v), st = as_number(step_v); - if(st === 0.) return ai; + if(st === 0.) return ax; var a = 0; if(0. < st){ var i$1 = s, items$2 = a; @@ -43338,7 +47753,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[44].call (null, function(x){ - var key = Sx_types[112].call(null, x); + var key = Sx_types[117].call(null, x); return Stdlib_Hashtbl[9].call(null, seen, key) ? 0 : (Stdlib_Hashtbl[11].call(null, seen, key, 1), 1); @@ -43353,7 +47768,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register (cst_dict, function(args){ - var d = Sx_types[105].call(null, 0), param = args; + var d = Sx_types[109].call(null, 0), param = args; for(;;){ if(! param) return [7, d]; var a = param[1]; @@ -43363,7 +47778,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = param[2]; if(match){ var rest = match[2], v = match[1], k = a[1]; - Sx_types[108].call(null, d, k, v); + Sx_types[112].call(null, d, k, v); param = rest; continue; } @@ -43372,7 +47787,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match$0 = param[2]; if(match$0){ var rest$0 = match$0[2], v$0 = match$0[1], k$0 = a[1]; - Sx_types[108].call(null, d, k$0, v$0); + Sx_types[112].call(null, d, k$0, v$0); param = rest$0; continue; } @@ -43414,11 +47829,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 3: if(b[2]) break a; var k = c[1]; - return Sx_types[106].call(null, d, k); + return Sx_types[110].call(null, d, k); case 5: if(b[2]) break a; var k$0 = c[1]; - return Sx_types[106].call(null, d, k$0); + return Sx_types[110].call(null, d, k$0); default: break b; } case 21: @@ -43458,13 +47873,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 3: if(! a[2]){ var k = b[1]; - return [0, Sx_types[107].call(null, d, k)]; + return [0, Sx_types[111].call(null, d, k)]; } break; case 5: if(! a[2]){ var k$0 = b[1]; - return [0, Sx_types[107].call(null, d, k$0)]; + return [0, Sx_types[111].call(null, d, k$0)]; } break; } @@ -43543,7 +47958,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("merge", function(args){ - var d = Sx_types[105].call(null, 0); + var d = Sx_types[109].call(null, 0); Stdlib_List[18].call (null, function(param){ @@ -43569,7 +47984,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]){ var d = a[1]; - return [6, Sx_types[110].call(null, d)]; + return [6, Sx_types[114].call(null, d)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[9], "keys: 1 dict"], 1); @@ -43581,7 +47996,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[1]; if(typeof a !== "number" && 7 === a[0] && ! args[2]){ var d = a[1]; - return [6, Sx_types[111].call(null, d)]; + return [6, Sx_types[115].call(null, d)]; } } throw caml_maybe_attach_backtrace([0, Sx_types[9], "vals: 1 dict"], 1); @@ -43639,7 +48054,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var e = a[2]; if(e && ! e[2]){ var v = e[1], k = b[1]; - Sx_types[108].call(null, d, k, v); + Sx_types[112].call(null, d, k, v); return v; } break; @@ -43647,7 +48062,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var f = a[2]; if(f && ! f[2]){ var v$0 = f[1], k$0 = b[1]; - Sx_types[108].call(null, d, k$0, v$0); + Sx_types[112].call(null, d, k$0, v$0); return v$0; } break; @@ -43670,12 +48085,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof b !== "number") switch(b[0]){ case 3: - if(! a[2]){var k = b[1]; return Sx_types[106].call(null, d, k);} + if(! a[2]){var k = b[1]; return Sx_types[110].call(null, d, k);} break; case 5: if(! a[2]){ var k$0 = b[1]; - return Sx_types[106].call(null, d, k$0); + return Sx_types[110].call(null, d, k$0); } break; } @@ -43696,7 +48111,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var c = b[1]; if(typeof c !== "number" && 3 === c[0] && ! b[2]){ var k = c[1], d = a[1]; - return [0, Sx_types[107].call(null, d, k)]; + return [0, Sx_types[111].call(null, d, k)]; } } } @@ -43715,7 +48130,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var c = b[1]; if(typeof c !== "number" && 3 === c[0] && ! b[2]){ var k = c[1], d = a[1]; - Sx_types[109].call(null, d, k); + Sx_types[113].call(null, d, k); return 0; } } @@ -43729,7 +48144,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var a = args[1]; - return [3, Sx_types[57].call(null, a)]; + return [3, Sx_types[61].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "type-of: 1 arg"], 1); }); @@ -43738,21 +48153,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var a = args[1]; - return [3, Sx_types[112].call(null, a)]; + return [3, Sx_types[117].call(null, a)]; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "inspect: 1 arg"], 1); }); var cst_s = "~%s", - ak = [3, ""], - al = [0, [12, 126, [2, 0, 0]], cst_s], - am = [0, [12, 126, [2, 0, 0]], cst_s], - an = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], - ao = + az = [3, ""], + aA = [0, [12, 126, [2, 0, 0]], cst_s], + aB = [0, [12, 126, [2, 0, 0]], cst_s], + aC = [0, [12, 58, [2, 0, [12, 32, [2, 0, 0]]]], ":%s %s"], + aD = [0, [11, "(make-spread {", [2, 0, [11, "})", 0]]], "(make-spread {%s})"], - ap = [0, [11, "#<", [2, 0, [12, 62, 0]]], "#<%s>"], - aq = [0, [11, "#"], - ar = [0, [11, "#(", [2, 0, [12, 41, 0]]], "#(%s)"]; + aE = [0, [11, "#<", [2, 0, [12, 62, 0]]], "#<%s>"], + aF = [0, [11, "#"], + aG = [0, [11, "#(", [2, 0, [12, 41, 0]]], "#(%s)"]; register ("serialize", function(args){ @@ -43762,15 +48177,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number") switch(a[0]){ case 8: - if(args[2]) break a; return ak; + if(args[2]) break a; return az; case 9: if(args[2]) break a; var c = a[1], b = c[1]; - return [3, caml_call1(Stdlib_Printf[4].call(null, al), b)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, aA), b)]; case 10: if(args[2]) break a; var i = a[1], d = i[1]; - return [3, caml_call1(Stdlib_Printf[4].call(null, am), d)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, aB), d)]; case 17: if(args[2]) break a; var s = a[1]; return [3, s]; case 18: @@ -43784,34 +48199,34 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var v = param[2], k = param[1], - a = Sx_types[112].call(null, v); - return caml_call2(Stdlib_Printf[4].call(null, an), k, a); + a = Sx_types[117].call(null, v); + return caml_call2(Stdlib_Printf[4].call(null, aC), k, a); }, pairs), - e = Stdlib_String[7].call(null, cst$0, dict_parts); - return [3, caml_call1(Stdlib_Printf[4].call(null, ao), e)]; + e = Stdlib_String[7].call(null, cst$1, dict_parts); + return [3, caml_call1(Stdlib_Printf[4].call(null, aD), e)]; case 19: if(args[2]) break a; var s$0 = a[1]; return [3, s$0]; case 27: if(args[2]) break a; var r = a[1], f = r[1][1]; - return [3, caml_call1(Stdlib_Printf[4].call(null, ap), f)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, aE), f)]; case 28: if(args[2]) break a; var p = a[1], g = p[1]; - return [3, caml_call1(Stdlib_Printf[4].call(null, aq), g)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, aF), g)]; case 29: if(args[2]) break a; var arr = a[1], h = Stdlib_Array[14].call - (null, function(v){return Sx_types[112].call(null, v);}, arr), + (null, function(v){return Sx_types[117].call(null, v);}, arr), elts = Stdlib_Array[10].call(null, h), - j = Stdlib_String[7].call(null, cst$0, elts); - return [3, caml_call1(Stdlib_Printf[4].call(null, ar), j)]; + j = Stdlib_String[7].call(null, cst$1, elts); + return [3, caml_call1(Stdlib_Printf[4].call(null, aG), j)]; } - if(! args[2]) return [3, Sx_types[112].call(null, a)]; + if(! args[2]) return [3, Sx_types[117].call(null, a)]; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "serialize: 1 arg"], 1); @@ -43864,6 +48279,27 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "host-error: 1 arg"], 1); }); + register + ("host-warn", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + if(args[2]) break a; + var msg = a[1]; + Stdlib[53].call(null, msg); + return 0; + } + if(! args[2]){ + var b = to_string(a); + Stdlib[53].call(null, b); + return 0; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "host-warn: 1 arg"], 1); + }); register ("try-catch", function(args){ @@ -43938,19 +48374,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("clear-stores", function(args){Stdlib_Hashtbl[2].call(null, store_registry); return 0;}); - var as = [0, 1], at = [0, 1], au = [6, 0], av = [6, 0]; + var aH = [0, 1], aI = [0, 1], aJ = [6, 0], aK = [6, 0]; register ("resource", function(args){ var state = Stdlib_Hashtbl[1].call(null, 0, 8); - Stdlib_Hashtbl[11].call(null, state, "loading", as); + Stdlib_Hashtbl[11].call(null, state, "loading", aH); Stdlib_Hashtbl[11].call(null, state, "data", 0); Stdlib_Hashtbl[11].call(null, state, cst_error, 0); var sig_d = Stdlib_Hashtbl[1].call(null, 0, 8); - Stdlib_Hashtbl[11].call(null, sig_d, cst_signal, at); + Stdlib_Hashtbl[11].call(null, sig_d, cst_signal, aI); Stdlib_Hashtbl[11].call(null, sig_d, cst_value, [7, state]); - Stdlib_Hashtbl[11].call(null, sig_d, "subscribers", au); - Stdlib_Hashtbl[11].call(null, sig_d, "deps", av); + Stdlib_Hashtbl[11].call(null, sig_d, "subscribers", aJ); + Stdlib_Hashtbl[11].call(null, sig_d, "deps", aK); return [7, sig_d]; }); register @@ -44059,15 +48495,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-spread: 1 dict"], 1); }); - var aw = [0, 0], ax = [0, 1]; + var aL = [0, 0], aM = [0, 1]; register ("spread?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 18 === a[0]){if(args[2]) break a; return ax;} - if(! args[2]) return aw; + if(typeof a !== "number" && 18 === a[0]){if(args[2]) break a; return aM;} + if(! args[2]) return aL; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "spread?: 1 arg"], 1); }); @@ -44077,12 +48513,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(args){ var a = args[1]; if(typeof a !== "number" && 18 === a[0] && ! args[2]){ - var pairs = a[1], d = Sx_types[105].call(null, 0); + var pairs = a[1], d = Sx_types[109].call(null, 0); Stdlib_List[18].call (null, function(param){ var v = param[2], k = param[1]; - return Sx_types[108].call(null, d, k, v); + return Sx_types[112].call(null, d, k, v); }, pairs); return [7, d]; @@ -44099,7 +48535,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = caml_call2(sx_call_fn[1], f, args); return caml_call1(sx_trampoline_fn[1], a); } - var ay = [6, 0]; + var aN = [6, 0]; register ("map", function(args){ @@ -44109,7 +48545,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(b){ var a = b[1], f = args[1]; if(typeof a === "number"){ - if(0 === a && ! b[2]) return ay; + if(0 === a && ! b[2]) return aN; } else{ switch(a[0]){ @@ -44129,7 +48565,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "map: expected (fn list)"], 1); }); - var az = [6, 0]; + var aO = [6, 0]; register ("map-indexed", function(args){ @@ -44139,7 +48575,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(b){ var a = b[1], f = args[1]; if(typeof a === "number"){ - if(0 === a && ! b[2]) return az; + if(0 === a && ! b[2]) return aO; } else{ switch(a[0]){ @@ -44161,7 +48597,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "map-indexed: expected (fn list)"], 1); }); - var aA = [6, 0]; + var aP = [6, 0]; register ("filter", function(args){ @@ -44171,7 +48607,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(b){ var a = b[1], f = args[1]; if(typeof a === "number"){ - if(0 === a && ! b[2]) return aA; + if(0 === a && ! b[2]) return aP; } else{ switch(a[0]){ @@ -44187,7 +48623,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(x){ var a = call_any(f, [0, x, 0]); - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, items)]; } @@ -44197,8 +48633,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "filter: expected (fn list)"], 1); }); var - cst$2 = ", ", - aB = + cst$4 = ", ", + aQ = [0, [11, "for-each: expected (fn list), got (", @@ -44234,10 +48670,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var c = Stdlib_List[20].call - (null, function(v){return Sx_types[57].call(null, v);}, args), - types = Stdlib_String[7].call(null, cst$2, c), + (null, function(v){return Sx_types[61].call(null, v);}, args), + types = Stdlib_String[7].call(null, cst$4, c), d = Stdlib_List[1].call(null, args), - e = caml_call2(Stdlib_Printf[4].call(null, aB), types, d); + e = caml_call2(Stdlib_Printf[4].call(null, aQ), types, d); throw caml_maybe_attach_backtrace([0, Sx_types[9], e], 1); }); register @@ -44271,7 +48707,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "reduce: expected (fn init list)"], 1); }); - var aC = [0, 0], aD = [0, 0]; + var aR = [0, 0], aS = [0, 0]; register ("some", function(args){ @@ -44281,7 +48717,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(b){ var a = b[1], f = args[1]; if(typeof a === "number"){ - if(0 === a && ! b[2]) return aC; + if(0 === a && ! b[2]) return aR; } else{ switch(a[0]){ @@ -44294,9 +48730,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(! b[2]){ var param = items; for(;;){ - if(! param) return aD; + if(! param) return aS; var rest = param[2], x = param[1], result = call_any(f, [0, x, 0]); - if(Sx_types[67].call(null, result)) return result; + if(Sx_types[71].call(null, result)) return result; param = rest; } } @@ -44306,7 +48742,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "some: expected (fn list)"], 1); }); - var aE = [0, 1]; + var aT = [0, 1]; register ("every?", function(args){ @@ -44316,7 +48752,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(b){ var a = b[1], f = args[1]; if(typeof a === "number"){ - if(0 === a && ! b[2]) return aE; + if(0 === a && ! b[2]) return aT; } else{ switch(a[0]){ @@ -44332,7 +48768,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(x){ var a = call_any(f, [0, x, 0]); - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, items)]; } @@ -44437,7 +48873,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "vm-stack-copy!: expected (src dst count)"], 1); }); - var aF = [0, 0]; + var aU = [0, 0]; register ("primitive?", function(args){ @@ -44448,37 +48884,37 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [0, Stdlib_Hashtbl[9].call(null, primitives, name)]; } } - return aF; + return aU; }); - var aG = [0, 0], aH = [0, 1]; + var aV = [0, 0], aW = [0, 1]; register ("lambda?", function(args){ if(args){ var a = args[1]; - if(typeof a !== "number" && 8 === a[0] && ! args[2]) return aH; + if(typeof a !== "number" && 8 === a[0] && ! args[2]) return aW; } - return aG; + return aV; }); - var aI = [0, 0], aJ = [0, 1]; + var aX = [0, 0], aY = [0, 1]; register ("island?", function(args){ if(args){ var a = args[1]; - if(typeof a !== "number" && 10 === a[0] && ! args[2]) return aJ; + if(typeof a !== "number" && 10 === a[0] && ! args[2]) return aY; } - return aI; + return aX; }); - var aK = [0, 0]; + var aZ = [0, 0]; register ("record?", function(args){ if(args && ! args[2]){ var v = args[1]; - return Sx_types[96].call(null, v); + return Sx_types[100].call(null, v); } - return aK; + return aZ; }); register ("make-rtd", @@ -44489,7 +48925,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var b = a[2]; if(b && ! b[2]){ var ctor_params = b[1], fields = a[1], name = args[1]; - return Sx_types[91].call(null, name, fields, ctor_params); + return Sx_types[95].call(null, name, fields, ctor_params); } } } @@ -44504,7 +48940,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[2]; if(a && ! a[2]){ var arg_list = a[1], uid = args[1]; - return Sx_types[92].call(null, uid, arg_list); + return Sx_types[96].call(null, uid, arg_list); } } throw caml_maybe_attach_backtrace @@ -44517,7 +48953,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[2]; if(a && ! a[2]){ var idx = a[1], v = args[1]; - return Sx_types[93].call(null, v, idx); + return Sx_types[97].call(null, v, idx); } } throw caml_maybe_attach_backtrace @@ -44532,7 +48968,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var b = a[2]; if(b && ! b[2]){ var nv = b[1], idx = a[1], v = args[1]; - return Sx_types[94].call(null, v, idx, nv); + return Sx_types[98].call(null, v, idx, nv); } } } @@ -44540,7 +48976,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "record-set!: expected (record index value)"], 1); }); - var aL = [0, 0]; + var a0 = [0, 0]; register ("record-type?", function(args){ @@ -44548,17 +48984,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[2]; if(a && ! a[2]){ var uid = a[1], v = args[1]; - return Sx_types[95].call(null, v, uid); + return Sx_types[99].call(null, v, uid); } } - return aL; + return a0; }); register ("make-record-constructor", function(args){ if(args && ! args[2]){ var uid = args[1]; - return Sx_types[97].call(null, uid); + return Sx_types[101].call(null, uid); } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-record-constructor: expected (uid)"], 1); @@ -44568,7 +49004,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var uid = args[1]; - return Sx_types[98].call(null, uid); + return Sx_types[102].call(null, uid); } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-record-predicate: expected (uid)"], 1); @@ -44578,7 +49014,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var idx = args[1]; - return Sx_types[99].call(null, idx); + return Sx_types[103].call(null, idx); } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-record-accessor: expected (index)"], 1); @@ -44588,7 +49024,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var idx = args[1]; - return Sx_types[100].call(null, idx); + return Sx_types[104].call(null, idx); } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-record-mutator: expected (index)"], 1); @@ -44622,17 +49058,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-parameter: expected 1-2 args"], 1); }); - var aM = [0, 0], aN = [0, 0], aO = [0, 1]; + var a1 = [0, 0], a2 = [0, 0], a3 = [0, 1]; register ("parameter?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 28 === a[0]){if(args[2]) break a; return aO;} - if(! args[2]) return aN; + if(typeof a !== "number" && 28 === a[0]){if(args[2]) break a; return a3;} + if(! args[2]) return a2; } - return aM; + return a1; }); register ("parameter-uid", @@ -44689,15 +49125,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("vector", function(args){return [29, Stdlib_Array[11].call(null, args)];}); - var aP = [0, 0], aQ = [0, 1]; + var a4 = [0, 0], a5 = [0, 1]; register ("vector?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 29 === a[0]){if(args[2]) break a; return aQ;} - if(! args[2]) return aP; + if(typeof a !== "number" && 29 === a[0]){if(args[2]) break a; return a5;} + if(! args[2]) return a4; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "vector?: 1 arg"], 1); }); @@ -44713,7 +49149,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }); var cst_out_of_bounds_length = " out of bounds (length ", - aR = + a6 = [0, [11, "vector-ref: index ", @@ -44739,7 +49175,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= d = c || arr.length - 1 <= i; if(! d) return caml_check_bound(arr, i)[i + 1]; var - e = caml_call2(Stdlib_Printf[4].call(null, aR), i, arr.length - 1); + e = caml_call2(Stdlib_Printf[4].call(null, a6), i, arr.length - 1); throw caml_maybe_attach_backtrace([0, Sx_types[9], e], 1); } } @@ -44748,7 +49184,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "vector-ref: expected (vector index)"], 1); }); var - aS = + a7 = [0, [11, "vector-set!: index ", @@ -44777,7 +49213,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e = d || arr.length - 1 <= i; if(e){ var - f = caml_call2(Stdlib_Printf[4].call(null, aS), i, arr.length - 1); + f = caml_call2(Stdlib_Printf[4].call(null, a7), i, arr.length - 1); throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); } caml_check_bound(arr, i)[i + 1] = v; @@ -44879,15 +49315,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("make-string-buffer", function(param){return [30, Stdlib_Buffer[1].call(null, 64)];}); - var aT = [0, 0], aU = [0, 1]; + var a8 = [0, 0], a9 = [0, 1]; register ("string-buffer?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 30 === a[0]){if(args[2]) break a; return aU;} - if(! args[2]) return aT; + if(typeof a !== "number" && 30 === a[0]){if(args[2]) break a; return a9;} + if(! args[2]) return a8; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "string-buffer?: expected 1 arg"], 1); @@ -44910,7 +49346,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } if(! a[2]){ var - c = Sx_types[57].call(null, v), + c = Sx_types[61].call(null, v), d = Stdlib[28].call (null, "string-buffer-append!: expected string, got ", c); @@ -44951,6 +49387,113 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "string-buffer-length: expected (buffer)"], 1); }); + register + ("make-buffer", + function(param){return [30, Stdlib_Buffer[1].call(null, 64)];}); + var a_ = [0, 0], a$ = [0, 1]; + register + ("buffer?", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 30 === a[0]){if(args[2]) break a; return a$;} + if(! args[2]) return a_; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "buffer?: expected 1 arg"], 1); + }); + register + ("buffer-append!", + function(args){ + a: + if(args){ + var b = args[1]; + if(typeof b !== "number" && 30 === b[0]){ + var a = args[2]; + if(a){ + var v = a[1], buf = b[1]; + if(typeof v === "number"){ + if(0 === v){ + if(a[2]) break a; + Stdlib_Buffer[16].call(null, buf, cst); + return 0; + } + } + else + switch(v[0]){ + case 0: + if(v[1]){ + if(a[2]) break a; + Stdlib_Buffer[16].call(null, buf, cst_true); + return 0; + } + if(a[2]) break a; + Stdlib_Buffer[16].call(null, buf, cst_false); + return 0; + case 1: + if(a[2]) break a; + var n = v[1], d = Stdlib[33].call(null, n); + Stdlib_Buffer[16].call(null, buf, d); + return 0; + case 2: + if(a[2]) break a; + var n$0 = v[1], e = Sx_types[34].call(null, n$0); + Stdlib_Buffer[16].call(null, buf, e); + return 0; + case 3: + if(a[2]) break a; + var s = v[1]; + Stdlib_Buffer[16].call(null, buf, s); + return 0; + case 4: + if(a[2]) break a; + var s$0 = v[1]; + Stdlib_Buffer[16].call(null, buf, s$0); + return 0; + case 32: + if(a[2]) break a; + var n$1 = v[1], f = Stdlib_Uchar[8].call(null, n$1); + Stdlib_Buffer[13].call(null, buf, f); + return 0; + } + if(! a[2]){ + var c = Sx_types[117].call(null, v); + Stdlib_Buffer[16].call(null, buf, c); + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "buffer-append!: expected (buffer value)"], 1); + }); + register + ("buffer->string", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 30 === a[0] && ! args[2]){ + var buf = a[1]; + return [3, Stdlib_Buffer[2].call(null, buf)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "buffer->string: expected (buffer)"], 1); + }); + register + ("buffer-length", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 30 === a[0] && ! args[2]){ + var buf = a[1]; + return [1, Stdlib_Buffer[7].call(null, buf)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "buffer-length: expected (buffer)"], 1); + }); var cap_stack = [0, 0]; register ("with-capabilities", @@ -45043,7 +49586,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[20].call (null, function(s){return [3, s];}, cap_stack[1])]; }); - var aV = [0, 1], aW = [0, 1]; + var ba = [0, 1], bb = [0, 1]; register ("has-capability?", function(args){ @@ -45052,14 +49595,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number" && a[0] - 3 >>> 0 < 3 && ! args[2]){ var cap = a[1]; return 0 === cap_stack[1] - ? aW + ? bb : [0, Stdlib_List[37].call(null, cap, cap_stack[1])]; } } - return aV; + return ba; }); var - aX = + bc = [0, [11, "Capability '", @@ -45077,8 +49620,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(0 === cap_stack[1]) return 0; if(Stdlib_List[37].call(null, cap, cap_stack[1])) return 0; var - b = Stdlib_String[7].call(null, cst$2, cap_stack[1]), - c = caml_call2(Stdlib_Printf[4].call(null, aX), cap, b); + b = Stdlib_String[7].call(null, cst$4, cap_stack[1]), + c = caml_call2(Stdlib_Printf[4].call(null, bc), cap, b); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } } @@ -45087,7 +49630,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("capability-restricted?", function(args){return [0, 0 !== cap_stack[1] ? 1 : 0];}); - var aY = [0, 0], aZ = [0, 1], a0 = [0, 1]; + var bd = [0, 0], be = [0, 1], bf = [0, 1]; register ("is-else-clause?", function(args){ @@ -45096,14 +49639,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number") switch(a[0]){ case 0: - if(a[1] && ! args[2]) return aZ; break; + if(a[1] && ! args[2]) return be; break; case 5: - if(a[1] === "else" && ! args[2]) return a0; break; + if(a[1] === "else" && ! args[2]) return bf; break; } } - return aY; + return bd; }); - var a1 = [0, 0]; + var bg = [0, 0]; register ("cond-scheme?", function(args){ @@ -45124,9 +49667,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= clauses)]; } } - return a1; + return bg; }); - var a2 = [0, 0], a3 = [0, 1], a4 = [0, 1]; + var bh = [0, 0], bi = [0, 1], bj = [0, 1]; register ("component?", function(args){ @@ -45135,12 +49678,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number") switch(a[0]){ case 9: - if(! args[2]) return a3; break; + if(! args[2]) return bi; break; case 10: - if(! args[2]) return a4; break; + if(! args[2]) return bj; break; } } - return a2; + return bh; }); register ("lambda-closure", @@ -45166,7 +49709,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }); - var a5 = [0, 0]; + var bk = [0, 0]; register ("component-has-children?", function(args){ @@ -45180,7 +49723,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(! args[2]){var i = a[1]; return [0, i[3]];} break; } } - return a5; + return bk; }); register ("component-name", @@ -45197,7 +49740,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }); - var a6 = [6, 0]; + var bl = [6, 0]; register ("component-params", function(args){ @@ -45223,7 +49766,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= break; } } - return a6; + return bl; }); register ("component-body", @@ -45245,7 +49788,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ if(args && ! args[2]){ var v = args[1]; - return Sx_types[76].call(null, v); + return Sx_types[80].call(null, v); } return 0; }); @@ -45256,20 +49799,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[2]; if(a && ! a[2]){ var f = a[1], v = args[1]; - return Sx_types[77].call(null, v, f); + return Sx_types[81].call(null, v, f); } } return 0; }); - var a7 = [0, 0], a8 = [0, 1]; + var bm = [0, 0], bn = [0, 1]; register ("macro?", function(args){ if(args){ var a = args[1]; - if(typeof a !== "number" && 11 === a[0] && ! args[2]) return a8; + if(typeof a !== "number" && 11 === a[0] && ! args[2]) return bn; } - return a7; + return bm; }); register ("for-each-indexed", @@ -45300,7 +49843,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "for-each-indexed: expected (fn list)"], 1); }); - var a9 = [6, 0]; + var bo = [6, 0]; register ("lambda-params", function(args){ @@ -45312,7 +49855,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[20].call(null, function(s){return [3, s];}, l[1])]; } } - return a9; + return bo; }); register ("lambda-body", @@ -45323,7 +49866,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }); - var a_ = [0, 1]; + var bp = [0, 1]; register ("empty-dict?", function(args){ @@ -45334,7 +49877,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [0, 0 === Stdlib_Hashtbl[15].call(null, d) ? 1 : 0]; } } - return a_; + return bp; }); register ("make-raw-html", @@ -45345,7 +49888,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }); - var a$ = [3, cst]; + var bq = [3, cst]; register ("raw-html-content", function(args){ @@ -45353,7 +49896,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[1]; if(typeof a !== "number" && 17 === a[0] && ! args[2]){var s = a[1]; return [3, s];} } - return a$; + return bq; }); var cst_VM_undefined = "VM undefined: "; register @@ -45432,13 +49975,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register("set-cookie", function(args){return 0;}); var cst_depth = " depth=", - cst$1 = "->", + cst$3 = "->", cst_scope_push = "scope-push!", - ba = + br = [0, [11, "PUSH ", - [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$1, [4, 0, 0, 0, 0]]]]]], + [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$3, [4, 0, 0, 0, 0]]]]]], "PUSH %s depth=%d->%d"]; register (cst_scope_push, @@ -45463,7 +50006,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= d = Stdlib_List[1].call(null, stack) + 1 | 0, e = Stdlib_List[1].call(null, stack); scope_log[1] = - [0, caml_call3(Stdlib_Printf[4].call(null, ba), name, e, d), c]; + [0, caml_call3(Stdlib_Printf[4].call(null, br), name, e, d), c]; } Stdlib_Hashtbl[11].call(null, scope_stacks, name, [0, value, stack]); return 0; @@ -45474,11 +50017,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }); var cst_scope_pop = "scope-pop!", - bb = + bs = [0, [11, "POP ", - [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$1, [4, 0, 0, 0, 0]]]]]], + [2, 0, [11, cst_depth, [4, 0, 0, 0, [11, cst$3, [4, 0, 0, 0, 0]]]]]], "POP %s depth=%d->%d"]; register (cst_scope_pop, @@ -45502,7 +50045,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= d = Stdlib[17].call(null, 0, c), e = Stdlib_List[1].call(null, stack); scope_log[1] = - [0, caml_call3(Stdlib_Printf[4].call(null, bb), name, e, d), b]; + [0, caml_call3(Stdlib_Printf[4].call(null, bs), name, e, d), b]; } if(stack){ var rest = stack[2]; @@ -45515,7 +50058,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }); var cst_found = " found=", - bc = + bt = [0, [11, "PEEK ", @@ -45541,7 +50084,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= scope_log[1] = [0, caml_call3 - (Stdlib_Printf[4].call(null, bc), name, c, 0 !== stack ? 1 : 0), + (Stdlib_Printf[4].call(null, bt), name, c, 0 !== stack ? 1 : 0), b]; } if(! stack) return 0; @@ -45553,7 +50096,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }); var cst_context = "context", - bd = + bu = [0, [11, "CTX ", @@ -45579,7 +50122,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= scope_log[1] = [0, caml_call3 - (Stdlib_Printf[4].call(null, bd), name, b, 0 !== stack ? 1 : 0), + (Stdlib_Printf[4].call(null, bu), name, b, 0 !== stack ? 1 : 0), a]; } if(stack){var v = stack[1]; return v;} @@ -45591,8 +50134,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; }); var - be = [3, "bad args"], - bf = + bv = [3, "bad args"], + bw = [0, [11, "name=", @@ -45626,10 +50169,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 0), b = Stdlib_String[7].call(null, ",", all_keys), c = Stdlib_List[1].call(null, stack); - return [3, caml_call3(Stdlib_Printf[4].call(null, bf), name, c, b)]; + return [3, caml_call3(Stdlib_Printf[4].call(null, bw), name, c, b)]; } } - return be; + return bv; }); register ("collect!", @@ -45668,7 +50211,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }); - var cst_collected = "collected", bg = [6, 0], bh = [6, 0]; + var cst_collected = "collected", bx = [6, 0], by = [6, 0]; register (cst_collected, function(args){ @@ -45688,15 +50231,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = stack[1]; if(typeof match !== "number" && 6 === match[0]){var items = match[1]; return [6, items];} } - return bh; + return by; } } - return bg; + return bx; }); var cst_clear_collected = "clear-collected!", - bi = [6, 0], - bj = [0, [6, 0], 0]; + bz = [6, 0], + bA = [0, [6, 0], 0]; register (cst_clear_collected, function(args){ @@ -45714,10 +50257,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } if(stack){ var rest = stack[2]; - Stdlib_Hashtbl[11].call(null, scope_stacks, name, [0, bi, rest]); + Stdlib_Hashtbl[11].call(null, scope_stacks, name, [0, bz, rest]); } else - Stdlib_Hashtbl[11].call(null, scope_stacks, name, bj); + Stdlib_Hashtbl[11].call(null, scope_stacks, name, bA); return 0; } } @@ -45774,7 +50317,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; }); var - bk = + bB = [0, [11, "provide-set!: '", [2, 0, [11, "' is not a reactive provide", 0]]], "provide-set!: '%s' is not a reactive provide"]; @@ -45805,7 +50348,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; } } - var c = caml_call1(Stdlib_Printf[4].call(null, bk), name); + var c = caml_call1(Stdlib_Printf[4].call(null, bB), name); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } } @@ -46057,7 +50600,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var fn = match[1]; return caml_call1(fn, args); }); - var cst_emitted = "emitted", bl = [6, 0], bm = [6, 0]; + var cst_emitted = "emitted", bC = [6, 0], bD = [6, 0]; register (cst_emitted, function(args){ @@ -46077,26 +50620,26 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = stack[1]; if(typeof match !== "number" && 6 === match[0]){var items = match[1]; return [6, items];} } - return bm; + return bD; } } - return bl; + return bC; }); - var bn = [6, 0]; + var bE = [6, 0]; register ("scope-emitted", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_emitted); - if(! match) return bn; + if(! match) return bE; var fn = match[1]; return caml_call1(fn, args); }); - var bo = [6, 0]; + var bF = [6, 0]; register ("scope-collected", function(args){ var match = Stdlib_Hashtbl[7].call(null, primitives, cst_collected); - if(! match) return bo; + if(! match) return bF; var fn = match[1]; return caml_call1(fn, args); }); @@ -46138,10 +50681,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var regex_table = Stdlib_Hashtbl[1].call(null, 0, 32), cst_id = "id", - bp = [0, 1]; + bG = [0, 1]; function make_regex_value(id, source, flags){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); - Stdlib_Hashtbl[11].call(null, d, "__regex__", bp); + Stdlib_Hashtbl[11].call(null, d, "__regex__", bG); Stdlib_Hashtbl[11].call(null, d, cst_id, [2, id]); Stdlib_Hashtbl[11].call(null, d, "source", [3, source]); Stdlib_Hashtbl[11].call(null, d, "flags", [3, flags]); @@ -46500,7 +51043,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 3: var s$0 = v[1]; return s$0; } - return Sx_types[112].call(null, v); + return Sx_types[117].call(null, v); }, global = Stdlib_String[15].call(null, flags, 103); if(global) return [3, Re[91].call(null, 0, 0, 0, re, call_fn, s)]; @@ -46599,15 +51142,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); } } + var cst_end = "end", cst_start = "start"; function match_dict(g, input){ var d = Stdlib_Hashtbl[1].call(null, 0, 4), e = [3, caml_call2(Re[1][1], g, 0)]; Stdlib_Hashtbl[11].call(null, d, cst_match, e); var f = [1, caml_call2(Re[1][5], g, 0)]; - Stdlib_Hashtbl[11].call(null, d, "start", f); + Stdlib_Hashtbl[11].call(null, d, cst_start, f); var h = [1, caml_call2(Re[1][7], g, 0)]; - Stdlib_Hashtbl[11].call(null, d, "end", h); + Stdlib_Hashtbl[11].call(null, d, cst_end, h); Stdlib_Hashtbl[11].call(null, d, cst_input, [3, input]); var count = caml_call1(Re[1][12], g), b = count - 1 | 0, a = 0; if(b < 1) @@ -46648,15 +51192,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-regexp: (pattern [flags])"], 1); }); - var bq = [0, 0], br = [0, 1]; + var bH = [0, 0], bI = [0, 1]; register ("regexp?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 36 === a[0]){if(args[2]) break a; return br;} - if(! args[2]) return bq; + if(typeof a !== "number" && 36 === a[0]){if(args[2]) break a; return bI;} + if(! args[2]) return bH; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "regexp?: 1 arg"], 1); }); @@ -47031,17 +51575,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register ("make-hash-table", function(param){return [31, Stdlib_Hashtbl[1].call(null, 0, 16)];}); - var bs = [0, 0], bt = [0, 0], bu = [0, 1]; + var bJ = [0, 0], bK = [0, 0], bL = [0, 1]; register ("hash-table?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 31 === a[0]){if(args[2]) break a; return bu;} - if(! args[2]) return bt; + if(typeof a !== "number" && 31 === a[0]){if(args[2]) break a; return bL;} + if(! args[2]) return bK; } - return bs; + return bJ; }); register ("hash-table-set!", @@ -47245,9 +51789,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "hash-table-merge!: expected (dst src)"], 1); }); - var bv = [6, 0]; + var bM = [6, 0]; function seq_to_list(v){ - if(typeof v === "number"){if(0 === v) return bv;} + if(typeof v === "number"){if(0 === v) return bM;} else switch(v[0]){ case 3: @@ -47330,15 +51874,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cst_out_of_bounds = " out of bounds", cst_sequence_ref_index = "sequence-ref: index ", cst_sequence_ref_index_d_out_o = "sequence-ref: index %d out of bounds", - bw = + bN = [0, [11, cst_sequence_ref_index, [4, 0, 0, 0, [11, cst_out_of_bounds, 0]]], cst_sequence_ref_index_d_out_o], - bx = + bO = [0, [11, cst_sequence_ref_index, [4, 0, 0, 0, [11, cst_out_of_bounds, 0]]], cst_sequence_ref_index_d_out_o], - by = + bP = [0, [11, cst_sequence_ref_index, [4, 0, 0, 0, [11, cst_out_of_bounds, 0]]], cst_sequence_ref_index_d_out_o]; @@ -47361,7 +51905,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var g = caml_string_get(s, i$0); return [3, Stdlib_String[1].call(null, 1, g)]; } - var f = caml_call1(Stdlib_Printf[4].call(null, bx), i$0); + var f = caml_call1(Stdlib_Printf[4].call(null, bO), i$0); throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); case 2: if(a[2]) break a; @@ -47370,7 +51914,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var j = caml_string_get(s, i$1); return [3, Stdlib_String[1].call(null, 1, j)]; } - var h = caml_call1(Stdlib_Printf[4].call(null, by), i$1); + var h = caml_call1(Stdlib_Printf[4].call(null, bP), i$1); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } } @@ -47390,7 +51934,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var xs = lst[1]; try{var e = Stdlib_List[8].call(null, xs, i); return e;} catch(exn){ - var d = caml_call1(Stdlib_Printf[4].call(null, bw), i); + var d = caml_call1(Stdlib_Printf[4].call(null, bN), i); throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); } } @@ -47585,13 +52129,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "intern: expected 1 string"], 1); }); - var bz = [0, 1]; + var bQ = [0, 1]; register ("symbol-interned?", function(args){ if(args){ var a = args[1]; - if(typeof a !== "number" && 4 === a[0] && ! args[2]) return bz; + if(typeof a !== "number" && 4 === a[0] && ! args[2]) return bQ; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "symbol-interned?: expected 1 symbol"], 1); @@ -47610,15 +52154,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-char: expected integer codepoint"], 1); }); - var bA = [0, 0], bB = [0, 1]; + var bR = [0, 0], bS = [0, 1]; register ("char?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 32 === a[0]){if(args[2]) break a; return bB;} - if(! args[2]) return bA; + if(typeof a !== "number" && 32 === a[0]){if(args[2]) break a; return bS;} + if(! args[2]) return bR; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "char?: expected 1 argument"], 1); @@ -47974,7 +52518,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return Stdlib_Buffer[12].call(null, buf, c); } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, "list->string: expected char, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); }, @@ -47986,15 +52530,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "list->string: expected list of chars"], 1); }); register("eof-object", function(args){return 1;}); - var bC = [0, 1], bD = [0, 0]; + var bT = [0, 1], bU = [0, 0]; register ("eof-object?", function(args){ a: if(args){ var a = args[1]; - if(typeof a === "number" && a){if(args[2]) break a; return bC;} - if(! args[2]) return bD; + if(typeof a === "number" && a){if(args[2]) break a; return bT;} + if(! args[2]) return bU; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "eof-object?: expected 1 argument"], 1); @@ -48034,41 +52578,41 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "get-output-string: expected output port"], 1); }); - var bE = [0, 0], bF = [0, 1]; + var bV = [0, 0], bW = [0, 1]; register ("port?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 33 === a[0]){if(args[2]) break a; return bF;} - if(! args[2]) return bE; + if(typeof a !== "number" && 33 === a[0]){if(args[2]) break a; return bW;} + if(! args[2]) return bV; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "port?: expected 1 argument"], 1); }); - var bG = [0, 0], bH = [0, 1]; + var bX = [0, 0], bY = [0, 1]; register ("input-port?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 33 === a[0] && 0 === a[1][2][0]){if(args[2]) break a; return bH;} - if(! args[2]) return bG; + if(typeof a !== "number" && 33 === a[0] && 0 === a[1][2][0]){if(args[2]) break a; return bY;} + if(! args[2]) return bX; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "input-port?: expected 1 argument"], 1); }); - var bI = [0, 0], bJ = [0, 1]; + var bZ = [0, 0], b0 = [0, 1]; register ("output-port?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 33 === a[0] && 0 !== a[1][2][0]){if(args[2]) break a; return bJ;} - if(! args[2]) return bI; + if(typeof a !== "number" && 33 === a[0] && 0 !== a[1][2][0]){if(args[2]) break a; return b0;} + if(! args[2]) return bZ; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "output-port?: expected 1 argument"], 1); @@ -48215,7 +52759,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= "write-string: expected string and output port"], 1); }); - var bK = [0, 0]; + var b1 = [0, 0]; register ("char-ready?", function(args){ @@ -48232,7 +52776,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [0, pos[1] < caml_ml_string_length(src) ? 1 : 0]; } } - if(! args[2]) return bK; + if(! args[2]) return b1; } } throw caml_maybe_attach_backtrace @@ -48356,10 +52900,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cst_f = "%.*f", cst_6f = "%.6f", - bL = [0, [8, [0, 0, 0], 0, [0, 6], 0], cst_6f], - bM = [0, [8, [0, 0, 0], 0, 1, 0], cst_f], - bN = [0, [8, [0, 0, 0], 0, [0, 6], 0], cst_6f], - bO = [0, [8, [0, 0, 0], 0, 1, 0], cst_f]; + b2 = [0, [8, [0, 0, 0], 0, [0, 6], 0], cst_6f], + b3 = [0, [8, [0, 0, 0], 0, 1, 0], cst_f], + b4 = [0, [8, [0, 0, 0], 0, [0, 6], 0], cst_6f], + b5 = [0, [8, [0, 0, 0], 0, 1, 0], cst_f]; register ("format-decimal", function(args){ @@ -48374,10 +52918,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof d !== "number" && 1 === d[0]){ if(b[2]) break; var prec = d[1]; - return [3, caml_call2(Stdlib_Printf[4].call(null, bM), prec, n)]; + return [3, caml_call2(Stdlib_Printf[4].call(null, b3), prec, n)]; } if(! b[2]) - return [3, caml_call1(Stdlib_Printf[4].call(null, bL), n)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, b2), n)]; } break; case 2: @@ -48388,10 +52932,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(c[2]) break; var prec$0 = e[1]; return [3, - caml_call2(Stdlib_Printf[4].call(null, bO), prec$0, n$0)]; + caml_call2(Stdlib_Printf[4].call(null, b5), prec$0, n$0)]; } if(! c[2]) - return [3, caml_call1(Stdlib_Printf[4].call(null, bN), n$0)]; + return [3, caml_call1(Stdlib_Printf[4].call(null, b4), n$0)]; } break; } @@ -48403,7 +52947,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= register("current-input-port", function(param){return 0;}); register("current-output-port", function(param){return 0;}); register("current-error-port", function(param){return 0;}); - function set_key(v){return Sx_types[112].call(null, v);} + function set_key(v){return Sx_types[117].call(null, v);} register ("make-set", function(args){ @@ -48445,15 +52989,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return [35, ht]; }); - var bP = [0, 0], bQ = [0, 1]; + var b6 = [0, 0], b7 = [0, 1]; register ("set?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 35 === a[0]){if(args[2]) break a; return bQ;} - if(! args[2]) return bP; + if(typeof a !== "number" && 35 === a[0]){if(args[2]) break a; return b7;} + if(! args[2]) return b6; } throw caml_maybe_attach_backtrace([0, Sx_types[9], "set?: 1 arg"], 1); }); @@ -48732,15 +53276,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "make-bytevector: expected n [fill]"], 1); }); - var bR = [0, 0], bS = [0, 1]; + var b8 = [0, 0], b9 = [0, 1]; register ("bytevector?", function(args){ a: if(args){ var a = args[1]; - if(typeof a !== "number" && 37 === a[0]){if(args[2]) break a; return bS;} - if(! args[2]) return bR; + if(typeof a !== "number" && 37 === a[0]){if(args[2]) break a; return b9;} + if(! args[2]) return b8; } throw caml_maybe_attach_backtrace ([0, Sx_types[9], "bytevector?: 1 arg"], 1); @@ -48757,7 +53301,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }); var cst_out_of_range = " out of range", - bT = + b_ = [0, [11, "bytevector-u8-ref: index ", @@ -48779,7 +53323,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e = i < 0, f = e || caml_ml_bytes_length(b) <= i; if(! f) return [1, caml_bytes_get(b, i)]; - var g = caml_call1(Stdlib_Printf[4].call(null, bT), i); + var g = caml_call1(Stdlib_Printf[4].call(null, b_), i); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); } } @@ -48790,7 +53334,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 1); }); var - bU = + b$ = [0, [11, "bytevector-u8-set!: index ", @@ -48817,7 +53361,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= g = i < 0, h = g || caml_ml_bytes_length(b) <= i; if(h){ - var j = caml_call1(Stdlib_Printf[4].call(null, bU), i); + var j = caml_call1(Stdlib_Printf[4].call(null, b$), i); throw caml_maybe_attach_backtrace([0, Sx_types[9], j], 1); } var k = byte < 0, l = k || 255 < byte; @@ -49026,7 +53570,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ([0, Sx_types[9], "bytevector->list: expected bytevector"], 1); }); var - bV = + ca = [0, [11, "list->bytevector: byte ", @@ -49054,11 +53598,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof v !== "number" && 1 === v[0]){ var n = v[1]; if(0 <= n && 255 >= n) return Stdlib_Char[1].call(null, n); - var c = caml_call1(Stdlib_Printf[4].call(null, bV), n); + var c = caml_call1(Stdlib_Printf[4].call(null, ca), n); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call (null, "list->bytevector: expected integer, got ", a); @@ -49103,6 +53647,44 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "file-read: (path)"], 1); }); + var cst$2 = "."; + register + ("file-list-dir", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var path = a[1]; + try{ + var + names = caml_sys_read_directory(path), + c = Stdlib_Array[10].call(null, names), + names$1 = + Stdlib_List[44].call + (null, + function(n){ + var a = n !== cst$2 ? 1 : 0, b = a ? n !== ".." ? 1 : 0 : a; + return b; + }, + c), + names$0 = + Stdlib_List[59].call(null, runtime.caml_string_compare, names$1), + d = + [6, + Stdlib_List[20].call(null, function(n){return [3, n];}, names$0)]; + return d; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[11]) throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], b = Stdlib[28].call(null, "file-list-dir: ", msg); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-list-dir: (path)"], 1); + }); register ("file-write", function(args){ @@ -49134,7 +53716,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "file-write: (path content)"], 1); }); - var bW = [0, 2, [0, 3, [0, 1, [0, 7, 0]]]]; + var cb = [0, 2, [0, 3, [0, 1, [0, 7, 0]]]]; register ("file-append", function(args){ @@ -49147,7 +53729,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof c !== "number" && 3 === c[0] && ! b[2]){ var content = c[1], path = a[1]; try{ - var oc = Stdlib[62].call(null, bW, 420, path); + var oc = Stdlib[62].call(null, cb, 420, path); Stdlib[66].call(null, oc, content); Stdlib[76].call(null, oc); return 0; @@ -49173,7 +53755,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = args[1]; if(typeof a !== "number" && 3 === a[0] && ! args[2]){ var path = a[1]; - return [0, runtime.caml_sys_file_exists(path)]; + return [0, caml_sys_file_exists(path)]; } } throw caml_maybe_attach_backtrace @@ -49189,10 +53771,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= pat = a[1], dir = Stdlib_Filename[14].call(null, pat), base_pat = Stdlib_Filename[13].call(null, pat), - cst$0 = ".", - cst = cst$0, + cst = cst$2, dir$0 = - dir === cst$0 + dir === cst$2 ? 1 < caml_ml_string_length(pat) ? 46 === caml_string_get(pat, 0) ? dir : cst @@ -49200,7 +53781,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= : dir; try{ var - entries = runtime.caml_sys_read_directory(dir$0), + entries = caml_sys_read_directory(dir$0), c = Stdlib_Array[18].call (null, @@ -49309,7 +53890,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(! go(0, 0)) return acc; var full = - dir$0 === cst$0 + dir$0 === cst$2 ? entry : Stdlib_Filename[4].call(null, dir$0, entry); return [0, full, acc]; @@ -49330,6 +53911,1472 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "file-glob: (pattern)"], 1); }); + function stat_or(param){ + if(typeof param !== "number" && 3 === param[0]){ + var path = param[1]; + try{var a = [0, Unix[42].call(null, path)]; return a;} + catch(exn){return 0;} + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file: path must be a string"], 1); + } + var cc = [1, 0]; + register + ("file-size", + function(args){ + if(args && ! args[2]){ + var v = args[1], match = stat_or(v); + if(! match) return cc; + var s = match[1]; + return [1, s[9]]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-size: (path)"], 1); + }); + var cd = [1, 0]; + register + ("file-mtime", + function(args){ + if(args && ! args[2]){ + var v = args[1], match = stat_or(v); + if(! match) return cd; + var s = match[1]; + return [1, s[11] | 0]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-mtime: (path)"], 1); + }); + var ce = [0, 0]; + register + ("file-isfile?", + function(args){ + if(args && ! args[2]){ + var v = args[1], match = stat_or(v); + if(! match) return ce; + var s = match[1]; + return [0, 0 === s[3] ? 1 : 0]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-isfile?: (path)"], 1); + }); + var cf = [0, 0]; + register + ("file-isdir?", + function(args){ + if(args && ! args[2]){ + var v = args[1], match = stat_or(v); + if(! match) return cf; + var s = match[1]; + return [0, 1 === s[3] ? 1 : 0]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-isdir?: (path)"], 1); + }); + var cg = [0, 0, 0]; + register + ("file-readable?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var path = a[1]; + try{Unix[57].call(null, path, cg); var b = 1;}catch(exn){var b = 0;} + return [0, b]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-readable?: (path)"], 1); + }); + var ch = [0, 1, 0]; + register + ("file-writable?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var path = a[1]; + try{Unix[57].call(null, path, ch); var b = 1;}catch(exn){var b = 0;} + return [0, b]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-writable?: (path)"], 1); + }); + var cst_file = "file"; + register + ("file-stat", + function(args){ + if(args && ! args[2]){ + var v = args[1], match = stat_or(v); + if(! match) return 0; + var s = match[1], d = Stdlib_Hashtbl[1].call(null, 0, 6); + Stdlib_Hashtbl[11].call(null, d, "size", [1, s[9]]); + Stdlib_Hashtbl[11].call(null, d, "mtime", [1, s[11] | 0]); + Stdlib_Hashtbl[11].call(null, d, "atime", [1, s[10] | 0]); + Stdlib_Hashtbl[11].call(null, d, "ctime", [1, s[12] | 0]); + Stdlib_Hashtbl[11].call(null, d, "mode", [1, s[4]]); + switch(s[3]){ + case 0: + var a = cst_file; break; + case 1: + var a = "directory"; break; + case 2: + var a = "characterSpecial"; break; + case 3: + var a = "blockSpecial"; break; + case 4: + var a = "link"; break; + case 5: + var a = "fifo"; break; + default: var a = "socket"; + } + Stdlib_Hashtbl[11].call(null, d, "type", [3, a]); + return [7, d]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-stat: (path)"], 1); + }); + register + ("file-delete", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var path = a[1]; + a: + try{ + if(runtime.caml_sys_is_directory(path)) + Unix[65].call(null, path); + else + Unix[48].call(null, path); + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + if(typeof e === "number" && 20 === e) break a; + var + b = Unix[2].call(null, e), + c = Stdlib[28].call(null, "file-delete: ", b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + return 0; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-delete: (path)"], 1); + }); + register + ("file-mkdir", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var + path = a[1], + mk = + function(p){ + if(p !== cst && p !== cst$2 && p !== cst$6){ + if(caml_sys_file_exists(p)) return; + mk(Stdlib_Filename[14].call(null, p)); + try{Unix[64].call(null, p, 493); return;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] === Unix[1]){ + var match = exn[2]; + if(typeof match === "number" && 8 === match) return; + } + throw caml_maybe_attach_backtrace(exn, 0); + } + } + }; + try{mk(path);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var + e = exn[2], + b = Unix[2].call(null, e), + c = Stdlib[28].call(null, "file-mkdir: ", b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + return 0; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-mkdir: (path)"], 1); + }); + register + ("file-copy", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0] && ! b[2]){ + var dst = c[1], src = a[1]; + try{ + var + ic = Stdlib[80].call(null, src), + oc = Stdlib[61].call(null, dst), + buf = caml_create_bytes(8192); + for(;;){ + var + n = Stdlib[84].call(null, ic, buf, 0, caml_ml_bytes_length(buf)); + if(0 >= n){ + Stdlib[93].call(null, ic); + Stdlib[76].call(null, oc); + return 0; + } + Stdlib[68].call(null, oc, buf, 0, n); + } + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[11]) + throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], d = Stdlib[28].call(null, "file-copy: ", msg); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-copy: (src dst)"], 1); + }); + register + ("file-rename", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0] && ! b[2]){ + var dst = c[1], src = a[1]; + try{runtime.caml_sys_rename(src, dst);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Stdlib[11]) + throw caml_maybe_attach_backtrace(exn, 0); + var msg = exn[2], d = Stdlib[28].call(null, "file-rename: ", msg); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "file-rename: (src dst)"], 1); + }); + var channel_table = Stdlib_Hashtbl[1].call(null, 0, 16); + function chan_get(name){ + var match = Stdlib_Hashtbl[7].call(null, channel_table, name); + if(match){var c = match[1]; return c;} + var a = Stdlib[28].call(null, "channel: no such channel ", name); + throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); + } + var + channel_next_id = [0, 0], + ci = [0, 2, [0, 5, [0, 6, 0]]], + cj = [0, 1, [0, 5, [0, 6, 0]]], + ck = [0, 2, 0], + cl = [0, 0, 0], + cm = [0, 2, [0, 5, [0, 4, 0]]], + cn = [0, 1, [0, 5, [0, 4, 0]]], + co = [0, [11, cst_file, [4, 0, 0, 0, 0]], "file%d"]; + register + ("channel-open", + function(args){ + if(args){ + var b = args[1]; + if(typeof b !== "number" && 3 === b[0]){ + var c = args[2]; + if(c){ + var d = c[1]; + if(typeof d !== "number" && 3 === d[0] && ! c[2]){ + var mode = d[1], path = b[1]; + try{ + if(mode !== "a") + if(mode !== "a+") + if(mode !== "r") + if(mode !== "r+") + if(mode !== "w"){ + if(mode !== "w+"){ + var + f = + Stdlib[28].call(null, "channel-open: invalid mode ", mode); + throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); + } + var a = ci; + } + else + var a = cj; + else + var a = ck; + else + var a = cl; + else + var a = cm; + else + var a = cn; + var + fd = Unix[24].call(null, path, a, 420), + id = channel_next_id[1]; + channel_next_id[1]++; + var name = caml_call1(Stdlib_Printf[4].call(null, co), id); + Stdlib_Hashtbl[11].call + (null, channel_table, name, [0, fd, mode, [0, 0], [0, 1]]); + return [3, name]; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var + e = exn[2], + g = Unix[2].call(null, e), + h = Stdlib[28].call(null, "channel-open: ", g); + throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-open: (path mode)"], 1); + }); + register + ("channel-close", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], fd = chan_get(name)[1]; + try{Unix[25].call(null, fd);}catch(exn){} + Stdlib_Hashtbl[10].call(null, channel_table, name); + return 0; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-close: (channel)"], 1); + }); + register + ("channel-read", + function(args){ + a: + if(args){ + var b = args[1]; + if(typeof b !== "number" && 3 === b[0]){ + var match = args[2], name = b[1]; + if(match){ + var a = match[1]; + if(typeof a === "number") break a; + switch(a[0]){ + case 1: + if(match[2]) break a; var m = a[1], max_n = m; break; + case 2: + if(match[2]) break a; var m$0 = a[1], max_n = m$0 | 0; break; + default: break a; + } + } + else + var max_n = -1; + var + match$0 = chan_get(name), + eof = match$0[3], + fd = match$0[1], + buf = caml_create_bytes(8192), + chunk = 8192, + buffer = Stdlib_Buffer[1].call(null, chunk), + total = [0, 0], + stop = [0, 0]; + for(;;){ + if(stop[1]) return [3, Stdlib_Buffer[2].call(null, buffer)]; + var + want = + 0 <= max_n + ? Stdlib[16].call(null, chunk, max_n - total[1] | 0) + : chunk; + if(0 < want) + try{ + var r = Unix[27].call(null, fd, buf, 0, want); + if(0 === r){ + eof[1] = 1; + stop[1] = 1; + } + else{ + Stdlib_Buffer[19].call(null, buffer, buf, 0, r); + total[1] = total[1] + r | 0; + } + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + b: + if(exn[1] === Unix[1]){ + var c = exn[2]; + if(typeof c === "number"){ + if(2 !== c && 37 !== c) break b; + stop[1] = 1; + continue; + } + } + throw caml_maybe_attach_backtrace(exn, 0); + } + else + stop[1] = 1; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-read: (channel ?n?)"], 1); + }); + register + ("channel-read-line", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var + name = a[1], + match = chan_get(name), + eof = match[3], + fd = match[1], + buf = Stdlib_Buffer[1].call(null, 80), + one = caml_create_bytes(1), + got_data = [0, 0], + stop = [0, 0]; + for(;;){ + if(stop[1]) + return got_data[1] ? [3, Stdlib_Buffer[2].call(null, buf)] : 0; + try{ + var r = Unix[27].call(null, fd, one, 0, 1); + if(0 === r){ + eof[1] = 1; + stop[1] = 1; + } + else{ + got_data[1] = 1; + var c = caml_bytes_get(one, 0); + if(10 === c) + stop[1] = 1; + else + Stdlib_Buffer[12].call(null, buf, c); + } + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + a: + if(exn[1] === Unix[1]){ + var b = exn[2]; + if(typeof b === "number"){ + if(2 !== b && 37 !== b) break a; + stop[1] = 1; + continue; + } + } + throw caml_maybe_attach_backtrace(exn, 0); + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-read-line: (channel)"], 1); + }); + register + ("channel-write", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var c = args[2]; + if(c){ + var d = c[1]; + if(typeof d !== "number" && 3 === d[0] && ! c[2]){ + var + s = d[1], + name = a[1], + fd = chan_get(name)[1], + b = Stdlib_Bytes[5].call(null, s), + n = caml_ml_bytes_length(b), + written = [0, 0]; + for(;;){ + if(written[1] >= n) return 0; + try{ + var + w = Unix[29].call(null, fd, b, written[1], n - written[1] | 0); + written[1] = written[1] + w | 0; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + a: + if(exn[1] === Unix[1]){ + var e = exn[2]; + if(typeof e === "number"){ + if(2 !== e && 37 !== e) break a; + written[1] = n; + continue; + } + } + throw caml_maybe_attach_backtrace(exn, 0); + } + } + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-write: (channel string)"], 1); + }); + register + ("channel-flush", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){var name = a[1]; chan_get(name); return 0;} + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-flush: (channel)"], 1); + }); + register + ("channel-seek", + function(args){ + a: + if(args){ + var c = args[1]; + if(typeof c !== "number" && 3 === c[0]){ + var a = args[2]; + if(a){ + var b = a[1], name = c[1]; + if(typeof b !== "number"){ + switch(b[0]){ + case 1: + var match = a[2], o = b[1]; + if(match){ + var d = match[1]; + if(typeof d === "number") break a; + if(3 !== d[0]) break a; + if(match[2]) break a; + var w = d[1], whence = w, offset = o; + } + else + var whence = cst_start, offset = o; + break; + case 2: + var match$1 = a[2], o$0 = b[1]; + if(match$1){ + var e = match$1[1]; + if(typeof e === "number") break a; + if(3 !== e[0]) break a; + if(match$1[2]) break a; + var w$0 = e[1], whence = w$0, offset = o$0 | 0; + } + else + var whence = cst_start, offset = o$0 | 0; + break; + default: break a; + } + var match$0 = chan_get(name), eof = match$0[3], fd = match$0[1]; + if(whence !== "current") + if(whence !== cst_end){ + if(whence !== cst_start){ + var + f = + Stdlib[28].call(null, "channel-seek: invalid whence ", whence); + throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); + } + var cmd = 0; + } + else + var cmd = 2; + else + var cmd = 1; + Unix[39].call(null, fd, offset, cmd); + eof[1] = 0; + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-seek: (channel offset ?whence?)"], 1); + }); + register + ("channel-tell", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], fd = chan_get(name)[1]; + return [1, Unix[39].call(null, fd, 0, 1)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-tell: (channel)"], 1); + }); + register + ("channel-eof?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], eof = chan_get(name)[3]; + return [0, eof[1]]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-eof?: (channel)"], 1); + }); + register + ("channel-blocking?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], blocking = chan_get(name)[4]; + return [0, blocking[1]]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-blocking?: (channel)"], 1); + }); + register + ("channel-set-blocking!", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var c = args[2]; + if(c){ + var d = c[1]; + if(typeof d !== "number" && 0 === d[0] && ! c[2]){ + var + b = d[1], + name = a[1], + match = chan_get(name), + blocking = match[4], + fd = match[1]; + blocking[1] = b; + try{if(b) Unix[61].call(null, fd); else Unix[60].call(null, fd);} + catch(exn){} + return 0; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-set-blocking!: (channel bool)"], 1); + }); + var cst_exec = "exec: ", cst_exec_empty_command = "exec: empty command"; + register + ("exec-process", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number"){ + switch(a[0]){ + case 6: + if(args[2]) break a; var items = a[1]; break; + case 21: + var m = a[1][1]; if(args[2]) break a; var items = m; break; + default: break a; + } + var + c = + Stdlib_List[20].call + (null, + function(v){ + if(typeof v !== "number" && 3 === v[0]){var s = v[1]; return s;} + return Sx_types[117].call(null, v); + }, + items), + argv = Stdlib_Array[11].call(null, c); + if(0 === argv.length - 1) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], cst_exec_empty_command], 1); + var + match = Unix[73].call(null, 0, 0), + out_w = match[2], + out_r = match[1], + match$0 = Unix[73].call(null, 0, 0), + err_w = match$0[2], + err_r = match$0[1]; + try{ + var + g = Unix[21], + h = caml_check_bound(argv, 0)[1], + pid = Unix[75].call(null, h, argv, g, out_w, err_w); + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + Unix[25].call(null, out_r); + Unix[25].call(null, out_w); + Unix[25].call(null, err_r); + Unix[25].call(null, err_w); + var + d = Unix[2].call(null, e), + f = Stdlib[28].call(null, cst_exec, d); + throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); + } + Unix[25].call(null, out_w); + Unix[25].call(null, err_w); + var + buf = Stdlib_Buffer[1].call(null, 256), + errbuf = Stdlib_Buffer[1].call(null, 64), + chunk = caml_create_bytes(4096), + read_all = + function(fd, target){ + try{ + var stop = 0; + for(;;){ + if(stop) return; + var + n = + Unix[27].call + (null, fd, chunk, 0, caml_ml_bytes_length(chunk)); + if(0 === n) + stop = 1; + else + Stdlib_Buffer[19].call(null, target, chunk, 0, n); + } + } + catch(exn){return;} + }; + read_all(out_r, buf); + read_all(err_r, errbuf); + Unix[25].call(null, out_r); + Unix[25].call(null, err_r); + var status = Unix[15].call(null, 0, pid)[2]; + if(0 === status[0]) + var n = status[1], exit_code = n; + else + var exit_code = 1; + var + s = Stdlib_Buffer[2].call(null, buf), + trimmed = + 0 < caml_ml_string_length(s) + ? 10 + === caml_string_get(s, caml_ml_string_length(s) - 1 | 0) + ? Stdlib_String + [16].call + (null, s, 0, caml_ml_string_length(s) - 1 | 0) + : s + : s; + if(0 === exit_code) return [3, trimmed]; + if(0 < Stdlib_Buffer[7].call(null, errbuf)) + var + i = Stdlib_Buffer[2].call(null, errbuf), + b = Stdlib[28].call(null, cst$0, i); + else + var b = cst; + var + j = Stdlib[33].call(null, exit_code), + k = Stdlib[28].call(null, j, b), + l = Stdlib[28].call(null, "exec: child exited ", k); + throw caml_maybe_attach_backtrace([0, Sx_types[9], l], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "exec-process: (cmd-list)"], 1); + }); + var cp = [0, 0, 0], cq = [0, 4, 0], cr = [0, 6, 0]; + register + ("exec-pipeline", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number"){ + switch(a[0]){ + case 6: + if(args[2]) break a; var items = a[1]; break; + case 21: + var k = a[1][1]; if(args[2]) break a; var items = k; break; + default: break a; + } + var + words = + Stdlib_List[20].call + (null, + function(v){ + if(typeof v !== "number" && 3 === v[0]){var s = v[1]; return s;} + return Sx_types[117].call(null, v); + }, + items); + if(0 === words) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], cst_exec_empty_command], 1); + var + extract_redirs = + function(ws){ + var + cleaned = 0, + merge_err = 0, + err_path = 0, + out_append = 0, + out_path = 0, + in_path = 0, + param = ws; + for(;;){ + if(! param) + return [0, + Stdlib_List[10].call(null, cleaned), + in_path, + out_path, + out_append, + err_path, + merge_err]; + var w = param[1]; + if(w !== "2>"){ + if(w === "2>@1"){ + var rest$3 = param[2]; + merge_err = 1; + param = rest$3; + continue; + } + if(w !== cst$7) + if(w !== cst$8){ + if(w === ">>"){ + var match = param[2]; + if(match){ + var rest$0 = match[2], p = match[1]; + out_append = 1; + out_path = [0, p]; + param = rest$0; + continue; + } + } + } + else{ + var match$0 = param[2]; + if(match$0){ + var rest$1 = match$0[2], p$0 = match$0[1]; + out_append = 0; + out_path = [0, p$0]; + param = rest$1; + continue; + } + } + else{ + var match$1 = param[2]; + if(match$1){ + var rest$2 = match$1[2], p$1 = match$1[1]; + in_path = [0, p$1]; + param = rest$2; + continue; + } + } + } + else{ + var match$2 = param[2]; + if(match$2){ + var rest$4 = match$2[2], p$2 = match$2[1]; + err_path = [0, p$2]; + param = rest$4; + continue; + } + } + var rest = param[2]; + cleaned = [0, w, cleaned]; + param = rest; + } + }, + acc = 0, + cur = 0, + param = words; + for(;;){ + if(! param) break; + var w = param[1]; + if(w !== "|"){ + var rest = param[2], cur$0 = [0, w, cur]; + cur = cur$0; + param = rest; + } + else{ + var + rest$0 = param[2], + acc$0 = [0, Stdlib_List[10].call(null, cur), acc]; + acc = acc$0; + cur = 0; + param = rest$0; + } + } + var + c = [0, Stdlib_List[10].call(null, cur), acc], + d = Stdlib_List[10].call(null, c), + stages = Stdlib_List[20].call(null, extract_redirs, d); + if(0 === stages) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "exec: no stages"], 1); + var + n = Stdlib_List[1].call(null, stages), + f = Stdlib[17].call(null, 0, n - 1 | 0), + pipes = + Stdlib_Array[1].call + (null, f, function(param){return Unix[73].call(null, 0, 0);}), + match = Unix[73].call(null, 0, 0), + final_w = match[2], + final_r = match[1], + match$0 = Unix[73].call(null, 0, 0), + errstash_w = match$0[2], + errstash_r = match$0[1], + close_safe = + function(fd){ + try{var a = Unix[25].call(null, fd); return a;} + catch(exn){return 0;} + }, + open_out_redir = + function(path, append){ + var a = append ? cq : cr; + try{ + var g = Unix[24].call(null, path, [0, 1, [0, 5, a]], 420); + return g; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var + e = exn[2], + b = Unix[2].call(null, e), + c = Stdlib[28].call(null, cst$0, b), + d = Stdlib[28].call(null, path, c), + f = Stdlib[28].call(null, "exec: open >", d); + throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); + } + }, + stages_arr = Stdlib_Array[11].call(null, stages), + pids = [0, 0]; + try{ + Stdlib_Array[13].call + (null, + function(i, param){ + var + merge = param[6], + ep = param[5], + app = param[4], + op = param[3], + ip = param[2], + cleaned = param[1]; + if(0 === cleaned) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "exec: empty stage in pipeline"], 1); + var argv = Stdlib_Array[11].call(null, cleaned); + if(0 === i) + if(ip){ + var path = ip[1]; + try{var m = Unix[24].call(null, path, cp, 420), stdin_fd = m;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) + throw caml_maybe_attach_backtrace(exn, 0); + var + e = exn[2], + h = Unix[2].call(null, e), + j = Stdlib[28].call(null, cst$0, h), + k = Stdlib[28].call(null, path, j), + l = Stdlib[28].call(null, "exec: open <", k); + throw caml_maybe_attach_backtrace([0, Sx_types[9], l], 1); + } + } + else + var stdin_fd = Unix[21]; + else + var + g = i - 1 | 0, + stdin_fd = caml_check_bound(pipes, g)[g + 1][1]; + if(i === (n - 1 | 0)) + if(op) + var path$0 = op[1], stdout_fd = open_out_redir(path$0, app); + else + var stdout_fd = final_w; + else + var stdout_fd = caml_check_bound(pipes, i)[i + 1][2]; + if(merge) + var stderr_fd = stdout_fd; + else if(ep) + var path$1 = ep[1], stderr_fd = open_out_redir(path$1, 0); + else + var stderr_fd = i === (n - 1 | 0) ? errstash_w : Unix[23]; + try{ + var + t = caml_check_bound(argv, 0)[1], + pid = + Unix[75].call(null, t, argv, stdin_fd, stdout_fd, stderr_fd); + } + catch(exn){ + var exn$0 = caml_wrap_exception(exn); + if(exn$0[1] !== Unix[1]) + throw caml_maybe_attach_backtrace(exn$0, 0); + var + e$0 = exn$0[2], + o = Unix[2].call(null, e$0), + p = Stdlib[28].call(null, cst$0, o), + q = caml_check_bound(argv, 0)[1], + r = Stdlib[28].call(null, q, p), + s = Stdlib[28].call(null, cst_exec, r); + throw caml_maybe_attach_backtrace([0, Sx_types[9], s], 1); + } + pids[1] = [0, pid, pids[1]]; + if(0 < i){ + var a = i - 1 | 0; + close_safe(caml_check_bound(pipes, a)[a + 1][1]); + } + if(i < (n - 1 | 0)) + close_safe(caml_check_bound(pipes, i)[i + 1][2]); + var b = 0 === i, u = b ? 0 !== ip : b; + if(u) close_safe(stdin_fd); + var c = i === (n - 1 | 0), v = c ? 0 !== op : c; + if(v) close_safe(stdout_fd); + var d = 1 - merge, f = d ? 0 !== ep ? 1 : 0 : d; + return f ? close_safe(stderr_fd) : f; + }, + stages_arr); + } + catch(e$0){ + var e = caml_wrap_exception(e$0); + close_safe(final_r); + close_safe(final_w); + close_safe(errstash_r); + close_safe(errstash_w); + Stdlib_Array[12].call + (null, + function(param){ + var b = param[2], a = param[1]; + close_safe(a); + return close_safe(b); + }, + pipes); + throw caml_maybe_attach_backtrace(e, 0); + } + close_safe(final_w); + close_safe(errstash_w); + var + buf = Stdlib_Buffer[1].call(null, 256), + errbuf = Stdlib_Buffer[1].call(null, 64), + chunk = caml_create_bytes(4096), + read_all = + function(fd, target){ + try{ + var stop = 0; + for(;;){ + if(stop) return; + var + r = + Unix[27].call + (null, fd, chunk, 0, caml_ml_bytes_length(chunk)); + if(0 === r) + stop = 1; + else + Stdlib_Buffer[19].call(null, target, chunk, 0, r); + } + } + catch(exn){return;} + }; + read_all(final_r, buf); + read_all(errstash_r, errbuf); + close_safe(final_r); + close_safe(errstash_r); + var + exit_codes = + Stdlib_List[22].call + (null, + function(pid){ + var st = Unix[15].call(null, 0, pid)[2]; + if(0 !== st[0]) return 1; + var c = st[1]; + return c; + }, + pids[1]), + match$1 = Stdlib_List[10].call(null, exit_codes); + if(match$1) + var last = match$1[1], final_code = last; + else + var final_code = 0; + var + s = Stdlib_Buffer[2].call(null, buf), + trimmed = + 0 < caml_ml_string_length(s) + ? 10 + === caml_string_get(s, caml_ml_string_length(s) - 1 | 0) + ? Stdlib_String + [16].call + (null, s, 0, caml_ml_string_length(s) - 1 | 0) + : s + : s; + if(0 === final_code) return [3, trimmed]; + if(0 < Stdlib_Buffer[7].call(null, errbuf)) + var + g = Stdlib_Buffer[2].call(null, errbuf), + b = Stdlib[28].call(null, cst$0, g); + else + var b = cst; + var + h = Stdlib[33].call(null, final_code), + i = Stdlib[28].call(null, h, b), + j = Stdlib[28].call(null, "exec: pipeline last stage exited ", i); + throw caml_maybe_attach_backtrace([0, Sx_types[9], j], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "exec-pipeline: (word-list)"], 1); + }); + function resolve_inet_addr(host){ + if(host !== cst && host !== "0.0.0.0"){ + if(host === "localhost") return Unix[132]; + try{var d = Unix[129].call(null, host); return d;} + catch(exn$0){ + var cst_socket_cannot_resolve = "socket: cannot resolve "; + try{ + var entry = Unix[165].call(null, host); + if(0 === entry[4].length - 1){ + var b = Stdlib[28].call(null, cst_socket_cannot_resolve, host); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); + } + var c = caml_check_bound(entry[4], 0)[1]; + return c; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn, 0); + var a = Stdlib[28].call(null, cst_socket_cannot_resolve, host); + throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); + } + } + } + return Unix[131]; + } + function port_of(v){ + if(typeof v !== "number") + switch(v[0]){ + case 1: + var n = v[1]; return n; + case 2: + var n$0 = v[1]; return n$0 | 0; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "socket: port must be a number"], 1); + } + var cs = [0, [11, "sock", [4, 0, 0, 0, 0]], "sock%d"]; + function alloc_chan_name(param){ + var id = channel_next_id[1]; + channel_next_id[1]++; + return caml_call1(Stdlib_Printf[4].call(null, cs), id); + } + var cst_rw = "rw"; + register + ("socket-connect", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b && ! b[2]){ + var + port_v = b[1], + host = a[1], + port = port_of(port_v), + addr = [1, resolve_inet_addr(host), port], + sock = Unix[136].call(null, 0, 1, 0, 0); + try{Unix[141].call(null, sock, addr);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + try{Unix[25].call(null, sock);}catch(exn){} + var + c = Unix[2].call(null, e), + d = Stdlib[28].call(null, "socket-connect: ", c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + var name = alloc_chan_name(0); + Stdlib_Hashtbl[11].call + (null, channel_table, name, [0, sock, cst_rw, [0, 0], [0, 1]]); + return [3, name]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "socket-connect: (host port)"], 1); + }); + register + ("socket-connect-async", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b && ! b[2]){ + var + port_v = b[1], + host = a[1], + port = port_of(port_v), + addr = [1, resolve_inet_addr(host), port], + sock = Unix[136].call(null, 0, 1, 0, 0); + Unix[60].call(null, sock); + a: + try{Unix[141].call(null, sock, addr);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + if(typeof e === "number" && 1 >= e - 37 >>> 0) break a; + try{Unix[25].call(null, sock);}catch(exn){} + var + c = Unix[2].call(null, e), + d = Stdlib[28].call(null, "socket-connect-async: ", c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); + } + var name = alloc_chan_name(0); + Stdlib_Hashtbl[11].call + (null, channel_table, name, [0, sock, cst_rw, [0, 0], [0, 0]]); + return [3, name]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "socket-connect-async: (host port)"], 1); + }); + var ct = [3, cst]; + register + ("channel-async-error", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], fd = chan_get(name)[1]; + try{ + var err = Unix[160].call(null, fd); + if(err) + var e$0 = err[1], b = [3, Unix[2].call(null, e$0)]; + else + var b = ct; + return b; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + return [3, Unix[2].call(null, e)]; + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "channel-async-error: (channel)"], 1); + }); + register + ("socket-server", + function(args){ + a: + if(args){ + var port_v = args[1]; + if(args[2]){ + if(typeof port_v === "number") break a; + if(3 !== port_v[0]) break a; + var a = args[2]; + if(a[2]) break a; + var + port_v$0 = a[1], + h = port_v[1], + port = port_of(port_v$0), + host = h; + } + else + var port = port_of(port_v), host = cst; + var + addr = [1, resolve_inet_addr(host), port], + sock = Unix[136].call(null, 0, 1, 0, 0); + Unix[153].call(null, sock, 2, 1); + try{Unix[140].call(null, sock, addr);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var e = exn[2]; + try{Unix[25].call(null, sock);}catch(exn){} + var + b = Unix[2].call(null, e), + c = Stdlib[28].call(null, "socket-server: bind: ", b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + Unix[142].call(null, sock, 8); + var name = alloc_chan_name(0); + Stdlib_Hashtbl[11].call + (null, channel_table, name, [0, sock, "server", [0, 0], [0, 1]]); + return [3, name]; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "socket-server: (port) or (host port)"], 1); + }); + register + ("socket-accept", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var name = a[1], sock = chan_get(name)[1]; + try{var match = Unix[139].call(null, 0, sock);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Unix[1]) throw caml_maybe_attach_backtrace(exn, 0); + var + e = exn[2], + b = Unix[2].call(null, e), + c = Stdlib[28].call(null, "socket-accept: ", b); + throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + } + var client_addr = match[2], client_sock = match[1]; + if(0 === client_addr[0]) + var path = client_addr[1], port = 0, host_str = path; + else + var + port$0 = client_addr[2], + addr = client_addr[1], + host_str$0 = Unix[130].call(null, addr), + port = port$0, + host_str = host_str$0; + var client_name = alloc_chan_name(0); + Stdlib_Hashtbl[11].call + (null, + channel_table, + client_name, + [0, client_sock, cst_rw, [0, 0], [0, 1]]); + var d = Stdlib_Hashtbl[1].call(null, 0, 3); + Stdlib_Hashtbl[11].call(null, d, "channel", [3, client_name]); + Stdlib_Hashtbl[11].call(null, d, "host", [3, host_str]); + Stdlib_Hashtbl[11].call(null, d, "port", [1, port]); + return [7, d]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "socket-accept: (server-channel)"], 1); + }); + register + ("io-select-channels", + function(args){ + function to_list(v){ + a: + { + if(typeof v !== "number"){ + switch(v[0]){ + case 6: + var xs = v[1]; break; + case 21: + var xs = v[1][1]; break; + default: break a; + } + return xs; + } + if(0 === v) return 0; + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "io-select-channels: expected list"], 1); + } + function chan_name_of(v){ + if(typeof v !== "number" && 3 === v[0]){var s = v[1]; return s;} + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "io-select-channels: channel must be a string"], + 1); + } + if(args){ + var a = args[2]; + if(a){ + var b = a[2]; + if(b && ! b[2]){ + var t = b[1], w = a[1], r = args[1]; + a: + if(typeof t !== "number"){ + switch(t[0]){ + case 1: + var n = t[1], timeout_ms = n; break; + case 2: + var n$0 = t[1], timeout_ms = n$0 | 0; break; + default: break a; + } + var + write_list = to_list(w), + read_list = to_list(r), + read_pairs = + Stdlib_List[20].call + (null, + function(v){ + var name = chan_name_of(v), fd = chan_get(name)[1]; + return [0, name, fd]; + }, + read_list), + write_pairs = + Stdlib_List[20].call + (null, + function(v){ + var name = chan_name_of(v), fd = chan_get(name)[1]; + return [0, name, fd]; + }, + write_list), + read_fds = + Stdlib_List[20].call(null, function(a){return a[2];}, read_pairs), + write_fds = + Stdlib_List[20].call + (null, function(a){return a[2];}, write_pairs), + timeout = 0 <= timeout_ms ? timeout_ms / 1000. : -1.; + b: + try{ + var + c = Unix[96].call(null, read_fds, write_fds, 0, timeout), + g = c[2], + h = c[1], + ready_w = g, + ready_r = h; + } + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] === Unix[1]){ + var match = exn[2]; + if(typeof match === "number" && 11 === match){var ready_w = 0, ready_r = 0; break b;} + } + throw caml_maybe_attach_backtrace(exn, 0); + } + var + names_of = + function(pairs, ready){ + return Stdlib_List[23].call + (null, + function(param){ + var fd = param[2], n = param[1]; + return Stdlib_List[34].call + (null, function(rfd){return caml_equal(rfd, fd);}, ready) + ? [0, [3, n]] + : 0; + }, + pairs); + }, + d = Stdlib_Hashtbl[1].call(null, 0, 2), + e = [6, names_of(read_pairs, ready_r)]; + Stdlib_Hashtbl[11].call(null, d, "readable", e); + var f = [6, names_of(write_pairs, ready_w)]; + Stdlib_Hashtbl[11].call(null, d, "writable", f); + return [7, d]; + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "io-select-channels: timeout must be a number"], + 1); + } + } + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "io-select-channels: (read-list write-list timeout-ms)"], + 1); + }); register ("clock-seconds", function(args){ @@ -49349,7 +55396,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cst_02d = "%02d", cst_May = "May", - bX = + cst_local = "local", + cst_utc = "utc", + cu = [0, "Sunday", "Monday", @@ -49358,7 +55407,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= "Thursday", "Friday", "Saturday"], - bY = + cv = [0, "January", "February", @@ -49372,12 +55421,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= "October", "November", "December"], - bZ = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], - b0 = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], - b1 = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], - b2 = [0, [4, 0, [0, 2, 4], 0, 0], "%04d"], - b3 = [0, "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], - b4 = + cw = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cx = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cy = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cz = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cA = [0, [4, 0, [0, 2, 4], 0, 0], "%04d"], + cB = [0, "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + cC = [0, "Jan", "Feb", @@ -49391,10 +55441,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= "Oct", "Nov", "Dec"], - b5 = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], - b6 = [0, [4, 0, [0, 1, 2], 0, 0], "%2d"], - b7 = [0, [4, 0, [0, 2, 3], 0, 0], "%03d"], - b8 = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d]; + cD = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cE = [0, [4, 0, [0, 1, 2], 0, 0], "%2d"], + cF = [0, [4, 0, [0, 2, 3], 0, 0], "%03d"], + cG = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d], + cH = [0, [4, 0, [0, 2, 2], 0, 0], cst_02d]; register ("clock-format", function(args){ @@ -49402,148 +55453,519 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(args){ var a = args[1]; if(typeof a !== "number" && 1 === a[0]){ - var b = args[2], t = a[1]; - if(b){ - var g = b[1]; - if(typeof g === "number" || 3 !== g[0] || b[2]) break a; - } - var cst_a_b_e_H_M_S_Z_Y = "%a %b %e %H:%M:%S %Z %Y"; - if(args){ - var d = args[2]; - if(d){ - var e = d[1]; - if(typeof e === "number" || ! (3 === e[0] && ! d[2])) - var fmt = cst_a_b_e_H_M_S_Z_Y; - else - var f = e[1], fmt = f; + var match = args[2], t = a[1]; + if(match){ + var b = match[1]; + if(typeof b === "number") break a; + if(3 !== b[0]) break a; + var match$0 = match[2], f = b[1]; + if(match$0){ + var c = match$0[1]; + if(typeof c === "number") break a; + if(3 !== c[0]) break a; + if(match$0[2]) break a; + var z = c[1], tz = z, fmt = f; } else - var fmt = cst_a_b_e_H_M_S_Z_Y; + var tz = cst_utc, fmt = f; } else - var fmt = cst_a_b_e_H_M_S_Z_Y; + var tz = cst_utc, fmt = "%a %b %e %H:%M:%S %Z %Y"; var - tm = Unix[105].call(null, t), - buf = Stdlib_Buffer[1].call(null, 32), - n = caml_ml_string_length(fmt), - i = 0; - for(;;){ - if(i >= n) return [3, Stdlib_Buffer[2].call(null, buf)]; - if(37 === caml_string_get(fmt, i) && (i + 1 | 0) < n){ - var c = caml_string_get(fmt, i + 1 | 0), switcher = c - 65 | 0; - b: - { - if(44 >= switcher >>> 0) - switch(switcher){ - case 0: - var - days = caml_obj_dup(bX), - h = tm[7], - m = caml_check_bound(days, h)[h + 1]; - Stdlib_Buffer[16].call(null, buf, m); - break b; - case 1: - var - mons = caml_obj_dup(bY), - j = tm[5], - o = caml_check_bound(mons, j)[j + 1]; - Stdlib_Buffer[16].call(null, buf, o); - break b; - case 7: - var - p = tm[3], - q = caml_call1(Stdlib_Printf[4].call(null, bZ), p); - Stdlib_Buffer[16].call(null, buf, q); - break b; - case 12: - var - r = tm[2], - s = caml_call1(Stdlib_Printf[4].call(null, b0), r); - Stdlib_Buffer[16].call(null, buf, s); - break b; - case 18: - var - u = tm[1], - v = caml_call1(Stdlib_Printf[4].call(null, b1), u); - Stdlib_Buffer[16].call(null, buf, v); - break b; - case 24: - var - w = 1900 + tm[6] | 0, - x = caml_call1(Stdlib_Printf[4].call(null, b2), w); - Stdlib_Buffer[16].call(null, buf, x); - break b; - case 25: - Stdlib_Buffer[16].call(null, buf, "UTC"); break b; - case 32: - var - days$0 = caml_obj_dup(b3), - k = tm[7], - y = caml_check_bound(days$0, k)[k + 1]; - Stdlib_Buffer[16].call(null, buf, y); - break b; - case 35: - var - A = tm[4], - B = caml_call1(Stdlib_Printf[4].call(null, b5), A); - Stdlib_Buffer[16].call(null, buf, B); - break b; - case 36: - var - C = tm[4], - D = caml_call1(Stdlib_Printf[4].call(null, b6), C); - Stdlib_Buffer[16].call(null, buf, D); - break b; - case 41: - var - E = tm[8] + 1 | 0, - F = caml_call1(Stdlib_Printf[4].call(null, b7), E); - Stdlib_Buffer[16].call(null, buf, F); - break b; - case 44: - var - G = tm[5] + 1 | 0, - H = caml_call1(Stdlib_Printf[4].call(null, b8), G); - Stdlib_Buffer[16].call(null, buf, H); - break b; - case 33: - case 39: - var - mons$0 = caml_obj_dup(b4), - l = tm[5], - z = caml_check_bound(mons$0, l)[l + 1]; - Stdlib_Buffer[16].call(null, buf, z); - break b; - } - Stdlib_Buffer[12].call(null, buf, 37); - Stdlib_Buffer[12].call(null, buf, c); + tm = + tz === cst_local + ? Unix[106].call(null, t) + : Unix[105].call(null, t), + tz_label = tz === cst_local ? cst : "UTC"; + return [3, + function(fmt){ + var + buf = Stdlib_Buffer[1].call(null, 32), + n = caml_ml_string_length(fmt), + i = 0; + for(;;){ + if(i >= n) return Stdlib_Buffer[2].call(null, buf); + if(37 === caml_string_get(fmt, i) && (i + 1 | 0) < n){ + var + c = caml_string_get(fmt, i + 1 | 0), + switcher = c - 37 | 0; + a: + { + if(84 >= switcher >>> 0) + switch(switcher){ + case 0: + Stdlib_Buffer[12].call(null, buf, 37); break a; + case 28: + var + days = caml_obj_dup(cu), + a = tm[7], + f = caml_check_bound(days, a)[a + 1]; + Stdlib_Buffer[16].call(null, buf, f); + break a; + case 29: + var + mons = caml_obj_dup(cv), + b = tm[5], + g = caml_check_bound(mons, b)[b + 1]; + Stdlib_Buffer[16].call(null, buf, g); + break a; + case 35: + var + j = tm[3], + k = caml_call1(Stdlib_Printf[4].call(null, cw), j); + Stdlib_Buffer[16].call(null, buf, k); + break a; + case 36: + var + h = tm[3] % 12 | 0, + l = 0 === h ? 12 : h, + m = caml_call1(Stdlib_Printf[4].call(null, cx), l); + Stdlib_Buffer[16].call(null, buf, m); + break a; + case 40: + var + o = tm[2], + p = caml_call1(Stdlib_Printf[4].call(null, cy), o); + Stdlib_Buffer[16].call(null, buf, p); + break a; + case 46: + var + q = tm[1], + r = caml_call1(Stdlib_Printf[4].call(null, cz), q); + Stdlib_Buffer[16].call(null, buf, r); + break a; + case 52: + var + s = 1900 + tm[6] | 0, + t = caml_call1(Stdlib_Printf[4].call(null, cA), s); + Stdlib_Buffer[16].call(null, buf, t); + break a; + case 53: + Stdlib_Buffer[16].call(null, buf, tz_label); break a; + case 60: + var + days$0 = caml_obj_dup(cB), + d = tm[7], + u = caml_check_bound(days$0, d)[d + 1]; + Stdlib_Buffer[16].call(null, buf, u); + break a; + case 63: + var + w = tm[4], + x = caml_call1(Stdlib_Printf[4].call(null, cD), w); + Stdlib_Buffer[16].call(null, buf, x); + break a; + case 64: + var + y = tm[4], + z = caml_call1(Stdlib_Printf[4].call(null, cE), y); + Stdlib_Buffer[16].call(null, buf, z); + break a; + case 69: + var + A = tm[8] + 1 | 0, + B = caml_call1(Stdlib_Printf[4].call(null, cF), A); + Stdlib_Buffer[16].call(null, buf, B); + break a; + case 72: + var + C = tm[5] + 1 | 0, + D = caml_call1(Stdlib_Printf[4].call(null, cG), C); + Stdlib_Buffer[16].call(null, buf, D); + break a; + case 75: + var E = 12 <= tm[3] ? "PM" : "AM"; + Stdlib_Buffer[16].call(null, buf, E); + break a; + case 82: + var F = Stdlib[33].call(null, tm[7]); + Stdlib_Buffer[16].call(null, buf, F); + break a; + case 84: + var + G = (1900 + tm[6] | 0) % 100 | 0, + H = caml_call1(Stdlib_Printf[4].call(null, cH), G); + Stdlib_Buffer[16].call(null, buf, H); + break a; + case 61: + case 67: + var + mons$0 = caml_obj_dup(cC), + e = tm[5], + v = caml_check_bound(mons$0, e)[e + 1]; + Stdlib_Buffer[16].call(null, buf, v); + break a; + } + Stdlib_Buffer[12].call(null, buf, 37); + Stdlib_Buffer[12].call(null, buf, c); + } + i = i + 2 | 0; + continue; + } + var I = caml_string_get(fmt, i); + Stdlib_Buffer[12].call(null, buf, I); + var i$0 = i + 1 | 0; + i = i$0; + } + } + (fmt)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "clock-format: (seconds [format [tz]])"], 1); + }); + var + cI = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + cJ = [0, 0, 0, 0, 1, 0, 70, 0, 0, 0]; + register + ("clock-scan", + function(args){ + a: + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0]){ + var match = b[2], fmt = c[1], str = a[1]; + if(match){ + var d = match[1]; + if(typeof d === "number") break a; + if(3 !== d[0]) break a; + if(match[2]) break a; + var z = d[1], tz = z; } - i = i + 2 | 0; - continue; + else + var tz = cst_utc; + var + n = caml_ml_string_length(fmt), + sn = caml_ml_string_length(str), + j = [0, 0], + read_n_digits = + function(k){ + var cnt = 0, s = cst; + for(;;){ + if + (cnt < k + && + j[1] < sn + && + 48 <= caml_string_get(str, j[1]) + && 57 >= caml_string_get(str, j[1])){ + var + a = caml_string_get(str, j[1]), + b = Stdlib_String[1].call(null, 1, a), + c = Stdlib[28].call(null, s, b); + j[1]++; + var cnt$0 = cnt + 1 | 0; + cnt = cnt$0; + s = c; + continue; + } + return s === cst ? 0 : caml_int_of_string(s); + } + }, + skip_ws = + function(param){ + for(;;){ + a: + if(j[1] < sn){ + if + (32 !== caml_string_get(str, j[1]) + && 9 !== caml_string_get(str, j[1])) + break a; + j[1]++; + continue; + } + return; + } + }, + i = 0, + tm = cJ; + for(;;){ + if(i >= n) break; + if(37 === caml_string_get(fmt, i) && (i + 1 | 0) < n){ + var match$0 = caml_string_get(fmt, i + 1 | 0); + if(100 <= match$0) + if(109 === match$0) + var + w = tm[9], + x = tm[8], + A = tm[7], + B = tm[6], + C = read_n_digits(2) - 1 | 0, + tm$0 = [0, tm[1], tm[2], tm[3], tm[4], C, B, A, x, w]; + else if(121 === match$0) + var + y$1 = read_n_digits(2), + D = tm[9], + E = tm[8], + F = tm[7], + y$2 = 70 <= y$1 ? y$1 : 100 + y$1 | 0, + tm$0 = [0, tm[1], tm[2], tm[3], tm[4], tm[5], y$2, F, E, D]; + else if(102 <= match$0) + var tm$0 = tm; + else{ + skip_ws(0); + var + G = tm[9], + H = tm[8], + I = tm[7], + J = tm[6], + K = tm[5], + L = read_n_digits(2), + tm$0 = [0, tm[1], tm[2], tm[3], L, K, J, I, H, G]; + } + else if(72 <= match$0) + if(90 <= match$0) + var tm$0 = tm; + else + switch(match$0 - 72 | 0){ + case 5: + var + T = tm[9], + U = tm[8], + V = tm[7], + W = tm[6], + X = tm[5], + Y = tm[4], + Z = tm[3], + _ = read_n_digits(2), + tm$0 = [0, tm[1], _, Z, Y, X, W, V, U, T]; + break; + case 11: + var + $ = tm[9], + aa = tm[8], + ab = tm[7], + ac = tm[6], + ad = tm[5], + ae = tm[4], + af = tm[3], + ag = tm[2], + tm$0 = [0, read_n_digits(2), ag, af, ae, ad, ac, ab, aa, $]; + break; + case 17: + var + ah = tm[9], + ai = tm[8], + aj = tm[7], + ak = read_n_digits(4) - 1900 | 0, + tm$0 = + [0, tm[1], tm[2], tm[3], tm[4], tm[5], ak, aj, ai, ah]; + break; + case 0: + case 1: + var + M = tm[9], + N = tm[8], + O = tm[7], + P = tm[6], + Q = tm[5], + R = tm[4], + S = read_n_digits(2), + tm$0 = [0, tm[1], tm[2], S, R, Q, P, O, N, M]; + break; + default: var tm$0 = tm; + } + else if(37 === match$0) + var + l = j[1] < sn, + al = l ? 37 === caml_string_get(str, j[1]) : l, + tm$0 = al ? (j[1]++, tm) : tm; + else + var tm$0 = tm; + i = i + 2 | 0; + tm = tm$0; + continue; + } + if(32 === caml_string_get(fmt, i)) + skip_ws(0); + else{ + var o = j[1] < sn; + if(o) + var + am = caml_string_get(fmt, i), + p = caml_string_get(str, j[1]) === am; + else + var p = o; + if(p) j[1]++; + } + var i$0 = i + 1 | 0; + i = i$0; + } + if(tz === cst_local) + var secs = Unix[107].call(null, tm)[1] | 0; + else{ + var + is_leap = + function(y){ + var a = 0 === (y % 4 | 0) ? 1 : 0; + if(a) + var + c = 0 !== (y % 100 | 0) ? 1 : 0, + b = c || (0 === (y % 400 | 0) ? 1 : 0); + else + var b = a; + return b; + }, + days_in_month = caml_obj_dup(cI), + year = tm[6] + 1900 | 0, + mon = tm[5], + mday = tm[4], + total_days = 0; + if(1970 <= year){ + var e = year - 1 | 0; + if(e < 1970) + var total_days$3 = total_days; + else{ + var total_days$1 = total_days, y = 1970; + for(;;){ + var + s = is_leap(y) ? 366 : 365, + h = total_days$1 + s | 0, + t = y + 1 | 0; + if(e === y){var total_days$3 = h; break;} + total_days$1 = h; + y = t; + } + } + } + else if(1969 < year) + var total_days$3 = total_days; + else{ + var total_days$2 = total_days, y$0 = year; + for(;;){ + var + u = is_leap(y$0) ? 366 : 365, + k = total_days$2 - u | 0, + v = y$0 + 1 | 0; + if(1969 === y$0){var total_days$3 = k; break;} + total_days$2 = k; + y$0 = v; + } + } + var f = mon - 1 | 0; + if(f < 0) + var total_days$7 = total_days$3; + else{ + var total_days$4 = total_days$3, m = 0; + for(;;){ + var + total_days$0 = + total_days$4 + caml_check_bound(days_in_month, m)[m + 1] | 0, + g = 1 === m, + q = g ? is_leap(year) : g; + if(q) + var + total_days$5 = total_days$0 + 1 | 0, + total_days$6 = total_days$5; + else + var total_days$6 = total_days$0; + var r = m + 1 | 0; + if(f === m){var total_days$7 = total_days$6; break;} + total_days$4 = total_days$6; + m = r; + } + } + var + secs = + (((((total_days$7 + mday | 0) - 1 | 0) * 86400 | 0) + + (tm[3] * 3600 | 0) + | 0) + + (tm[2] * 60 | 0) + | 0) + + tm[1] + | 0; + } + return [1, secs]; } - var I = caml_string_get(fmt, i); - Stdlib_Buffer[12].call(null, buf, I); - var i$0 = i + 1 | 0; - i = i$0; } } } throw caml_maybe_attach_backtrace - ([0, Sx_types[9], "clock-format: (seconds [format])"], 1); + ([0, Sx_types[9], "clock-scan: (str fmt [tz])"], 1); + }); + register + ("env-lookup", + function(args){ + if(args){ + var a = args[2]; + if(a && ! a[2]){ + var key = a[1], env_val = args[1]; + a: + { + if(typeof env_val === "number"){ + if(0 === env_val){var e$0 = Sx_types[20].call(null, 0); break a;} + } + else if(20 === env_val[0]){var e = env_val[1], e$0 = e; break a;} + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "env-lookup: first arg must be an environment"], + 1); + } + var k = Sx_types[35].call(null, key); + return Sx_types[28].call(null, e$0, k) + ? Sx_types[30].call(null, e$0, k) + : 0; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "env-lookup: (env key)"], 1); + }); + register + ("env-extend", + function(args){ + if(! args) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "env-extend: requires at least one arg"], 1); + var pairs = args[2], env_val = args[1]; + a: + { + if(typeof env_val === "number"){ + if(0 === env_val){ + var parent_env = Sx_types[20].call(null, 0); + break a; + } + } + else if(20 === env_val[0]){ + var e = env_val[1], parent_env = e; + break a; + } + throw caml_maybe_attach_backtrace + ([0, + Sx_types[9], + "env-extend: first arg must be an environment"], + 1); + } + var child = Sx_types[21].call(null, parent_env), param = pairs; + for(;;){ + if(! param) return [20, child]; + var match = param[2], k = param[1]; + if(! match) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "env-extend: odd number of key-val pairs"], + 1); + var rest = match[2], v = match[1], a = Sx_types[35].call(null, k); + Sx_types[26].call(null, child, a, v); + param = rest; + } }); register ("jit-stats", function(args){ var d = Stdlib_Hashtbl[1].call(null, 0, 8); Stdlib_Hashtbl[11].call(null, d, "threshold", [2, Sx_types[43][1]]); - Stdlib_Hashtbl[11].call(null, d, "budget", [2, Sx_types[47][1]]); - var a = [2, Sx_types[50].call(null, 0)]; + Stdlib_Hashtbl[11].call(null, d, "budget", [2, Sx_types[51][1]]); + var a = [2, Sx_types[54].call(null, 0)]; Stdlib_Hashtbl[11].call(null, d, "cache-size", a); Stdlib_Hashtbl[11].call(null, d, "compiled", [2, Sx_types[44][1]]); Stdlib_Hashtbl[11].call(null, d, "compile-failed", [2, Sx_types[45][1]]); Stdlib_Hashtbl[11].call (null, d, "below-threshold", [2, Sx_types[46][1]]); - Stdlib_Hashtbl[11].call(null, d, "evicted", [2, Sx_types[48][1]]); + Stdlib_Hashtbl[11].call(null, d, "evicted", [2, Sx_types[52][1]]); return [7, d]; }); register @@ -49572,9 +55994,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof a !== "number") switch(a[0]){ case 1: - if(! args[2]){var n = a[1]; Sx_types[47][1] = n; return 0;} break; + if(! args[2]){var n = a[1]; Sx_types[51][1] = n; return 0;} break; case 2: - if(! args[2]){var n$0 = a[1]; Sx_types[47][1] = n$0 | 0; return 0;} + if(! args[2]){var n$0 = a[1]; Sx_types[51][1] = n$0 | 0; return 0;} break; } } @@ -49591,8 +56013,55 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof v !== "number" && 8 === v[0]){var l = v[1]; l[5] = 0; return 0;} return 0; }, - Sx_types[49]); - Stdlib_Queue[11].call(null, Sx_types[49]); + Sx_types[53]); + Stdlib_Queue[11].call(null, Sx_types[53]); + return 0; + }); + register + ("jit-exclude!", + function(args){ + Stdlib_List[18].call + (null, + function(a){ + if(typeof a !== "number" && a[0] - 3 >>> 0 < 2){ + var n = a[1], len = caml_ml_string_length(n); + if(0 < len && 42 === caml_string_get(n, len - 1 | 0)){ + var + prefix = Stdlib_String[16].call(null, n, 0, len - 1 | 0), + b = 1 - Stdlib_List[37].call(null, prefix, Sx_types[48][1]), + c = b ? (Sx_types[48][1] = [0, prefix, Sx_types[48][1]], 0) : b; + return c; + } + return Stdlib_Hashtbl[11].call(null, Sx_types[47], n, 0); + } + return 0; + }, + args); + return 0; + }); + var cK = [0, 0]; + register + ("jit-excluded?", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && a[0] - 3 >>> 0 < 2 && ! args[2]){var n = a[1]; return [0, Sx_types[49].call(null, n)];} + } + return cK; + }); + register + ("jit-exclude-callers-of!", + function(args){ + Stdlib_List[18].call + (null, + function(a){ + if(typeof a !== "number" && a[0] - 3 >>> 0 < 2){ + var n = a[1]; + return Stdlib_Hashtbl[11].call(null, Sx_types[50], n, 0); + } + return 0; + }, + args); return 0; }); register @@ -49601,11 +56070,170 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Sx_types[44][1] = 0; Sx_types[45][1] = 0; Sx_types[46][1] = 0; - Sx_types[48][1] = 0; + Sx_types[52][1] = 0; return 0; }); + register + ("crypto-sha256", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){var s = a[1]; return [3, Sx_sha2[3].call(null, s)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "crypto-sha256: (bytes)"], 1); + }); + register + ("crypto-sha512", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var s = a[1]; + return [3, Sx_sha2[11].call(null, s)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "crypto-sha512: (bytes)"], 1); + }); + register + ("crypto-sha3-256", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){var s = a[1]; return [3, Sx_sha3[8].call(null, s)]; + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "crypto-sha3-256: (bytes)"], 1); + }); + register + ("cbor-encode", + function(args){ + if(args && ! args[2]){ + var v = args[1]; + try{var a = [3, Sx_cbor[5].call(null, v)]; return a;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Sx_cbor[1]) throw caml_maybe_attach_backtrace(exn, 0); + var m = exn[2]; + throw caml_maybe_attach_backtrace([0, Sx_types[9], m], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "cbor-encode: (value)"], 1); + }); + register + ("cbor-decode", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0] && ! args[2]){ + var s = a[1]; + try{var b = Sx_cbor[6].call(null, s); return b;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Sx_cbor[1]) throw caml_maybe_attach_backtrace(exn, 0); + var m = exn[2]; + throw caml_maybe_attach_backtrace([0, Sx_types[9], m], 1); + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "cbor-decode: (bytes)"], 1); + }); + register + ("cid-from-bytes", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 1 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0] && ! b[2]){ + var mh = c[1], codec = a[1]; + return [3, Sx_cid[6].call(null, codec, mh)]; + } + } + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "cid-from-bytes: (codec multihash-bytes)"], 1); + }); + register + ("cid-from-sx", + function(args){ + if(args && ! args[2]){ + var v = args[1]; + try{var a = [3, Sx_cid[9].call(null, v)]; return a;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== Sx_cbor[1]) throw caml_maybe_attach_backtrace(exn, 0); + var m = exn[2]; + throw caml_maybe_attach_backtrace([0, Sx_types[9], m], 1); + } + } + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], "cid-from-sx: (value)"], 1); + }); + var cL = [0, 0]; + register + ("ed25519-verify", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0]){ + var d = b[2]; + if(d){ + var e = d[1]; + if(typeof e !== "number" && 3 === e[0] && ! d[2]){ + var sg = e[1], msg = c[1], pk = a[1]; + try{var g = Sx_ed25519[38].call(null, pk, msg, sg), f = g;} + catch(exn){var f = 0;} + return [0, f]; + } + } + } + } + } + } + return cL; + }); + var cM = [0, 0]; + register + ("rsa-sha256-verify", + function(args){ + if(args){ + var a = args[1]; + if(typeof a !== "number" && 3 === a[0]){ + var b = args[2]; + if(b){ + var c = b[1]; + if(typeof c !== "number" && 3 === c[0]){ + var d = b[2]; + if(d){ + var e = d[1]; + if(typeof e !== "number" && 3 === e[0] && ! d[2]){ + var sg = e[1], msg = c[1], spki = a[1]; + try{var g = Sx_rsa[23].call(null, spki, msg, sg), f = g;} + catch(exn){var f = 0;} + return [0, f]; + } + } + } + } + } + } + return cM; + }); runtime.caml_register_global - (1082, + (1364, [0, primitives, sx_call_fn, @@ -49647,8 +56275,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 12900 "../lib/.sx.objs/jsoo/default/sx.cma.js" -//# shape: Sx_runtime:[F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(2),F(3),F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(2),F(1),F(1),F(3),F(2),F(2),F(1),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(2),F(1)*,F(1)*,F(1),F(2),F(2),F(3),F(3),F(1),F(1),F(2),F(2),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(2),F(1)*,F(2),F(1),F(1)*,F(2),F(1),F(1)*,F(1),F(4),F(2),F(1),F(1),F(2),F(2),F(1),N,F(2),N,N,F(1)*,F(1),F(2),F(2),F(2),F(1)*,F(2)*,F(1)*,F(1)*,F(2),F(4),F(2),F(2),F(2),F(2)*,F(1)*,N,N,N,N,F(1),N,F(1),F(1),F(2)] +//# 17871 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_runtime:[F(2),F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(2),F(3),F(2),F(1),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(2),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(2),F(1),F(1),F(3),F(2),F(2),F(1),F(1),F(2),F(1),F(1),F(1),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(2),F(1)*,F(1)*,F(1),F(2),F(2),F(3),F(3),F(1),F(1),F(2),F(2),F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1)*,F(1),F(1)*,F(1),F(1),F(2),F(1)*,F(2),F(1),F(1)*,F(2),F(1),F(1)*,F(1),F(1),F(4),F(2),F(1),F(1),F(2),F(2),F(1),N,F(2),N,N,F(1)*,F(1),F(2),F(2),F(2),F(1)*,F(2)*,F(1)*,F(1)*,F(2),F(4),F(2),F(2),F(2),F(2)*,F(1)*,N,N,N,N,F(1),N,F(1),F(1),F(2)] (function (globalThis){ "use strict"; @@ -49656,6 +56284,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= runtime = globalThis.jsoo_runtime, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, + caml_mul = runtime.caml_mul, caml_string_compare = runtime.caml_string_compare, caml_wrap_exception = runtime.caml_wrap_exception; function caml_call1(f, a0){ @@ -49670,18 +56299,379 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var global_data = runtime.caml_get_global_data(), - Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, - Stdlib_String = global_data.Stdlib__String, Stdlib_List = global_data.Stdlib__List, Stdlib = global_data.Stdlib, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, + Stdlib_String = global_data.Stdlib__String, Sx_types = global_data.Sx_types, Sx_primitives = global_data.Sx_primitives, Stdlib_Array = global_data.Stdlib__Array; + function fast_eq(a, b){ + if(a === b) return 1; + a: + if(typeof a === "number"){ + if(0 === a && typeof b === "number" && ! b) return 1; + } + else{ + switch(a[0]){ + case 0: + if(typeof b === "number") break a; + if(0 !== b[0]) break a; + var y = b[1], x = a[1]; + return x === y ? 1 : 0; + case 1: + var x$0 = a[1]; + if(typeof b === "number") break a; + switch(b[0]){ + case 1: + var y$0 = b[1]; return x$0 === y$0 ? 1 : 0; + case 2: + var y$1 = b[1]; return x$0 === y$1 ? 1 : 0; + case 34: + var d = b[2], n = b[1]; return caml_mul(x$0, d) === n ? 1 : 0; + default: break a; + } + case 2: + var x$1 = a[1]; + if(typeof b === "number") break a; + switch(b[0]){ + case 1: + var y$2 = b[1]; return x$1 === y$2 ? 1 : 0; + case 2: + var y$3 = b[1]; return x$1 === y$3 ? 1 : 0; + case 34: + var d$0 = b[2], n$0 = b[1]; return x$1 === n$0 / d$0 ? 1 : 0; + default: break a; + } + case 3: + if(typeof b === "number") break a; + if(3 !== b[0]) break a; + var y$4 = b[1], x$2 = a[1]; + return x$2 === y$4 ? 1 : 0; + case 4: + if(typeof b === "number") break a; + if(4 !== b[0]) break a; + var y$5 = b[1], x$3 = a[1]; + return x$3 === y$5 ? 1 : 0; + case 5: + if(typeof b === "number") break a; + if(5 !== b[0]) break a; + var y$6 = b[1], x$4 = a[1]; + return x$4 === y$6 ? 1 : 0; + case 6: + var la = a[1]; break; + case 21: + var la = a[1][1]; break; + case 34: + var ad = a[2], an = a[1]; + if(typeof b === "number") break a; + switch(b[0]){ + case 1: + var y$7 = b[1]; return an === caml_mul(y$7, ad) ? 1 : 0; + case 2: + var y$8 = b[1]; return an / ad === y$8 ? 1 : 0; + case 34: + var bd = b[2], bn = b[1]; + return caml_mul(an, bd) === caml_mul(bn, ad) ? 1 : 0; + default: break a; + } + default: break a; + } + if(typeof b !== "number"){ + switch(b[0]){ + case 6: + var lb = b[1]; break; + case 21: + var lb = b[1][1]; break; + default: break a; + } + try{var c = Stdlib_List[35].call(null, fast_eq, la, lb); return c;} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] === Stdlib[6]) return 0; + throw caml_maybe_attach_backtrace(exn, 0); + } + } + } + return 0; + } + var + cst_empty = "empty?", + cst_first = "first", + cst_len = "len", + cst_rest = "rest", + a = [6, 0], + b = [6, 0], + c = [6, 0], + e = [1, 0], + f = [0, 1], + g = [0, 0], + h = [0, 1], + i = [0, 0], + j = [0, 1]; function prim_call(name, args){ + if(name !== "<"){ + if(name !== "<="){ + if(name !== "="){ + if(name !== ">"){ + if(name !== ">="){ + if(name !== cst_empty){ + if(name !== cst_first){ + if(name !== cst_len){ + if(name === cst_rest && args){ + var k = args[1]; + if(typeof k === "number"){ + if(0 === k && ! args[2]) return a; + } + else + switch(k[0]){ + case 6: + var N = k[1]; + if(N){ + if(! args[2]){var xs = N[2]; return [6, xs];} + } + else if(! args[2]) return b; + break; + case 21: + var O = k[1][1]; + if(O){ + if(! args[2]){var xs$0 = O[2]; return [6, xs$0];} + } + else if(! args[2]) return c; + break; + } + } + } + else if(args){ + var d = args[1]; + if(typeof d === "number"){ + if(0 === d && ! args[2]) return e; + } + else + switch(d[0]){ + case 3: + if(! args[2]){ + var s = d[1]; + return [1, caml_ml_string_length(s)]; + } + break; + case 6: + if(! args[2]){ + var l = d[1]; + return [1, Stdlib_List[1].call(null, l)]; + } + break; + case 21: + if(! args[2]){ + var r = d[1]; + return [1, Stdlib_List[1].call(null, r[1])]; + } + break; + } + } + } + else if(args){ + var m = args[1]; + if(typeof m === "number"){ + if(0 === m && ! args[2]) return 0; + } + else + switch(m[0]){ + case 6: + var P = m[1]; + if(P){ + if(! args[2]){var x = P[1]; return x;} + } + else if(! args[2]) return 0; + break; + case 21: + var Q = m[1][1]; + if(Q){ + if(! args[2]){var x$0 = Q[1]; return x$0;} + } + else if(! args[2]) return 0; + break; + } + } + } + else if(args){ + var n = args[1]; + if(typeof n === "number"){ + if(0 === n && ! args[2]) return f; + } + else + switch(n[0]){ + case 6: + if(n[1]){if(! args[2]) return g;} else if(! args[2]) return h; + break; + case 21: + if(n[1][1]){ + if(! args[2]) return i; + } + else if(! args[2]) return j; + break; + } + } + } + else if(args){ + var o = args[1]; + if(typeof o !== "number") + switch(o[0]){ + case 1: + var p = args[2]; + if(p){ + var q = p[1], x$1 = o[1]; + if(typeof q !== "number") + switch(q[0]){ + case 1: + if(! p[2]){var y = q[1]; return [0, y <= x$1 ? 1 : 0];} + break; + case 2: + if(! p[2]){var y$0 = q[1]; return [0, y$0 <= x$1 ? 1 : 0];} + break; + } + } + break; + case 2: + var t = args[2]; + if(t){ + var u = t[1], x$2 = o[1]; + if(typeof u !== "number") + switch(u[0]){ + case 1: + if(! t[2]){var y$1 = u[1]; return [0, y$1 <= x$2 ? 1 : 0];} + break; + case 2: + if(! t[2]){var y$2 = u[1]; return [0, y$2 <= x$2 ? 1 : 0];} + break; + } + } + break; + } + } + } + else if(args){ + var v = args[1]; + if(typeof v !== "number") + switch(v[0]){ + case 1: + var w = args[2]; + if(w){ + var z = w[1], x$3 = v[1]; + if(typeof z !== "number") + switch(z[0]){ + case 1: + if(! w[2]){var y$3 = z[1]; return [0, y$3 < x$3 ? 1 : 0];} + break; + case 2: + if(! w[2]){var y$4 = z[1]; return [0, y$4 < x$3 ? 1 : 0];} + break; + } + } + break; + case 2: + var A = args[2]; + if(A){ + var B = A[1], x$4 = v[1]; + if(typeof B !== "number") + switch(B[0]){ + case 1: + if(! A[2]){var y$5 = B[1]; return [0, y$5 < x$4 ? 1 : 0];} + break; + case 2: + if(! A[2]){var y$6 = B[1]; return [0, y$6 < x$4 ? 1 : 0];} + break; + } + } + break; + } + } + } + else if(args){ + var M = args[2]; + if(M && ! M[2]){ + var b$0 = M[1], a$0 = args[1]; + return [0, fast_eq(a$0, b$0)]; + } + } + } + else if(args){ + var C = args[1]; + if(typeof C !== "number") + switch(C[0]){ + case 1: + var D = args[2]; + if(D){ + var E = D[1], x$5 = C[1]; + if(typeof E !== "number") + switch(E[0]){ + case 1: + if(! D[2]){var y$7 = E[1]; return [0, x$5 <= y$7 ? 1 : 0];} + break; + case 2: + if(! D[2]){var y$8 = E[1]; return [0, x$5 <= y$8 ? 1 : 0];} + break; + } + } + break; + case 2: + var F = args[2]; + if(F){ + var G = F[1], x$6 = C[1]; + if(typeof G !== "number") + switch(G[0]){ + case 1: + if(! F[2]){var y$9 = G[1]; return [0, x$6 <= y$9 ? 1 : 0];} + break; + case 2: + if(! F[2]){var y$10 = G[1]; return [0, x$6 <= y$10 ? 1 : 0];} + break; + } + } + break; + } + } + } + else if(args){ + var H = args[1]; + if(typeof H !== "number") + switch(H[0]){ + case 1: + var I = args[2]; + if(I){ + var J = I[1], x$7 = H[1]; + if(typeof J !== "number") + switch(J[0]){ + case 1: + if(! I[2]){var y$11 = J[1]; return [0, x$7 < y$11 ? 1 : 0];} + break; + case 2: + if(! I[2]){var y$12 = J[1]; return [0, x$7 < y$12 ? 1 : 0];} + break; + } + } + break; + case 2: + var K = args[2]; + if(K){ + var L = K[1], x$8 = H[1]; + if(typeof L !== "number") + switch(L[0]){ + case 1: + if(! K[2]){var y$13 = L[1]; return [0, x$8 < y$13 ? 1 : 0];} + break; + case 2: + if(! K[2]){var y$14 = L[1]; return [0, x$8 < y$14 ? 1 : 0];} + break; + } + } + break; + } + } var match = Stdlib_Hashtbl[7].call(null, Sx_primitives[1], name); - if(match){var f = match[1]; return caml_call1(f, args);} - var a = Stdlib[28].call(null, "Unknown primitive: ", name); - throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); + if(match){var f$0 = match[1]; return caml_call1(f$0, args);} + var R = Stdlib[28].call(null, "Unknown primitive: ", name); + throw caml_maybe_attach_backtrace([0, Sx_types[9], R], 1); } var cst = ""; function value_to_str(v){ @@ -49697,7 +56687,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 5: var s = v[1]; return s; } - return Sx_types[112].call(null, v); + return Sx_types[117].call(null, v); } function sx_to_string(v){return [3, value_to_str(v)];} function sx_str(args){ @@ -49714,7 +56704,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var r = v[1]; return r[1]; } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, "Expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -49747,7 +56737,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[20].call (null, function(a){ - var s = Sx_types[112].call(null, a); + var s = Sx_types[117].call(null, a); if(40 >= caml_ml_string_length(s)) return s; var b = Stdlib_String[16].call(null, s, 0, 40); return Stdlib[28].call(null, b, ".."); @@ -49757,20 +56747,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e = Stdlib[28].call(null, s, "]"), args_preview = Stdlib[28].call(null, " with args=[", e); var - a = Sx_types[112].call(null, f), + a = Sx_types[117].call(null, f), b = Stdlib[28].call(null, a, args_preview), c = Stdlib[28].call(null, "Not callable: ", b); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } Sx_primitives[2][1] = sx_call; function sx_apply(f, args_list){return sx_call(f, sx_to_list(args_list));} - var cst_eval_error = "__eval_error__", a = [0, 1]; + var cst_eval_error = "__eval_error__", k = [0, 1]; function sx_apply_cek(f, args_list){ if(typeof f !== "number") switch(f[0]){ case 15: case 24: - try{var b = sx_apply(f, args_list); return b;} + try{var a = sx_apply(f, args_list); return a;} catch(e$0){ var e = caml_wrap_exception(e$0); if(e[1] === Sx_types[11]) throw caml_maybe_attach_backtrace(e, 0); @@ -49778,7 +56768,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(match){var marker = match[1]; return marker;} if(e[1] !== Sx_types[9]) throw caml_maybe_attach_backtrace(e, 0); var msg = e[2], d = Stdlib_Hashtbl[1].call(null, 0, 3); - Stdlib_Hashtbl[11].call(null, d, cst_eval_error, a); + Stdlib_Hashtbl[11].call(null, d, cst_eval_error, k); Stdlib_Hashtbl[11].call(null, d, "message", [3, msg]); return [7, d]; } @@ -49808,7 +56798,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return lst; } var - a = Sx_types[57].call(null, lst), + a = Sx_types[61].call(null, lst), b = Stdlib[28].call(null, "append!: expected list, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -49909,7 +56899,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, "dict-set! vm-frame: unknown field ", key$1); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } - f$0[2] = Sx_types[90].call(null, v); + f$0[2] = Sx_types[94].call(null, v); return v; } break; @@ -49917,7 +56907,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof k !== "number" && 3 === k[0]){ var key$2 = k[1], m = d[1]; if(key$2 !== cst_frames){ - if(key$2 === cst_sp){m[2] = Sx_types[90].call(null, v); return v;} + if(key$2 === cst_sp){m[2] = Sx_types[94].call(null, v); return v;} if(key$2 !== cst_stack){ var e = @@ -49959,7 +56949,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cst_body = "body", cst_else = "else", cst_name = "name", - cst_type = "type"; + cst_type = "type", + l = [0, 1]; function get_val(container, key){ a: if(typeof container === "number"){if(0 === container) return 0;} @@ -49967,18 +56958,18 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cst_env = "env"; switch(container[0]){ case 6: - var l = container[1]; break; + var l$0 = container[1]; break; case 7: var d = container[1]; if(typeof key === "number") break a; switch(key[0]){ case 3: case 5: - var k = key[1]; return Sx_types[106].call(null, d, k); + var k = key[1]; return Sx_types[110].call(null, d, k); default: break a; } case 21: - var l = container[1][1]; break; + var l$0 = container[1][1]; break; case 22: if(typeof key === "number") break a; if(3 !== key[0]) break a; @@ -50063,21 +57054,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(k$2 === "vm-code"){ var c = cl[1], match$0 = c[6]; if(match$0) - var l$1 = match$0[1], bc = l$1; + var l$2 = match$0[1], bc = l$2; else{ var - h = Stdlib_Array[14].call(null, function(i){return [2, i];}, c[4]), - l$4 = Stdlib_Array[10].call(null, h); - c[6] = [0, l$4]; - var bc = l$4; + i = Stdlib_Array[14].call(null, function(i){return [2, i];}, c[4]), + l$5 = Stdlib_Array[10].call(null, i); + c[6] = [0, l$5]; + var bc = l$5; } var match$1 = c[7]; if(match$1) - var l$2 = match$1[1], consts = l$2; + var l$3 = match$1[1], consts = l$3; else{ - var l$3 = Stdlib_Array[10].call(null, c[5]); - c[7] = [0, l$3]; - var consts = l$3; + var l$4 = Stdlib_Array[10].call(null, c[5]); + c[7] = [0, l$4]; + var consts = l$4; } var d$0 = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d$0, "vc-bytecode", [6, bc]); @@ -50091,8 +57082,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(k$2 !== "vm-name"){ if(k$2 !== "vm-upvalues") return 0; var - g = Stdlib_Array[14].call(null, function(uv){return uv[1];}, cl[2]); - return [6, Stdlib_Array[10].call(null, g)]; + h = Stdlib_Array[14].call(null, function(uv){return uv[1];}, cl[2]); + return [6, Stdlib_Array[10].call(null, h)]; } var match = cl[3]; if(! match) return 0; @@ -50123,24 +57114,42 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= : [6, Stdlib_List[20].call (null, function(f){return [25, f];}, m[3])]; + case 38: + var a = container[1]; + if(typeof key === "number") break a; + switch(key[0]){ + case 3: + case 5: + var k$5 = key[1]; + return k$5 !== "_adt" + ? k$5 + !== "_ctor" + ? k$5 + !== "_fields" + ? k$5 !== "_type" ? 0 : [3, a[1]] + : [6, Stdlib_Array[10].call(null, a[3])] + : [3, a[2]] + : l; + default: break a; + } default: break a; } if(typeof key !== "number" && 2 === key[0]){ var n$0 = key[1]; - try{var b = Stdlib_List[8].call(null, l, n$0 | 0); return b;} + try{var g = Stdlib_List[8].call(null, l$0, n$0 | 0); return g;} catch(exn){return 0;} } if(typeof container !== "number"){ switch(container[0]){ case 6: - var l$0 = container[1]; break; + var l$1 = container[1]; break; case 21: - var l$0 = container[1][1]; break; + var l$1 = container[1][1]; break; default: break a; } if(typeof key !== "number" && 1 === key[0]){ var n = key[1]; - try{var a = Stdlib_List[8].call(null, l$0, n); return a;} + try{var b = Stdlib_List[8].call(null, l$1, n); return b;} catch(exn){return 0;} } } @@ -50177,8 +57186,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var f = match[1]; return f; } - function first(args){return caml_call1(prim("first"), [0, args, 0]);} - function rest(args){return caml_call1(prim("rest"), [0, args, 0]);} + function first(args){return caml_call1(prim(cst_first), [0, args, 0]);} + function rest(args){return caml_call1(prim(cst_rest), [0, args, 0]);} function last(args){return caml_call1(prim("last"), [0, args, 0]);} function nth(coll, i){ return caml_call1(prim("nth"), [0, coll, [0, i, 0]]); @@ -50193,7 +57202,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return caml_call1(prim("concat"), [0, a, [0, b, 0]]); } function slice(a, b){return caml_call1(prim("slice"), [0, a, [0, b, 0]]);} - function len(a){return caml_call1(prim("len"), [0, a, 0]);} + function len(a){return caml_call1(prim(cst_len), [0, a, 0]);} function get(a, b){return get_val(a, b);} function sort(a){return caml_call1(prim("sort"), [0, a, 0]);} function range(a){return caml_call1(prim("range"), [0, a, 0]);} @@ -50202,7 +57211,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function take(a, b){return caml_call1(prim("take"), [0, a, [0, b, 0]]);} function drop(a, b){return caml_call1(prim("drop"), [0, a, [0, b, 0]]);} function keyword_p(a){return caml_call1(prim("keyword?"), [0, a, 0]);} - function empty_p(a){return caml_call1(prim("empty?"), [0, a, 0]);} + function empty_p(a){return caml_call1(prim(cst_empty), [0, a, 0]);} function number_p(a){return caml_call1(prim("number?"), [0, a, 0]);} function string_p(a){return caml_call1(prim("string?"), [0, a, 0]);} function boolean_p(a){return caml_call1(prim("boolean?"), [0, a, 0]);} @@ -50256,14 +57265,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = value_to_str(msg); throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); } - function inspect(v){return [3, Sx_types[112].call(null, v)];} + function inspect(v){return [3, Sx_types[117].call(null, v)];} function apply(f, args){return sx_apply(f, args);} function spread_attrs(a){ return caml_call1(prim("spread-attrs"), [0, a, 0]); } function sx_context(a, b){return prim_call("context", [0, a, [0, b, 0]]);} function trampoline(v){return v;} - function type_of(v){return [3, Sx_types[57].call(null, v)];} + function type_of(v){return [3, Sx_types[61].call(null, v)];} function unwrap_env(v){ if(typeof v === "number"){ if(0 === v) return Sx_types[20].call(null, 0); @@ -50281,7 +57290,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var e$0 = v[1]; return e$0; } var - a = Sx_types[57].call(null, v), + a = Sx_types[61].call(null, v), b = Stdlib[28].call(null, "Expected env, got ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -50312,16 +57321,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } function set_lambda_name(l, n){ var a = value_to_str(n); - return Sx_types[74].call(null, l, a); + return Sx_types[78].call(null, l, a); } - function is_nil(v){return [0, Sx_types[58].call(null, v)];} - function is_thunk(v){return [0, Sx_types[63].call(null, v)];} - function is_lambda(v){return [0, Sx_types[59].call(null, v)];} - function is_component(v){return [0, Sx_types[60].call(null, v)];} - function is_island(v){return [0, Sx_types[61].call(null, v)];} - function is_macro(v){return [0, Sx_types[62].call(null, v)];} - function is_signal(v){return [0, Sx_types[64].call(null, v)];} - function is_callable(v){return [0, Sx_types[66].call(null, v)];} + function is_nil(v){return [0, Sx_types[62].call(null, v)];} + function is_thunk(v){return [0, Sx_types[67].call(null, v)];} + function is_lambda(v){return [0, Sx_types[63].call(null, v)];} + function is_component(v){return [0, Sx_types[64].call(null, v)];} + function is_island(v){return [0, Sx_types[65].call(null, v)];} + function is_macro(v){return [0, Sx_types[66].call(null, v)];} + function is_signal(v){return [0, Sx_types[68].call(null, v)];} + function is_callable(v){return [0, Sx_types[70].call(null, v)];} function is_primitive(name){ var a = value_to_str(name); return [0, Sx_primitives[14].call(null, a)]; @@ -50336,10 +57345,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(i, x){sx_call(fn, [0, [2, i], [0, x, 0]]); return 0;}, a); return 0; } - var b = [0, 0], c = [0, 1]; + var m = [0, 0], n = [0, 1]; function continuation_p(v){ - if(typeof v !== "number" && 13 === v[0]) return c; - return b; + if(typeof v !== "number" && 13 === v[0]) return n; + return m; } function make_cek_continuation(captured, rest_kont){ var data = Stdlib_Hashtbl[1].call(null, 0, 2); @@ -50357,10 +57366,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "not a continuation"], 1); } - var e = [0, 0], f = [0, 1]; + var o = [0, 0], p = [0, 1]; function callcc_continuation_p(v){ - if(typeof v !== "number" && 14 === v[0]) return f; - return e; + if(typeof v !== "number" && 14 === v[0]) return p; + return o; } function make_callcc_continuation(captured, winders_len){ a: @@ -50381,15 +57390,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace ([0, Sx_types[9], "not a callcc continuation"], 1); } - var g = [2, 0.]; + var q = [2, 0.]; function callcc_continuation_winders_le(v){ if(typeof v !== "number" && 14 === v[0]){var n = v[2]; return [2, n];} - return g; + return q; } function host_error(msg){ var a = value_to_str(msg); throw caml_maybe_attach_backtrace([0, Sx_types[9], a], 1); } + function host_warn(msg){ + var a = value_to_str(msg); + Stdlib[53].call(null, a); + return 0; + } function dynamic_wind_call(before, body, after, env){ sx_call(before, 0); var result = sx_call(body, 0); @@ -50419,18 +57433,18 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Hashtbl[11].call(null, tbl, a, handler); return handler; } - var h = [0, 0], i = [0, 1]; + var r = [0, 0], s = [0, 1]; function is_else_clause(v){ if(typeof v !== "number"){ var cst_default = "default"; switch(v[0]){ case 0: - if(v[1]) return i; break; + if(v[1]) return s; break; case 4: var - s = v[1], - a = s === cst_else ? 1 : 0, - b = a || (s === cst_default ? 1 : 0); + s$0 = v[1], + a = s$0 === cst_else ? 1 : 0, + b = a || (s$0 === cst_default ? 1 : 0); return [0, b]; case 5: var @@ -50440,7 +57454,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [0, d]; } } - return h; + return r; } function signal_value(s){ if(typeof s !== "number") @@ -50513,33 +57527,33 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } function register_in_scope(dispose_fn){return 0;} function component_set_param_types_b(comp, types){return 0;} - var j = [6, [0, [6, 0], [0, 0, [0, [0, 0], 0]]]]; - function parse_comp_params(params){return j;} - var k = [6, [0, [6, 0], [0, 0, 0]]]; - function parse_macro_params(params){return k;} - var l = [0, [6, 0], 0]; + var t = [6, [0, [6, 0], [0, 0, [0, [0, 0], 0]]]]; + function parse_comp_params(params){return t;} + var u = [6, [0, [6, 0], [0, 0, 0]]]; + function parse_macro_params(params){return u;} + var v = [0, [6, 0], 0]; function parse_keyword_args(raw_args, env){ - return [6, [0, [7, Stdlib_Hashtbl[1].call(null, 0, 0)], l]]; + return [6, [0, [7, Stdlib_Hashtbl[1].call(null, 0, 0)], v]]; } - var m = [3, "handler"]; + var w = [3, "handler"]; function make_handler_def(name, params, body, env){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); - Stdlib_Hashtbl[11].call(null, d, cst_type, m); + Stdlib_Hashtbl[11].call(null, d, cst_type, w); Stdlib_Hashtbl[11].call(null, d, cst_name, name); Stdlib_Hashtbl[11].call(null, d, "params", params); Stdlib_Hashtbl[11].call(null, d, cst_body, body); return [7, d]; } - var n = [3, "page"]; + var x = [3, "page"]; function make_page_def(name, opts){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); - Stdlib_Hashtbl[11].call(null, d, cst_type, n); + Stdlib_Hashtbl[11].call(null, d, cst_type, x); Stdlib_Hashtbl[11].call(null, d, cst_name, name); return [7, d]; } - var o = [2, 1.]; + var y = [2, 1.]; function sf_defhandler(args, env){ - var name = first(args), rest_args = rest(args), a = nth(rest_args, o); + var name = first(args), rest_args = rest(args), a = nth(rest_args, y); return make_handler_def(name, first(rest_args), a, env); } function strip_prefix(s, prefix){ @@ -50605,8 +57619,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return jit_skip_sentinel; } runtime.caml_register_global - (211, + (234, [0, + fast_eq, prim_call, value_to_str, sx_to_string, @@ -50708,6 +57723,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= callcc_continuation_data, callcc_continuation_winders_le, host_error, + host_warn, dynamic_wind_call, scope_push, scope_pop, @@ -50749,8 +57765,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 14003 "../lib/.sx.objs/jsoo/default/sx.cma.js" -//# shape: Sx_ref:[N,F(1),N,N,N,N,F(1),F(3)*,F(3)*,F(3),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3)*,F(2)*,F(2)*,F(4)*,F(4)*,F(3)*,F(2)*,F(6)*,F(3)*,F(3)*,F(2)*,F(3)*,F(4)*,F(3),F(3),F(4)*,F(4)*,F(4)*,F(5)*,F(3)*,F(3)*,F(3)*,F(3)*,F(3)*,F(4)*,F(3)*,F(2)*,F(4)*,F(1)*,F(3)*,F(2)*,F(2)*,F(4)*,F(3)*,F(1)*,F(3)*,F(2)*,F(1)*,F(4)*,F(2)*,F(1),F(3)*,F(3)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(3)*,F(5)*,F(2),F(2),F(2),F(1),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(1),F(1),N,F(2),N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),F(1),F(1),F(2),N,F(2),F(1),F(1),F(1),N,F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(3),F(1),F(2),F(3),F(2),F(2),F(3),N,N,F(1),N,N,F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(1),F(1),F(2),F(2),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(3),F(3),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(3),F(3),F(1),F(1),F(1),F(1),F(3),F(3),F(3),F(5),F(2),F(2),F(2),F(3),F(3),F(3),F(2),F(3),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(2),F(3),F(4),F(1),F(1)*,F(2),F(4),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1),F(5),F(4),F(2),F(1),F(1)*,F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(1),F(1)] +//# 19362 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_ref:[N,F(1),N,N,N,N,F(1),F(3)*,F(3)*,F(3),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(1),F(3)*,F(2)*,F(2)*,F(4)*,F(4)*,F(3)*,F(2)*,F(6)*,F(3)*,F(3)*,F(2)*,F(3)*,F(4)*,F(3),F(3),F(4)*,F(4)*,F(4)*,F(5)*,F(3)*,F(3)*,F(3)*,F(3)*,F(3)*,F(4)*,F(3)*,F(2)*,F(4)*,F(1)*,F(3)*,F(2)*,F(2)*,F(4)*,F(3)*,F(1)*,F(3)*,F(2)*,F(1)*,F(4)*,F(2)*,F(1),F(3)*,F(3)*,F(2)*,F(2)*,F(2)*,F(1)*,F(2)*,F(3)*,F(5)*,F(2),F(2),F(2),F(1),F(2),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(3),F(2),F(2),F(1),F(1),N,F(2),N,N,N,N,N,N,N,N,N,N,N,N,N,F(1),F(1),F(1),F(2),N,F(2),F(1),F(1),F(1),N,F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(3),F(1),F(2),F(3),F(2),F(2),F(3),N,N,F(1),N,N,F(1),F(2),F(2),F(3),F(3),F(3),F(2),F(1),F(1),F(2),F(2),F(2),F(3),F(1),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(3),F(3),F(2),F(2),F(3),F(1),F(1),F(2),F(1),F(1),F(3),F(3),F(3),F(3),F(3),F(3),F(1),F(1),F(1),F(1),F(3),F(3),F(3),F(5),F(2),F(2),F(2),F(3),F(3),F(3),F(2),F(3),F(2),F(3),F(3),F(2),F(2),F(2),F(2),F(1),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(2),F(3),F(4),F(1),F(1)*,F(2),F(4),F(3),F(3),F(3),F(3),F(3),F(3),F(3),F(1),F(5),F(4),F(2),F(1),F(1)*,F(2),F(1),F(1),F(1),F(1),F(2),F(1),F(1),F(2),F(2),F(2),F(2),F(2),F(1),F(1)] (function (globalThis){ "use strict"; @@ -50778,9 +57794,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Sx_runtime = global_data.Sx_runtime, Sx_types = global_data.Sx_types, Stdlib_List = global_data.Stdlib__List, + Stdlib_String = global_data.Stdlib__String, Stdlib = global_data.Stdlib, Stdlib_Printf = global_data.Stdlib__Printf, - Stdlib_String = global_data.Stdlib__String, Stdlib_Array = global_data.Stdlib__Array, Sx_primitives = global_data.Sx_primitives, trampoline_fn = [0, function(v){return v;}]; @@ -50842,29 +57858,29 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= f = [3, cst_kont]; function cek_terminal_p(state){ var - a = [0, Sx_runtime[25].call(null, state, e), d], - and = Sx_runtime[1].call(null, cst, a); - if(! Sx_types[67].call(null, and)) return and; - var b = Sx_runtime[25].call(null, state, f); - return Sx_runtime[33].call(null, b); + a = [0, Sx_runtime[26].call(null, state, e), d], + and = Sx_runtime[2].call(null, cst, a); + if(! Sx_types[71].call(null, and)) return and; + var b = Sx_runtime[26].call(null, state, f); + return Sx_runtime[34].call(null, b); } var g = [0, [3, cst_io_suspended], 0], h = [3, cst_phase]; function cek_suspended_p(state){ - var a = [0, Sx_runtime[25].call(null, state, h), g]; - return Sx_runtime[1].call(null, cst, a); + var a = [0, Sx_runtime[26].call(null, state, h), g]; + return Sx_runtime[2].call(null, cst, a); } var i = [3, "control"]; - function cek_control(s){return Sx_runtime[25].call(null, s, i);} + function cek_control(s){return Sx_runtime[26].call(null, s, i);} var j = [3, cst_env]; - function cek_env(s){return Sx_runtime[25].call(null, s, j);} + function cek_env(s){return Sx_runtime[26].call(null, s, j);} var k = [3, cst_kont]; - function cek_kont(s){return Sx_runtime[25].call(null, s, k);} + function cek_kont(s){return Sx_runtime[26].call(null, s, k);} var l = [3, cst_phase]; - function cek_phase(s){return Sx_runtime[25].call(null, s, l);} + function cek_phase(s){return Sx_runtime[26].call(null, s, l);} var m = [3, cst_request]; - function cek_io_request(s){return Sx_runtime[25].call(null, s, m);} + function cek_io_request(s){return Sx_runtime[26].call(null, s, m);} var cst_value = "value", n = [3, cst_value]; - function cek_value(s){return Sx_runtime[25].call(null, s, n);} + function cek_value(s){return Sx_runtime[26].call(null, s, n);} var cst_if = "if"; function make_if_frame(then_expr, else_expr, env){ return [23, [0, cst_if, env, else_expr, then_expr, 0, 0, 0, 0, 0, 0]]; @@ -50906,7 +57922,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var cst_arg = "arg"; function make_arg_frame(f, evaled, remaining, env, raw_args, head_name){ - var head_name$0 = Sx_types[67].call(null, head_name) ? head_name : 0; + var head_name$0 = Sx_types[71].call(null, head_name) ? head_name : 0; return [23, [0, cst_arg, @@ -50947,16 +57963,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= q = [4, cst_quote]; function thread_insert_arg(form, value, fenv){ var - a = [0, Sx_runtime[73].call(null, form), o], - b = Sx_runtime[1].call(null, cst, a); - if(! Sx_types[67].call(null, b)) + a = [0, Sx_runtime[74].call(null, form), o], + b = Sx_runtime[2].call(null, cst, a); + if(! Sx_types[71].call(null, b)) return eval_expr ([6, [0, form, [0, [6, [0, q, [0, value, 0]]], 0]]], fenv); var - c = Sx_runtime[15].call(null, form), - d = Sx_runtime[18].call(null, [6, [0, p, [0, value, 0]]], c), - e = Sx_runtime[14].call(null, form); - return eval_expr(Sx_runtime[18].call(null, e, d), fenv); + c = Sx_runtime[16].call(null, form), + d = Sx_runtime[19].call(null, [6, [0, p, [0, value, 0]]], c), + e = Sx_runtime[15].call(null, form); + return eval_expr(Sx_runtime[19].call(null, e, d), fenv); } var cst_append = "append", @@ -50965,11 +57981,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= t = [4, cst_quote]; function thread_insert_arg_last(form, value, fenv){ var - a = [0, Sx_runtime[73].call(null, form), r], - b = Sx_runtime[1].call(null, cst, a); - return Sx_types[67].call(null, b) + a = [0, Sx_runtime[74].call(null, form), r], + b = Sx_runtime[2].call(null, cst, a); + return Sx_types[71].call(null, b) ? eval_expr - (Sx_runtime[1].call + (Sx_runtime[2].call (null, cst_append, [0, form, [0, [6, [0, [6, [0, s, [0, value, 0]]], 0]], 0]]), @@ -51049,7 +58065,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var cst_scope_acc = "scope-acc", x = [6, 0]; function make_scope_acc_frame(name, value, remaining, env){ - var value$0 = Sx_types[67].call(null, value) ? value : 0; + var value$0 = Sx_types[71].call(null, value) ? value : 0; return [23, [0, cst_scope_acc, env, name, 0, remaining, 0, 0, 0, value$0, x]]; } @@ -51145,23 +58161,23 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_collect_comp_trace(kont$1){ var kont = kont$1; for(;;){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)) return y; + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)) return y; var - frame = Sx_runtime[14].call(null, kont), + frame = Sx_runtime[15].call(null, kont), b = [0, frame_type(frame), z], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)){ var - e = kont_collect_comp_trace(Sx_runtime[15].call(null, kont)), + e = kont_collect_comp_trace(Sx_runtime[16].call(null, kont)), d = Stdlib_Hashtbl[1].call(null, 0, 2), - f = Sx_runtime[25].call(null, frame, A); + f = Sx_runtime[26].call(null, frame, A); Stdlib_Hashtbl[11].call(null, d, cst_file, f); - var g = Sx_runtime[25].call(null, frame, B); + var g = Sx_runtime[26].call(null, frame, B); Stdlib_Hashtbl[11].call(null, d, cst_name, g); - return Sx_runtime[18].call(null, [7, d], e); + return Sx_runtime[19].call(null, [7, d], e); } - var kont$0 = Sx_runtime[15].call(null, kont); + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } } @@ -51218,15 +58234,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function find_matching_handler(handlers$1, condition){ var handlers = handlers$1; for(;;){ - var a = Sx_runtime[33].call(null, handlers); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, handlers); + if(Sx_types[71].call(null, a)) return 0; var - pair = Sx_runtime[14].call(null, handlers), - pred = Sx_runtime[14].call(null, pair), - handler_fn = Sx_runtime[17].call(null, pair, C), + pair = Sx_runtime[15].call(null, handlers), + pred = Sx_runtime[15].call(null, pair), + handler_fn = Sx_runtime[18].call(null, pair, C), b = cek_call(pred, [6, [0, condition, 0]]); - if(Sx_types[67].call(null, b)) return handler_fn; - var handlers$0 = Sx_runtime[15].call(null, handlers); + if(Sx_types[71].call(null, b)) return handler_fn; + var handlers$0 = Sx_runtime[16].call(null, handlers); handlers = handlers$0; } } @@ -51234,22 +58250,22 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_find_handler(kont$2, condition){ var kont = kont$2; for(;;){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)) return 0; var - frame = Sx_runtime[14].call(null, kont), + frame = Sx_runtime[15].call(null, kont), b = [0, frame_type(frame), D], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)){ var match = - find_matching_handler(Sx_runtime[25].call(null, frame, E), condition), - d = Sx_runtime[83].call(null, match); - if(! Sx_types[67].call(null, d)) return match; - var kont$0 = Sx_runtime[15].call(null, kont); + find_matching_handler(Sx_runtime[26].call(null, frame, E), condition), + d = Sx_runtime[84].call(null, match); + if(! Sx_types[71].call(null, d)) return match; + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } - else{var kont$1 = Sx_runtime[15].call(null, kont); kont = kont$1;} + else{var kont$1 = Sx_runtime[16].call(null, kont); kont = kont$1;} } } var @@ -51266,24 +58282,24 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_unwind_to_handler(kont$0, condition){ var kont = kont$0; for(;;){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)){ + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)){ var d = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d, cst_handler, 0); Stdlib_Hashtbl[11].call(null, d, cst_kont, kont); return [7, d]; } var - frame = Sx_runtime[14].call(null, kont), - rest_k = Sx_runtime[15].call(null, kont), + frame = Sx_runtime[15].call(null, kont), + rest_k = Sx_runtime[16].call(null, kont), b = [0, frame_type(frame), F], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)){ var match = - find_matching_handler(Sx_runtime[25].call(null, frame, G), condition), - e = Sx_runtime[83].call(null, match); - if(! Sx_types[67].call(null, e)){ + find_matching_handler(Sx_runtime[26].call(null, frame, G), condition), + e = Sx_runtime[84].call(null, match); + if(! Sx_types[71].call(null, e)){ var d$0 = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d$0, cst_handler, match); Stdlib_Hashtbl[11].call(null, d$0, cst_kont, kont); @@ -51292,15 +58308,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= kont = rest_k; } else{ - var f = [0, frame_type(frame), H], g = Sx_runtime[1].call(null, cst, f); - if(Sx_types[67].call(null, g)){ + var f = [0, frame_type(frame), H], g = Sx_runtime[2].call(null, cst, f); + if(Sx_types[71].call(null, g)){ var - h = [0, Sx_runtime[25].call(null, frame, I), 0], - i = [0, Sx_runtime[24].call(null, winders_ref[1]), h], - j = Sx_runtime[1].call(null, cst$0, i); - if(Sx_types[67].call(null, j)) - winders_ref[1] = Sx_runtime[15].call(null, winders_ref[1]); - cek_call(Sx_runtime[25].call(null, frame, K), J); + h = [0, Sx_runtime[26].call(null, frame, I), 0], + i = [0, Sx_runtime[25].call(null, winders_ref[1]), h], + j = Sx_runtime[2].call(null, cst$0, i); + if(Sx_types[71].call(null, j)) + winders_ref[1] = Sx_runtime[16].call(null, winders_ref[1]); + cek_call(Sx_runtime[26].call(null, frame, K), J); kont = rest_k; } else @@ -51312,25 +58328,25 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function wind_escape_to(target_len){ for(;;){ var - a = [0, Sx_runtime[24].call(null, winders_ref[1]), [0, target_len, 0]], - b = Sx_runtime[1].call(null, cst$0, a); - if(! Sx_types[67].call(null, b)) return 0; - var after_thunk = Sx_runtime[14].call(null, winders_ref[1]); - winders_ref[1] = Sx_runtime[15].call(null, winders_ref[1]); + a = [0, Sx_runtime[25].call(null, winders_ref[1]), [0, target_len, 0]], + b = Sx_runtime[2].call(null, cst$0, a); + if(! Sx_types[71].call(null, b)) return 0; + var after_thunk = Sx_runtime[15].call(null, winders_ref[1]); + winders_ref[1] = Sx_runtime[16].call(null, winders_ref[1]); cek_call(after_thunk, L); } } function find_named_restart(restarts$1, name){ var restarts = restarts$1; for(;;){ - var a = Sx_runtime[33].call(null, restarts); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, restarts); + if(Sx_types[71].call(null, a)) return 0; var - entry = Sx_runtime[14].call(null, restarts), - b = [0, Sx_runtime[14].call(null, entry), [0, name, 0]], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)) return entry; - var restarts$0 = Sx_runtime[15].call(null, restarts); + entry = Sx_runtime[15].call(null, restarts), + b = [0, Sx_runtime[15].call(null, entry), [0, name, 0]], + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)) return entry; + var restarts$0 = Sx_runtime[16].call(null, restarts); restarts = restarts$0; } } @@ -51338,33 +58354,33 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_find_restart(kont$2, name){ var kont = kont$2; for(;;){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)) return 0; var - frame = Sx_runtime[14].call(null, kont), + frame = Sx_runtime[15].call(null, kont), b = [0, frame_type(frame), M], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)){ var - match = find_named_restart(Sx_runtime[25].call(null, frame, N), name), - d = Sx_runtime[83].call(null, match); - if(! Sx_types[67].call(null, d)) + match = find_named_restart(Sx_runtime[26].call(null, frame, N), name), + d = Sx_runtime[84].call(null, match); + if(! Sx_types[71].call(null, d)) return [6, - [0, match, [0, frame, [0, Sx_runtime[15].call(null, kont), 0]]]]; - var kont$0 = Sx_runtime[15].call(null, kont); + [0, match, [0, frame, [0, Sx_runtime[16].call(null, kont), 0]]]]; + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } - else{var kont$1 = Sx_runtime[15].call(null, kont); kont = kont$1;} + else{var kont$1 = Sx_runtime[16].call(null, kont); kont = kont$1;} } } var cst_type = "type", O = [3, cst_type]; - function frame_type(f){return Sx_runtime[25].call(null, f, O);} + function frame_type(f){return Sx_runtime[26].call(null, f, O);} function kont_push(frame, kont){ - return Sx_runtime[18].call(null, frame, kont); + return Sx_runtime[19].call(null, frame, kont); } - function kont_top(kont){return Sx_runtime[14].call(null, kont);} - function kont_pop(kont){return Sx_runtime[15].call(null, kont);} - function kont_empty_p(kont){return Sx_runtime[33].call(null, kont);} + function kont_top(kont){return Sx_runtime[15].call(null, kont);} + function kont_pop(kont){return Sx_runtime[16].call(null, kont);} + function kont_empty_p(kont){return Sx_runtime[34].call(null, kont);} var captured = [6, 0], P = [3, "shift without enclosing reset"], @@ -51373,28 +58389,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_capture_to_reset(kont){ var k = kont, captured$0 = captured; for(;;){ - var a = Sx_runtime[33].call(null, k); - if(Sx_types[67].call(null, a)){ - var b = Sx_runtime[2].call(null, P); + var a = Sx_runtime[34].call(null, k); + if(Sx_types[71].call(null, a)){ + var b = Sx_runtime[3].call(null, P); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } var - frame = Sx_runtime[14].call(null, k), + frame = Sx_runtime[15].call(null, k), c = [0, frame_type(frame), Q], - or = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, or)) + or = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, or)) var or$0 = or; else var d = [0, frame_type(frame), R], - or$0 = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, or$0)) - return [6, [0, captured$0, [0, Sx_runtime[15].call(null, k), 0]]]; + or$0 = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, or$0)) + return [6, [0, captured$0, [0, Sx_runtime[16].call(null, k), 0]]]; var captured$1 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, captured$0, [0, [6, [0, frame, 0]], 0]]), - k$0 = Sx_runtime[15].call(null, k); + k$0 = Sx_runtime[16].call(null, k); k = k$0; captured$0 = captured$1; } @@ -51403,14 +58419,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_push_provides(pairs$1, env, kont$1){ var pairs = pairs$1, kont = kont$1; for(;;){ - var a = Sx_runtime[33].call(null, pairs); - if(Sx_types[67].call(null, a)) return kont; + var a = Sx_runtime[34].call(null, pairs); + if(Sx_types[71].call(null, a)) return kont; var - pair = Sx_runtime[14].call(null, pairs), - b = Sx_runtime[17].call(null, pair, T), - c = make_provide_frame(Sx_runtime[14].call(null, pair), b, S, env), - kont$0 = Sx_runtime[18].call(null, c, kont), - pairs$0 = Sx_runtime[15].call(null, pairs); + pair = Sx_runtime[15].call(null, pairs), + b = Sx_runtime[18].call(null, pair, T), + c = make_provide_frame(Sx_runtime[15].call(null, pair), b, S, env), + kont$0 = Sx_runtime[19].call(null, c, kont), + pairs$0 = Sx_runtime[16].call(null, pairs); pairs = pairs$0; kont = kont$0; } @@ -51419,20 +58435,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_find_provide(kont$1, name){ var kont = kont$1; for(;;){ - var b = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, b)) return 0; + var b = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, b)) return 0; var - frame = Sx_runtime[14].call(null, kont), + frame = Sx_runtime[15].call(null, kont), c = [0, frame_type(frame), U], - and = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and)) + and = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and)) var - d = [0, Sx_runtime[25].call(null, frame, V), [0, name, 0]], - a = Sx_runtime[1].call(null, cst, d); + d = [0, Sx_runtime[26].call(null, frame, V), [0, name, 0]], + a = Sx_runtime[2].call(null, cst, d); else var a = and; - if(Sx_types[67].call(null, a)) return frame; - var kont$0 = Sx_runtime[15].call(null, kont); + if(Sx_types[71].call(null, a)) return frame; + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } } @@ -51440,20 +58456,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_find_scope_acc(kont$1, name){ var kont = kont$1; for(;;){ - var b = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, b)) return 0; + var b = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, b)) return 0; var - frame = Sx_runtime[14].call(null, kont), + frame = Sx_runtime[15].call(null, kont), c = [0, frame_type(frame), W], - and = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and)) + and = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and)) var - d = [0, Sx_runtime[25].call(null, frame, X), [0, name, 0]], - a = Sx_runtime[1].call(null, cst, d); + d = [0, Sx_runtime[26].call(null, frame, X), [0, name, 0]], + a = Sx_runtime[2].call(null, cst, d); else var a = and; - if(Sx_types[67].call(null, a)) return frame; - var kont$0 = Sx_runtime[15].call(null, kont); + if(Sx_types[71].call(null, a)) return frame; + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } } @@ -51461,13 +58477,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function has_reactive_reset_frame_p(kont$1){ var kont = kont$1; for(;;){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)) return Y; + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)) return Y; var - b = [0, frame_type(Sx_runtime[14].call(null, kont)), Z], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)) return _; - var kont$0 = Sx_runtime[15].call(null, kont); + b = [0, frame_type(Sx_runtime[15].call(null, kont)), Z], + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)) return _; + var kont$0 = Sx_runtime[16].call(null, kont); kont = kont$0; } } @@ -51478,35 +58494,35 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function kont_capture_to_reactive_reset(kont){ var k = kont, captured = captured$0; for(;;){ - var a = Sx_runtime[33].call(null, k); - if(Sx_types[67].call(null, a)){ - var b = Sx_runtime[2].call(null, $); + var a = Sx_runtime[34].call(null, k); + if(Sx_types[71].call(null, a)){ + var b = Sx_runtime[3].call(null, $); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } var - frame = Sx_runtime[14].call(null, k), + frame = Sx_runtime[15].call(null, k), c = [0, frame_type(frame), aa], - d = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, d)) + d = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, d)) return [6, - [0, captured, [0, frame, [0, Sx_runtime[15].call(null, k), 0]]]]; + [0, captured, [0, frame, [0, Sx_runtime[16].call(null, k), 0]]]]; var captured$1 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, captured, [0, [6, [0, frame, 0]], 0]]), - k$0 = Sx_runtime[15].call(null, k); + k$0 = Sx_runtime[16].call(null, k); k = k$0; captured = captured$1; } } var custom_special_forms = []; function register_special_form(name, handler){ - return Sx_runtime[11].call(null, custom_special_forms, name, handler); + return Sx_runtime[12].call(null, custom_special_forms, name, handler); } var cst$1 = ".", cst_join = "join", ab = [3, cst$1]; function library_name_key(spec){ var - a = Sx_runtime[5].call(null, spec), + a = Sx_runtime[6].call(null, spec), b = [0, ab, @@ -51515,67 +58531,69 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_List[20].call (null, function(s){ - var a = Sx_runtime[39].call(null, s); - return Sx_types[67].call(null, a) - ? Sx_types[68].call(null, s) - : [3, Sx_runtime[4].call(null, [0, s, 0])]; + var a = Sx_runtime[40].call(null, s); + return Sx_types[71].call(null, a) + ? Sx_types[72].call(null, s) + : [3, Sx_runtime[5].call(null, [0, s, 0])]; }, a)], 0]]; - return Sx_runtime[1].call(null, cst_join, b); + return Sx_runtime[2].call(null, cst_join, b); } var cst_has_key = "has-key?", library_registry = []; function library_loaded_p(spec){ var a = [0, library_registry, [0, library_name_key(spec), 0]]; - return Sx_runtime[1].call(null, cst_has_key, a); + return Sx_runtime[2].call(null, cst_has_key, a); } var cst_exports = "exports", ac = [3, cst_exports]; function library_exports(spec){ var a = library_name_key(spec), - b = Sx_runtime[25].call(null, library_registry, a); - return Sx_runtime[25].call(null, b, ac); + entry = Sx_runtime[26].call(null, library_registry, a); + return Sx_types[71].call(null, entry) + ? Sx_runtime[26].call(null, entry, ac) + : [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; } function register_library(spec, exports){ var d = Stdlib_Hashtbl[1].call(null, 0, 1); Stdlib_Hashtbl[11].call(null, d, cst_exports, exports); var a = library_name_key(spec); - return Sx_runtime[11].call(null, library_registry, a, [7, d]); + return Sx_runtime[12].call(null, library_registry, a, [7, d]); } var io_registry = []; function io_register_b(name, spec){ - return Sx_runtime[11].call(null, io_registry, name, spec); + return Sx_runtime[12].call(null, io_registry, name, spec); } function io_registered_p(name){ - return Sx_runtime[1].call + return Sx_runtime[2].call (null, cst_has_key, [0, io_registry, [0, name, 0]]); } function io_lookup(name){ - return Sx_runtime[25].call(null, io_registry, name); + return Sx_runtime[26].call(null, io_registry, name); } var cst_keys = "keys"; function io_names(param){ - return Sx_runtime[1].call(null, cst_keys, [0, io_registry, 0]); + return Sx_runtime[2].call(null, cst_keys, [0, io_registry, 0]); } var foreign_registry = []; function foreign_register_b(name, spec){ - return Sx_runtime[11].call(null, foreign_registry, name, spec); + return Sx_runtime[12].call(null, foreign_registry, name, spec); } function foreign_registered_p(name){ - return Sx_runtime[1].call + return Sx_runtime[2].call (null, cst_has_key, [0, foreign_registry, [0, name, 0]]); } function foreign_lookup(name){ - return Sx_runtime[25].call(null, foreign_registry, name); + return Sx_runtime[26].call(null, foreign_registry, name); } function foreign_names(param){ - return Sx_runtime[1].call(null, cst_keys, [0, foreign_registry, 0]); + return Sx_runtime[2].call(null, cst_keys, [0, foreign_registry, 0]); } var result = [6, 0], ad = [6, 0]; function foreign_parse_params(param_list){ var - a = Sx_runtime[37].call(null, param_list), - items = Sx_types[67].call(null, a) ? param_list : ad; + a = Sx_runtime[38].call(null, param_list), + items = Sx_types[71].call(null, a) ? param_list : ad; return foreign_parse_params_loop(items, result); } var cst$2 = ">=", ae = [0, [2, 2.], 0], af = [2, 1.]; @@ -51583,32 +58601,32 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var remaining = remaining$1; for(;;){ var - b = Sx_runtime[33].call(null, remaining), - and = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and)){ + b = Sx_runtime[34].call(null, remaining), + and = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and)){ var - c = [0, Sx_runtime[24].call(null, remaining), ae], - and$0 = Sx_runtime[1].call(null, cst$2, c); - if(Sx_types[67].call(null, and$0)) + c = [0, Sx_runtime[25].call(null, remaining), ae], + and$0 = Sx_runtime[2].call(null, cst$2, c); + if(Sx_types[71].call(null, and$0)) var - d = Sx_runtime[14].call(null, remaining), - a = Sx_runtime[32].call(null, d); + d = Sx_runtime[15].call(null, remaining), + a = Sx_runtime[33].call(null, d); else var a = and$0; } else var a = and; - if(! Sx_types[67].call(null, a)) return 0; + if(! Sx_types[71].call(null, a)) return 0; var - v = Sx_runtime[17].call(null, remaining, af), - e = Sx_runtime[32].call(null, v), - f = Sx_types[67].call(null, e) ? Sx_types[69].call(null, v) : v, - g = Sx_runtime[14].call(null, remaining), - h = Sx_types[69].call(null, g); - Sx_runtime[11].call(null, spec, h, f); + v = Sx_runtime[18].call(null, remaining, af), + e = Sx_runtime[33].call(null, v), + f = Sx_types[71].call(null, e) ? Sx_types[73].call(null, v) : v, + g = Sx_runtime[15].call(null, remaining), + h = Sx_types[73].call(null, g); + Sx_runtime[12].call(null, spec, h, f); var - i = Sx_runtime[15].call(null, remaining), - remaining$0 = Sx_runtime[15].call(null, i); + i = Sx_runtime[16].call(null, remaining), + remaining$0 = Sx_runtime[16].call(null, i); remaining = remaining$0; } } @@ -51620,21 +58638,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ai = [3, cst$1]; function foreign_resolve_binding(binding_str){ var - parts = Sx_runtime[1].call(null, "split", [0, binding_str, ag]), - a = [0, Sx_runtime[24].call(null, parts), ah], - b = Sx_runtime[1].call(null, "<=", a); - if(Sx_types[67].call(null, b)){ + parts = Sx_runtime[2].call(null, "split", [0, binding_str, ag]), + a = [0, Sx_runtime[25].call(null, parts), ah], + b = Sx_runtime[2].call(null, "<=", a); + if(Sx_types[71].call(null, b)){ var d = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d, cst_method, binding_str); Stdlib_Hashtbl[11].call(null, d, cst_object, 0); return [7, d]; } var - method = Sx_runtime[16].call(null, parts), - c = Sx_runtime[20].call(null, parts), - e = Sx_runtime[15].call(null, c), - f = [0, ai, [0, Sx_runtime[20].call(null, e), 0]], - obj = Sx_runtime[1].call(null, cst_join, f), + method = Sx_runtime[17].call(null, parts), + c = Sx_runtime[21].call(null, parts), + e = Sx_runtime[16].call(null, c), + f = [0, ai, [0, Sx_runtime[21].call(null, e), 0]], + obj = Sx_runtime[2].call(null, cst_join, f), d$0 = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d$0, cst_method, method); Stdlib_Hashtbl[11].call(null, d$0, cst_object, obj); @@ -51661,57 +58679,57 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= at = [3, cst_foreign]; function foreign_check_args(name, params, args){ var - b = Sx_runtime[33].call(null, params), - and = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and)) + b = Sx_runtime[34].call(null, params), + and = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and)) var - c = [0, Sx_runtime[24].call(null, params), 0], - d = [0, Sx_runtime[24].call(null, args), c], - a = Sx_runtime[1].call(null, cst$3, d); + c = [0, Sx_runtime[25].call(null, params), 0], + d = [0, Sx_runtime[25].call(null, args), c], + a = Sx_runtime[2].call(null, cst$3, d); else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - e = [0, aj, [0, Sx_runtime[24].call(null, args), 0]], + e = [0, aj, [0, Sx_runtime[25].call(null, args), 0]], f = - [0, al, [0, name, [0, ak, [0, Sx_runtime[24].call(null, params), e]]]], - g = [3, Sx_runtime[4].call(null, f)], - h = Sx_runtime[2].call(null, g); + [0, al, [0, name, [0, ak, [0, Sx_runtime[25].call(null, params), e]]]], + g = [3, Sx_runtime[5].call(null, f)], + h = Sx_runtime[3].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } var - i = [0, Sx_runtime[24].call(null, args), 0], - j = [0, Sx_runtime[24].call(null, params), i], - k = [0, am, [0, Sx_runtime[1].call(null, "min", j), 0]], - l = Sx_runtime[1].call(null, cst_range, k), - m = Sx_runtime[5].call(null, l); + i = [0, Sx_runtime[25].call(null, args), 0], + j = [0, Sx_runtime[25].call(null, params), i], + k = [0, am, [0, Sx_runtime[2].call(null, "min", j), 0]], + l = Sx_runtime[2].call(null, cst_range, k), + m = Sx_runtime[6].call(null, l); Stdlib_List[18].call (null, function(i){ var - spec = Sx_runtime[17].call(null, params, i), - val = Sx_runtime[17].call(null, args, i), - expected = Sx_runtime[25].call(null, spec, an), - b = Sx_runtime[1].call(null, cst, [0, expected, ao]), - and = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and)) + spec = Sx_runtime[18].call(null, params, i), + val = Sx_runtime[18].call(null, args, i), + expected = Sx_runtime[26].call(null, spec, an), + b = Sx_runtime[2].call(null, cst, [0, expected, ao]), + and = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and)) var c = value_matches_type_p(val, expected), - a = [0, 1 - Sx_types[67].call(null, c)]; + a = [0, 1 - Sx_types[71].call(null, c)]; else var a = and; - if(! Sx_types[67].call(null, a)) return 0; + if(! Sx_types[71].call(null, a)) return 0; var d = [0, aq, - [0, expected, [0, ap, [0, Sx_runtime[73].call(null, val), 0]]]], + [0, expected, [0, ap, [0, Sx_runtime[74].call(null, val), 0]]]], e = [0, at, - [0, name, [0, as, [0, Sx_runtime[25].call(null, spec, ar), d]]]], - f = [3, Sx_runtime[4].call(null, e)], - g = Sx_runtime[2].call(null, f); + [0, name, [0, as, [0, Sx_runtime[26].call(null, spec, ar), d]]]], + f = [3, Sx_runtime[5].call(null, e)], + g = Sx_runtime[3].call(null, f); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); }, m); @@ -51746,17 +58764,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= aM = [3, cst_sync]; function foreign_build_lambda(spec){ var - name = Sx_runtime[25].call(null, spec, au), - a = Sx_runtime[1].call(null, cst_has_key, [0, spec, av]); - if(Sx_types[67].call(null, a)) + name = Sx_runtime[26].call(null, spec, au), + a = Sx_runtime[2].call(null, cst_has_key, [0, spec, av]); + if(Sx_types[71].call(null, a)) var - r = Sx_runtime[25].call(null, spec, aw), - b = Sx_runtime[1].call(null, cst, [0, r, ax]), - mode = Sx_types[67].call(null, b) ? ay : aL; + r = Sx_runtime[26].call(null, spec, aw), + b = Sx_runtime[2].call(null, cst, [0, r, ax]), + mode = Sx_types[71].call(null, b) ? ay : aL; else var mode = aM; - var c = Sx_runtime[1].call(null, cst, [0, mode, az]); - return Sx_types[67].call(null, c) + var c = Sx_runtime[2].call(null, cst, [0, mode, az]); + return Sx_types[71].call(null, c) ? [6, [0, aF, @@ -51781,35 +58799,35 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= aO = [3, cst_name], aP = [3, cst_params]; function sf_define_foreign(args, env){ - var a = Sx_runtime[14].call(null, args), b = Sx_runtime[39].call(null, a); - if(Sx_types[67].call(null, b)) + var a = Sx_runtime[15].call(null, args), b = Sx_runtime[40].call(null, a); + if(Sx_types[71].call(null, b)) var - c = Sx_runtime[14].call(null, args), - name = Sx_types[68].call(null, c); + c = Sx_runtime[15].call(null, args), + name = Sx_types[72].call(null, c); else - var name = Sx_runtime[14].call(null, args); + var name = Sx_runtime[15].call(null, args); var - param_list = Sx_runtime[17].call(null, args, aN), + param_list = Sx_runtime[18].call(null, args, aN), spec = [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; - Sx_runtime[11].call(null, spec, aO, name); + Sx_runtime[12].call(null, spec, aO, name); var d = foreign_parse_params(param_list); - Sx_runtime[11].call(null, spec, aP, d); - var e = Sx_runtime[15].call(null, args); - foreign_parse_kwargs_b(spec, Sx_runtime[15].call(null, e)); + Sx_runtime[12].call(null, spec, aP, d); + var e = Sx_runtime[16].call(null, args); + foreign_parse_kwargs_b(spec, Sx_runtime[16].call(null, e)); foreign_register_b(name, spec); return spec; } function step_sf_define_foreign(args, env, kont){ var spec = sf_define_foreign(args, env), - a = Sx_runtime[14].call(null, args), - b = Sx_runtime[39].call(null, a); - if(Sx_types[67].call(null, b)) + a = Sx_runtime[15].call(null, args), + b = Sx_runtime[40].call(null, a); + if(Sx_types[71].call(null, b)) var - c = Sx_runtime[14].call(null, args), - name = Sx_types[68].call(null, c); + c = Sx_runtime[15].call(null, args), + name = Sx_types[72].call(null, c); else - var name = Sx_runtime[14].call(null, args); + var name = Sx_runtime[15].call(null, args); var lambda_expr = foreign_build_lambda(spec); return make_cek_state (lambda_expr, @@ -51835,53 +58853,53 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= a3 = [0, [3, ": host-call not available on this platform"], 0], a4 = [3, cst_foreign]; function foreign_dispatch(name, args){ - var spec = foreign_lookup(name), a = Sx_runtime[83].call(null, spec); - if(Sx_types[67].call(null, a)){ + var spec = foreign_lookup(name), a = Sx_runtime[84].call(null, spec); + if(Sx_types[71].call(null, a)){ var - b = [3, Sx_runtime[4].call(null, [0, aR, [0, name, aQ]])], - c = Sx_runtime[2].call(null, b); + b = [3, Sx_runtime[5].call(null, [0, aR, [0, name, aQ]])], + c = Sx_runtime[3].call(null, b); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); } var - params = Sx_runtime[25].call(null, spec, aS), - binding = Sx_runtime[25].call(null, spec, aT), - d = Sx_runtime[83].call(null, params), - e = Sx_types[67].call(null, d) ? aU : params; + params = Sx_runtime[26].call(null, spec, aS), + binding = Sx_runtime[26].call(null, spec, aT), + d = Sx_runtime[84].call(null, params), + e = Sx_types[71].call(null, d) ? aU : params; foreign_check_args(name, e, args); - var f = Sx_runtime[83].call(null, binding); - if(Sx_types[67].call(null, f)){ + var f = Sx_runtime[84].call(null, binding); + if(Sx_types[71].call(null, f)){ var - g = [3, Sx_runtime[4].call(null, [0, aW, [0, name, aV]])], - h = Sx_runtime[2].call(null, g); + g = [3, Sx_runtime[5].call(null, [0, aW, [0, name, aV]])], + h = Sx_runtime[3].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } var resolved = foreign_resolve_binding(binding), - obj_name = Sx_runtime[25].call(null, resolved, aX), - method = Sx_runtime[25].call(null, resolved, aY), - i = Sx_runtime[91].call(null, aZ); - if(! Sx_types[67].call(null, i)){ + obj_name = Sx_runtime[26].call(null, resolved, aX), + method = Sx_runtime[26].call(null, resolved, aY), + i = Sx_runtime[92].call(null, aZ); + if(! Sx_types[71].call(null, i)){ var - o = [3, Sx_runtime[4].call(null, [0, a4, [0, name, a3]])], - p = Sx_runtime[2].call(null, o); + o = [3, Sx_runtime[5].call(null, [0, a4, [0, name, a3]])], + p = Sx_runtime[3].call(null, o); throw caml_maybe_attach_backtrace([0, Sx_types[9], p], 1); } - var j = Sx_runtime[83].call(null, obj_name); - if(Sx_types[67].call(null, j)){ + var j = Sx_runtime[84].call(null, obj_name); + if(Sx_types[71].call(null, j)){ var k = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_concat, [0, [6, [0, 0, [0, method, 0]]], [0, args, 0]]), - l = Sx_runtime[92].call(null, a0); - return Sx_runtime[7].call(null, l, k); + l = Sx_runtime[93].call(null, a0); + return Sx_runtime[8].call(null, l, k); } var - obj = cek_call(Sx_runtime[92].call(null, a1), [6, [0, obj_name, 0]]), + obj = cek_call(Sx_runtime[93].call(null, a1), [6, [0, obj_name, 0]]), m = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_concat, [0, [6, [0, obj, [0, method, 0]]], [0, args, 0]]), - n = Sx_runtime[92].call(null, a2); - return Sx_runtime[7].call(null, n, m); + n = Sx_runtime[93].call(null, a2); + return Sx_runtime[8].call(null, n, m); } var cst_as = "as", @@ -51891,26 +58909,26 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function foreign_parse_params_loop(items$1, acc$2){ var items = items$1, acc = acc$2; for(;;){ - var b = Sx_runtime[33].call(null, items); - if(Sx_types[67].call(null, b)) return acc; + var b = Sx_runtime[34].call(null, items); + if(Sx_types[71].call(null, b)) return acc; var - item = Sx_runtime[14].call(null, items), - rest_items = Sx_runtime[15].call(null, items), - c = Sx_runtime[33].call(null, rest_items), - and = [0, 1 - Sx_types[67].call(null, c)]; - if(Sx_types[67].call(null, and)){ + item = Sx_runtime[15].call(null, items), + rest_items = Sx_runtime[16].call(null, items), + c = Sx_runtime[34].call(null, rest_items), + and = [0, 1 - Sx_types[71].call(null, c)]; + if(Sx_types[71].call(null, and)){ var - e = Sx_runtime[14].call(null, rest_items), - and$0 = Sx_runtime[32].call(null, e); - if(Sx_types[67].call(null, and$0)){ + e = Sx_runtime[15].call(null, rest_items), + and$0 = Sx_runtime[33].call(null, e); + if(Sx_types[71].call(null, and$0)){ var - f = Sx_runtime[14].call(null, rest_items), - g = [0, Sx_types[69].call(null, f), a5], - and$1 = Sx_runtime[1].call(null, cst, g); - if(Sx_types[67].call(null, and$1)) + f = Sx_runtime[15].call(null, rest_items), + g = [0, Sx_types[73].call(null, f), a5], + and$1 = Sx_runtime[2].call(null, cst, g); + if(Sx_types[71].call(null, and$1)) var - h = [0, Sx_runtime[24].call(null, rest_items), a6], - a = Sx_runtime[1].call(null, cst$2, h); + h = [0, Sx_runtime[25].call(null, rest_items), a6], + a = Sx_runtime[2].call(null, cst$2, h); else var a = and$1; } @@ -51919,41 +58937,41 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var d = Stdlib_Hashtbl[1].call(null, 0, 2), - t = Sx_runtime[17].call(null, rest_items, a7), - i = Sx_runtime[32].call(null, t), + t = Sx_runtime[18].call(null, rest_items, a7), + i = Sx_runtime[33].call(null, t), j = - Sx_types[67].call(null, i) - ? Sx_types[69].call(null, t) - : [3, Sx_runtime[4].call(null, [0, t, 0])]; + Sx_types[71].call(null, i) + ? Sx_types[73].call(null, t) + : [3, Sx_runtime[5].call(null, [0, t, 0])]; Stdlib_Hashtbl[11].call(null, d, cst_type, j); var - k = Sx_runtime[39].call(null, item), + k = Sx_runtime[40].call(null, item), l = - Sx_types[67].call(null, k) - ? Sx_types[68].call(null, item) - : [3, Sx_runtime[4].call(null, [0, item, 0])]; + Sx_types[71].call(null, k) + ? Sx_types[72].call(null, item) + : [3, Sx_runtime[5].call(null, [0, item, 0])]; Stdlib_Hashtbl[11].call(null, d, cst_name, l); var acc$0 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, acc, [0, [6, [0, [7, d], 0]], 0]]), - m = Sx_runtime[15].call(null, rest_items), - items$0 = Sx_runtime[15].call(null, m); + m = Sx_runtime[16].call(null, rest_items), + items$0 = Sx_runtime[16].call(null, m); items = items$0; acc = acc$0; } else{ var - n = Sx_runtime[39].call(null, item), + n = Sx_runtime[40].call(null, item), o = - Sx_types[67].call(null, n) - ? Sx_types[68].call(null, item) - : [3, Sx_runtime[4].call(null, [0, item, 0])], + Sx_types[71].call(null, n) + ? Sx_types[72].call(null, item) + : [3, Sx_runtime[5].call(null, [0, item, 0])], acc$1 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, @@ -51972,21 +58990,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= a_ = [4, cst_perform]; function step_sf_io(args, env, kont){ var - name = Sx_runtime[14].call(null, args), - io_args = Sx_runtime[15].call(null, args), + name = Sx_runtime[15].call(null, args), + io_args = Sx_runtime[16].call(null, args), a = io_registered_p(name), - b = [0, 1 - Sx_types[67].call(null, a)]; - if(Sx_types[67].call(null, b)){ + b = [0, 1 - Sx_types[71].call(null, a)]; + if(Sx_types[71].call(null, b)){ var - c = [3, Sx_runtime[4].call(null, [0, a9, [0, name, a8]])], - e = Sx_runtime[2].call(null, c); + c = [3, Sx_runtime[5].call(null, [0, a9, [0, name, a8]])], + e = Sx_runtime[3].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[9], e], 1); } var d = Stdlib_Hashtbl[1].call(null, 0, 2); Stdlib_Hashtbl[11].call(null, d, cst_args, io_args); Stdlib_Hashtbl[11].call(null, d, cst_op, name); return make_cek_state - (Sx_runtime[18].call(null, a_, [6, [0, [7, d], 0]]), env, kont); + (Sx_runtime[19].call(null, a_, [6, [0, [7, d], 0]]), env, kont); } var strict_ref = []; function set_strict_b(val){strict_ref[1] = val; return 0;} @@ -52027,51 +59045,51 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function value_matches_type_p(val, expected_type$1){ var expected_type = expected_type$1; for(;;){ - var a = Sx_runtime[1].call(null, cst, [0, expected_type, a$]); - if(Sx_types[67].call(null, a)) return ba; - var b = Sx_runtime[1].call(null, cst, [0, expected_type, bb]); - if(Sx_types[67].call(null, b)) return Sx_runtime[34].call(null, val); - var c = Sx_runtime[1].call(null, cst, [0, expected_type, bc]); - if(Sx_types[67].call(null, c)) return Sx_runtime[35].call(null, val); - var d = Sx_runtime[1].call(null, cst, [0, expected_type, bd]); - if(Sx_types[67].call(null, d)) return Sx_runtime[36].call(null, val); - var e = Sx_runtime[1].call(null, cst, [0, expected_type, be]); - if(Sx_types[67].call(null, e)) return Sx_runtime[83].call(null, val); - var f = Sx_runtime[1].call(null, cst, [0, expected_type, bf]); - if(Sx_types[67].call(null, f)) return Sx_runtime[37].call(null, val); - var g = Sx_runtime[1].call(null, cst, [0, expected_type, bg]); - if(Sx_types[67].call(null, g)) return Sx_runtime[38].call(null, val); - var h = Sx_runtime[1].call(null, cst, [0, expected_type, bh]); - if(Sx_types[67].call(null, h)) return Sx_runtime[85].call(null, val); - var i = Sx_runtime[1].call(null, cst, [0, expected_type, bi]); - if(Sx_types[67].call(null, i)){ - var j = [0, Sx_runtime[73].call(null, val), bj]; - return Sx_runtime[1].call(null, cst, j); + var a = Sx_runtime[2].call(null, cst, [0, expected_type, a$]); + if(Sx_types[71].call(null, a)) return ba; + var b = Sx_runtime[2].call(null, cst, [0, expected_type, bb]); + if(Sx_types[71].call(null, b)) return Sx_runtime[35].call(null, val); + var c = Sx_runtime[2].call(null, cst, [0, expected_type, bc]); + if(Sx_types[71].call(null, c)) return Sx_runtime[36].call(null, val); + var d = Sx_runtime[2].call(null, cst, [0, expected_type, bd]); + if(Sx_types[71].call(null, d)) return Sx_runtime[37].call(null, val); + var e = Sx_runtime[2].call(null, cst, [0, expected_type, be]); + if(Sx_types[71].call(null, e)) return Sx_runtime[84].call(null, val); + var f = Sx_runtime[2].call(null, cst, [0, expected_type, bf]); + if(Sx_types[71].call(null, f)) return Sx_runtime[38].call(null, val); + var g = Sx_runtime[2].call(null, cst, [0, expected_type, bg]); + if(Sx_types[71].call(null, g)) return Sx_runtime[39].call(null, val); + var h = Sx_runtime[2].call(null, cst, [0, expected_type, bh]); + if(Sx_types[71].call(null, h)) return Sx_runtime[86].call(null, val); + var i = Sx_runtime[2].call(null, cst, [0, expected_type, bi]); + if(Sx_types[71].call(null, i)){ + var j = [0, Sx_runtime[74].call(null, val), bj]; + return Sx_runtime[2].call(null, cst, j); } - var k = Sx_runtime[1].call(null, cst, [0, expected_type, bk]); - if(Sx_types[67].call(null, k)){ - var l = [0, Sx_runtime[73].call(null, val), bl]; - return Sx_runtime[1].call(null, cst, l); + var k = Sx_runtime[2].call(null, cst, [0, expected_type, bk]); + if(Sx_types[71].call(null, k)){ + var l = [0, Sx_runtime[74].call(null, val), bl]; + return Sx_runtime[2].call(null, cst, l); } var - and = Sx_runtime[35].call(null, expected_type), + and = Sx_runtime[36].call(null, expected_type), m = - Sx_types[67].call(null, and) - ? Sx_runtime[1].call(null, cst_ends_with, [0, expected_type, bm]) + Sx_types[71].call(null, and) + ? Sx_runtime[2].call(null, cst_ends_with, [0, expected_type, bm]) : and; - if(! Sx_types[67].call(null, m)) return bp; - var or = Sx_runtime[83].call(null, val); - if(Sx_types[67].call(null, or)) return or; + if(! Sx_types[71].call(null, m)) return bp; + var or = Sx_runtime[84].call(null, val); + if(Sx_types[71].call(null, or)) return or; var n = [0, - Sx_runtime[1].call(null, "string-length", [0, expected_type, 0]), + Sx_runtime[2].call(null, "string-length", [0, expected_type, 0]), bn], o = [0, expected_type, - [0, bo, [0, Sx_runtime[1].call(null, cst$5, n), 0]]], - expected_type$0 = Sx_runtime[1].call(null, cst_slice, o); + [0, bo, [0, Sx_runtime[2].call(null, cst$5, n), 0]]], + expected_type$0 = Sx_runtime[2].call(null, cst_slice, o); expected_type = expected_type$0; } } @@ -52102,41 +59120,41 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function strict_check_args(name, args){ var and = strict_ref[1], - b = Sx_types[67].call(null, and) ? prim_param_types_ref[1] : and; - if(! Sx_types[67].call(null, b)) return 0; - var spec = Sx_runtime[25].call(null, prim_param_types_ref[1], name); - if(! Sx_types[67].call(null, spec)) return 0; + b = Sx_types[71].call(null, and) ? prim_param_types_ref[1] : and; + if(! Sx_types[71].call(null, b)) return 0; + var spec = Sx_runtime[26].call(null, prim_param_types_ref[1], name); + if(! Sx_types[71].call(null, spec)) return 0; var - positional = Sx_runtime[25].call(null, spec, bq), - rest_type = Sx_runtime[25].call(null, spec, br); - if(Sx_types[67].call(null, positional)){ + positional = Sx_runtime[26].call(null, spec, bq), + rest_type = Sx_runtime[26].call(null, spec, br); + if(Sx_types[71].call(null, positional)){ var - c = Sx_runtime[5].call(null, positional), + c = Sx_runtime[6].call(null, positional), d = [6, Stdlib_List[21].call (null, function(i, p){var i$0 = [2, i]; return [6, [0, i$0, [0, p, 0]]];}, c)], - e = Sx_runtime[5].call(null, d); + e = Sx_runtime[6].call(null, d); Stdlib_List[18].call (null, function(pair){ var - idx = Sx_runtime[14].call(null, pair), - param = Sx_runtime[17].call(null, pair, bs), - p_name = Sx_runtime[14].call(null, param), - p_type = Sx_runtime[17].call(null, param, bt), - a = [0, idx, [0, Sx_runtime[24].call(null, args), 0]], - b = Sx_runtime[1].call(null, cst$3, a); - if(Sx_types[67].call(null, b)){ + idx = Sx_runtime[15].call(null, pair), + param = Sx_runtime[18].call(null, pair, bs), + p_name = Sx_runtime[15].call(null, param), + p_type = Sx_runtime[18].call(null, param, bt), + a = [0, idx, [0, Sx_runtime[25].call(null, args), 0]], + b = Sx_runtime[2].call(null, cst$3, a); + if(Sx_types[71].call(null, b)){ var - val = Sx_runtime[17].call(null, args, idx), + val = Sx_runtime[18].call(null, args, idx), c = value_matches_type_p(val, p_type), - d = [0, 1 - Sx_types[67].call(null, c)]; - if(Sx_types[67].call(null, d)){ + d = [0, 1 - Sx_types[71].call(null, c)]; + if(Sx_types[71].call(null, d)){ var - e = [0, bv, [0, [3, Sx_runtime[4].call(null, [0, val, 0])], bu]], + e = [0, bv, [0, [3, Sx_runtime[5].call(null, [0, val, 0])], bu]], f = [0, bz, @@ -52148,9 +59166,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= p_type, [0, bx, - [0, p_name, [0, bw, [0, Sx_runtime[73].call(null, val), e]]]]]]]], - g = [3, Sx_runtime[4].call(null, f)], - h = Sx_runtime[2].call(null, g); + [0, p_name, [0, bw, [0, Sx_runtime[74].call(null, val), e]]]]]]]], + g = [3, Sx_runtime[5].call(null, f)], + h = Sx_runtime[3].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } } @@ -52158,38 +59176,38 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }, e); } - if(Sx_types[67].call(null, rest_type)) + if(Sx_types[71].call(null, rest_type)) var - positional$0 = Sx_types[67].call(null, positional) ? positional : bI, - f = [0, Sx_runtime[24].call(null, positional$0), 0], - g = [0, Sx_runtime[24].call(null, args), f], - a = Sx_runtime[1].call(null, cst$0, g); + positional$0 = Sx_types[71].call(null, positional) ? positional : bI, + f = [0, Sx_runtime[25].call(null, positional$0), 0], + g = [0, Sx_runtime[25].call(null, args), f], + a = Sx_runtime[2].call(null, cst$0, g); else var a = rest_type; - if(! Sx_types[67].call(null, a)) return 0; + if(! Sx_types[71].call(null, a)) return 0; var - positional$1 = Sx_types[67].call(null, positional) ? positional : bH, - h = [0, args, [0, Sx_runtime[24].call(null, positional$1), 0]], - i = Sx_runtime[1].call(null, cst_slice, h), - j = Sx_runtime[5].call(null, i), + positional$1 = Sx_types[71].call(null, positional) ? positional : bH, + h = [0, args, [0, Sx_runtime[25].call(null, positional$1), 0]], + i = Sx_runtime[2].call(null, cst_slice, h), + j = Sx_runtime[6].call(null, i), k = [6, Stdlib_List[21].call (null, function(i, v){var i$0 = [2, i]; return [6, [0, i$0, [0, v, 0]]];}, j)], - l = Sx_runtime[5].call(null, k); + l = Sx_runtime[6].call(null, k); Stdlib_List[18].call (null, function(pair){ var - idx = Sx_runtime[14].call(null, pair), - val = Sx_runtime[17].call(null, pair, bA), + idx = Sx_runtime[15].call(null, pair), + val = Sx_runtime[18].call(null, pair, bA), a = value_matches_type_p(val, rest_type), - b = [0, 1 - Sx_types[67].call(null, a)]; - if(! Sx_types[67].call(null, b)) return 0; + b = [0, 1 - Sx_types[71].call(null, a)]; + if(! Sx_types[71].call(null, b)) return 0; var - c = [0, bC, [0, [3, Sx_runtime[4].call(null, [0, val, 0])], bB]], + c = [0, bC, [0, [3, Sx_runtime[5].call(null, [0, val, 0])], bB]], d = [0, bG, @@ -52201,9 +59219,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= rest_type, [0, bE, - [0, idx, [0, bD, [0, Sx_runtime[73].call(null, val), c]]]]]]]], - e = [3, Sx_runtime[4].call(null, d)], - f = Sx_runtime[2].call(null, e); + [0, idx, [0, bD, [0, Sx_runtime[74].call(null, val), c]]]]]]]], + e = [3, Sx_runtime[5].call(null, d)], + f = Sx_runtime[3].call(null, e); throw caml_maybe_attach_backtrace([0, Sx_types[9], f], 1); }, l); @@ -52221,22 +59239,22 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= bO = [0, 0]; function bind_lambda_params(params, args, local){ var - rest_idx = Sx_runtime[1].call(null, cst_index_of, [0, params, bJ]), - and = Sx_runtime[34].call(null, rest_idx); - if(Sx_types[67].call(null, and)) + rest_idx = Sx_runtime[2].call(null, cst_index_of, [0, params, bJ]), + and = Sx_runtime[35].call(null, rest_idx); + if(Sx_types[71].call(null, and)) var - b = [0, rest_idx, [0, Sx_runtime[24].call(null, params), 0]], - a = Sx_runtime[1].call(null, cst$3, b); + b = [0, rest_idx, [0, Sx_runtime[25].call(null, params), 0]], + a = Sx_runtime[2].call(null, cst$3, b); else var a = and; - if(! Sx_types[67].call(null, a)) return bO; + if(! Sx_types[71].call(null, a)) return bO; var positional = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_slice, [0, params, [0, bK, [0, rest_idx, 0]]]), - c = Sx_runtime[1].call(null, cst$8, [0, rest_idx, bL]), - rest_name = Sx_runtime[17].call(null, params, c); - Sx_runtime[93].call + c = Sx_runtime[2].call(null, cst$8, [0, rest_idx, bL]), + rest_name = Sx_runtime[18].call(null, params, c); + Sx_runtime[94].call (null, [15, cst$9, @@ -52247,28 +59265,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var p = a[1], i = args$0[1], - b = [0, i, [0, Sx_runtime[24].call(null, args), 0]], - c = Sx_runtime[1].call(null, cst$3, b), + b = [0, i, [0, Sx_runtime[25].call(null, args), 0]], + c = Sx_runtime[2].call(null, cst$3, b), d = - Sx_types[67].call(null, c) - ? Sx_runtime[17].call(null, args, i) + Sx_types[71].call(null, c) + ? Sx_runtime[18].call(null, args, i) : 0, - e = Sx_runtime[3].call(null, p); - return Sx_runtime[77].call(null, local, e, d); + e = Sx_runtime[4].call(null, p); + return Sx_runtime[78].call(null, local, e, d); } } return 0; }], positional); var - d = [0, Sx_runtime[24].call(null, args), [0, rest_idx, 0]], - e = Sx_runtime[1].call(null, cst$0, d), + d = [0, Sx_runtime[25].call(null, args), [0, rest_idx, 0]], + e = Sx_runtime[2].call(null, cst$0, d), f = - Sx_types[67].call(null, e) - ? Sx_runtime[1].call(null, cst_slice, [0, args, [0, rest_idx, 0]]) + Sx_types[71].call(null, e) + ? Sx_runtime[2].call(null, cst_slice, [0, args, [0, rest_idx, 0]]) : bN, - g = Sx_runtime[3].call(null, rest_name); - Sx_runtime[77].call(null, local, g, f); + g = Sx_runtime[4].call(null, rest_name); + Sx_runtime[78].call(null, local, g, f); return bM; } var @@ -52280,84 +59298,84 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= bS = [2, 1.]; function call_lambda(f, args, caller_env){ var - params = Sx_types[70].call(null, f), - a = Sx_types[72].call(null, f), - local = Sx_runtime[81].call(null, a, caller_env), + params = Sx_types[74].call(null, f), + a = Sx_types[76].call(null, f), + local = Sx_runtime[82].call(null, a, caller_env), b = bind_lambda_params(params, args, local), - c = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, c)){ + c = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, c)){ var - d = [0, Sx_runtime[24].call(null, params), 0], - e = [0, Sx_runtime[24].call(null, args), d], - g = Sx_runtime[1].call(null, cst$0, e); - if(Sx_types[67].call(null, g)){ + d = [0, Sx_runtime[25].call(null, params), 0], + e = [0, Sx_runtime[25].call(null, args), d], + g = Sx_runtime[2].call(null, cst$0, e); + if(Sx_types[71].call(null, g)){ var - h = [0, bP, [0, Sx_runtime[24].call(null, args), 0]], - i = [0, bQ, [0, Sx_runtime[24].call(null, params), h]], - or = Sx_types[73].call(null, f), - or$0 = Sx_types[67].call(null, or) ? or : bR, - j = [3, Sx_runtime[4].call(null, [0, or$0, i])], - k = Sx_runtime[2].call(null, j); + h = [0, bP, [0, Sx_runtime[25].call(null, args), 0]], + i = [0, bQ, [0, Sx_runtime[25].call(null, params), h]], + or = Sx_types[77].call(null, f), + or$0 = Sx_types[71].call(null, or) ? or : bR, + j = [3, Sx_runtime[5].call(null, [0, or$0, i])], + k = Sx_runtime[3].call(null, j); throw caml_maybe_attach_backtrace([0, Sx_types[9], k], 1); } var - l = Sx_runtime[1].call(null, cst_zip, [0, params, [0, args, 0]]), - m = Sx_runtime[5].call(null, l); + l = Sx_runtime[2].call(null, cst_zip, [0, params, [0, args, 0]]), + m = Sx_runtime[6].call(null, l); Stdlib_List[18].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, bS), - b = Sx_runtime[14].call(null, pair), - c = Sx_runtime[3].call(null, b); - Sx_runtime[77].call(null, local, c, a); + a = Sx_runtime[18].call(null, pair, bS), + b = Sx_runtime[15].call(null, pair), + c = Sx_runtime[4].call(null, b); + Sx_runtime[78].call(null, local, c, a); return 0; }, m); var - n = [0, params, [0, Sx_runtime[24].call(null, args), 0]], - o = Sx_runtime[1].call(null, cst_slice, n), - p = Sx_runtime[5].call(null, o); + n = [0, params, [0, Sx_runtime[25].call(null, args), 0]], + o = Sx_runtime[2].call(null, cst_slice, n), + p = Sx_runtime[6].call(null, o); Stdlib_List[18].call (null, function(p){ - var a = Sx_runtime[3].call(null, p); - Sx_runtime[77].call(null, local, a, 0); + var a = Sx_runtime[4].call(null, p); + Sx_runtime[78].call(null, local, a, 0); return 0; }, p); } - var q = Sx_types[71].call(null, f); - return Sx_types[54].call(null, q, local); + var q = Sx_types[75].call(null, f); + return Sx_types[58].call(null, q, local); } var cst_children = "children", bT = [2, 1.], bU = [3, cst_children]; function call_component(comp, raw_args, env){ var parsed = parse_keyword_args(raw_args, env), - kwargs = Sx_runtime[14].call(null, parsed), - children = Sx_runtime[17].call(null, parsed, bT), - a = Sx_types[81].call(null, comp), - local = Sx_runtime[81].call(null, a, env), - b = Sx_types[79].call(null, comp), - c = Sx_runtime[5].call(null, b); + kwargs = Sx_runtime[15].call(null, parsed), + children = Sx_runtime[18].call(null, parsed, bT), + a = Sx_types[85].call(null, comp), + local = Sx_runtime[82].call(null, a, env), + b = Sx_types[83].call(null, comp), + c = Sx_runtime[6].call(null, b); Stdlib_List[18].call (null, function(p){ var - or = Sx_runtime[56].call(null, kwargs, p), - or$0 = Sx_types[67].call(null, or) ? or : 0, - a = Sx_runtime[3].call(null, p); - Sx_runtime[77].call(null, local, a, or$0); + or = Sx_runtime[57].call(null, kwargs, p), + or$0 = Sx_types[71].call(null, or) ? or : 0, + a = Sx_runtime[4].call(null, p); + Sx_runtime[78].call(null, local, a, or$0); return 0; }, c); - var d = Sx_types[82].call(null, comp); - if(Sx_types[67].call(null, d)){ - var e = Sx_runtime[3].call(null, bU); - Sx_runtime[77].call(null, local, e, children); + var d = Sx_types[86].call(null, comp); + if(Sx_types[71].call(null, d)){ + var e = Sx_runtime[4].call(null, bU); + Sx_runtime[78].call(null, local, e, children); } - var f = Sx_types[80].call(null, comp); - return Sx_types[54].call(null, f, local); + var f = Sx_types[84].call(null, comp); + return Sx_types[58].call(null, f, local); } var cst_assoc = "assoc", @@ -52382,20 +59400,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function parse_keyword_args(raw_args, env){ var kwargs = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - a = Sx_runtime[5].call(null, raw_args), + a = Sx_runtime[6].call(null, raw_args), d = Stdlib_Hashtbl[1].call(null, 0, 2), - b = Sx_runtime[2].call(null, bX); + b = Sx_runtime[3].call(null, bX); Stdlib_Hashtbl[11].call(null, d, b, bW); - var c = Sx_runtime[2].call(null, bZ); + var c = Sx_runtime[3].call(null, bZ); Stdlib_Hashtbl[11].call(null, d, c, bY); var children = [0, bV]; Stdlib_List[26].call (null, function(state, arg){ var - idx = Sx_runtime[25].call(null, state, b0), - skip = Sx_runtime[25].call(null, state, b1); - if(Sx_types[67].call(null, skip)){ + idx = Sx_runtime[26].call(null, state, b0), + skip = Sx_runtime[26].call(null, state, b1); + if(Sx_types[71].call(null, skip)){ var b = [0, @@ -52404,26 +59422,26 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= b4, [0, b3, - [0, b2, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]]]; - return Sx_runtime[1].call(null, cst_assoc, b); + [0, b2, [0, Sx_runtime[2].call(null, cst_inc, [0, idx, 0]), 0]]]]]; + return Sx_runtime[2].call(null, cst_assoc, b); } var - c = [0, Sx_runtime[73].call(null, arg), b5], - and = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and)) + c = [0, Sx_runtime[74].call(null, arg), b5], + and = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and)) var - d = [0, Sx_runtime[24].call(null, raw_args), 0], - e = [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), d], - a = Sx_runtime[1].call(null, cst$3, e); + d = [0, Sx_runtime[25].call(null, raw_args), 0], + e = [0, Sx_runtime[2].call(null, cst_inc, [0, idx, 0]), d], + a = Sx_runtime[2].call(null, cst$3, e); else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - f = Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), + f = Sx_runtime[2].call(null, cst_inc, [0, idx, 0]), g = - trampoline(eval_expr(Sx_runtime[17].call(null, raw_args, f), env)), - h = Sx_types[69].call(null, arg); - Sx_runtime[11].call(null, kwargs, h, g); + trampoline(eval_expr(Sx_runtime[18].call(null, raw_args, f), env)), + h = Sx_types[73].call(null, arg); + Sx_runtime[12].call(null, kwargs, h, g); var i = [0, @@ -52432,17 +59450,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= b8, [0, b7, - [0, b6, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]]]; - return Sx_runtime[1].call(null, cst_assoc, i); + [0, b6, [0, Sx_runtime[2].call(null, cst_inc, [0, idx, 0]), 0]]]]]; + return Sx_runtime[2].call(null, cst_assoc, i); } var j = trampoline(eval_expr(arg, env)); - children[1] = Sx_runtime[10].call(null, children[1], j); + children[1] = Sx_runtime[11].call(null, children[1], j); var k = [0, state, - [0, b9, [0, Sx_runtime[1].call(null, cst_inc, [0, idx, 0]), 0]]]; - return Sx_runtime[1].call(null, cst_assoc, k); + [0, b9, [0, Sx_runtime[2].call(null, cst_inc, [0, idx, 0]), 0]]]; + return Sx_runtime[2].call(null, cst_assoc, k); }, [7, d], a); @@ -52458,34 +59476,34 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cd = [0, [3, cst$10], 0], ce = [2, 1.]; function cond_scheme_p(clauses){ - var a = Sx_runtime[5].call(null, clauses); + var a = Sx_runtime[6].call(null, clauses); return [0, Stdlib_List[33].call (null, function(c){ var - a = [0, Sx_runtime[73].call(null, c), b_], - and = Sx_runtime[1].call(null, cst, a); - if(Sx_types[67].call(null, and)){ + a = [0, Sx_runtime[74].call(null, c), b_], + and = Sx_runtime[2].call(null, cst, a); + if(Sx_types[71].call(null, and)){ var - b = [0, Sx_runtime[24].call(null, c), b$], - or = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, or)) + b = [0, Sx_runtime[25].call(null, c), b$], + or = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, or)) var or$0 = or; else{ var - d = [0, Sx_runtime[24].call(null, c), ca], - and$0 = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and$0)){ + d = [0, Sx_runtime[25].call(null, c), ca], + and$0 = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and$0)){ var - e = Sx_runtime[17].call(null, c, cc), - f = [0, Sx_runtime[73].call(null, e), cb], - and$1 = Sx_runtime[1].call(null, cst, f); - if(Sx_types[67].call(null, and$1)) + e = Sx_runtime[18].call(null, c, cc), + f = [0, Sx_runtime[74].call(null, e), cb], + and$1 = Sx_runtime[2].call(null, cst, f); + if(Sx_types[71].call(null, and$1)) var - g = Sx_runtime[17].call(null, c, ce), - h = [0, Sx_types[68].call(null, g), cd], - or$0 = Sx_runtime[1].call(null, cst, h); + g = Sx_runtime[18].call(null, c, ce), + h = [0, Sx_types[72].call(null, g), cd], + or$0 = Sx_runtime[2].call(null, cst, h); else var or$0 = and$1; } @@ -52495,7 +59513,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var or$0 = and; - return Sx_types[67].call(null, or$0); + return Sx_types[71].call(null, or$0); }, a)]; } @@ -52508,25 +59526,25 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cj = [0, [3, ":else"], 0]; function is_else_clause(test){ var - a = [0, Sx_runtime[73].call(null, test), cf], - and = Sx_runtime[1].call(null, cst, a); - if(Sx_types[67].call(null, and)) + a = [0, Sx_runtime[74].call(null, test), cf], + and = Sx_runtime[2].call(null, cst, a); + if(Sx_types[71].call(null, and)) var - b = [0, Sx_types[69].call(null, test), cg], - or = Sx_runtime[1].call(null, cst, b); + b = [0, Sx_types[73].call(null, test), cg], + or = Sx_runtime[2].call(null, cst, b); else var or = and; - if(Sx_types[67].call(null, or)) return or; + if(Sx_types[71].call(null, or)) return or; var - c = [0, Sx_runtime[73].call(null, test), ch], - and$0 = Sx_runtime[1].call(null, cst, c); - if(! Sx_types[67].call(null, and$0)) return and$0; + c = [0, Sx_runtime[74].call(null, test), ch], + and$0 = Sx_runtime[2].call(null, cst, c); + if(! Sx_types[71].call(null, and$0)) return and$0; var - d = [0, Sx_types[68].call(null, test), ci], - or$0 = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, or$0)) return or$0; - var e = [0, Sx_types[68].call(null, test), cj]; - return Sx_runtime[1].call(null, cst, e); + d = [0, Sx_types[72].call(null, test), ci], + or$0 = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, or$0)) return or$0; + var e = [0, Sx_types[72].call(null, test), cj]; + return Sx_runtime[2].call(null, cst, e); } var cst$11 = "*", @@ -52550,96 +59568,96 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cA = [0, [2, 2.], 0]; function sf_named_let(args, env){ var - b = Sx_runtime[14].call(null, args), - loop_name = Sx_types[68].call(null, b), - bindings = Sx_runtime[17].call(null, args, ck), - body = Sx_runtime[1].call(null, cst_slice, [0, args, cl]), - c = Sx_runtime[14].call(null, bindings), - d = [0, Sx_runtime[73].call(null, c), co], - and = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and)) + b = Sx_runtime[15].call(null, args), + loop_name = Sx_types[72].call(null, b), + bindings = Sx_runtime[18].call(null, args, ck), + body = Sx_runtime[2].call(null, cst_slice, [0, args, cl]), + c = Sx_runtime[15].call(null, bindings), + d = [0, Sx_runtime[74].call(null, c), co], + and = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and)) var - e = Sx_runtime[14].call(null, bindings), - f = [0, Sx_runtime[24].call(null, e), cp], - a = Sx_runtime[1].call(null, cst, f); + e = Sx_runtime[15].call(null, bindings), + f = [0, Sx_runtime[25].call(null, e), cp], + a = Sx_runtime[2].call(null, cst, f); else var a = and; var params = [0, cm], inits = [0, cn]; - if(Sx_types[67].call(null, a)){ - var g = Sx_runtime[5].call(null, bindings); + if(Sx_types[71].call(null, a)){ + var g = Sx_runtime[6].call(null, bindings); Stdlib_List[18].call (null, function(binding){ var - b = Sx_runtime[14].call(null, binding), - c = [0, Sx_runtime[73].call(null, b), cq], - d = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, d)) + b = Sx_runtime[15].call(null, binding), + c = [0, Sx_runtime[74].call(null, b), cq], + d = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, d)) var - e = Sx_runtime[14].call(null, binding), - a = Sx_types[68].call(null, e); + e = Sx_runtime[15].call(null, binding), + a = Sx_types[72].call(null, e); else - var a = Sx_runtime[14].call(null, binding); - params[1] = Sx_runtime[10].call(null, params[1], a); - var f = Sx_runtime[17].call(null, binding, cr); - inits[1] = Sx_runtime[10].call(null, inits[1], f); + var a = Sx_runtime[15].call(null, binding); + params[1] = Sx_runtime[11].call(null, params[1], a); + var f = Sx_runtime[18].call(null, binding, cr); + inits[1] = Sx_runtime[11].call(null, inits[1], f); return 0; }, g); } else{ var - o = [0, Sx_runtime[24].call(null, bindings), cu], - p = [0, cv, [0, Sx_runtime[1].call(null, cst$12, o), 0]], - q = Sx_runtime[1].call(null, cst_range, p), - r = Sx_runtime[5].call(null, q); + o = [0, Sx_runtime[25].call(null, bindings), cu], + p = [0, cv, [0, Sx_runtime[2].call(null, cst$12, o), 0]], + q = Sx_runtime[2].call(null, cst_range, p), + r = Sx_runtime[6].call(null, q); Stdlib_List[26].call (null, function(acc, pair_idx){ var - b = Sx_runtime[1].call(null, cst$11, [0, pair_idx, cx]), - c = Sx_runtime[17].call(null, bindings, b), - d = [0, Sx_runtime[73].call(null, c), cw], - e = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, e)) + b = Sx_runtime[2].call(null, cst$11, [0, pair_idx, cx]), + c = Sx_runtime[18].call(null, bindings, b), + d = [0, Sx_runtime[74].call(null, c), cw], + e = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, e)) var - f = Sx_runtime[1].call(null, cst$11, [0, pair_idx, cy]), - g = Sx_runtime[17].call(null, bindings, f), - a = Sx_types[68].call(null, g); + f = Sx_runtime[2].call(null, cst$11, [0, pair_idx, cy]), + g = Sx_runtime[18].call(null, bindings, f), + a = Sx_types[72].call(null, g); else var - k = Sx_runtime[1].call(null, cst$11, [0, pair_idx, cA]), - a = Sx_runtime[17].call(null, bindings, k); - params[1] = Sx_runtime[10].call(null, params[1], a); + k = Sx_runtime[2].call(null, cst$11, [0, pair_idx, cA]), + a = Sx_runtime[18].call(null, bindings, k); + params[1] = Sx_runtime[11].call(null, params[1], a); var - h = [0, Sx_runtime[1].call(null, cst$11, [0, pair_idx, cz]), 0], - i = Sx_runtime[1].call(null, cst_inc, h), - j = Sx_runtime[17].call(null, bindings, i); - inits[1] = Sx_runtime[10].call(null, inits[1], j); + h = [0, Sx_runtime[2].call(null, cst$11, [0, pair_idx, cz]), 0], + i = Sx_runtime[2].call(null, cst_inc, h), + j = Sx_runtime[18].call(null, bindings, i); + inits[1] = Sx_runtime[11].call(null, inits[1], j); return 0; }, 0, r); } var - h = [0, Sx_runtime[24].call(null, body), cs], - i = Sx_runtime[1].call(null, cst, h); - if(Sx_types[67].call(null, i)) - var loop_body = Sx_runtime[14].call(null, body); + h = [0, Sx_runtime[25].call(null, body), cs], + i = Sx_runtime[2].call(null, cst, h); + if(Sx_types[71].call(null, i)) + var loop_body = Sx_runtime[15].call(null, body); else var - n = Sx_types[55].call(null, ct), - loop_body = Sx_runtime[18].call(null, n, body); + n = Sx_types[59].call(null, ct), + loop_body = Sx_runtime[19].call(null, n, body); var loop_fn = Sx_types[42].call(null, params[1], loop_body, env), - j = Sx_runtime[3].call(null, loop_name); - Sx_runtime[82].call(null, loop_fn, j); + j = Sx_runtime[4].call(null, loop_name); + Sx_runtime[83].call(null, loop_fn, j); var - k = Sx_runtime[3].call(null, loop_name), - l = Sx_types[72].call(null, loop_fn); - Sx_runtime[77].call(null, l, k, loop_fn); + k = Sx_runtime[4].call(null, loop_name), + l = Sx_types[76].call(null, loop_fn); + Sx_runtime[78].call(null, l, k, loop_fn); var - m = Sx_runtime[5].call(null, inits[1]), + m = Sx_runtime[6].call(null, inits[1]), init_vals = [6, Stdlib_List[20].call @@ -52658,44 +59676,44 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cJ = [3, cst_begin]; function sf_lambda(args, env){ var - params_expr = Sx_runtime[14].call(null, args), - body_exprs = Sx_runtime[15].call(null, args), - a = [0, Sx_runtime[24].call(null, body_exprs), cB], - b = Sx_runtime[1].call(null, cst, a); - if(Sx_types[67].call(null, b)) - var body = Sx_runtime[14].call(null, body_exprs); + params_expr = Sx_runtime[15].call(null, args), + body_exprs = Sx_runtime[16].call(null, args), + a = [0, Sx_runtime[25].call(null, body_exprs), cB], + b = Sx_runtime[2].call(null, cst, a); + if(Sx_types[71].call(null, b)) + var body = Sx_runtime[15].call(null, body_exprs); else var - d = Sx_types[55].call(null, cJ), - body = Sx_runtime[18].call(null, d, body_exprs); + d = Sx_types[59].call(null, cJ), + body = Sx_runtime[19].call(null, d, body_exprs); var - c = Sx_runtime[5].call(null, params_expr), + c = Sx_runtime[6].call(null, params_expr), param_names = [6, Stdlib_List[20].call (null, function(p){ var - b = [0, Sx_runtime[73].call(null, p), cC], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)) return Sx_types[68].call(null, p); + b = [0, Sx_runtime[74].call(null, p), cC], + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)) return Sx_types[72].call(null, p); var - d = [0, Sx_runtime[73].call(null, p), cD], - and = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and)){ + d = [0, Sx_runtime[74].call(null, p), cD], + and = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and)){ var - e = [0, Sx_runtime[24].call(null, p), cE], - and$0 = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, and$0)){ + e = [0, Sx_runtime[25].call(null, p), cE], + and$0 = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, and$0)){ var - f = Sx_runtime[17].call(null, p, cG), - g = [0, Sx_runtime[73].call(null, f), cF], - and$1 = Sx_runtime[1].call(null, cst, g); - if(Sx_types[67].call(null, and$1)) + f = Sx_runtime[18].call(null, p, cG), + g = [0, Sx_runtime[74].call(null, f), cF], + and$1 = Sx_runtime[2].call(null, cst, g); + if(Sx_types[71].call(null, and$1)) var - h = Sx_runtime[17].call(null, p, cI), - i = [0, Sx_types[69].call(null, h), cH], - a = Sx_runtime[1].call(null, cst, i); + h = Sx_runtime[18].call(null, p, cI), + i = [0, Sx_types[73].call(null, h), cH], + a = Sx_runtime[2].call(null, cst, i); else var a = and$1; } @@ -52704,9 +59722,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(! Sx_types[67].call(null, a)) return p; - var j = Sx_runtime[14].call(null, p); - return Sx_types[68].call(null, j); + if(! Sx_types[71].call(null, a)) return p; + var j = Sx_runtime[15].call(null, p); + return Sx_types[72].call(null, j); }, c)]; return Sx_types[42].call(null, param_names, body, env); @@ -52732,73 +59750,73 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cX = [3, cst_current_file]; function sf_defcomp(args, env){ var - name_sym = Sx_runtime[14].call(null, args), - params_raw = Sx_runtime[17].call(null, args, cK), - body = Sx_runtime[16].call(null, args), - a = Sx_types[68].call(null, name_sym), - comp_name = Sx_runtime[126].call(null, a, cL), + name_sym = Sx_runtime[15].call(null, args), + params_raw = Sx_runtime[18].call(null, args, cK), + body = Sx_runtime[17].call(null, args), + a = Sx_types[72].call(null, name_sym), + comp_name = Sx_runtime[128].call(null, a, cL), parsed = parse_comp_params(params_raw), - params = Sx_runtime[14].call(null, parsed), - has_children = Sx_runtime[17].call(null, parsed, cM), - param_types = Sx_runtime[17].call(null, parsed, cN), + params = Sx_runtime[15].call(null, parsed), + has_children = Sx_runtime[18].call(null, parsed, cM), + param_types = Sx_runtime[18].call(null, parsed, cN), affinity = defcomp_kwarg(args, cP, cO), comp = - Sx_types[51].call + Sx_types[55].call (null, comp_name, params, has_children, body, env, affinity), effects = defcomp_kwarg(args, cQ, 0), - b = Sx_runtime[83].call(null, param_types), - and = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and)){ - var c = Sx_runtime[1].call(null, cst_keys, [0, param_types, 0]); - Sx_runtime[33].call(null, c); + b = Sx_runtime[84].call(null, param_types), + and = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and)){ + var c = Sx_runtime[2].call(null, cst_keys, [0, param_types, 0]); + Sx_runtime[34].call(null, c); } var - d = Sx_runtime[83].call(null, effects), - e = [0, 1 - Sx_types[67].call(null, d)]; - if(Sx_types[67].call(null, e)){ + d = Sx_runtime[84].call(null, effects), + e = [0, 1 - Sx_types[71].call(null, d)]; + if(Sx_types[71].call(null, e)){ var - f = [0, Sx_runtime[73].call(null, effects), cR], - g = Sx_runtime[1].call(null, cst, f); - if(Sx_types[67].call(null, g)) + f = [0, Sx_runtime[74].call(null, effects), cR], + g = Sx_runtime[2].call(null, cst, f); + if(Sx_types[71].call(null, g)) var - h = Sx_runtime[5].call(null, effects), + h = Sx_runtime[6].call(null, effects), effect_list = [6, Stdlib_List[20].call (null, function(e){ var - a = [0, Sx_runtime[73].call(null, e), cS], - b = Sx_runtime[1].call(null, cst, a); - return Sx_types[67].call(null, b) - ? Sx_types[68].call(null, e) - : [3, Sx_runtime[4].call(null, [0, e, 0])]; + a = [0, Sx_runtime[74].call(null, e), cS], + b = Sx_runtime[2].call(null, cst, a); + return Sx_types[71].call(null, b) + ? Sx_types[72].call(null, e) + : [3, Sx_runtime[5].call(null, [0, e, 0])]; }, h)]; else var effect_list = - [6, [0, [3, Sx_runtime[4].call(null, [0, effects, 0])], 0]]; + [6, [0, [3, Sx_runtime[5].call(null, [0, effects, 0])], 0]]; var - i = Sx_runtime[75].call(null, env, cT), + i = Sx_runtime[76].call(null, env, cT), effect_anns = - Sx_types[67].call(null, i) - ? Sx_runtime[76].call(null, env, cU) + Sx_types[71].call(null, i) + ? Sx_runtime[77].call(null, env, cU) : [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - j = Sx_types[68].call(null, name_sym); - Sx_runtime[11].call(null, effect_anns, j, effect_list); - var k = Sx_runtime[3].call(null, cV); - Sx_runtime[77].call(null, env, k, effect_anns); + j = Sx_types[72].call(null, name_sym); + Sx_runtime[12].call(null, effect_anns, j, effect_list); + var k = Sx_runtime[4].call(null, cV); + Sx_runtime[78].call(null, env, k, effect_anns); } - var l = Sx_runtime[75].call(null, env, cW); - if(Sx_types[67].call(null, l)){ - var m = Sx_runtime[76].call(null, env, cX); - Sx_types[78].call(null, comp, m); + var l = Sx_runtime[76].call(null, env, cW); + if(Sx_types[71].call(null, l)){ + var m = Sx_runtime[77].call(null, env, cX); + Sx_types[82].call(null, comp, m); } var - n = Sx_types[68].call(null, name_sym), - o = Sx_runtime[3].call(null, n); - Sx_runtime[77].call(null, env, o, comp); + n = Sx_types[72].call(null, name_sym), + o = Sx_runtime[4].call(null, n); + Sx_runtime[78].call(null, env, o, comp); return comp; } var @@ -52811,39 +59829,39 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= c4 = [0, [3, cst_keyword], 0]; function defcomp_kwarg(args, key, default$){ var - a = [0, Sx_runtime[24].call(null, args), cY], - end = Sx_runtime[1].call(null, cst$5, a), + a = [0, Sx_runtime[25].call(null, args), cY], + end = Sx_runtime[2].call(null, cst$5, a), result = [0, default$], - b = Sx_runtime[1].call(null, cst_range, [0, c0, [0, end, cZ]]), - c = Sx_runtime[5].call(null, b); + b = Sx_runtime[2].call(null, cst_range, [0, c0, [0, end, cZ]]), + c = Sx_runtime[6].call(null, b); Stdlib_List[18].call (null, function(i){ var - b = Sx_runtime[17].call(null, args, i), - c = [0, Sx_runtime[73].call(null, b), c1], - and = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and)){ + b = Sx_runtime[18].call(null, args, i), + c = [0, Sx_runtime[74].call(null, b), c1], + and = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and)){ var - d = Sx_runtime[17].call(null, args, i), - e = [0, Sx_types[69].call(null, d), [0, key, 0]], - and$0 = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, and$0)) + d = Sx_runtime[18].call(null, args, i), + e = [0, Sx_types[73].call(null, d), [0, key, 0]], + and$0 = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, and$0)) var - f = [0, Sx_runtime[1].call(null, cst$8, [0, i, c2]), [0, end, 0]], - a = Sx_runtime[1].call(null, cst$3, f); + f = [0, Sx_runtime[2].call(null, cst$8, [0, i, c2]), [0, end, 0]], + a = Sx_runtime[2].call(null, cst$3, f); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - g = Sx_runtime[1].call(null, cst$8, [0, i, c3]), - val = Sx_runtime[17].call(null, args, g), - h = [0, Sx_runtime[73].call(null, val), c4], - j = Sx_runtime[1].call(null, cst, h), - k = Sx_types[67].call(null, j) ? Sx_types[69].call(null, val) : val; + g = Sx_runtime[2].call(null, cst$8, [0, i, c3]), + val = Sx_runtime[18].call(null, args, g), + h = [0, Sx_runtime[74].call(null, val), c4], + j = Sx_runtime[2].call(null, cst, h), + k = Sx_types[71].call(null, j) ? Sx_types[73].call(null, val) : val; result[1] = k; } return 0; @@ -52874,7 +59892,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function parse_comp_params(params_expr){ var param_types = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - a = Sx_runtime[5].call(null, params_expr), + a = Sx_runtime[6].call(null, params_expr), params = [0, c5], has_children = [0, c6], in_key = [0, c7]; @@ -52882,27 +59900,27 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(p){ var - b = [0, Sx_runtime[73].call(null, p), c8], - and = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, and)){ + b = [0, Sx_runtime[74].call(null, p), c8], + and = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, and)){ var - c = [0, Sx_runtime[24].call(null, p), c9], - and$0 = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and$0)){ + c = [0, Sx_runtime[25].call(null, p), c9], + and$0 = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and$0)){ var - d = Sx_runtime[14].call(null, p), - e = [0, Sx_runtime[73].call(null, d), c_], - and$1 = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, and$1)){ + d = Sx_runtime[15].call(null, p), + e = [0, Sx_runtime[74].call(null, d), c_], + and$1 = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, and$1)){ var - f = Sx_runtime[17].call(null, p, da), - g = [0, Sx_runtime[73].call(null, f), c$], - and$2 = Sx_runtime[1].call(null, cst, g); - if(Sx_types[67].call(null, and$2)) + f = Sx_runtime[18].call(null, p, da), + g = [0, Sx_runtime[74].call(null, f), c$], + and$2 = Sx_runtime[2].call(null, cst, g); + if(Sx_types[71].call(null, and$2)) var - h = Sx_runtime[17].call(null, p, dc), - i = [0, Sx_types[69].call(null, h), db], - a = Sx_runtime[1].call(null, cst, i); + h = Sx_runtime[18].call(null, p, dc), + i = [0, Sx_types[73].call(null, h), db], + a = Sx_runtime[2].call(null, cst, i); else var a = and$2; } @@ -52914,44 +59932,44 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - j = Sx_runtime[14].call(null, p), - name = Sx_types[68].call(null, j), - ptype = Sx_runtime[17].call(null, p, dd), - k = [0, Sx_runtime[73].call(null, ptype), de], - l = Sx_runtime[1].call(null, cst, k), + j = Sx_runtime[15].call(null, p), + name = Sx_types[72].call(null, j), + ptype = Sx_runtime[18].call(null, p, dd), + k = [0, Sx_runtime[74].call(null, ptype), de], + l = Sx_runtime[2].call(null, cst, k), type_val = - Sx_types[67].call(null, l) ? Sx_types[68].call(null, ptype) : ptype, - m = [0, 1 - Sx_types[67].call(null, has_children[1])]; - if(Sx_types[67].call(null, m)){ - params[1] = Sx_runtime[10].call(null, params[1], name); - Sx_runtime[11].call(null, param_types, name, type_val); + Sx_types[71].call(null, l) ? Sx_types[72].call(null, ptype) : ptype, + m = [0, 1 - Sx_types[71].call(null, has_children[1])]; + if(Sx_types[71].call(null, m)){ + params[1] = Sx_runtime[11].call(null, params[1], name); + Sx_runtime[12].call(null, param_types, name, type_val); } } else{ var - n = [0, Sx_runtime[73].call(null, p), df], - o = Sx_runtime[1].call(null, cst, n); - if(Sx_types[67].call(null, o)){ + n = [0, Sx_runtime[74].call(null, p), df], + o = Sx_runtime[2].call(null, cst, n); + if(Sx_types[71].call(null, o)){ var - name$0 = Sx_types[68].call(null, p), - q = Sx_runtime[1].call(null, cst, [0, name$0, dg]); - if(Sx_types[67].call(null, q)) + name$0 = Sx_types[72].call(null, p), + q = Sx_runtime[2].call(null, cst, [0, name$0, dg]); + if(Sx_types[71].call(null, q)) in_key[1] = dh; else{ - var r = Sx_runtime[1].call(null, cst, [0, name$0, di]); - if(Sx_types[67].call(null, r)) + var r = Sx_runtime[2].call(null, cst, [0, name$0, di]); + if(Sx_types[71].call(null, r)) has_children[1] = dj; else{ - var s = Sx_runtime[1].call(null, cst, [0, name$0, dk]); - if(Sx_types[67].call(null, s)) + var s = Sx_runtime[2].call(null, cst, [0, name$0, dk]); + if(Sx_types[71].call(null, s)) has_children[1] = dl; - else if(! Sx_types[67].call(null, has_children[1])) - if(Sx_types[67].call(null, in_key[1])) - params[1] = Sx_runtime[10].call(null, params[1], name$0); + else if(! Sx_types[71].call(null, has_children[1])) + if(Sx_types[71].call(null, in_key[1])) + params[1] = Sx_runtime[11].call(null, params[1], name$0); else - params[1] = Sx_runtime[10].call(null, params[1], name$0); + params[1] = Sx_runtime[11].call(null, params[1], name$0); } } } @@ -52972,34 +59990,34 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= du = [3, cst_begin]; function sf_defisland(args, env){ var - name_sym = Sx_runtime[14].call(null, args), - params_raw = Sx_runtime[17].call(null, args, dm), - body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, dn]), - a = [0, Sx_runtime[24].call(null, body_exprs), dp], - b = Sx_runtime[1].call(null, cst, a); - if(Sx_types[67].call(null, b)) - var body = Sx_runtime[14].call(null, body_exprs); + name_sym = Sx_runtime[15].call(null, args), + params_raw = Sx_runtime[18].call(null, args, dm), + body_exprs = Sx_runtime[2].call(null, cst_slice, [0, args, dn]), + a = [0, Sx_runtime[25].call(null, body_exprs), dp], + b = Sx_runtime[2].call(null, cst, a); + if(Sx_types[71].call(null, b)) + var body = Sx_runtime[15].call(null, body_exprs); else var - h = Sx_types[55].call(null, du), - body = Sx_runtime[18].call(null, h, body_exprs); + h = Sx_types[59].call(null, du), + body = Sx_runtime[19].call(null, h, body_exprs); var - c = Sx_types[68].call(null, name_sym), - comp_name = Sx_runtime[126].call(null, c, dq), + c = Sx_types[72].call(null, name_sym), + comp_name = Sx_runtime[128].call(null, c, dq), parsed = parse_comp_params(params_raw), - params = Sx_runtime[14].call(null, parsed), - has_children = Sx_runtime[17].call(null, parsed, dr), + params = Sx_runtime[15].call(null, parsed), + has_children = Sx_runtime[18].call(null, parsed, dr), island = - Sx_types[52].call(null, comp_name, params, has_children, body, env), - d = Sx_runtime[75].call(null, env, ds); - if(Sx_types[67].call(null, d)){ - var e = Sx_runtime[76].call(null, env, dt); - Sx_types[78].call(null, island, e); + Sx_types[56].call(null, comp_name, params, has_children, body, env), + d = Sx_runtime[76].call(null, env, ds); + if(Sx_types[71].call(null, d)){ + var e = Sx_runtime[77].call(null, env, dt); + Sx_types[82].call(null, island, e); } var - f = Sx_types[68].call(null, name_sym), - g = Sx_runtime[3].call(null, f); - Sx_runtime[77].call(null, env, g, island); + f = Sx_types[72].call(null, name_sym), + g = Sx_runtime[4].call(null, f); + Sx_runtime[78].call(null, env, g, island); return island; } var dv = [0, [2, 2.], 0], dw = [2, 1.]; @@ -53007,57 +60025,57 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var remaining = remaining$1; for(;;){ var - b = Sx_runtime[33].call(null, remaining), - and = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and)){ + b = Sx_runtime[34].call(null, remaining), + and = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and)){ var - c = [0, Sx_runtime[24].call(null, remaining), dv], - and$0 = Sx_runtime[1].call(null, cst$2, c); - if(Sx_types[67].call(null, and$0)) + c = [0, Sx_runtime[25].call(null, remaining), dv], + and$0 = Sx_runtime[2].call(null, cst$2, c); + if(Sx_types[71].call(null, and$0)) var - d = Sx_runtime[14].call(null, remaining), - a = Sx_runtime[32].call(null, d); + d = Sx_runtime[15].call(null, remaining), + a = Sx_runtime[33].call(null, d); else var a = and$0; } else var a = and; - if(! Sx_types[67].call(null, a)) return 0; + if(! Sx_types[71].call(null, a)) return 0; var - e = Sx_runtime[17].call(null, remaining, dw), - f = Sx_runtime[14].call(null, remaining), - g = Sx_types[69].call(null, f); - Sx_runtime[11].call(null, spec, g, e); + e = Sx_runtime[18].call(null, remaining, dw), + f = Sx_runtime[15].call(null, remaining), + g = Sx_types[73].call(null, f); + Sx_runtime[12].call(null, spec, g, e); var - h = Sx_runtime[15].call(null, remaining), - remaining$0 = Sx_runtime[15].call(null, h); + h = Sx_runtime[16].call(null, remaining), + remaining$0 = Sx_runtime[16].call(null, h); remaining = remaining$0; } } var dx = [3, cst_name]; function sf_defio(args, env){ var - name = Sx_runtime[14].call(null, args), + name = Sx_runtime[15].call(null, args), spec = [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; - Sx_runtime[11].call(null, spec, dx, name); - defio_parse_kwargs_b(spec, Sx_runtime[15].call(null, args)); + Sx_runtime[12].call(null, spec, dx, name); + defio_parse_kwargs_b(spec, Sx_runtime[16].call(null, args)); io_register_b(name, spec); return spec; } var dy = [2, 1.], dz = [2, 2.], dA = [2, 1.]; function sf_defmacro(args, env){ var - name_sym = Sx_runtime[14].call(null, args), - params_raw = Sx_runtime[17].call(null, args, dy), - body = Sx_runtime[17].call(null, args, dz), + name_sym = Sx_runtime[15].call(null, args), + params_raw = Sx_runtime[18].call(null, args, dy), + body = Sx_runtime[18].call(null, args, dz), parsed = parse_macro_params(params_raw), - params = Sx_runtime[14].call(null, parsed), - rest_param = Sx_runtime[17].call(null, parsed, dA), - a = Sx_types[68].call(null, name_sym), - mac = Sx_types[53].call(null, params, rest_param, body, env, a), - b = Sx_types[68].call(null, name_sym), - c = Sx_runtime[3].call(null, b); - Sx_runtime[77].call(null, env, c, mac); + params = Sx_runtime[15].call(null, parsed), + rest_param = Sx_runtime[18].call(null, parsed, dA), + a = Sx_types[72].call(null, name_sym), + mac = Sx_types[57].call(null, params, rest_param, body, env, a), + b = Sx_types[72].call(null, name_sym), + c = Sx_runtime[4].call(null, b); + Sx_runtime[78].call(null, env, c, mac); return mac; } var @@ -53073,39 +60091,39 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= dJ = [0, [3, cst_symbol], 0]; function parse_macro_params(params_expr){ var - a = Sx_runtime[5].call(null, params_expr), + a = Sx_runtime[6].call(null, params_expr), d = Stdlib_Hashtbl[1].call(null, 0, 1), - b = Sx_runtime[2].call(null, dD); + b = Sx_runtime[3].call(null, dD); Stdlib_Hashtbl[11].call(null, d, b, dC); var params = [0, dB], rest_param = [0, 0]; Stdlib_List[26].call (null, function(state, p){ var - b = [0, Sx_runtime[73].call(null, p), dE], - and = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, and)) + b = [0, Sx_runtime[74].call(null, p), dE], + and = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, and)) var - c = [0, Sx_types[68].call(null, p), dF], - a = Sx_runtime[1].call(null, cst, c); + c = [0, Sx_types[72].call(null, p), dF], + a = Sx_runtime[2].call(null, cst, c); else var a = and; - if(Sx_types[67].call(null, a)) - return Sx_runtime[1].call(null, cst_assoc, [0, state, dG]); - var d = Sx_runtime[25].call(null, state, dH); - if(Sx_types[67].call(null, d)){ + if(Sx_types[71].call(null, a)) + return Sx_runtime[2].call(null, cst_assoc, [0, state, dG]); + var d = Sx_runtime[26].call(null, state, dH); + if(Sx_types[71].call(null, d)){ var - e = [0, Sx_runtime[73].call(null, p), dI], - f = Sx_runtime[1].call(null, cst, e), - g = Sx_types[67].call(null, f) ? Sx_types[68].call(null, p) : p; + e = [0, Sx_runtime[74].call(null, p), dI], + f = Sx_runtime[2].call(null, cst, e), + g = Sx_types[71].call(null, f) ? Sx_types[72].call(null, p) : p; rest_param[1] = g; return state; } var - h = [0, Sx_runtime[73].call(null, p), dJ], - i = Sx_runtime[1].call(null, cst, h), - j = Sx_types[67].call(null, i) ? Sx_types[68].call(null, p) : p; - params[1] = Sx_runtime[10].call(null, params[1], j); + h = [0, Sx_runtime[74].call(null, p), dJ], + i = Sx_runtime[2].call(null, cst, h), + j = Sx_types[71].call(null, i) ? Sx_types[72].call(null, p) : p; + params[1] = Sx_runtime[11].call(null, params[1], j); return state; }, [7, d], @@ -53127,46 +60145,46 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= dV = [0, [3, cst_list], 0]; function qq_expand(template, env){ var - b = [0, Sx_runtime[73].call(null, template), dK], - c = Sx_runtime[1].call(null, cst, b), - d = [0, 1 - Sx_types[67].call(null, c)]; - if(Sx_types[67].call(null, d)) return template; - var e = Sx_runtime[33].call(null, template); - if(Sx_types[67].call(null, e)) return dL; + b = [0, Sx_runtime[74].call(null, template), dK], + c = Sx_runtime[2].call(null, cst, b), + d = [0, 1 - Sx_types[71].call(null, c)]; + if(Sx_types[71].call(null, d)) return template; + var e = Sx_runtime[34].call(null, template); + if(Sx_types[71].call(null, e)) return dL; var - head = Sx_runtime[14].call(null, template), - f = [0, Sx_runtime[73].call(null, head), dM], - and = Sx_runtime[1].call(null, cst, f); - if(Sx_types[67].call(null, and)) + head = Sx_runtime[15].call(null, template), + f = [0, Sx_runtime[74].call(null, head), dM], + and = Sx_runtime[2].call(null, cst, f); + if(Sx_types[71].call(null, and)) var - g = [0, Sx_types[68].call(null, head), dN], - a = Sx_runtime[1].call(null, cst, g); + g = [0, Sx_types[72].call(null, head), dN], + a = Sx_runtime[2].call(null, cst, g); else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) return trampoline - (eval_expr(Sx_runtime[17].call(null, template, dO), env)); - var h = Sx_runtime[5].call(null, template); + (eval_expr(Sx_runtime[18].call(null, template, dO), env)); + var h = Sx_runtime[6].call(null, template); return Stdlib_List[26].call (null, function(result, item){ var - b = [0, Sx_runtime[73].call(null, item), dQ], - and = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, and)){ + b = [0, Sx_runtime[74].call(null, item), dQ], + and = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, and)){ var - c = [0, Sx_runtime[24].call(null, item), dR], - and$0 = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and$0)){ + c = [0, Sx_runtime[25].call(null, item), dR], + and$0 = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and$0)){ var - d = Sx_runtime[14].call(null, item), - e = [0, Sx_runtime[73].call(null, d), dS], - and$1 = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, and$1)) + d = Sx_runtime[15].call(null, item), + e = [0, Sx_runtime[74].call(null, d), dS], + and$1 = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, and$1)) var - f = Sx_runtime[14].call(null, item), - g = [0, Sx_types[68].call(null, f), dT], - a = Sx_runtime[1].call(null, cst, g); + f = Sx_runtime[15].call(null, item), + g = [0, Sx_types[72].call(null, f), dT], + a = Sx_runtime[2].call(null, cst, g); else var a = and$1; } @@ -53175,24 +60193,24 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(! Sx_types[67].call(null, a)){ + if(! Sx_types[71].call(null, a)){ var k = [0, result, [0, [6, [0, qq_expand(item, env), 0]], 0]]; - return Sx_runtime[1].call(null, cst_concat, k); + return Sx_runtime[2].call(null, cst_concat, k); } var spliced = trampoline - (eval_expr(Sx_runtime[17].call(null, item, dU), env)), - h = [0, Sx_runtime[73].call(null, spliced), dV], - i = Sx_runtime[1].call(null, cst, h); - if(Sx_types[67].call(null, i)) - return Sx_runtime[1].call + (eval_expr(Sx_runtime[18].call(null, item, dU), env)), + h = [0, Sx_runtime[74].call(null, spliced), dV], + i = Sx_runtime[2].call(null, cst, h); + if(Sx_types[71].call(null, i)) + return Sx_runtime[2].call (null, cst_concat, [0, result, [0, spliced, 0]]); - var j = Sx_runtime[83].call(null, spliced); - return Sx_types[67].call(null, j) + var j = Sx_runtime[84].call(null, spliced); + return Sx_types[71].call(null, j) ? result : Sx_runtime - [1].call + [2].call (null, cst_concat, [0, result, [0, [6, [0, spliced, 0]], 0]]); @@ -53219,113 +60237,113 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= d_ = [0, [2, 2.], 0]; function sf_letrec(args, env){ var - bindings = Sx_runtime[14].call(null, args), - body = Sx_runtime[15].call(null, args), - local = Sx_runtime[80].call(null, env), - b = Sx_runtime[14].call(null, bindings), - c = [0, Sx_runtime[73].call(null, b), dY], - and = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, and)) + bindings = Sx_runtime[15].call(null, args), + body = Sx_runtime[16].call(null, args), + local = Sx_runtime[81].call(null, env), + b = Sx_runtime[15].call(null, bindings), + c = [0, Sx_runtime[74].call(null, b), dY], + and = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, and)) var - d = Sx_runtime[14].call(null, bindings), - e = [0, Sx_runtime[24].call(null, d), dZ], - a = Sx_runtime[1].call(null, cst, e); + d = Sx_runtime[15].call(null, bindings), + e = [0, Sx_runtime[25].call(null, d), dZ], + a = Sx_runtime[2].call(null, cst, e); else var a = and; var names = [0, dW], val_exprs = [0, dX]; - if(Sx_types[67].call(null, a)){ - var f = Sx_runtime[5].call(null, bindings); + if(Sx_types[71].call(null, a)){ + var f = Sx_runtime[6].call(null, bindings); Stdlib_List[18].call (null, function(binding){ var - a = Sx_runtime[14].call(null, binding), - b = [0, Sx_runtime[73].call(null, a), d0], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)) + a = Sx_runtime[15].call(null, binding), + b = [0, Sx_runtime[74].call(null, a), d0], + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)) var - d = Sx_runtime[14].call(null, binding), - vname = Sx_types[68].call(null, d); + d = Sx_runtime[15].call(null, binding), + vname = Sx_types[72].call(null, d); else - var vname = Sx_runtime[14].call(null, binding); - names[1] = Sx_runtime[10].call(null, names[1], vname); - var e = Sx_runtime[17].call(null, binding, d1); - val_exprs[1] = Sx_runtime[10].call(null, val_exprs[1], e); - var f = Sx_runtime[3].call(null, vname); - Sx_runtime[77].call(null, local, f, 0); + var vname = Sx_runtime[15].call(null, binding); + names[1] = Sx_runtime[11].call(null, names[1], vname); + var e = Sx_runtime[18].call(null, binding, d1); + val_exprs[1] = Sx_runtime[11].call(null, val_exprs[1], e); + var f = Sx_runtime[4].call(null, vname); + Sx_runtime[78].call(null, local, f, 0); return 0; }, f); } else{ var - p = [0, Sx_runtime[24].call(null, bindings), d4], - q = [0, d5, [0, Sx_runtime[1].call(null, cst$12, p), 0]], - r = Sx_runtime[1].call(null, cst_range, q), - s = Sx_runtime[5].call(null, r); + p = [0, Sx_runtime[25].call(null, bindings), d4], + q = [0, d5, [0, Sx_runtime[2].call(null, cst$12, p), 0]], + r = Sx_runtime[2].call(null, cst_range, q), + s = Sx_runtime[6].call(null, r); Stdlib_List[26].call (null, function(acc, pair_idx){ var - a = Sx_runtime[1].call(null, cst$11, [0, pair_idx, d7]), - b = Sx_runtime[17].call(null, bindings, a), - c = [0, Sx_runtime[73].call(null, b), d6], - d = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, d)) + a = Sx_runtime[2].call(null, cst$11, [0, pair_idx, d7]), + b = Sx_runtime[18].call(null, bindings, a), + c = [0, Sx_runtime[74].call(null, b), d6], + d = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, d)) var - e = Sx_runtime[1].call(null, cst$11, [0, pair_idx, d8]), - f = Sx_runtime[17].call(null, bindings, e), - vname = Sx_types[68].call(null, f); + e = Sx_runtime[2].call(null, cst$11, [0, pair_idx, d8]), + f = Sx_runtime[18].call(null, bindings, e), + vname = Sx_types[72].call(null, f); else var - j = Sx_runtime[1].call(null, cst$11, [0, pair_idx, d_]), - vname = Sx_runtime[17].call(null, bindings, j); + j = Sx_runtime[2].call(null, cst$11, [0, pair_idx, d_]), + vname = Sx_runtime[18].call(null, bindings, j); var - g = [0, Sx_runtime[1].call(null, cst$11, [0, pair_idx, d9]), 0], - h = Sx_runtime[1].call(null, cst_inc, g), - val_expr = Sx_runtime[17].call(null, bindings, h); - names[1] = Sx_runtime[10].call(null, names[1], vname); - val_exprs[1] = Sx_runtime[10].call(null, val_exprs[1], val_expr); - var i = Sx_runtime[3].call(null, vname); - return Sx_runtime[77].call(null, local, i, 0); + g = [0, Sx_runtime[2].call(null, cst$11, [0, pair_idx, d9]), 0], + h = Sx_runtime[2].call(null, cst_inc, g), + val_expr = Sx_runtime[18].call(null, bindings, h); + names[1] = Sx_runtime[11].call(null, names[1], vname); + val_exprs[1] = Sx_runtime[11].call(null, val_exprs[1], val_expr); + var i = Sx_runtime[4].call(null, vname); + return Sx_runtime[78].call(null, local, i, 0); }, 0, s); } var - g = Sx_runtime[5].call(null, val_exprs[1]), + g = Sx_runtime[6].call(null, val_exprs[1]), values = [6, Stdlib_List[20].call (null, function(e){return trampoline(eval_expr(e, local));}, g)], - h = Sx_runtime[1].call(null, cst_zip, [0, names[1], [0, values, 0]]), - i = Sx_runtime[5].call(null, h); + h = Sx_runtime[2].call(null, cst_zip, [0, names[1], [0, values, 0]]), + i = Sx_runtime[6].call(null, h); Stdlib_List[18].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, d2), - b = Sx_runtime[14].call(null, pair), - c = Sx_runtime[3].call(null, b); - Sx_runtime[77].call(null, local, c, a); + a = Sx_runtime[18].call(null, pair, d2), + b = Sx_runtime[15].call(null, pair), + c = Sx_runtime[4].call(null, b); + Sx_runtime[78].call(null, local, c, a); return 0; }, i); - var j = Sx_runtime[5].call(null, values); + var j = Sx_runtime[6].call(null, values); Stdlib_List[18].call (null, function(val){ - var a = Sx_runtime[85].call(null, val); - if(Sx_types[67].call(null, a)){ - var b = Sx_runtime[5].call(null, names[1]); + var a = Sx_runtime[86].call(null, val); + if(Sx_types[71].call(null, a)){ + var b = Sx_runtime[6].call(null, names[1]); Stdlib_List[18].call (null, function(n){ var - a = Sx_runtime[76].call(null, local, n), - b = Sx_runtime[3].call(null, n), - c = Sx_types[72].call(null, val); - Sx_runtime[77].call(null, c, b, a); + a = Sx_runtime[77].call(null, local, n), + b = Sx_runtime[4].call(null, n), + c = Sx_types[76].call(null, val); + Sx_runtime[78].call(null, c, b, a); return 0; }, b); @@ -53334,28 +60352,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }, j); var - k = [0, Sx_runtime[24].call(null, body), 0], - l = [0, body, [0, d3, [0, Sx_runtime[1].call(null, cst_dec, k), 0]]], - m = Sx_runtime[1].call(null, cst_slice, l), - n = Sx_runtime[5].call(null, m); + k = [0, Sx_runtime[25].call(null, body), 0], + l = [0, body, [0, d3, [0, Sx_runtime[2].call(null, cst_dec, k), 0]]], + m = Sx_runtime[2].call(null, cst_slice, l), + n = Sx_runtime[6].call(null, m); Stdlib_List[18].call (null, function(e){trampoline(eval_expr(e, local)); return 0;}, n); - var o = Sx_runtime[16].call(null, body); - return Sx_types[54].call(null, o, local); + var o = Sx_runtime[17].call(null, body); + return Sx_types[58].call(null, o, local); } function step_sf_letrec(args, env, kont){ - var thk = sf_letrec(args, env), a = Sx_types[89].call(null, thk); - return make_cek_state(Sx_types[88].call(null, thk), a, kont); + var thk = sf_letrec(args, env), a = Sx_types[93].call(null, thk); + return make_cek_state(Sx_types[92].call(null, thk), a, kont); } var d$ = [2, 1.], ea = [2, 2.], eb = [6, 0], ec = [6, 0], ed = [6, 0]; function step_sf_dynamic_wind(args, env, kont){ var - before = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - body = trampoline(eval_expr(Sx_runtime[17].call(null, args, d$), env)), - after = trampoline(eval_expr(Sx_runtime[17].call(null, args, ea), env)); + before = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + body = trampoline(eval_expr(Sx_runtime[18].call(null, args, d$), env)), + after = trampoline(eval_expr(Sx_runtime[18].call(null, args, ea), env)); cek_call(before, eb); - var winders_len = Sx_runtime[24].call(null, winders_ref[1]); - winders_ref[1] = Sx_runtime[18].call(null, after, winders_ref[1]); + var winders_len = Sx_runtime[25].call(null, winders_ref[1]); + winders_ref[1] = Sx_runtime[19].call(null, after, winders_ref[1]); return continue_with_call (body, ed, @@ -53372,54 +60390,54 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ej = [0, [2, 2.], 0]; function sf_scope(args, env){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - rest = Sx_runtime[1].call(null, cst_slice, [0, args, ee]), - b = [0, Sx_runtime[24].call(null, rest), ef], - and = Sx_runtime[1].call(null, cst$2, b); - if(Sx_types[67].call(null, and)){ + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + rest = Sx_runtime[2].call(null, cst_slice, [0, args, ee]), + b = [0, Sx_runtime[25].call(null, rest), ef], + and = Sx_runtime[2].call(null, cst$2, b); + if(Sx_types[71].call(null, and)){ var - c = Sx_runtime[14].call(null, rest), - d = [0, Sx_runtime[73].call(null, c), eg], - and$0 = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and$0)) + c = Sx_runtime[15].call(null, rest), + d = [0, Sx_runtime[74].call(null, c), eg], + and$0 = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and$0)) var - e = Sx_runtime[14].call(null, rest), - f = [0, Sx_types[69].call(null, e), eh], - a = Sx_runtime[1].call(null, cst, f); + e = Sx_runtime[15].call(null, rest), + f = [0, Sx_types[73].call(null, e), eh], + a = Sx_runtime[2].call(null, cst, f); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - g = trampoline(eval_expr(Sx_runtime[17].call(null, rest, ei), env)), - body_exprs = Sx_runtime[1].call(null, cst_slice, [0, rest, ej]), + g = trampoline(eval_expr(Sx_runtime[18].call(null, rest, ei), env)), + body_exprs = Sx_runtime[2].call(null, cst_slice, [0, rest, ej]), val = g; else var body_exprs = rest, val = 0; - Sx_runtime[103].call(null, name, val); - var h = Sx_runtime[5].call(null, body_exprs), result = [0, 0]; + Sx_runtime[105].call(null, name, val); + var h = Sx_runtime[6].call(null, body_exprs), result = [0, 0]; Stdlib_List[18].call (null, function(e){result[1] = trampoline(eval_expr(e, env)); return 0;}, h); - Sx_runtime[104].call(null, name); + Sx_runtime[106].call(null, name); return result[1]; } var ek = [2, 1.], el = [0, [2, 2.], 0]; function sf_provide(args, env){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - val = trampoline(eval_expr(Sx_runtime[17].call(null, args, ek), env)), - body_exprs = Sx_runtime[1].call(null, cst_slice, [0, args, el]); - Sx_runtime[103].call(null, name, val); - var a = Sx_runtime[5].call(null, body_exprs), result = [0, 0]; + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[18].call(null, args, ek), env)), + body_exprs = Sx_runtime[2].call(null, cst_slice, [0, args, el]); + Sx_runtime[105].call(null, name, val); + var a = Sx_runtime[6].call(null, body_exprs), result = [0, 0]; Stdlib_List[18].call (null, function(e){result[1] = trampoline(eval_expr(e, env)); return 0;}, a); - Sx_runtime[104].call(null, name); + Sx_runtime[106].call(null, name); return result[1]; } var @@ -53433,72 +60451,72 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= eq = [2, 1.]; function expand_macro(mac, raw_args, env){ var - body = Sx_types[86].call(null, mac), - and = Sx_runtime[39].call(null, body); - if(Sx_types[67].call(null, and)) + body = Sx_types[90].call(null, mac), + and = Sx_runtime[40].call(null, body); + if(Sx_types[71].call(null, and)) var - b = [0, Sx_types[68].call(null, body), em], - a = Sx_runtime[1].call(null, cst, b); + b = [0, Sx_types[72].call(null, body), em], + a = Sx_runtime[2].call(null, cst, b); else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - closure = Sx_types[87].call(null, mac), - c = Sx_runtime[76].call(null, closure, en); + closure = Sx_types[91].call(null, mac), + c = Sx_runtime[77].call(null, closure, en); return syntax_rules_expand - (Sx_runtime[76].call(null, closure, eo), c, raw_args); + (Sx_runtime[77].call(null, closure, eo), c, raw_args); } var - d = Sx_types[87].call(null, mac), - local = Sx_runtime[81].call(null, d, env), - e = Sx_types[84].call(null, mac), - f = Sx_runtime[5].call(null, e), + d = Sx_types[91].call(null, mac), + local = Sx_runtime[82].call(null, d, env), + e = Sx_types[88].call(null, mac), + f = Sx_runtime[6].call(null, e), g = [6, Stdlib_List[21].call (null, function(i, p){var i$0 = [2, i]; return [6, [0, p, [0, i$0, 0]]];}, f)], - h = Sx_runtime[5].call(null, g); + h = Sx_runtime[6].call(null, g); Stdlib_List[18].call (null, function(pair){ var - b = [0, Sx_runtime[24].call(null, raw_args), 0], - c = [0, Sx_runtime[17].call(null, pair, ep), b], - d = Sx_runtime[1].call(null, cst$3, c); - if(Sx_types[67].call(null, d)) + b = [0, Sx_runtime[25].call(null, raw_args), 0], + c = [0, Sx_runtime[18].call(null, pair, ep), b], + d = Sx_runtime[2].call(null, cst$3, c); + if(Sx_types[71].call(null, d)) var - e = Sx_runtime[17].call(null, pair, eq), - a = Sx_runtime[17].call(null, raw_args, e); + e = Sx_runtime[18].call(null, pair, eq), + a = Sx_runtime[18].call(null, raw_args, e); else var a = 0; var - f = Sx_runtime[14].call(null, pair), - g = Sx_runtime[3].call(null, f); - Sx_runtime[77].call(null, local, g, a); + f = Sx_runtime[15].call(null, pair), + g = Sx_runtime[4].call(null, f); + Sx_runtime[78].call(null, local, g, a); return 0; }, h); - var i = Sx_types[85].call(null, mac); - if(Sx_types[67].call(null, i)){ + var i = Sx_types[89].call(null, mac); + if(Sx_types[71].call(null, i)){ var - j = Sx_types[84].call(null, mac), - k = [0, raw_args, [0, Sx_runtime[24].call(null, j), 0]], - l = Sx_runtime[1].call(null, cst_slice, k), - m = Sx_types[85].call(null, mac), - n = Sx_runtime[3].call(null, m); - Sx_runtime[77].call(null, local, n, l); + j = Sx_types[88].call(null, mac), + k = [0, raw_args, [0, Sx_runtime[25].call(null, j), 0]], + l = Sx_runtime[2].call(null, cst_slice, k), + m = Sx_types[89].call(null, mac), + n = Sx_runtime[4].call(null, m); + Sx_runtime[78].call(null, local, n, l); } - return trampoline(eval_expr(Sx_types[86].call(null, mac), local)); + return trampoline(eval_expr(Sx_types[90].call(null, mac), local)); } function cek_step_loop(state$1){ var state = state$1; for(;;){ var or = cek_terminal_p(state), - or$0 = Sx_types[67].call(null, or) ? or : cek_suspended_p(state); - if(Sx_types[67].call(null, or$0)) return state; + or$0 = Sx_types[71].call(null, or) ? or : cek_suspended_p(state); + if(Sx_types[71].call(null, or$0)) return state; var state$0 = cek_step(state); state = state$0; } @@ -53508,8 +60526,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= er = [3, cst_IO_suspension_in_non_IO_co]; function cek_run(state){ var final = cek_step_loop(state), a = cek_suspended_p(final); - if(! Sx_types[67].call(null, a)) return cek_value(final); - var b = Sx_runtime[2].call(null, er); + if(! Sx_types[71].call(null, a)) return cek_value(final); + var match = Sx_types[13][1]; + if(match){var hook = match[1]; return caml_call1(hook, final);} + var b = Sx_runtime[3].call(null, er); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } function cek_resume(suspended_state, result){ @@ -53518,8 +60538,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var es = [0, [3, cst_eval], 0]; function cek_step(state){ - var a = [0, cek_phase(state), es], b = Sx_runtime[1].call(null, cst, a); - return Sx_types[67].call(null, b) + var a = [0, cek_phase(state), es], b = Sx_runtime[2].call(null, cst, a); + return Sx_types[71].call(null, b) ? step_eval(state) : step_continue(state); } @@ -53547,32 +60567,32 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= expr = cek_control(state), env = cek_env(state), kont = cek_kont(state), - match_val = Sx_runtime[73].call(null, expr); + match_val = Sx_runtime[74].call(null, expr); if(caml_equal(match_val, et)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, eu)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, ev)) return make_cek_value(expr, env, kont); if(caml_equal(match_val, ew)) return make_cek_value(0, env, kont); if(! caml_equal(match_val, ex)){ if(caml_equal(match_val, eF)) - return make_cek_value(Sx_types[69].call(null, expr), env, kont); + return make_cek_value(Sx_types[73].call(null, expr), env, kont); if(caml_equal(match_val, eG)){ var - ks = Sx_runtime[1].call(null, cst_keys, [0, expr, 0]), - h = Sx_runtime[33].call(null, ks); - if(Sx_types[67].call(null, h)) + ks = Sx_runtime[2].call(null, cst_keys, [0, expr, 0]), + h = Sx_runtime[34].call(null, ks); + if(Sx_types[71].call(null, h)) return make_cek_value ([7, Stdlib_Hashtbl[1].call(null, 0, 0)], env, kont); var - first_key = Sx_runtime[14].call(null, ks), - i = Sx_runtime[15].call(null, ks), - j = Sx_runtime[5].call(null, i), + first_key = Sx_runtime[15].call(null, ks), + i = Sx_runtime[16].call(null, ks), + j = Sx_runtime[6].call(null, i), remaining_entries = [0, eH]; Stdlib_List[18].call (null, function(k){ - var a = [6, [0, k, [0, Sx_runtime[25].call(null, expr, k), 0]]]; + var a = [6, [0, k, [0, Sx_runtime[26].call(null, expr, k), 0]]]; remaining_entries[1] = - Sx_runtime[10].call(null, remaining_entries[1], a); + Sx_runtime[11].call(null, remaining_entries[1], a); return 0; }, j); @@ -53583,37 +60603,37 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (remaining_entries[1], [6, [0, [6, [0, first_key, 0]], 0]], env), kont); return make_cek_state - (Sx_runtime[25].call(null, expr, first_key), env, k); + (Sx_runtime[26].call(null, expr, first_key), env, k); } if(! caml_equal(match_val, eI)) return make_cek_value(expr, env, kont); - var l = Sx_runtime[33].call(null, expr); - return Sx_types[67].call(null, l) + var l = Sx_runtime[34].call(null, expr); + return Sx_types[71].call(null, l) ? make_cek_value(eJ, env, kont) : step_eval_list(expr, env, kont); } var - name = Sx_types[68].call(null, expr), - a = Sx_runtime[75].call(null, env, name); - if(Sx_types[67].call(null, a)) - var val = Sx_runtime[76].call(null, env, name); + name = Sx_types[72].call(null, expr), + a = Sx_runtime[76].call(null, env, name); + if(Sx_types[71].call(null, a)) + var val = Sx_runtime[77].call(null, env, name); else{ - var b = Sx_runtime[91].call(null, name); - if(Sx_types[67].call(null, b)) - var val = Sx_runtime[92].call(null, name); + var b = Sx_runtime[92].call(null, name); + if(Sx_types[71].call(null, b)) + var val = Sx_runtime[93].call(null, name); else{ - var c = Sx_runtime[1].call(null, cst, [0, name, ez]); - if(Sx_types[67].call(null, c)) + var c = Sx_runtime[2].call(null, cst, [0, name, ez]); + if(Sx_types[71].call(null, c)) var val = eA; else{ - var d = Sx_runtime[1].call(null, cst, [0, name, eB]); - if(Sx_types[67].call(null, d)) + var d = Sx_runtime[2].call(null, cst, [0, name, eB]); + if(Sx_types[71].call(null, d)) var val = eC; else{ - var e = Sx_runtime[1].call(null, cst, [0, name, eD]); - if(! Sx_types[67].call(null, e)){ + var e = Sx_runtime[2].call(null, cst, [0, name, eD]); + if(! Sx_types[71].call(null, e)){ var - f = [3, Sx_runtime[4].call(null, [0, eE, [0, name, 0]])], - g = Sx_runtime[2].call(null, f); + f = [3, Sx_runtime[5].call(null, [0, eE, [0, name, 0]])], + g = Sx_runtime[3].call(null, f); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); } var val = 0; @@ -53621,15 +60641,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } } } - var and = Sx_runtime[83].call(null, val); - if(Sx_types[67].call(null, and)) - Sx_runtime[1].call(null, cst_starts_with, [0, name, ey]); + var and = Sx_runtime[84].call(null, val); + if(Sx_types[71].call(null, and)) + Sx_runtime[2].call(null, cst_starts_with, [0, name, ey]); return make_cek_value(val, env, kont); } var eK = [0, 0]; function step_sf_raise(args, env, kont){ var a = kont_push(make_raise_eval_frame(env, eK), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } var cst$14 = "_", @@ -53681,15 +60701,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e_ = [4, cst_let]; function step_sf_guard$0(counter, args, env, kont){ var - var_clauses = Sx_runtime[14].call(null, args), - body = Sx_runtime[15].call(null, args), - var$ = Sx_runtime[14].call(null, var_clauses), - clauses = Sx_runtime[15].call(null, var_clauses), - sentinel = Sx_types[55].call(null, eL), + var_clauses = Sx_runtime[15].call(null, args), + body = Sx_runtime[16].call(null, args), + var$ = Sx_runtime[15].call(null, var_clauses), + clauses = Sx_runtime[16].call(null, var_clauses), + sentinel = Sx_types[59].call(null, eL), b = - [6, [0, [6, [0, eV, [0, Sx_runtime[18].call(null, eU, body), 0]]], 0]], + [6, [0, [6, [0, eV, [0, Sx_runtime[19].call(null, eU, body), 0]]], 0]], c = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, @@ -53706,21 +60726,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 0]]], 0]], 0]]), - d = [6, [0, [6, [0, e0, [0, Sx_runtime[18].call(null, eZ, c), 0]]], 0]], - e = Sx_runtime[18].call(null, [6, [0, var$, 0]], d), - f = [0, Sx_runtime[18].call(null, e1, e), 0], - g = Sx_runtime[18].call(null, e3, e2), - h = [6, [0, [6, [0, Sx_runtime[18].call(null, e4, g), f]], 0]], - i = Sx_runtime[18].call(null, h, b), - j = [6, [0, Sx_runtime[18].call(null, e5, i), 0]], - k = Sx_runtime[18].call(null, e6, j), - l = [6, [0, Sx_runtime[18].call(null, e7, k), 0]], + d = [6, [0, [6, [0, e0, [0, Sx_runtime[19].call(null, eZ, c), 0]]], 0]], + e = Sx_runtime[19].call(null, [6, [0, var$, 0]], d), + f = [0, Sx_runtime[19].call(null, e1, e), 0], + g = Sx_runtime[19].call(null, e3, e2), + h = [6, [0, [6, [0, Sx_runtime[19].call(null, e4, g), f]], 0]], + i = Sx_runtime[19].call(null, h, b), + j = [6, [0, Sx_runtime[19].call(null, e5, i), 0]], + k = Sx_runtime[19].call(null, e6, j), + l = [6, [0, Sx_runtime[19].call(null, e7, k), 0]], a = [6, [0, e_, [0, - [6, [0, [6, [0, e9, [0, Sx_runtime[18].call(null, e8, l), 0]]], 0]], + [6, [0, [6, [0, e9, [0, Sx_runtime[19].call(null, e8, l), 0]]], 0]], [0, [6, [0, @@ -53748,28 +60768,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } function step_sf_callcc(args, env, kont){ var a = kont_push(make_callcc_frame(env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } function step_sf_case(args, env, kont){ var a = kont_push - (make_case_frame(0, Sx_runtime[15].call(null, args), env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + (make_case_frame(0, Sx_runtime[16].call(null, args), env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } var e$ = [2, 1.], fa = [4, cst_begin]; function step_sf_let_match(args, env, kont){ var - pattern = Sx_runtime[14].call(null, args), - expr = Sx_runtime[17].call(null, args, e$), - a = Sx_runtime[15].call(null, args), - body = Sx_runtime[15].call(null, a); + pattern = Sx_runtime[15].call(null, args), + expr = Sx_runtime[18].call(null, args, e$), + a = Sx_runtime[16].call(null, args), + body = Sx_runtime[16].call(null, a); return step_sf_match ([6, [0, expr, [0, - [6, [0, pattern, [0, Sx_runtime[18].call(null, fa, body), 0]]], + [6, [0, pattern, [0, Sx_runtime[19].call(null, fa, body), 0]]], 0]]], env, kont); @@ -53871,100 +60891,100 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var expr = expr$1; for(;;){ var - head = Sx_runtime[14].call(null, expr), - args = Sx_runtime[15].call(null, expr), - e = [0, Sx_runtime[73].call(null, head), fb], - or = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, or)) + head = Sx_runtime[15].call(null, expr), + args = Sx_runtime[16].call(null, expr), + e = [0, Sx_runtime[74].call(null, head), fb], + or = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, or)) var or$0 = or; else{ var - aY = [0, Sx_runtime[73].call(null, head), gt], - or$1 = Sx_runtime[1].call(null, cst, aY); - if(Sx_types[67].call(null, or$1)) + aY = [0, Sx_runtime[74].call(null, head), gt], + or$1 = Sx_runtime[2].call(null, cst, aY); + if(Sx_types[71].call(null, or$1)) var or$0 = or$1; else var - aZ = [0, Sx_runtime[73].call(null, head), gu], - or$0 = Sx_runtime[1].call(null, cst, aZ); + aZ = [0, Sx_runtime[74].call(null, head), gu], + or$0 = Sx_runtime[2].call(null, cst, aZ); } - var f = [0, 1 - Sx_types[67].call(null, or$0)]; - if(Sx_types[67].call(null, f)){ - var g = Sx_runtime[33].call(null, expr); - if(Sx_types[67].call(null, g)) return make_cek_value(fc, env, kont); + var f = [0, 1 - Sx_types[71].call(null, or$0)]; + if(Sx_types[71].call(null, f)){ + var g = Sx_runtime[34].call(null, expr); + if(Sx_types[71].call(null, g)) return make_cek_value(fc, env, kont); var h = kont_push - (make_map_frame(0, Sx_runtime[15].call(null, expr), fd, env), kont); - return make_cek_state(Sx_runtime[14].call(null, expr), env, h); + (make_map_frame(0, Sx_runtime[16].call(null, expr), fd, env), kont); + return make_cek_state(Sx_runtime[15].call(null, expr), env, h); } var - i = [0, Sx_runtime[73].call(null, head), fe], - j = Sx_runtime[1].call(null, cst, i); - if(! Sx_types[67].call(null, j)) + i = [0, Sx_runtime[74].call(null, head), fe], + j = Sx_runtime[2].call(null, cst, i); + if(! Sx_types[71].call(null, j)) return step_eval_call(head, args, env, kont); var - match_val = Sx_types[68].call(null, head), - k = Sx_runtime[1].call(null, cst, [0, match_val, ff]); - if(Sx_types[67].call(null, k)) return step_sf_if(args, env, kont); - var l = Sx_runtime[1].call(null, cst, [0, match_val, fg]); - if(Sx_types[67].call(null, l)) return step_sf_when(args, env, kont); - var m = Sx_runtime[1].call(null, cst, [0, match_val, fh]); - if(Sx_types[67].call(null, m)) return step_sf_cond(args, env, kont); - var n = Sx_runtime[1].call(null, cst, [0, match_val, fi]); - if(Sx_types[67].call(null, n)) return step_sf_case(args, env, kont); - var o = Sx_runtime[1].call(null, cst, [0, match_val, fj]); - if(Sx_types[67].call(null, o)) return step_sf_and(args, env, kont); - var p = Sx_runtime[1].call(null, cst, [0, match_val, fk]); - if(Sx_types[67].call(null, p)) return step_sf_or(args, env, kont); - var q = Sx_runtime[1].call(null, cst, [0, match_val, fl]); - if(Sx_types[67].call(null, q)) return step_sf_let(args, env, kont); - var r = Sx_runtime[1].call(null, cst, [0, match_val, fm]); - if(Sx_types[67].call(null, r)) return step_sf_let(args, env, kont); - var s = Sx_runtime[1].call(null, cst, [0, match_val, fn]); - if(Sx_types[67].call(null, s)) return step_sf_lambda(args, env, kont); - var t = Sx_runtime[1].call(null, cst, [0, match_val, fo]); - if(Sx_types[67].call(null, t)) return step_sf_lambda(args, env, kont); - var u = Sx_runtime[1].call(null, cst, [0, match_val, fp]); - if(Sx_types[67].call(null, u)) return step_sf_define(args, env, kont); - var v = Sx_runtime[1].call(null, cst, [0, match_val, fq]); - if(Sx_types[67].call(null, v)) + match_val = Sx_types[72].call(null, head), + k = Sx_runtime[2].call(null, cst, [0, match_val, ff]); + if(Sx_types[71].call(null, k)) return step_sf_if(args, env, kont); + var l = Sx_runtime[2].call(null, cst, [0, match_val, fg]); + if(Sx_types[71].call(null, l)) return step_sf_when(args, env, kont); + var m = Sx_runtime[2].call(null, cst, [0, match_val, fh]); + if(Sx_types[71].call(null, m)) return step_sf_cond(args, env, kont); + var n = Sx_runtime[2].call(null, cst, [0, match_val, fi]); + if(Sx_types[71].call(null, n)) return step_sf_case(args, env, kont); + var o = Sx_runtime[2].call(null, cst, [0, match_val, fj]); + if(Sx_types[71].call(null, o)) return step_sf_and(args, env, kont); + var p = Sx_runtime[2].call(null, cst, [0, match_val, fk]); + if(Sx_types[71].call(null, p)) return step_sf_or(args, env, kont); + var q = Sx_runtime[2].call(null, cst, [0, match_val, fl]); + if(Sx_types[71].call(null, q)) return step_sf_let(args, env, kont); + var r = Sx_runtime[2].call(null, cst, [0, match_val, fm]); + if(Sx_types[71].call(null, r)) return step_sf_let(args, env, kont); + var s = Sx_runtime[2].call(null, cst, [0, match_val, fn]); + if(Sx_types[71].call(null, s)) return step_sf_lambda(args, env, kont); + var t = Sx_runtime[2].call(null, cst, [0, match_val, fo]); + if(Sx_types[71].call(null, t)) return step_sf_lambda(args, env, kont); + var u = Sx_runtime[2].call(null, cst, [0, match_val, fp]); + if(Sx_types[71].call(null, u)) return step_sf_define(args, env, kont); + var v = Sx_runtime[2].call(null, cst, [0, match_val, fq]); + if(Sx_types[71].call(null, v)) return make_cek_value(sf_defcomp(args, env), env, kont); - var w = Sx_runtime[1].call(null, cst, [0, match_val, fr]); - if(Sx_types[67].call(null, w)) + var w = Sx_runtime[2].call(null, cst, [0, match_val, fr]); + if(Sx_types[71].call(null, w)) return make_cek_value(sf_defisland(args, env), env, kont); - var x = Sx_runtime[1].call(null, cst, [0, match_val, fs]); - if(Sx_types[67].call(null, x)) + var x = Sx_runtime[2].call(null, cst, [0, match_val, fs]); + if(Sx_types[71].call(null, x)) return make_cek_value(sf_defmacro(args, env), env, kont); - var y = Sx_runtime[1].call(null, cst, [0, match_val, ft]); - if(Sx_types[67].call(null, y)) + var y = Sx_runtime[2].call(null, cst, [0, match_val, ft]); + if(Sx_types[71].call(null, y)) return make_cek_value(sf_defio(args, env), env, kont); - var z = Sx_runtime[1].call(null, cst, [0, match_val, fu]); - if(Sx_types[67].call(null, z)) + var z = Sx_runtime[2].call(null, cst, [0, match_val, fu]); + if(Sx_types[71].call(null, z)) return step_sf_define_foreign(args, env, kont); - var A = Sx_runtime[1].call(null, cst, [0, match_val, fv]); - if(Sx_types[67].call(null, A)) return step_sf_io(args, env, kont); - var B = Sx_runtime[1].call(null, cst, [0, match_val, fw]); - if(Sx_types[67].call(null, B)) return step_sf_begin(args, env, kont); - var C = Sx_runtime[1].call(null, cst, [0, match_val, fx]); - if(! Sx_types[67].call(null, C)) break; + var A = Sx_runtime[2].call(null, cst, [0, match_val, fv]); + if(Sx_types[71].call(null, A)) return step_sf_io(args, env, kont); + var B = Sx_runtime[2].call(null, cst, [0, match_val, fw]); + if(Sx_types[71].call(null, B)) return step_sf_begin(args, env, kont); + var C = Sx_runtime[2].call(null, cst, [0, match_val, fx]); + if(! Sx_types[71].call(null, C)) break; var - D = Sx_runtime[33].call(null, args), - and = [0, 1 - Sx_types[67].call(null, D)]; - if(Sx_types[67].call(null, and)){ + D = Sx_runtime[34].call(null, args), + and = [0, 1 - Sx_types[71].call(null, D)]; + if(Sx_types[71].call(null, and)){ var - E = Sx_runtime[14].call(null, args), - and$0 = Sx_runtime[37].call(null, E); - if(Sx_types[67].call(null, and$0)){ + E = Sx_runtime[15].call(null, args), + and$0 = Sx_runtime[38].call(null, E); + if(Sx_types[71].call(null, and$0)){ var - F = Sx_runtime[14].call(null, args), - G = Sx_runtime[33].call(null, F), - and$1 = [0, 1 - Sx_types[67].call(null, G)]; - if(Sx_types[67].call(null, and$1)) + F = Sx_runtime[15].call(null, args), + G = Sx_runtime[34].call(null, F), + and$1 = [0, 1 - Sx_types[71].call(null, G)]; + if(Sx_types[71].call(null, and$1)) var - H = Sx_runtime[14].call(null, args), - I = Sx_runtime[14].call(null, H), - a = Sx_runtime[37].call(null, I); + H = Sx_runtime[15].call(null, args), + I = Sx_runtime[15].call(null, H), + a = Sx_runtime[38].call(null, I); else var a = and$1; } @@ -53973,219 +60993,219 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(! Sx_types[67].call(null, a)) return step_sf_begin(args, env, kont); + if(! Sx_types[71].call(null, a)) return step_sf_begin(args, env, kont); var - bindings = Sx_runtime[14].call(null, args), - test_clause = Sx_runtime[17].call(null, args, fy), - J = Sx_runtime[15].call(null, args), - body = Sx_runtime[15].call(null, J), - K = Sx_runtime[5].call(null, bindings); + bindings = Sx_runtime[15].call(null, args), + test_clause = Sx_runtime[18].call(null, args, fy), + J = Sx_runtime[16].call(null, args), + body = Sx_runtime[16].call(null, J), + K = Sx_runtime[6].call(null, bindings); Stdlib_List[20].call - (null, function(b){return Sx_runtime[14].call(null, b);}, K); - var L = Sx_runtime[5].call(null, bindings); + (null, function(b){return Sx_runtime[15].call(null, b);}, K); + var L = Sx_runtime[6].call(null, bindings); Stdlib_List[20].call - (null, function(b){return Sx_runtime[17].call(null, b, fz);}, L); + (null, function(b){return Sx_runtime[18].call(null, b, fz);}, L); var - M = Sx_runtime[5].call(null, bindings), + M = Sx_runtime[6].call(null, bindings), steps = [6, Stdlib_List[20].call (null, function(b){ var - a = [0, Sx_runtime[24].call(null, b), fA], - c = Sx_runtime[1].call(null, cst$0, a); - return Sx_types[67].call(null, c) - ? Sx_runtime[17].call(null, b, fB) - : Sx_runtime[14].call(null, b); + a = [0, Sx_runtime[25].call(null, b), fA], + c = Sx_runtime[2].call(null, cst$0, a); + return Sx_types[71].call(null, c) + ? Sx_runtime[18].call(null, b, fB) + : Sx_runtime[15].call(null, b); }, M)], - test = Sx_runtime[14].call(null, test_clause), - result = Sx_runtime[15].call(null, test_clause), - N = [0, body, [0, [6, [0, Sx_runtime[18].call(null, fC, steps), 0]], 0]], - O = Sx_runtime[1].call(null, cst_append, N), - P = [6, [0, Sx_runtime[18].call(null, fD, O), 0]], - Q = Sx_runtime[33].call(null, result), + test = Sx_runtime[15].call(null, test_clause), + result = Sx_runtime[16].call(null, test_clause), + N = [0, body, [0, [6, [0, Sx_runtime[19].call(null, fC, steps), 0]], 0]], + O = Sx_runtime[2].call(null, cst_append, N), + P = [6, [0, Sx_runtime[19].call(null, fD, O), 0]], + Q = Sx_runtime[34].call(null, result), R = - Sx_types[67].call(null, Q) ? 0 : Sx_runtime[18].call(null, fI, result), - S = Sx_runtime[18].call(null, R, P), - T = Sx_runtime[18].call(null, test, S), - U = [6, [0, Sx_runtime[18].call(null, fE, T), 0]], - V = Sx_runtime[5].call(null, bindings), + Sx_types[71].call(null, Q) ? 0 : Sx_runtime[19].call(null, fI, result), + S = Sx_runtime[19].call(null, R, P), + T = Sx_runtime[19].call(null, test, S), + U = [6, [0, Sx_runtime[19].call(null, fE, T), 0]], + V = Sx_runtime[6].call(null, bindings), W = [6, Stdlib_List[20].call (null, function(b){ - var a = [0, Sx_runtime[17].call(null, b, fF), 0]; - return [6, [0, Sx_runtime[14].call(null, b), a]]; + var a = [0, Sx_runtime[18].call(null, b, fF), 0]; + return [6, [0, Sx_runtime[15].call(null, b), a]]; }, V)], - X = Sx_runtime[18].call(null, W, U), - Y = Sx_runtime[18].call(null, fG, X), - expr$0 = Sx_runtime[18].call(null, fH, Y); + X = Sx_runtime[19].call(null, W, U), + Y = Sx_runtime[19].call(null, fG, X), + expr$0 = Sx_runtime[19].call(null, fH, Y); expr = expr$0; } - var Z = Sx_runtime[1].call(null, cst, [0, match_val, fJ]); - if(Sx_types[67].call(null, Z)) + var Z = Sx_runtime[2].call(null, cst, [0, match_val, fJ]); + if(Sx_types[71].call(null, Z)) return counter < 50 ? step_sf_guard$0(counter + 1 | 0, args, env, kont) : caml_trampoline_return(step_sf_guard$0, [0, args, env, kont]); - var _ = Sx_runtime[1].call(null, cst, [0, match_val, fK]); - if(Sx_types[67].call(null, _)){ + var _ = Sx_runtime[2].call(null, cst, [0, match_val, fK]); + if(Sx_types[71].call(null, _)){ var - $ = Sx_runtime[33].call(null, args), - aa = Sx_types[67].call(null, $) ? 0 : Sx_runtime[14].call(null, args); + $ = Sx_runtime[34].call(null, args), + aa = Sx_types[71].call(null, $) ? 0 : Sx_runtime[15].call(null, args); return make_cek_value(aa, env, kont); } - var ab = Sx_runtime[1].call(null, cst, [0, match_val, fL]); - if(Sx_types[67].call(null, ab)) + var ab = Sx_runtime[2].call(null, cst, [0, match_val, fL]); + if(Sx_types[71].call(null, ab)) return make_cek_value - (qq_expand(Sx_runtime[14].call(null, args), env), env, kont); - var ac = Sx_runtime[1].call(null, cst, [0, match_val, fM]); - if(Sx_types[67].call(null, ac)) + (qq_expand(Sx_runtime[15].call(null, args), env), env, kont); + var ac = Sx_runtime[2].call(null, cst, [0, match_val, fM]); + if(Sx_types[71].call(null, ac)) return step_sf_thread_first(args, env, kont); - var ad = Sx_runtime[1].call(null, cst, [0, match_val, fN]); - if(Sx_types[67].call(null, ad)) + var ad = Sx_runtime[2].call(null, cst, [0, match_val, fN]); + if(Sx_types[71].call(null, ad)) return step_sf_thread_last(args, env, kont); - var ae = Sx_runtime[1].call(null, cst, [0, match_val, fO]); - if(Sx_types[67].call(null, ae)) + var ae = Sx_runtime[2].call(null, cst, [0, match_val, fO]); + if(Sx_types[71].call(null, ae)) return step_sf_thread_last(args, env, kont); - var af = Sx_runtime[1].call(null, cst, [0, match_val, fP]); - if(Sx_types[67].call(null, af)) return step_sf_thread_as(args, env, kont); - var ag = Sx_runtime[1].call(null, cst, [0, match_val, fQ]); - if(Sx_types[67].call(null, ag)) return step_sf_set_b(args, env, kont); - var ah = Sx_runtime[1].call(null, cst, [0, match_val, fR]); - if(Sx_types[67].call(null, ah)) return step_sf_letrec(args, env, kont); - var ai = Sx_runtime[1].call(null, cst, [0, match_val, fS]); - if(Sx_types[67].call(null, ai)) return step_sf_reset(args, env, kont); - var aj = Sx_runtime[1].call(null, cst, [0, match_val, fT]); - if(Sx_types[67].call(null, aj)) return step_sf_shift(args, env, kont); - var ak = Sx_runtime[1].call(null, cst, [0, match_val, fU]); - if(Sx_types[67].call(null, ak)) return step_sf_deref(args, env, kont); - var al = Sx_runtime[1].call(null, cst, [0, match_val, fV]); - if(Sx_types[67].call(null, al)) return step_sf_scope(args, env, kont); - var am = Sx_runtime[1].call(null, cst, [0, match_val, fW]); - if(Sx_types[67].call(null, am)) return step_sf_provide(args, env, kont); - var an = Sx_runtime[1].call(null, cst, [0, match_val, fX]); - if(Sx_types[67].call(null, an)) return step_sf_peek(args, env, kont); - var ao = Sx_runtime[1].call(null, cst, [0, match_val, fY]); - if(Sx_types[67].call(null, ao)) return step_sf_provide_b(args, env, kont); - var ap = Sx_runtime[1].call(null, cst, [0, match_val, fZ]); - if(Sx_types[67].call(null, ap)) return step_sf_context(args, env, kont); - var aq = Sx_runtime[1].call(null, cst, [0, match_val, f0]); - if(Sx_types[67].call(null, aq)) return step_sf_bind(args, env, kont); - var ar = Sx_runtime[1].call(null, cst, [0, match_val, f1]); - if(Sx_types[67].call(null, ar)) return step_sf_emit(args, env, kont); - var as = Sx_runtime[1].call(null, cst, [0, match_val, f2]); - if(Sx_types[67].call(null, as)) return step_sf_emitted(args, env, kont); - var at = Sx_runtime[1].call(null, cst, [0, match_val, f3]); - if(Sx_types[67].call(null, at)) + var af = Sx_runtime[2].call(null, cst, [0, match_val, fP]); + if(Sx_types[71].call(null, af)) return step_sf_thread_as(args, env, kont); + var ag = Sx_runtime[2].call(null, cst, [0, match_val, fQ]); + if(Sx_types[71].call(null, ag)) return step_sf_set_b(args, env, kont); + var ah = Sx_runtime[2].call(null, cst, [0, match_val, fR]); + if(Sx_types[71].call(null, ah)) return step_sf_letrec(args, env, kont); + var ai = Sx_runtime[2].call(null, cst, [0, match_val, fS]); + if(Sx_types[71].call(null, ai)) return step_sf_reset(args, env, kont); + var aj = Sx_runtime[2].call(null, cst, [0, match_val, fT]); + if(Sx_types[71].call(null, aj)) return step_sf_shift(args, env, kont); + var ak = Sx_runtime[2].call(null, cst, [0, match_val, fU]); + if(Sx_types[71].call(null, ak)) return step_sf_deref(args, env, kont); + var al = Sx_runtime[2].call(null, cst, [0, match_val, fV]); + if(Sx_types[71].call(null, al)) return step_sf_scope(args, env, kont); + var am = Sx_runtime[2].call(null, cst, [0, match_val, fW]); + if(Sx_types[71].call(null, am)) return step_sf_provide(args, env, kont); + var an = Sx_runtime[2].call(null, cst, [0, match_val, fX]); + if(Sx_types[71].call(null, an)) return step_sf_peek(args, env, kont); + var ao = Sx_runtime[2].call(null, cst, [0, match_val, fY]); + if(Sx_types[71].call(null, ao)) return step_sf_provide_b(args, env, kont); + var ap = Sx_runtime[2].call(null, cst, [0, match_val, fZ]); + if(Sx_types[71].call(null, ap)) return step_sf_context(args, env, kont); + var aq = Sx_runtime[2].call(null, cst, [0, match_val, f0]); + if(Sx_types[71].call(null, aq)) return step_sf_bind(args, env, kont); + var ar = Sx_runtime[2].call(null, cst, [0, match_val, f1]); + if(Sx_types[71].call(null, ar)) return step_sf_emit(args, env, kont); + var as = Sx_runtime[2].call(null, cst, [0, match_val, f2]); + if(Sx_types[71].call(null, as)) return step_sf_emitted(args, env, kont); + var at = Sx_runtime[2].call(null, cst, [0, match_val, f3]); + if(Sx_types[71].call(null, at)) return step_sf_handler_bind(args, env, kont); - var au = Sx_runtime[1].call(null, cst, [0, match_val, f4]); - if(Sx_types[67].call(null, au)) + var au = Sx_runtime[2].call(null, cst, [0, match_val, f4]); + if(Sx_types[71].call(null, au)) return step_sf_restart_case(args, env, kont); - var av = Sx_runtime[1].call(null, cst, [0, match_val, f5]); - if(Sx_types[67].call(null, av)) return step_sf_signal(args, env, kont); - var aw = Sx_runtime[1].call(null, cst, [0, match_val, f6]); - if(Sx_types[67].call(null, aw)) + var av = Sx_runtime[2].call(null, cst, [0, match_val, f5]); + if(Sx_types[71].call(null, av)) return step_sf_signal(args, env, kont); + var aw = Sx_runtime[2].call(null, cst, [0, match_val, f6]); + if(Sx_types[71].call(null, aw)) return step_sf_invoke_restart(args, env, kont); - var ax = Sx_runtime[1].call(null, cst, [0, match_val, f7]); - if(Sx_types[67].call(null, ax)) return step_sf_match(args, env, kont); - var ay = Sx_runtime[1].call(null, cst, [0, match_val, f8]); - if(Sx_types[67].call(null, ay)) return step_sf_let_match(args, env, kont); - var az = Sx_runtime[1].call(null, cst, [0, match_val, f9]); - if(Sx_types[67].call(null, az)) + var ax = Sx_runtime[2].call(null, cst, [0, match_val, f7]); + if(Sx_types[71].call(null, ax)) return step_sf_match(args, env, kont); + var ay = Sx_runtime[2].call(null, cst, [0, match_val, f8]); + if(Sx_types[71].call(null, ay)) return step_sf_let_match(args, env, kont); + var az = Sx_runtime[2].call(null, cst, [0, match_val, f9]); + if(Sx_types[71].call(null, az)) return step_sf_dynamic_wind(args, env, kont); - var aA = Sx_runtime[1].call(null, cst, [0, match_val, f_]); - if(Sx_types[67].call(null, aA)) return step_ho_map(args, env, kont); - var aB = Sx_runtime[1].call(null, cst, [0, match_val, f$]); - if(Sx_types[67].call(null, aB)) + var aA = Sx_runtime[2].call(null, cst, [0, match_val, f_]); + if(Sx_types[71].call(null, aA)) return step_ho_map(args, env, kont); + var aB = Sx_runtime[2].call(null, cst, [0, match_val, f$]); + if(Sx_types[71].call(null, aB)) return step_ho_map_indexed(args, env, kont); - var aC = Sx_runtime[1].call(null, cst, [0, match_val, ga]); - if(Sx_types[67].call(null, aC)) return step_ho_filter(args, env, kont); - var aD = Sx_runtime[1].call(null, cst, [0, match_val, gb]); - if(Sx_types[67].call(null, aD)) return step_ho_reduce(args, env, kont); - var aE = Sx_runtime[1].call(null, cst, [0, match_val, gc]); - if(Sx_types[67].call(null, aE)) return step_ho_some(args, env, kont); - var aF = Sx_runtime[1].call(null, cst, [0, match_val, gd]); - if(Sx_types[67].call(null, aF)) return step_ho_every(args, env, kont); - var aG = Sx_runtime[1].call(null, cst, [0, match_val, ge]); - if(Sx_types[67].call(null, aG)) return step_ho_for_each(args, env, kont); - var aH = Sx_runtime[1].call(null, cst, [0, match_val, gf]); - if(Sx_types[67].call(null, aH)) return step_sf_raise(args, env, kont); - var aI = Sx_runtime[1].call(null, cst, [0, match_val, gg]); - if(Sx_types[67].call(null, aI)){ + var aC = Sx_runtime[2].call(null, cst, [0, match_val, ga]); + if(Sx_types[71].call(null, aC)) return step_ho_filter(args, env, kont); + var aD = Sx_runtime[2].call(null, cst, [0, match_val, gb]); + if(Sx_types[71].call(null, aD)) return step_ho_reduce(args, env, kont); + var aE = Sx_runtime[2].call(null, cst, [0, match_val, gc]); + if(Sx_types[71].call(null, aE)) return step_ho_some(args, env, kont); + var aF = Sx_runtime[2].call(null, cst, [0, match_val, gd]); + if(Sx_types[71].call(null, aF)) return step_ho_every(args, env, kont); + var aG = Sx_runtime[2].call(null, cst, [0, match_val, ge]); + if(Sx_types[71].call(null, aG)) return step_ho_for_each(args, env, kont); + var aH = Sx_runtime[2].call(null, cst, [0, match_val, gf]); + if(Sx_types[71].call(null, aH)) return step_sf_raise(args, env, kont); + var aI = Sx_runtime[2].call(null, cst, [0, match_val, gg]); + if(Sx_types[71].call(null, aI)){ var aJ = kont_push(make_raise_eval_frame(env, gh), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, aJ); + return make_cek_state(Sx_runtime[15].call(null, args), env, aJ); } - var aK = Sx_runtime[1].call(null, cst, [0, match_val, gi]); - if(Sx_types[67].call(null, aK)) return step_sf_callcc(args, env, kont); - var aL = Sx_runtime[1].call(null, cst, [0, match_val, gj]); - if(Sx_types[67].call(null, aL)) return step_sf_callcc(args, env, kont); - var aM = Sx_runtime[1].call(null, cst, [0, match_val, gk]); - if(Sx_types[67].call(null, aM)) return step_sf_perform(args, env, kont); - var aN = Sx_runtime[1].call(null, cst, [0, match_val, gl]); - if(Sx_types[67].call(null, aN)) + var aK = Sx_runtime[2].call(null, cst, [0, match_val, gi]); + if(Sx_types[71].call(null, aK)) return step_sf_callcc(args, env, kont); + var aL = Sx_runtime[2].call(null, cst, [0, match_val, gj]); + if(Sx_types[71].call(null, aL)) return step_sf_callcc(args, env, kont); + var aM = Sx_runtime[2].call(null, cst, [0, match_val, gk]); + if(Sx_types[71].call(null, aM)) return step_sf_perform(args, env, kont); + var aN = Sx_runtime[2].call(null, cst, [0, match_val, gl]); + if(Sx_types[71].call(null, aN)) return step_sf_define_library(args, env, kont); - var aO = Sx_runtime[1].call(null, cst, [0, match_val, gm]); - if(Sx_types[67].call(null, aO)) return step_sf_import(args, env, kont); - var aP = Sx_runtime[1].call(null, cst, [0, match_val, gn]); - if(Sx_types[67].call(null, aP)) + var aO = Sx_runtime[2].call(null, cst, [0, match_val, gm]); + if(Sx_types[71].call(null, aO)) return step_sf_import(args, env, kont); + var aP = Sx_runtime[2].call(null, cst, [0, match_val, gn]); + if(Sx_types[71].call(null, aP)) return make_cek_value(sf_define_record_type(args, env), env, kont); - var aQ = Sx_runtime[1].call(null, cst, [0, match_val, go]); - if(Sx_types[67].call(null, aQ)) + var aQ = Sx_runtime[2].call(null, cst, [0, match_val, go]); + if(Sx_types[71].call(null, aQ)) return make_cek_value(sf_define_protocol(args, env), env, kont); - var aR = Sx_runtime[1].call(null, cst, [0, match_val, gp]); - if(Sx_types[67].call(null, aR)) + var aR = Sx_runtime[2].call(null, cst, [0, match_val, gp]); + if(Sx_types[71].call(null, aR)) return make_cek_value(sf_implement(args, env), env, kont); - var aS = Sx_runtime[1].call(null, cst, [0, match_val, gq]); - if(Sx_types[67].call(null, aS)) + var aS = Sx_runtime[2].call(null, cst, [0, match_val, gq]); + if(Sx_types[71].call(null, aS)) return step_sf_parameterize(args, env, kont); - var aT = Sx_runtime[1].call(null, cst, [0, match_val, gr]); - if(Sx_types[67].call(null, aT)) + var aT = Sx_runtime[2].call(null, cst, [0, match_val, gr]); + if(Sx_types[71].call(null, aT)) return make_cek_value(sf_syntax_rules(args, env), env, kont); - var aU = Sx_runtime[1].call(null, cst, [0, match_val, gs]); - if(Sx_types[67].call(null, aU)) return step_sf_define(args, env, kont); + var aU = Sx_runtime[2].call(null, cst, [0, match_val, gs]); + if(Sx_types[71].call(null, aU)) return step_sf_define(args, env, kont); var and$2 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_has_key, [0, custom_special_forms, [0, match_val, 0]]); - if(Sx_types[67].call(null, and$2)) + if(Sx_types[71].call(null, and$2)) var - aV = Sx_runtime[75].call(null, env, match_val), - b = [0, 1 - Sx_types[67].call(null, aV)]; + aV = Sx_runtime[76].call(null, env, match_val), + b = [0, 1 - Sx_types[71].call(null, aV)]; else var b = and$2; - if(Sx_types[67].call(null, b)) + if(Sx_types[71].call(null, b)) return make_cek_value (cek_call - (Sx_runtime[25].call(null, custom_special_forms, match_val), + (Sx_runtime[26].call(null, custom_special_forms, match_val), [6, [0, args, [0, env, 0]]]), env, kont); - var and$3 = Sx_runtime[75].call(null, env, match_val); - if(Sx_types[67].call(null, and$3)) + var and$3 = Sx_runtime[76].call(null, env, match_val); + if(Sx_types[71].call(null, and$3)) var - aW = Sx_runtime[76].call(null, env, match_val), - c = Sx_runtime[88].call(null, aW); + aW = Sx_runtime[77].call(null, env, match_val), + c = Sx_runtime[89].call(null, aW); else var c = and$3; - if(Sx_types[67].call(null, c)){ - var mac = Sx_runtime[76].call(null, env, match_val); + if(Sx_types[71].call(null, c)){ + var mac = Sx_runtime[77].call(null, env, match_val); return make_cek_state(expand_macro(mac, args, env), env, kont); } - if(Sx_types[67].call(null, render_check)) + if(Sx_types[71].call(null, render_check)) var - aX = Sx_runtime[75].call(null, env, match_val), - and$4 = [0, 1 - Sx_types[67].call(null, aX)], + aX = Sx_runtime[76].call(null, env, match_val), + and$4 = [0, 1 - Sx_types[71].call(null, aX)], d = - Sx_types[67].call(null, and$4) + Sx_types[71].call(null, and$4) ? cek_call(render_check, [6, [0, expr, [0, env, 0]]]) : and$4; else var d = render_check; - return Sx_types[67].call(null, d) + return Sx_types[71].call(null, d) ? make_cek_value (cek_call(render_fn, [6, [0, expr, [0, env, 0]]]), env, kont) : step_eval_call(head, args, env, kont); @@ -54202,22 +61222,22 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= gA = [3, cst_name], gB = [3, cst_env]; function kont_extract_provides(kont){ - var a = Sx_runtime[33].call(null, kont); - if(Sx_types[67].call(null, a)) return gv; + var a = Sx_runtime[34].call(null, kont); + if(Sx_types[71].call(null, a)) return gv; var - frame = Sx_runtime[14].call(null, kont), - rest_frames = kont_extract_provides(Sx_runtime[15].call(null, kont)), + frame = Sx_runtime[15].call(null, kont), + rest_frames = kont_extract_provides(Sx_runtime[16].call(null, kont)), b = [0, frame_type(frame), gw], - c = Sx_runtime[1].call(null, cst, b); - if(! Sx_types[67].call(null, c)) return rest_frames; + c = Sx_runtime[2].call(null, cst, b); + if(! Sx_types[71].call(null, c)) return rest_frames; var - d = Sx_runtime[25].call(null, frame, gx), - e = Sx_runtime[25].call(null, frame, gA), + d = Sx_runtime[26].call(null, frame, gx), + e = Sx_runtime[26].call(null, frame, gA), f = [23, [0, cst_provide, - Sx_runtime[25].call(null, frame, gB), + Sx_runtime[26].call(null, frame, gB), e, 0, gz, @@ -54226,7 +61246,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= gy, d, 0]]; - return Sx_runtime[18].call(null, f, rest_frames); + return Sx_runtime[19].call(null, f, rest_frames); } var cst_contains = "contains?", @@ -54236,42 +61256,42 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= gC = [0, [2, 0.], 0], gD = [6, [0, 0, 0]]; function fire_provide_subscribers(name){ - var subs = Sx_runtime[25].call(null, provide_subscribers_ref[1], name); - if(Sx_types[67].call(null, subs)) + var subs = Sx_runtime[26].call(null, provide_subscribers_ref[1], name); + if(Sx_types[71].call(null, subs)) var - b = Sx_runtime[33].call(null, subs), - a = [0, 1 - Sx_types[67].call(null, b)]; + b = Sx_runtime[34].call(null, subs), + a = [0, 1 - Sx_types[71].call(null, b)]; else var a = subs; - if(! Sx_types[67].call(null, a)) return 0; + if(! Sx_types[71].call(null, a)) return 0; var - c = Sx_runtime[1].call(null, cst$0, [0, provide_batch_depth_ref[1], gC]); - if(Sx_types[67].call(null, c)){ - var d = Sx_runtime[5].call(null, subs); + c = Sx_runtime[2].call(null, cst$0, [0, provide_batch_depth_ref[1], gC]); + if(Sx_types[71].call(null, c)){ + var d = Sx_runtime[6].call(null, subs); Stdlib_List[18].call (null, function(sub){ var a = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_contains, [0, provide_batch_queue_ref[1], [0, sub, 0]]), - b = [0, 1 - Sx_types[67].call(null, a)]; - if(Sx_types[67].call(null, b)) + b = [0, 1 - Sx_types[71].call(null, a)]; + if(Sx_types[71].call(null, b)) provide_batch_queue_ref[1] = - Sx_runtime[10].call(null, provide_batch_queue_ref[1], sub); + Sx_runtime[11].call(null, provide_batch_queue_ref[1], sub); return 0; }, d); return 0; } - var e = Sx_runtime[5].call(null, subs); + var e = Sx_runtime[6].call(null, subs); Stdlib_List[18].call(null, function(sub){cek_call(sub, gD); return 0;}, e); return 0; } var gE = [0, [2, 1.], 0]; function batch_begin_b(param){ provide_batch_depth_ref[1] = - Sx_runtime[1].call(null, cst$8, [0, provide_batch_depth_ref[1], gE]); + Sx_runtime[2].call(null, cst$8, [0, provide_batch_depth_ref[1], gE]); return 0; } var @@ -54281,19 +61301,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= gI = [6, [0, 0, 0]]; function batch_end_b(param){ provide_batch_depth_ref[1] = - Sx_runtime[1].call(null, cst$5, [0, provide_batch_depth_ref[1], gF]); + Sx_runtime[2].call(null, cst$5, [0, provide_batch_depth_ref[1], gF]); var - a = Sx_runtime[1].call(null, cst, [0, provide_batch_depth_ref[1], gG]); - if(! Sx_types[67].call(null, a)) return 0; + a = Sx_runtime[2].call(null, cst, [0, provide_batch_depth_ref[1], gG]); + if(! Sx_types[71].call(null, a)) return 0; var queue = provide_batch_queue_ref[1]; provide_batch_queue_ref[1] = gH; - var b = Sx_runtime[5].call(null, queue); + var b = Sx_runtime[6].call(null, queue); Stdlib_List[18].call(null, function(sub){cek_call(sub, gI); return 0;}, b); return 0; } var bind_tracking_ref = [], gJ = [6, 0]; function step_sf_bind(args, env, kont){ - var body = Sx_runtime[14].call(null, args), prev = bind_tracking_ref[1]; + var body = Sx_runtime[15].call(null, args), prev = bind_tracking_ref[1]; bind_tracking_ref[1] = gJ; return make_cek_state (body, env, kont_push(make_bind_frame(body, env, prev), kont)); @@ -54301,83 +61321,83 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var gK = [6, 0]; function step_sf_parameterize(args, env, kont){ var - bindings = Sx_runtime[14].call(null, args), - body = Sx_runtime[15].call(null, args), - or = Sx_runtime[83].call(null, bindings), + bindings = Sx_runtime[15].call(null, args), + body = Sx_runtime[16].call(null, args), + or = Sx_runtime[84].call(null, bindings), or$0 = - Sx_types[67].call(null, or) ? or : Sx_runtime[33].call(null, bindings); - if(Sx_types[67].call(null, or$0)) return step_sf_begin(body, env, kont); + Sx_types[71].call(null, or) ? or : Sx_runtime[34].call(null, bindings); + if(Sx_types[71].call(null, or$0)) return step_sf_begin(body, env, kont); var - first_pair = Sx_runtime[14].call(null, bindings), + first_pair = Sx_runtime[15].call(null, bindings), a = kont_push(make_parameterize_frame(bindings, 0, gK, body, env), kont); - return make_cek_state(Sx_runtime[14].call(null, first_pair), env, a); + return make_cek_state(Sx_runtime[15].call(null, first_pair), env, a); } var gL = [0, [3, cst$14], 0], gM = [2, 0.], gN = [2, 0.]; function syntax_rules_match(pattern, form, literals){ - var and = Sx_runtime[39].call(null, pattern); - if(Sx_types[67].call(null, and)) + var and = Sx_runtime[40].call(null, pattern); + if(Sx_types[71].call(null, and)) var - e = [0, Sx_types[68].call(null, pattern), gL], - a = Sx_runtime[1].call(null, cst, e); + e = [0, Sx_types[72].call(null, pattern), gL], + a = Sx_runtime[2].call(null, cst, e); else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) return [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; - var and$0 = Sx_runtime[39].call(null, pattern); - if(Sx_types[67].call(null, and$0)) + var and$0 = Sx_runtime[40].call(null, pattern); + if(Sx_types[71].call(null, and$0)) var - f = [0, literals, [0, Sx_types[68].call(null, pattern), 0]], - b = Sx_runtime[1].call(null, cst_contains, f); + f = [0, literals, [0, Sx_types[72].call(null, pattern), 0]], + b = Sx_runtime[2].call(null, cst_contains, f); else var b = and$0; - if(Sx_types[67].call(null, b)){ - var and$1 = Sx_runtime[39].call(null, form); - if(Sx_types[67].call(null, and$1)) + if(Sx_types[71].call(null, b)){ + var and$1 = Sx_runtime[40].call(null, form); + if(Sx_types[71].call(null, and$1)) var - g = [0, Sx_types[68].call(null, form), 0], - h = [0, Sx_types[68].call(null, pattern), g], - c = Sx_runtime[1].call(null, cst, h); + g = [0, Sx_types[72].call(null, form), 0], + h = [0, Sx_types[72].call(null, pattern), g], + c = Sx_runtime[2].call(null, cst, h); else var c = and$1; - return Sx_types[67].call(null, c) + return Sx_types[71].call(null, c) ? [7, Stdlib_Hashtbl[1].call(null, 0, 0)] : 0; } - var i = Sx_runtime[39].call(null, pattern); - if(Sx_types[67].call(null, i)){ + var i = Sx_runtime[40].call(null, pattern); + if(Sx_types[71].call(null, i)){ var d = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - j = Sx_types[68].call(null, pattern); - Sx_runtime[11].call(null, d, j, form); + j = Sx_types[72].call(null, pattern); + Sx_runtime[12].call(null, d, j, form); return d; } var - and$2 = Sx_runtime[37].call(null, pattern), + and$2 = Sx_runtime[38].call(null, pattern), k = - Sx_types[67].call(null, and$2) - ? Sx_runtime[33].call(null, pattern) + Sx_types[71].call(null, and$2) + ? Sx_runtime[34].call(null, pattern) : and$2; - if(Sx_types[67].call(null, k)){ + if(Sx_types[71].call(null, k)){ var - and$3 = Sx_runtime[37].call(null, form), + and$3 = Sx_runtime[38].call(null, form), l = - Sx_types[67].call(null, and$3) - ? Sx_runtime[33].call(null, form) + Sx_types[71].call(null, and$3) + ? Sx_runtime[34].call(null, form) : and$3; - return Sx_types[67].call(null, l) + return Sx_types[71].call(null, l) ? [7, Stdlib_Hashtbl[1].call(null, 0, 0)] : 0; } var - and$4 = Sx_runtime[37].call(null, pattern), + and$4 = Sx_runtime[38].call(null, pattern), m = - Sx_types[67].call(null, and$4) - ? Sx_runtime[37].call(null, form) + Sx_types[71].call(null, and$4) + ? Sx_runtime[38].call(null, form) : and$4; - if(Sx_types[67].call(null, m)) + if(Sx_types[71].call(null, m)) return syntax_rules_match_list(pattern, gN, form, gM, literals); - var n = Sx_runtime[1].call(null, cst, [0, pattern, [0, form, 0]]); - return Sx_types[67].call(null, n) + var n = Sx_runtime[2].call(null, cst, [0, pattern, [0, form, 0]]); + return Sx_types[71].call(null, n) ? [7, Stdlib_Hashtbl[1].call(null, 0, 0)] : 0; } @@ -54396,112 +61416,112 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= gY = [0, [2, 1.], 0]; function syntax_rules_match_list(pattern, pi, form, fi, literals){ var - plen = Sx_runtime[24].call(null, pattern), - flen = Sx_runtime[24].call(null, form), - and = Sx_runtime[1].call(null, cst$2, [0, pi, [0, plen, 0]]), + plen = Sx_runtime[25].call(null, pattern), + flen = Sx_runtime[25].call(null, form), + and = Sx_runtime[2].call(null, cst$2, [0, pi, [0, plen, 0]]), b = - Sx_types[67].call(null, and) - ? Sx_runtime[1].call(null, cst$2, [0, fi, [0, flen, 0]]) + Sx_types[71].call(null, and) + ? Sx_runtime[2].call(null, cst$2, [0, fi, [0, flen, 0]]) : and; - if(Sx_types[67].call(null, b)) + if(Sx_types[71].call(null, b)) return [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; - var c = Sx_runtime[1].call(null, cst$2, [0, pi, [0, plen, 0]]); - if(Sx_types[67].call(null, c)) return 0; + var c = Sx_runtime[2].call(null, cst$2, [0, pi, [0, plen, 0]]); + if(Sx_types[71].call(null, c)) return 0; var - d = [0, Sx_runtime[1].call(null, cst$8, [0, pi, gO]), [0, plen, 0]], - and$0 = Sx_runtime[1].call(null, cst$3, d); - if(Sx_types[67].call(null, and$0)){ + d = [0, Sx_runtime[2].call(null, cst$8, [0, pi, gO]), [0, plen, 0]], + and$0 = Sx_runtime[2].call(null, cst$3, d); + if(Sx_types[71].call(null, and$0)){ var - e = Sx_runtime[1].call(null, cst$8, [0, pi, gP]), - f = Sx_runtime[17].call(null, pattern, e), - and$1 = Sx_runtime[39].call(null, f); - if(Sx_types[67].call(null, and$1)) + e = Sx_runtime[2].call(null, cst$8, [0, pi, gP]), + f = Sx_runtime[18].call(null, pattern, e), + and$1 = Sx_runtime[40].call(null, f); + if(Sx_types[71].call(null, and$1)) var - g = Sx_runtime[1].call(null, cst$8, [0, pi, gR]), - h = Sx_runtime[17].call(null, pattern, g), - i = [0, Sx_types[68].call(null, h), gQ], - a = Sx_runtime[1].call(null, cst, i); + g = Sx_runtime[2].call(null, cst$8, [0, pi, gR]), + h = Sx_runtime[18].call(null, pattern, g), + i = [0, Sx_types[72].call(null, h), gQ], + a = Sx_runtime[2].call(null, cst, i); else var a = and$1; } else var a = and$0; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - sub_pat = Sx_runtime[17].call(null, pattern, pi), - j = [0, plen, [0, Sx_runtime[1].call(null, cst$8, [0, pi, gS]), 0]]; - Sx_runtime[1].call(null, cst$5, j); - Sx_runtime[1].call(null, cst$5, [0, flen, [0, fi, 0]]); + sub_pat = Sx_runtime[18].call(null, pattern, pi), + j = [0, plen, [0, Sx_runtime[2].call(null, cst$8, [0, pi, gS]), 0]]; + Sx_runtime[2].call(null, cst$5, j); + Sx_runtime[2].call(null, cst$5, [0, flen, [0, fi, 0]]); var - k = [0, plen, [0, Sx_runtime[1].call(null, cst$8, [0, pi, gT]), 0]], - l = [0, Sx_runtime[1].call(null, cst$5, k), 0], - m = [0, Sx_runtime[1].call(null, cst$5, [0, flen, [0, fi, 0]]), l], - n_ellipsis = Sx_runtime[1].call(null, cst$5, m), - n = Sx_runtime[1].call(null, cst$3, [0, n_ellipsis, gU]); - if(Sx_types[67].call(null, n)) return 0; + k = [0, plen, [0, Sx_runtime[2].call(null, cst$8, [0, pi, gT]), 0]], + l = [0, Sx_runtime[2].call(null, cst$5, k), 0], + m = [0, Sx_runtime[2].call(null, cst$5, [0, flen, [0, fi, 0]]), l], + n_ellipsis = Sx_runtime[2].call(null, cst$5, m), + n = Sx_runtime[2].call(null, cst$3, [0, n_ellipsis, gU]); + if(Sx_types[71].call(null, n)) return 0; var o = [0, form, [0, fi, - [0, Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]]; - Sx_runtime[1].call(null, cst_slice, o); + [0, Sx_runtime[2].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]]; + Sx_runtime[2].call(null, cst_slice, o); var p = [0, form, [0, fi, - [0, Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]], - q = Sx_runtime[1].call(null, cst_slice, p), - r = Sx_runtime[5].call(null, q), + [0, Sx_runtime[2].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), 0]]], + q = Sx_runtime[2].call(null, cst_slice, p), + r = Sx_runtime[6].call(null, q), sub_bindings = [6, Stdlib_List[20].call (null, function(f){return syntax_rules_match(sub_pat, f, literals);}, r)], - s = Sx_runtime[1].call(null, cst_contains, [0, sub_bindings, gV]); - if(Sx_types[67].call(null, s)) return 0; + s = Sx_runtime[2].call(null, cst_contains, [0, sub_bindings, gV]); + if(Sx_types[71].call(null, s)) return 0; var - t = Sx_runtime[1].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), + t = Sx_runtime[2].call(null, cst$8, [0, fi, [0, n_ellipsis, 0]]), rest_result = syntax_rules_match_list (pattern, - Sx_runtime[1].call(null, cst$8, [0, pi, gW]), + Sx_runtime[2].call(null, cst$8, [0, pi, gW]), form, t, literals), - u = Sx_runtime[83].call(null, rest_result); - if(Sx_types[67].call(null, u)) return 0; + u = Sx_runtime[84].call(null, rest_result); + if(Sx_types[71].call(null, u)) return 0; var merged = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - v = Sx_runtime[5].call(null, sub_bindings); + v = Sx_runtime[6].call(null, sub_bindings); Stdlib_List[18].call (null, function(b){ var - a = Sx_runtime[1].call(null, cst_keys, [0, b, 0]), - c = Sx_runtime[5].call(null, a); + a = Sx_runtime[2].call(null, cst_keys, [0, b, 0]), + c = Sx_runtime[6].call(null, a); Stdlib_List[18].call (null, function(key){ var - existing = Sx_runtime[56].call(null, merged, key), - a = Sx_runtime[83].call(null, existing); - if(Sx_types[67].call(null, a)){ - var c = [6, [0, Sx_runtime[25].call(null, b, key), 0]]; - Sx_runtime[11].call(null, merged, key, c); + existing = Sx_runtime[57].call(null, merged, key), + a = Sx_runtime[84].call(null, existing); + if(Sx_types[71].call(null, a)){ + var c = [6, [0, Sx_runtime[26].call(null, b, key), 0]]; + Sx_runtime[12].call(null, merged, key, c); } else{ var d = [0, existing, - [0, [6, [0, Sx_runtime[25].call(null, b, key), 0]], 0]], - e = Sx_runtime[1].call(null, cst_append, d); - Sx_runtime[11].call(null, merged, key, e); + [0, [6, [0, Sx_runtime[26].call(null, b, key), 0]], 0]], + e = Sx_runtime[2].call(null, cst_append, d); + Sx_runtime[12].call(null, merged, key, e); } return 0; }, @@ -54510,75 +61530,75 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }, v); var - w = Sx_runtime[1].call(null, cst_keys, [0, rest_result, 0]), - x = Sx_runtime[5].call(null, w); + w = Sx_runtime[2].call(null, cst_keys, [0, rest_result, 0]), + x = Sx_runtime[6].call(null, w); Stdlib_List[18].call (null, function(key){ - var a = Sx_runtime[25].call(null, rest_result, key); - Sx_runtime[11].call(null, merged, key, a); + var a = Sx_runtime[26].call(null, rest_result, key); + Sx_runtime[12].call(null, merged, key, a); return 0; }, x); return merged; } - var y = Sx_runtime[1].call(null, cst$2, [0, fi, [0, flen, 0]]); - if(Sx_types[67].call(null, y)) return 0; + var y = Sx_runtime[2].call(null, cst$2, [0, fi, [0, flen, 0]]); + if(Sx_types[71].call(null, y)) return 0; var - z = Sx_runtime[17].call(null, form, fi), + z = Sx_runtime[18].call(null, form, fi), sub_result = - syntax_rules_match(Sx_runtime[17].call(null, pattern, pi), z, literals), - A = Sx_runtime[83].call(null, sub_result); - if(Sx_types[67].call(null, A)) return 0; + syntax_rules_match(Sx_runtime[18].call(null, pattern, pi), z, literals), + A = Sx_runtime[84].call(null, sub_result); + if(Sx_types[71].call(null, A)) return 0; var - B = Sx_runtime[1].call(null, cst$8, [0, fi, gX]), + B = Sx_runtime[2].call(null, cst$8, [0, fi, gX]), rest_result$0 = syntax_rules_match_list (pattern, - Sx_runtime[1].call(null, cst$8, [0, pi, gY]), + Sx_runtime[2].call(null, cst$8, [0, pi, gY]), form, B, literals), - C = Sx_runtime[83].call(null, rest_result$0); - if(Sx_types[67].call(null, C)) return 0; + C = Sx_runtime[84].call(null, rest_result$0); + if(Sx_types[71].call(null, C)) return 0; var - D = Sx_runtime[1].call(null, cst_keys, [0, sub_result, 0]), - E = Sx_runtime[5].call(null, D); + D = Sx_runtime[2].call(null, cst_keys, [0, sub_result, 0]), + E = Sx_runtime[6].call(null, D); Stdlib_List[18].call (null, function(key){ - var a = Sx_runtime[25].call(null, sub_result, key); - Sx_runtime[11].call(null, rest_result$0, key, a); + var a = Sx_runtime[26].call(null, sub_result, key); + Sx_runtime[12].call(null, rest_result$0, key, a); return 0; }, E); return rest_result$0; } function syntax_rules_find_var(template, bindings){ - var and = Sx_runtime[39].call(null, template); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[40].call(null, template); + if(Sx_types[71].call(null, and)){ var - b = [0, bindings, [0, Sx_types[68].call(null, template), 0]], - and$0 = Sx_runtime[1].call(null, cst_has_key, b); - if(Sx_types[67].call(null, and$0)) + b = [0, bindings, [0, Sx_types[72].call(null, template), 0]], + and$0 = Sx_runtime[2].call(null, cst_has_key, b); + if(Sx_types[71].call(null, and$0)) var - c = Sx_types[68].call(null, template), - d = Sx_runtime[25].call(null, bindings, c), - a = Sx_runtime[37].call(null, d); + c = Sx_types[72].call(null, template), + d = Sx_runtime[26].call(null, bindings, c), + a = Sx_runtime[38].call(null, d); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) return Sx_types[68].call(null, template); - var e = Sx_runtime[37].call(null, template); - if(! Sx_types[67].call(null, e)) return 0; - var f = Sx_runtime[5].call(null, template); + if(Sx_types[71].call(null, a)) return Sx_types[72].call(null, template); + var e = Sx_runtime[38].call(null, template); + if(! Sx_types[71].call(null, e)) return 0; + var f = Sx_runtime[6].call(null, template); return Stdlib_List[26].call (null, function(found, t){ - var a = Sx_runtime[83].call(null, found); - return Sx_types[67].call(null, a) + var a = Sx_runtime[84].call(null, found); + return Sx_types[71].call(null, a) ? syntax_rules_find_var(t, bindings) : found; }, @@ -54587,55 +61607,55 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var gZ = [6, 0], g0 = [6, 0]; function syntax_rules_find_all_vars(template, bindings){ - var and = Sx_runtime[39].call(null, template); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[40].call(null, template); + if(Sx_types[71].call(null, and)){ var - b = [0, bindings, [0, Sx_types[68].call(null, template), 0]], - and$0 = Sx_runtime[1].call(null, cst_has_key, b); - if(Sx_types[67].call(null, and$0)) + b = [0, bindings, [0, Sx_types[72].call(null, template), 0]], + and$0 = Sx_runtime[2].call(null, cst_has_key, b); + if(Sx_types[71].call(null, and$0)) var - c = Sx_types[68].call(null, template), - d = Sx_runtime[25].call(null, bindings, c), - a = Sx_runtime[37].call(null, d); + c = Sx_types[72].call(null, template), + d = Sx_runtime[26].call(null, bindings, c), + a = Sx_runtime[38].call(null, d); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) - return [6, [0, Sx_types[68].call(null, template), 0]]; - var e = Sx_runtime[37].call(null, template); - if(! Sx_types[67].call(null, e)) return g0; - var f = Sx_runtime[5].call(null, template); + if(Sx_types[71].call(null, a)) + return [6, [0, Sx_types[72].call(null, template), 0]]; + var e = Sx_runtime[38].call(null, template); + if(! Sx_types[71].call(null, e)) return g0; + var f = Sx_runtime[6].call(null, template); return Stdlib_List[26].call (null, function(acc, t){ var a = [0, acc, [0, syntax_rules_find_all_vars(t, bindings), 0]]; - return Sx_runtime[1].call(null, cst_append, a); + return Sx_runtime[2].call(null, cst_append, a); }, gZ, f); } var g1 = [2, 0.]; function syntax_rules_instantiate(template, bindings){ - var and = Sx_runtime[39].call(null, template); - if(Sx_types[67].call(null, and)) + var and = Sx_runtime[40].call(null, template); + if(Sx_types[71].call(null, and)) var - b = [0, bindings, [0, Sx_types[68].call(null, template), 0]], - a = Sx_runtime[1].call(null, cst_has_key, b); + b = [0, bindings, [0, Sx_types[72].call(null, template), 0]], + a = Sx_runtime[2].call(null, cst_has_key, b); else var a = and; - if(Sx_types[67].call(null, a)){ - var c = Sx_types[68].call(null, template); - return Sx_runtime[25].call(null, bindings, c); + if(Sx_types[71].call(null, a)){ + var c = Sx_types[72].call(null, template); + return Sx_runtime[26].call(null, bindings, c); } var - d = Sx_runtime[37].call(null, template), - e = [0, 1 - Sx_types[67].call(null, d)]; - if(Sx_types[67].call(null, e)) return template; - var f = Sx_runtime[33].call(null, template); - return Sx_types[67].call(null, f) + d = Sx_runtime[38].call(null, template), + e = [0, 1 - Sx_types[71].call(null, d)]; + if(Sx_types[71].call(null, e)) return template; + var f = Sx_runtime[34].call(null, template); + return Sx_types[71].call(null, f) ? template : syntax_rules_instantiate_list(template, g1, bindings); } @@ -54652,51 +61672,51 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var i = i$1; for(;;){ var - a = [0, i, [0, Sx_runtime[24].call(null, template), 0]], - b = Sx_runtime[1].call(null, cst$2, a); - if(Sx_types[67].call(null, b)) return g2; + a = [0, i, [0, Sx_runtime[25].call(null, template), 0]], + b = Sx_runtime[2].call(null, cst$2, a); + if(Sx_types[71].call(null, b)) return g2; var - elem = Sx_runtime[17].call(null, template, i), - c = [0, Sx_runtime[24].call(null, template), 0], - d = [0, Sx_runtime[1].call(null, cst$8, [0, i, g3]), c], - and = Sx_runtime[1].call(null, cst$3, d); - if(Sx_types[67].call(null, and)){ + elem = Sx_runtime[18].call(null, template, i), + c = [0, Sx_runtime[25].call(null, template), 0], + d = [0, Sx_runtime[2].call(null, cst$8, [0, i, g3]), c], + and = Sx_runtime[2].call(null, cst$3, d); + if(Sx_types[71].call(null, and)){ var - e = Sx_runtime[1].call(null, cst$8, [0, i, g4]), - f = Sx_runtime[17].call(null, template, e), - and$0 = Sx_runtime[39].call(null, f); - if(Sx_types[67].call(null, and$0)) + e = Sx_runtime[2].call(null, cst$8, [0, i, g4]), + f = Sx_runtime[18].call(null, template, e), + and$0 = Sx_runtime[40].call(null, f); + if(Sx_types[71].call(null, and$0)) var - g = Sx_runtime[1].call(null, cst$8, [0, i, g6]), - h = Sx_runtime[17].call(null, template, g), - j = [0, Sx_types[68].call(null, h), g5], - has_ellipsis = Sx_runtime[1].call(null, cst, j); + g = Sx_runtime[2].call(null, cst$8, [0, i, g6]), + h = Sx_runtime[18].call(null, template, g), + j = [0, Sx_types[72].call(null, h), g5], + has_ellipsis = Sx_runtime[2].call(null, cst, j); else var has_ellipsis = and$0; } else var has_ellipsis = and; - if(! Sx_types[67].call(null, has_ellipsis)){ + if(! Sx_types[71].call(null, has_ellipsis)){ var p = syntax_rules_instantiate_list - (template, Sx_runtime[1].call(null, cst$8, [0, i, g9]), bindings), + (template, Sx_runtime[2].call(null, cst$8, [0, i, g9]), bindings), q = syntax_rules_instantiate(elem, bindings); - return Sx_runtime[18].call(null, q, p); + return Sx_runtime[19].call(null, q, p); } var all_vars = syntax_rules_find_all_vars(elem, bindings), - k = Sx_runtime[33].call(null, all_vars); - if(! Sx_types[67].call(null, k)) break; - var i$0 = Sx_runtime[1].call(null, cst$8, [0, i, g7]); + k = Sx_runtime[34].call(null, all_vars); + if(! Sx_types[71].call(null, k)) break; + var i$0 = Sx_runtime[2].call(null, cst$8, [0, i, g7]); i = i$0; } var - l = Sx_runtime[14].call(null, all_vars), - m = Sx_runtime[25].call(null, bindings, l), - count = Sx_runtime[24].call(null, m), - n = Sx_runtime[1].call(null, cst_range, [0, count, 0]), - o = Sx_runtime[5].call(null, n), + l = Sx_runtime[15].call(null, all_vars), + m = Sx_runtime[26].call(null, bindings, l), + count = Sx_runtime[25].call(null, m), + n = Sx_runtime[2].call(null, cst_range, [0, count, 0]), + o = Sx_runtime[6].call(null, n), expanded = [6, Stdlib_List[20].call @@ -54704,24 +61724,24 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(idx){ var b = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - a = Sx_runtime[1].call(null, cst_keys, [0, bindings, 0]), - c = Sx_runtime[5].call(null, a); + a = Sx_runtime[2].call(null, cst_keys, [0, bindings, 0]), + c = Sx_runtime[6].call(null, a); Stdlib_List[18].call (null, function(key){ - var a = Sx_runtime[25].call(null, bindings, key); - Sx_runtime[11].call(null, b, key, a); + var a = Sx_runtime[26].call(null, bindings, key); + Sx_runtime[12].call(null, b, key, a); return 0; }, c); - var d = Sx_runtime[5].call(null, all_vars); + var d = Sx_runtime[6].call(null, all_vars); Stdlib_List[18].call (null, function(var_name){ var - a = Sx_runtime[25].call(null, bindings, var_name), - c = Sx_runtime[17].call(null, a, idx); - Sx_runtime[11].call(null, b, var_name, c); + a = Sx_runtime[26].call(null, bindings, var_name), + c = Sx_runtime[18].call(null, a, idx); + Sx_runtime[12].call(null, b, var_name, c); return 0; }, d); @@ -54730,39 +61750,39 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= o)], rest_result = syntax_rules_instantiate_list - (template, Sx_runtime[1].call(null, cst$8, [0, i, g8]), bindings); - return Sx_runtime[1].call + (template, Sx_runtime[2].call(null, cst$8, [0, i, g8]), bindings); + return Sx_runtime[2].call (null, cst_append, [0, expanded, [0, rest_result, 0]]); } var g_ = [3, cst$14]; function syntax_rules_expand(literals, rules, form){ var - a = Sx_types[55].call(null, g_), - full_form = Sx_runtime[18].call(null, a, form); + a = Sx_types[59].call(null, g_), + full_form = Sx_runtime[19].call(null, a, form); return syntax_rules_try_rules(literals, rules, full_form); } var g$ = [3, "syntax-rules: no pattern matched for "], ha = [2, 1.]; function syntax_rules_try_rules(literals, rules$1, full_form){ var rules = rules$1; for(;;){ - var a = Sx_runtime[33].call(null, rules); - if(Sx_types[67].call(null, a)){ + var a = Sx_runtime[34].call(null, rules); + if(Sx_types[71].call(null, a)){ var - b = [0, g$, [0, Sx_runtime[68].call(null, full_form), 0]], - c = [3, Sx_runtime[4].call(null, b)], - d = Sx_runtime[2].call(null, c); + b = [0, g$, [0, Sx_runtime[69].call(null, full_form), 0]], + c = [3, Sx_runtime[5].call(null, b)], + d = Sx_runtime[3].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); } var - rule = Sx_runtime[14].call(null, rules), - pattern = Sx_runtime[14].call(null, rule), - template = Sx_runtime[17].call(null, rule, ha), + rule = Sx_runtime[15].call(null, rules), + pattern = Sx_runtime[15].call(null, rule), + template = Sx_runtime[18].call(null, rule, ha), bindings = syntax_rules_match(pattern, full_form, literals), - e = Sx_runtime[83].call(null, bindings), - f = [0, 1 - Sx_types[67].call(null, e)]; - if(Sx_types[67].call(null, f)) + e = Sx_runtime[84].call(null, bindings), + f = [0, 1 - Sx_types[71].call(null, e)]; + if(Sx_types[71].call(null, f)) return syntax_rules_instantiate(template, bindings); - var rules$0 = Sx_runtime[15].call(null, rules); + var rules$0 = Sx_runtime[16].call(null, rules); rules = rules$0; } } @@ -54775,32 +61795,32 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= hg = [6, 0], hh = [6, 0]; function sf_syntax_rules(args, env){ - var a = Sx_runtime[14].call(null, args), b = Sx_runtime[37].call(null, a); - if(Sx_types[67].call(null, b)) + var a = Sx_runtime[15].call(null, args), b = Sx_runtime[38].call(null, a); + if(Sx_types[71].call(null, b)) var - c = Sx_runtime[14].call(null, args), - d = Sx_runtime[5].call(null, c), + c = Sx_runtime[15].call(null, args), + d = Sx_runtime[6].call(null, c), literals = [6, Stdlib_List[20].call (null, function(s){ - var a = Sx_runtime[39].call(null, s); - return Sx_types[67].call(null, a) - ? Sx_types[68].call(null, s) - : [3, Sx_runtime[4].call(null, [0, s, 0])]; + var a = Sx_runtime[40].call(null, s); + return Sx_types[71].call(null, a) + ? Sx_types[72].call(null, s) + : [3, Sx_runtime[5].call(null, [0, s, 0])]; }, d)]; else var literals = hh; var - rules = Sx_runtime[15].call(null, args), - closure = Sx_runtime[80].call(null, env), - e = Sx_runtime[3].call(null, hb); - Sx_runtime[77].call(null, closure, e, literals); - var f = Sx_runtime[3].call(null, hc); - Sx_runtime[77].call(null, closure, f, rules); - return Sx_types[53].call(null, hg, hf, he, closure, hd); + rules = Sx_runtime[16].call(null, args), + closure = Sx_runtime[81].call(null, env), + e = Sx_runtime[4].call(null, hb); + Sx_runtime[78].call(null, closure, e, literals); + var f = Sx_runtime[4].call(null, hc); + Sx_runtime[78].call(null, closure, f, rules); + return Sx_types[57].call(null, hg, hf, he, closure, hd); } var hi = [6, 0], @@ -54810,59 +61830,59 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= hm = [0, [3, cst_begin], 0]; function step_sf_define_library(args, env, kont){ var - lib_spec = Sx_runtime[14].call(null, args), - decls = Sx_runtime[15].call(null, args), - lib_env = Sx_runtime[80].call(null, env), - a = Sx_runtime[5].call(null, decls), + lib_spec = Sx_runtime[15].call(null, args), + decls = Sx_runtime[16].call(null, args), + lib_env = Sx_runtime[81].call(null, env), + a = Sx_runtime[6].call(null, decls), exports = [0, hi], body_forms = [0, hj]; Stdlib_List[18].call (null, function(decl){ - var and = Sx_runtime[37].call(null, decl); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[38].call(null, decl); + if(Sx_types[71].call(null, and)){ var - b = Sx_runtime[33].call(null, decl), - and$0 = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and$0)) + b = Sx_runtime[34].call(null, decl), + and$0 = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and$0)) var - c = Sx_runtime[14].call(null, decl), - a = Sx_runtime[39].call(null, c); + c = Sx_runtime[15].call(null, decl), + a = Sx_runtime[40].call(null, c); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - d = Sx_runtime[14].call(null, decl), - kind = Sx_types[68].call(null, d), - e = Sx_runtime[1].call(null, cst, [0, kind, hk]); - if(Sx_types[67].call(null, e)){ + d = Sx_runtime[15].call(null, decl), + kind = Sx_types[72].call(null, d), + e = Sx_runtime[2].call(null, cst, [0, kind, hk]); + if(Sx_types[71].call(null, e)){ var - f = Sx_runtime[15].call(null, decl), - g = Sx_runtime[5].call(null, f), + f = Sx_runtime[16].call(null, decl), + g = Sx_runtime[6].call(null, f), h = [0, [6, Stdlib_List[20].call (null, function(s){ - var a = Sx_runtime[39].call(null, s); - return Sx_types[67].call(null, a) - ? Sx_types[68].call(null, s) - : [3, Sx_runtime[4].call(null, [0, s, 0])]; + var a = Sx_runtime[40].call(null, s); + return Sx_types[71].call(null, a) + ? Sx_types[72].call(null, s) + : [3, Sx_runtime[5].call(null, [0, s, 0])]; }, g)], 0]; - exports[1] = Sx_runtime[1].call(null, cst_append, [0, exports[1], h]); + exports[1] = Sx_runtime[2].call(null, cst_append, [0, exports[1], h]); } else{ - var i = Sx_runtime[1].call(null, cst, [0, kind, hl]); - if(Sx_types[67].call(null, i)){ + var i = Sx_runtime[2].call(null, cst, [0, kind, hl]); + if(Sx_types[71].call(null, i)){ var - j = Sx_runtime[15].call(null, decl), - k = Sx_runtime[5].call(null, j); + j = Sx_runtime[16].call(null, decl), + k = Sx_runtime[6].call(null, j); Stdlib_List[18].call (null, function(import_set){ @@ -54872,11 +61892,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= k); } else{ - var l = Sx_runtime[1].call(null, cst, [0, kind, hm]); - if(Sx_types[67].call(null, l)){ - var m = [0, Sx_runtime[15].call(null, decl), 0]; + var l = Sx_runtime[2].call(null, cst, [0, kind, hm]); + if(Sx_types[71].call(null, l)){ + var m = [0, Sx_runtime[16].call(null, decl), 0]; body_forms[1] = - Sx_runtime[1].call(null, cst_append, [0, body_forms[1], m]); + Sx_runtime[2].call(null, cst_append, [0, body_forms[1], m]); } } } @@ -54884,19 +61904,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; }, a); - var b = Sx_runtime[5].call(null, body_forms[1]); + var b = Sx_runtime[6].call(null, body_forms[1]); Stdlib_List[18].call (null, function(form){eval_expr(form, lib_env); return 0;}, b); var export_dict = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - c = Sx_runtime[5].call(null, exports[1]); + c = Sx_runtime[6].call(null, exports[1]); Stdlib_List[18].call (null, function(name){ - var a = Sx_runtime[75].call(null, lib_env, name); - if(Sx_types[67].call(null, a)){ - var b = Sx_runtime[76].call(null, lib_env, name); - Sx_runtime[11].call(null, export_dict, name, b); + var a = Sx_runtime[76].call(null, lib_env, name); + if(Sx_types[71].call(null, a)){ + var b = Sx_runtime[77].call(null, lib_env, name); + Sx_runtime[12].call(null, export_dict, name, b); } return 0; }, @@ -54918,104 +61938,104 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ht = [0, [3, cst_prefix], 0], hu = [0, [3, cst_rename], 0]; function bind_import_set(import_set, env){ - var and = Sx_runtime[37].call(null, import_set); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[38].call(null, import_set); + if(Sx_types[71].call(null, and)){ var - b = Sx_runtime[33].call(null, import_set), - and$0 = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and$0)) + b = Sx_runtime[34].call(null, import_set), + and$0 = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and$0)) var - c = Sx_runtime[14].call(null, import_set), - a = Sx_runtime[39].call(null, c); + c = Sx_runtime[15].call(null, import_set), + a = Sx_runtime[40].call(null, c); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - d = Sx_runtime[14].call(null, import_set), - head = Sx_types[68].call(null, d); + d = Sx_runtime[15].call(null, import_set), + head = Sx_types[72].call(null, d); else var head = 0; - var or = Sx_runtime[1].call(null, cst, [0, head, hn]); - if(Sx_types[67].call(null, or)) + var or = Sx_runtime[2].call(null, cst, [0, head, hn]); + if(Sx_types[71].call(null, or)) var or$0 = or; else{ - var or$1 = Sx_runtime[1].call(null, cst, [0, head, hs]); - if(Sx_types[67].call(null, or$1)) + var or$1 = Sx_runtime[2].call(null, cst, [0, head, hs]); + if(Sx_types[71].call(null, or$1)) var or$0 = or$1; else var - or$2 = Sx_runtime[1].call(null, cst, [0, head, ht]), + or$2 = Sx_runtime[2].call(null, cst, [0, head, ht]), or$0 = - Sx_types[67].call(null, or$2) + Sx_types[71].call(null, or$2) ? or$2 - : Sx_runtime[1].call(null, cst, [0, head, hu]); + : Sx_runtime[2].call(null, cst, [0, head, hu]); } var lib_spec = - Sx_types[67].call(null, or$0) - ? Sx_runtime[17].call(null, import_set, ho) + Sx_types[71].call(null, or$0) + ? Sx_runtime[18].call(null, import_set, ho) : import_set, exports = library_exports(lib_spec), - e = Sx_runtime[1].call(null, cst, [0, head, hp]); - if(Sx_types[67].call(null, e)){ + e = Sx_runtime[2].call(null, cst, [0, head, hp]); + if(Sx_types[71].call(null, e)){ var - f = Sx_runtime[15].call(null, import_set), - g = Sx_runtime[15].call(null, f), - h = Sx_runtime[5].call(null, g); + f = Sx_runtime[16].call(null, import_set), + g = Sx_runtime[16].call(null, f), + h = Sx_runtime[6].call(null, g); Stdlib_List[18].call (null, function(s){ var - a = Sx_runtime[39].call(null, s), + a = Sx_runtime[40].call(null, s), id = - Sx_types[67].call(null, a) - ? Sx_types[68].call(null, s) - : [3, Sx_runtime[4].call(null, [0, s, 0])], - b = Sx_runtime[1].call(null, cst_has_key, [0, exports, [0, id, 0]]); - if(Sx_types[67].call(null, b)){ + Sx_types[71].call(null, a) + ? Sx_types[72].call(null, s) + : [3, Sx_runtime[5].call(null, [0, s, 0])], + b = Sx_runtime[2].call(null, cst_has_key, [0, exports, [0, id, 0]]); + if(Sx_types[71].call(null, b)){ var - c = Sx_runtime[25].call(null, exports, id), - d = Sx_runtime[3].call(null, id); - Sx_runtime[77].call(null, env, d, c); + c = Sx_runtime[26].call(null, exports, id), + d = Sx_runtime[4].call(null, id); + Sx_runtime[78].call(null, env, d, c); } return 0; }, h); return 0; } - var i = Sx_runtime[1].call(null, cst, [0, head, hq]); - if(Sx_types[67].call(null, i)){ + var i = Sx_runtime[2].call(null, cst, [0, head, hq]); + if(Sx_types[71].call(null, i)){ var - j = [0, Sx_runtime[17].call(null, import_set, hr), 0], - pfx = [3, Sx_runtime[4].call(null, j)], - k = Sx_runtime[1].call(null, cst_keys, [0, exports, 0]), - l = Sx_runtime[5].call(null, k); + j = [0, Sx_runtime[18].call(null, import_set, hr), 0], + pfx = [3, Sx_runtime[5].call(null, j)], + k = Sx_runtime[2].call(null, cst_keys, [0, exports, 0]), + l = Sx_runtime[6].call(null, k); Stdlib_List[18].call (null, function(key){ var - a = Sx_runtime[25].call(null, exports, key), - b = [3, Sx_runtime[4].call(null, [0, pfx, [0, key, 0]])], - c = Sx_runtime[3].call(null, b); - Sx_runtime[77].call(null, env, c, a); + a = Sx_runtime[26].call(null, exports, key), + b = [3, Sx_runtime[5].call(null, [0, pfx, [0, key, 0]])], + c = Sx_runtime[4].call(null, b); + Sx_runtime[78].call(null, env, c, a); return 0; }, l); return 0; } var - m = Sx_runtime[1].call(null, cst_keys, [0, exports, 0]), - n = Sx_runtime[5].call(null, m); + m = Sx_runtime[2].call(null, cst_keys, [0, exports, 0]), + n = Sx_runtime[6].call(null, m); Stdlib_List[18].call (null, function(key){ var - a = Sx_runtime[25].call(null, exports, key), - b = Sx_runtime[3].call(null, key); - Sx_runtime[77].call(null, env, b, a); + a = Sx_runtime[26].call(null, exports, key), + b = Sx_runtime[4].call(null, key); + Sx_runtime[78].call(null, env, b, a); return 0; }, n); @@ -55031,53 +62051,53 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function step_sf_import(args$0, env, kont){ var args = args$0; for(;;){ - var b = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, b)) return make_cek_value(0, env, kont); + var b = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, b)) return make_cek_value(0, env, kont); var - import_set = Sx_runtime[14].call(null, args), - rest_sets = Sx_runtime[15].call(null, args), - and = Sx_runtime[37].call(null, import_set); - if(Sx_types[67].call(null, and)){ + import_set = Sx_runtime[15].call(null, args), + rest_sets = Sx_runtime[16].call(null, args), + and = Sx_runtime[38].call(null, import_set); + if(Sx_types[71].call(null, and)){ var - c = Sx_runtime[33].call(null, import_set), - and$0 = [0, 1 - Sx_types[67].call(null, c)]; - if(Sx_types[67].call(null, and$0)) + c = Sx_runtime[34].call(null, import_set), + and$0 = [0, 1 - Sx_types[71].call(null, c)]; + if(Sx_types[71].call(null, and$0)) var - e = Sx_runtime[14].call(null, import_set), - a = Sx_runtime[39].call(null, e); + e = Sx_runtime[15].call(null, import_set), + a = Sx_runtime[40].call(null, e); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - f = Sx_runtime[14].call(null, import_set), - head = Sx_types[68].call(null, f); + f = Sx_runtime[15].call(null, import_set), + head = Sx_types[72].call(null, f); else var head = 0; - var or = Sx_runtime[1].call(null, cst, [0, head, hv]); - if(Sx_types[67].call(null, or)) + var or = Sx_runtime[2].call(null, cst, [0, head, hv]); + if(Sx_types[71].call(null, or)) var or$0 = or; else{ - var or$1 = Sx_runtime[1].call(null, cst, [0, head, hy]); - if(Sx_types[67].call(null, or$1)) + var or$1 = Sx_runtime[2].call(null, cst, [0, head, hy]); + if(Sx_types[71].call(null, or$1)) var or$0 = or$1; else var - or$2 = Sx_runtime[1].call(null, cst, [0, head, hz]), + or$2 = Sx_runtime[2].call(null, cst, [0, head, hz]), or$0 = - Sx_types[67].call(null, or$2) + Sx_types[71].call(null, or$2) ? or$2 - : Sx_runtime[1].call(null, cst, [0, head, hA]); + : Sx_runtime[2].call(null, cst, [0, head, hA]); } var lib_spec = - Sx_types[67].call(null, or$0) - ? Sx_runtime[17].call(null, import_set, hw) + Sx_types[71].call(null, or$0) + ? Sx_runtime[18].call(null, import_set, hw) : import_set, g = library_loaded_p(lib_spec); - if(! Sx_types[67].call(null, g)){ + if(! Sx_types[71].call(null, g)){ var i = kont_push(make_import_frame(import_set, rest_sets, env), kont), d = Stdlib_Hashtbl[1].call(null, 0, 2); @@ -55086,20 +62106,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return make_cek_suspended([7, d], env, i); } bind_import_set(import_set, env); - var h = Sx_runtime[33].call(null, rest_sets); - if(Sx_types[67].call(null, h)) return make_cek_value(0, env, kont); + var h = Sx_runtime[34].call(null, rest_sets); + if(Sx_types[71].call(null, h)) return make_cek_value(0, env, kont); args = rest_sets; } } var hB = [3, "perform requires an IO request argument"]; function step_sf_perform(args, env, kont){ - var a = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, a)){ - var b = Sx_runtime[2].call(null, hB); + var a = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, a)){ + var b = Sx_runtime[3].call(null, hB); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } var c = kont_push(make_perform_frame(env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, c); + return make_cek_state(Sx_runtime[15].call(null, args), env, c); } var hC = [2, 1.], @@ -55114,52 +62134,52 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= hL = [2, 2.]; function sf_define_record_type(args, env){ var - type_sym = Sx_runtime[14].call(null, args), - ctor_spec = Sx_runtime[17].call(null, args, hC), - pred_sym = Sx_runtime[17].call(null, args, hD), - field_specs = Sx_runtime[1].call(null, cst_slice, [0, args, hE]), - raw_name = Sx_types[68].call(null, type_sym), - and = Sx_runtime[1].call(null, cst_starts_with, [0, raw_name, hF]), + type_sym = Sx_runtime[15].call(null, args), + ctor_spec = Sx_runtime[18].call(null, args, hC), + pred_sym = Sx_runtime[18].call(null, args, hD), + field_specs = Sx_runtime[2].call(null, cst_slice, [0, args, hE]), + raw_name = Sx_types[72].call(null, type_sym), + and = Sx_runtime[2].call(null, cst_starts_with, [0, raw_name, hF]), a = - Sx_types[67].call(null, and) - ? Sx_runtime[1].call(null, cst_ends_with, [0, raw_name, hG]) + Sx_types[71].call(null, and) + ? Sx_runtime[2].call(null, cst_ends_with, [0, raw_name, hG]) : and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - b = [0, Sx_runtime[24].call(null, raw_name), hH], - c = [0, raw_name, [0, hI, [0, Sx_runtime[1].call(null, cst$5, b), 0]]], - type_name = Sx_runtime[1].call(null, cst_slice, c); + b = [0, Sx_runtime[25].call(null, raw_name), hH], + c = [0, raw_name, [0, hI, [0, Sx_runtime[2].call(null, cst$5, b), 0]]], + type_name = Sx_runtime[2].call(null, cst_slice, c); else var type_name = raw_name; var - d = Sx_runtime[14].call(null, ctor_spec), - ctor_name = Sx_types[68].call(null, d), - e = Sx_runtime[15].call(null, ctor_spec), - f = Sx_runtime[5].call(null, e), + d = Sx_runtime[15].call(null, ctor_spec), + ctor_name = Sx_types[72].call(null, d), + e = Sx_runtime[16].call(null, ctor_spec), + f = Sx_runtime[6].call(null, e), ctor_params = [6, Stdlib_List[20].call - (null, function(s){return Sx_types[68].call(null, s);}, f)], - pred_name = Sx_types[68].call(null, pred_sym), - g = Sx_runtime[5].call(null, field_specs), + (null, function(s){return Sx_types[72].call(null, s);}, f)], + pred_name = Sx_types[72].call(null, pred_sym), + g = Sx_runtime[6].call(null, field_specs), field_names = [6, Stdlib_List[20].call (null, function(fs){ - var a = Sx_runtime[14].call(null, fs); - return Sx_types[68].call(null, a); + var a = Sx_runtime[15].call(null, fs); + return Sx_types[72].call(null, a); }, g)], - rtd_uid = Sx_types[91].call(null, type_name, field_names, ctor_params), - h = Sx_types[97].call(null, rtd_uid), - i = Sx_runtime[3].call(null, ctor_name); - Sx_runtime[77].call(null, env, i, h); + rtd_uid = Sx_types[95].call(null, type_name, field_names, ctor_params), + h = Sx_types[101].call(null, rtd_uid), + i = Sx_runtime[4].call(null, ctor_name); + Sx_runtime[78].call(null, env, i, h); var - j = Sx_types[98].call(null, rtd_uid), - k = Sx_runtime[3].call(null, pred_name); - Sx_runtime[77].call(null, env, k, j); - Sx_runtime[93].call + j = Sx_types[102].call(null, rtd_uid), + k = Sx_runtime[4].call(null, pred_name); + Sx_runtime[78].call(null, env, k, j); + Sx_runtime[94].call (null, [15, cst$9, @@ -55170,21 +62190,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var fs = a[1], idx = args[1], - b = Sx_runtime[17].call(null, fs, hJ), - accessor_name = Sx_types[68].call(null, b), - c = Sx_types[99].call(null, idx), - d = Sx_runtime[3].call(null, accessor_name); - Sx_runtime[77].call(null, env, d, c); + b = Sx_runtime[18].call(null, fs, hJ), + accessor_name = Sx_types[72].call(null, b), + c = Sx_types[103].call(null, idx), + d = Sx_runtime[4].call(null, accessor_name); + Sx_runtime[78].call(null, env, d, c); var - e = [0, Sx_runtime[24].call(null, fs), hK], - f = Sx_runtime[1].call(null, cst$2, e); - if(! Sx_types[67].call(null, f)) return 0; + e = [0, Sx_runtime[25].call(null, fs), hK], + f = Sx_runtime[2].call(null, cst$2, e); + if(! Sx_types[71].call(null, f)) return 0; var - g = Sx_runtime[17].call(null, fs, hL), - mutator_name = Sx_types[68].call(null, g), - h = Sx_types[100].call(null, idx), - i = Sx_runtime[3].call(null, mutator_name); - return Sx_runtime[77].call(null, env, i, h); + g = Sx_runtime[18].call(null, fs, hL), + mutator_name = Sx_types[72].call(null, g), + h = Sx_types[104].call(null, idx), + i = Sx_runtime[4].call(null, mutator_name); + return Sx_runtime[78].call(null, env, i, h); } } return 0; @@ -55219,13 +62239,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= h3 = [4, cst_fn]; function sf_define_protocol(args, env){ var - a = Sx_runtime[14].call(null, args), - proto_name = Sx_types[68].call(null, a), - method_specs = Sx_runtime[15].call(null, args), - b = Sx_runtime[3].call(null, hM); - Sx_runtime[77].call(null, env, b, protocol_registry); - var c = Sx_runtime[3].call(null, hN); - Sx_runtime[77].call + a = Sx_runtime[15].call(null, args), + proto_name = Sx_types[72].call(null, a), + method_specs = Sx_runtime[16].call(null, args), + b = Sx_runtime[4].call(null, hM); + Sx_runtime[78].call(null, env, b, protocol_registry); + var c = Sx_runtime[4].call(null, hN); + Sx_runtime[78].call (null, env, c, @@ -55246,7 +62266,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e = [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; Stdlib_Hashtbl[11].call(null, d, cst_impls, e); var - f = Sx_runtime[5].call(null, method_specs), + f = Sx_runtime[6].call(null, method_specs), g = [6, Stdlib_List[20].call @@ -55254,28 +62274,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(spec){ var d = Stdlib_Hashtbl[1].call(null, 0, 2), - a = Sx_runtime[24].call(null, spec); + a = Sx_runtime[25].call(null, spec); Stdlib_Hashtbl[11].call(null, d, cst_arity, a); var - b = Sx_runtime[14].call(null, spec), - c = Sx_types[68].call(null, b); + b = Sx_runtime[15].call(null, spec), + c = Sx_types[72].call(null, b); Stdlib_Hashtbl[11].call(null, d, cst_name, c); return [7, d]; }, f)]; Stdlib_Hashtbl[11].call(null, d, cst_methods, g); Stdlib_Hashtbl[11].call(null, d, cst_name, proto_name); - Sx_runtime[11].call(null, protocol_registry, proto_name, [7, d]); - var h = Sx_runtime[5].call(null, method_specs); + Sx_runtime[12].call(null, protocol_registry, proto_name, [7, d]); + var h = Sx_runtime[6].call(null, method_specs); Stdlib_List[18].call (null, function(spec){ var - a = Sx_runtime[14].call(null, spec), - method_name = Sx_types[68].call(null, a), - params = Sx_runtime[15].call(null, spec), - self_sym = Sx_runtime[14].call(null, params), - b = [0, Sx_runtime[18].call(null, hV, params), 0], + a = Sx_runtime[15].call(null, spec), + method_name = Sx_types[72].call(null, a), + params = Sx_runtime[16].call(null, spec), + self_sym = Sx_runtime[15].call(null, params), + b = [0, Sx_runtime[19].call(null, hV, params), 0], c = eval_expr ([6, @@ -55320,15 +62340,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= hY, [0, [3, - Sx_runtime[4].call + Sx_runtime[5].call (null, [0, proto_name, [0, hX, [0, method_name, hW]]])], 0]]], b]]]], 0]]]], 0]]]], env), - d = Sx_runtime[3].call(null, method_name); - Sx_runtime[77].call(null, env, d, c); + d = Sx_runtime[4].call(null, method_name); + Sx_runtime[78].call(null, env, d, c); return 0; }, h); @@ -55351,106 +62371,106 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ig = [4, cst_begin]; function sf_implement(args, env){ var - a = Sx_runtime[14].call(null, args), - proto_name = Sx_types[68].call(null, a), - b = Sx_runtime[17].call(null, args, h4), - raw_type_name = Sx_types[68].call(null, b), - c = [0, Sx_runtime[24].call(null, raw_type_name), h5], + a = Sx_runtime[15].call(null, args), + proto_name = Sx_types[72].call(null, a), + b = Sx_runtime[18].call(null, args, h4), + raw_type_name = Sx_types[72].call(null, b), + c = [0, Sx_runtime[25].call(null, raw_type_name), h5], d = - [0, raw_type_name, [0, h6, [0, Sx_runtime[1].call(null, cst$5, c), 0]]], - type_name = Sx_runtime[1].call(null, cst_slice, d), - e = Sx_runtime[15].call(null, args), - method_defs = Sx_runtime[15].call(null, e), - proto = Sx_runtime[25].call(null, protocol_registry, proto_name), - f = Sx_runtime[83].call(null, proto); - if(Sx_types[67].call(null, f)){ + [0, raw_type_name, [0, h6, [0, Sx_runtime[2].call(null, cst$5, c), 0]]], + type_name = Sx_runtime[2].call(null, cst_slice, d), + e = Sx_runtime[16].call(null, args), + method_defs = Sx_runtime[16].call(null, e), + proto = Sx_runtime[26].call(null, protocol_registry, proto_name), + f = Sx_runtime[84].call(null, proto); + if(Sx_types[71].call(null, f)){ var - g = [3, Sx_runtime[4].call(null, [0, h7, [0, proto_name, 0]])], - h = Sx_runtime[2].call(null, g); + g = [3, Sx_runtime[5].call(null, [0, h7, [0, proto_name, 0]])], + h = Sx_runtime[3].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } var - impls = Sx_runtime[25].call(null, proto, h8), - or = Sx_runtime[25].call(null, impls, type_name), + impls = Sx_runtime[26].call(null, proto, h8), + or = Sx_runtime[26].call(null, impls, type_name), type_impls = - Sx_types[67].call(null, or) + Sx_types[71].call(null, or) ? or : [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - i = Sx_runtime[5].call(null, method_defs); + i = Sx_runtime[6].call(null, method_defs); Stdlib_List[18].call (null, function(method_def){ var - a = Sx_runtime[14].call(null, method_def), - mname = Sx_types[68].call(null, a), - b = Sx_runtime[25].call(null, proto, h9), - c = Sx_runtime[5].call(null, b), + a = Sx_runtime[15].call(null, method_def), + mname = Sx_types[72].call(null, a), + b = Sx_runtime[26].call(null, proto, h9), + c = Sx_runtime[6].call(null, b), d = [6, Stdlib_List[44].call (null, function(m){ var - a = [0, Sx_runtime[25].call(null, m, h_), [0, mname, 0]], - b = Sx_runtime[1].call(null, cst, a); - return Sx_types[67].call(null, b); + a = [0, Sx_runtime[26].call(null, m, h_), [0, mname, 0]], + b = Sx_runtime[2].call(null, cst, a); + return Sx_types[71].call(null, b); }, c)], - proto_method = Sx_runtime[14].call(null, d), - e = Sx_runtime[83].call(null, proto_method); - if(Sx_types[67].call(null, e)){ + proto_method = Sx_runtime[15].call(null, d), + e = Sx_runtime[84].call(null, proto_method); + if(Sx_types[71].call(null, e)){ var f = [3, - Sx_runtime[4].call + Sx_runtime[5].call (null, [0, ia, [0, mname, [0, h$, [0, proto_name, 0]]]])], - g = Sx_runtime[2].call(null, f); + g = Sx_runtime[3].call(null, f); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); } var - arity = Sx_runtime[25].call(null, proto_method, ib), + arity = Sx_runtime[26].call(null, proto_method, ib), params = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_slice, [0, method_def, [0, ic, [0, arity, 0]]]), - h = [0, Sx_runtime[1].call(null, cst$8, [0, arity, id]), 0], - i = [0, Sx_runtime[24].call(null, method_def), h], - j = Sx_runtime[1].call(null, cst, i); - if(Sx_types[67].call(null, j)) - var body = Sx_runtime[17].call(null, method_def, arity); + h = [0, Sx_runtime[2].call(null, cst$8, [0, arity, id]), 0], + i = [0, Sx_runtime[25].call(null, method_def), h], + j = Sx_runtime[2].call(null, cst, i); + if(Sx_types[71].call(null, j)) + var body = Sx_runtime[18].call(null, method_def, arity); else var l = - Sx_runtime[1].call(null, cst_slice, [0, method_def, [0, arity, 0]]), - body = Sx_runtime[18].call(null, ig, l); + Sx_runtime[2].call(null, cst_slice, [0, method_def, [0, arity, 0]]), + body = Sx_runtime[19].call(null, ig, l); var k = eval_expr([6, [0, ie, [0, params, [0, body, 0]]]], env); - Sx_runtime[11].call(null, type_impls, mname, k); + Sx_runtime[12].call(null, type_impls, mname, k); return 0; }, i); - Sx_runtime[11].call(null, impls, type_name, type_impls); + Sx_runtime[12].call(null, impls, type_name, type_impls); return 0; } var ih = [0, 0], ii = [0, 0], ij = [3, cst_impls]; function satisfies_p(proto_name, value){ var - a = Sx_types[96].call(null, value), - b = [0, 1 - Sx_types[67].call(null, a)]; - if(Sx_types[67].call(null, b)) return ih; + a = Sx_types[100].call(null, value), + b = [0, 1 - Sx_types[71].call(null, a)]; + if(Sx_types[71].call(null, b)) return ih; var - c = Sx_runtime[39].call(null, proto_name), + c = Sx_runtime[40].call(null, proto_name), d = - Sx_types[67].call(null, c) - ? Sx_types[68].call(null, proto_name) + Sx_types[71].call(null, c) + ? Sx_types[72].call(null, proto_name) : proto_name, - proto = Sx_runtime[25].call(null, protocol_registry, d), - e = Sx_runtime[83].call(null, proto); - if(Sx_types[67].call(null, e)) return ii; + proto = Sx_runtime[26].call(null, protocol_registry, d), + e = Sx_runtime[84].call(null, proto); + if(Sx_types[71].call(null, e)) return ii; var - f = Sx_runtime[73].call(null, value), - g = Sx_runtime[25].call(null, proto, ij), - h = Sx_runtime[25].call(null, g, f), - i = Sx_runtime[83].call(null, h); - return [0, 1 - Sx_types[67].call(null, i)]; + f = Sx_runtime[74].call(null, value), + g = Sx_runtime[26].call(null, proto, ij), + h = Sx_runtime[26].call(null, g, f), + i = Sx_runtime[84].call(null, h); + return [0, 1 - Sx_types[71].call(null, i)]; } var warnings = [6, 0], @@ -55470,95 +62490,95 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= is = [3, "match on boolean missing true case"]; function check_match_exhaustiveness(clauses){ var - b = Sx_runtime[5].call(null, clauses), + b = Sx_runtime[6].call(null, clauses), patterns = [6, Stdlib_List[20].call - (null, function(c){return Sx_runtime[14].call(null, c);}, b)], - c = Sx_runtime[5].call(null, patterns), + (null, function(c){return Sx_runtime[15].call(null, c);}, b)], + c = Sx_runtime[6].call(null, patterns), has_wildcard = [0, Stdlib_List[34].call (null, function(p){ - var and = Sx_runtime[39].call(null, p); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[40].call(null, p); + if(Sx_types[71].call(null, and)){ var - b = Sx_runtime[1].call(null, cst, [0, p, ik]), - and$0 = [0, 1 - Sx_types[67].call(null, b)]; - if(Sx_types[67].call(null, and$0)) + b = Sx_runtime[2].call(null, cst, [0, p, ik]), + and$0 = [0, 1 - Sx_types[71].call(null, b)]; + if(Sx_types[71].call(null, and$0)) var - c = Sx_runtime[1].call(null, cst, [0, p, il]), - a = [0, 1 - Sx_types[67].call(null, c)]; + c = Sx_runtime[2].call(null, cst, [0, p, il]), + a = [0, 1 - Sx_types[71].call(null, c)]; else var a = and$0; } else var a = and; - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, c)], - d = Sx_runtime[5].call(null, patterns), + d = Sx_runtime[6].call(null, patterns), has_else = [0, Stdlib_List[34].call (null, function(p){ - var a = Sx_runtime[1].call(null, cst, [0, p, im]); - return Sx_types[67].call(null, a); + var a = Sx_runtime[2].call(null, cst, [0, p, im]); + return Sx_types[71].call(null, a); }, d)], - e = Sx_runtime[5].call(null, patterns), + e = Sx_runtime[6].call(null, patterns), has_true = [0, Stdlib_List[34].call (null, function(p){ - var a = Sx_runtime[1].call(null, cst, [0, p, io]); - return Sx_types[67].call(null, a); + var a = Sx_runtime[2].call(null, cst, [0, p, io]); + return Sx_types[71].call(null, a); }, e)], - f = Sx_runtime[5].call(null, patterns), + f = Sx_runtime[6].call(null, patterns), has_false = [0, Stdlib_List[34].call (null, function(p){ - var a = Sx_runtime[1].call(null, cst, [0, p, ip]); - return Sx_types[67].call(null, a); + var a = Sx_runtime[2].call(null, cst, [0, p, ip]); + return Sx_types[71].call(null, a); }, f)], - and = [0, 1 - Sx_types[67].call(null, has_wildcard)], + and = [0, 1 - Sx_types[71].call(null, has_wildcard)], g = - Sx_types[67].call(null, and) - ? [0, 1 - Sx_types[67].call(null, has_else)] + Sx_types[71].call(null, and) + ? [0, 1 - Sx_types[71].call(null, has_else)] : and, warnings$0 = - Sx_types[67].call(null, g) - ? Sx_runtime[1].call(null, cst_append, [0, warnings, iq]) + Sx_types[71].call(null, g) + ? Sx_runtime[2].call(null, cst_append, [0, warnings, iq]) : warnings, - and$0 = Sx_types[67].call(null, has_true) ? has_true : has_false; - if(Sx_types[67].call(null, and$0)){ + and$0 = Sx_types[71].call(null, has_true) ? has_true : has_false; + if(Sx_types[71].call(null, and$0)){ var - has_false$0 = Sx_types[67].call(null, has_true) ? has_false : has_true, - and$1 = [0, 1 - Sx_types[67].call(null, has_false$0)]; - if(Sx_types[67].call(null, and$1)) + has_false$0 = Sx_types[71].call(null, has_true) ? has_false : has_true, + and$1 = [0, 1 - Sx_types[71].call(null, has_false$0)]; + if(Sx_types[71].call(null, and$1)) var - and$2 = [0, 1 - Sx_types[67].call(null, has_wildcard)], + and$2 = [0, 1 - Sx_types[71].call(null, has_wildcard)], a = - Sx_types[67].call(null, and$2) - ? [0, 1 - Sx_types[67].call(null, has_else)] + Sx_types[71].call(null, and$2) + ? [0, 1 - Sx_types[71].call(null, has_else)] : and$2; else var a = and$1; } else var a = and$0; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - h = Sx_types[67].call(null, has_true) ? ir : is, + h = Sx_types[71].call(null, has_true) ? ir : is, warnings$1 = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, warnings$0, [0, [6, [0, h, 0]], 0]]); else var warnings$1 = warnings$0; @@ -55568,23 +62588,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function match_find_clause(val, clauses$1, env){ var clauses = clauses$1; for(;;){ - var a = Sx_runtime[33].call(null, clauses); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, clauses); + if(Sx_types[71].call(null, a)) return 0; var - clause = Sx_runtime[14].call(null, clauses), - pattern = Sx_runtime[14].call(null, clause), - body = Sx_runtime[17].call(null, clause, it), - local = Sx_runtime[80].call(null, env), + clause = Sx_runtime[15].call(null, clauses), + pattern = Sx_runtime[15].call(null, clause), + body = Sx_runtime[18].call(null, clause, it), + local = Sx_runtime[81].call(null, env), b = match_pattern(pattern, val, local); - if(Sx_types[67].call(null, b)) return [6, [0, local, [0, body, 0]]]; - var clauses$0 = Sx_runtime[15].call(null, clauses); + if(Sx_types[71].call(null, b)) return [6, [0, local, [0, body, 0]]]; + var clauses$0 = Sx_runtime[16].call(null, clauses); clauses = clauses$0; } } var cst_adt = "_adt", - cst_ctor = "_ctor", - cst_fields = "_fields", iu = [0, [4, cst$14], 0], iv = [0, 1], iw = [0, [2, 2.], 0], @@ -55594,8 +62612,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= iA = [2, 1.], iB = [0, 1], iC = [3, cst_adt], - iD = [3, cst_fields], - iE = [3, cst_ctor], + iD = [3, "_fields"], + iE = [3, "_ctor"], iF = [2, 1.], iG = [0, [4, cst_rest], 0], iH = [0, [4, cst_rest], 0], @@ -55607,67 +62625,67 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= iN = [0, 0], iO = [2, 1.]; function match_pattern(pattern, value, env){ - var e = Sx_runtime[1].call(null, cst, [0, pattern, iu]); - if(Sx_types[67].call(null, e)) return iv; - var and = Sx_runtime[37].call(null, pattern); - if(Sx_types[67].call(null, and)){ + var e = Sx_runtime[2].call(null, cst, [0, pattern, iu]); + if(Sx_types[71].call(null, e)) return iv; + var and = Sx_runtime[38].call(null, pattern); + if(Sx_types[71].call(null, and)){ var - f = [0, Sx_runtime[24].call(null, pattern), iw], - and$0 = Sx_runtime[1].call(null, cst, f); - if(Sx_types[67].call(null, and$0)) + f = [0, Sx_runtime[25].call(null, pattern), iw], + and$0 = Sx_runtime[2].call(null, cst, f); + if(Sx_types[71].call(null, and$0)) var - g = [0, Sx_runtime[14].call(null, pattern), ix], - b = Sx_runtime[1].call(null, cst, g); + g = [0, Sx_runtime[15].call(null, pattern), ix], + b = Sx_runtime[2].call(null, cst, g); else var b = and$0; } else var b = and; - if(Sx_types[67].call(null, b)){ - var pred = eval_expr(Sx_runtime[17].call(null, pattern, iy), env); + if(Sx_types[71].call(null, b)){ + var pred = eval_expr(Sx_runtime[18].call(null, pattern, iy), env); return cek_call(pred, [6, [0, value, 0]]); } - var and$1 = Sx_runtime[37].call(null, pattern); - if(Sx_types[67].call(null, and$1)){ + var and$1 = Sx_runtime[38].call(null, pattern); + if(Sx_types[71].call(null, and$1)){ var - h = Sx_runtime[33].call(null, pattern), - and$2 = [0, 1 - Sx_types[67].call(null, h)]; - if(Sx_types[67].call(null, and$2)) + h = Sx_runtime[34].call(null, pattern), + and$2 = [0, 1 - Sx_types[71].call(null, h)]; + if(Sx_types[71].call(null, and$2)) var - i = [0, Sx_runtime[14].call(null, pattern), iz], - c = Sx_runtime[1].call(null, cst, i); + i = [0, Sx_runtime[15].call(null, pattern), iz], + c = Sx_runtime[2].call(null, cst, i); else var c = and$2; } else var c = and$1; - if(Sx_types[67].call(null, c)){ - var j = [0, value, [0, Sx_runtime[17].call(null, pattern, iA), 0]]; - return Sx_runtime[1].call(null, cst, j); + if(Sx_types[71].call(null, c)){ + var j = [0, value, [0, Sx_runtime[18].call(null, pattern, iA), 0]]; + return Sx_runtime[2].call(null, cst, j); } - var k = Sx_runtime[39].call(null, pattern); - if(Sx_types[67].call(null, k)){ + var k = Sx_runtime[40].call(null, pattern); + if(Sx_types[71].call(null, k)){ var - l = Sx_types[68].call(null, pattern), - m = Sx_runtime[3].call(null, l); - Sx_runtime[77].call(null, env, m, value); + l = Sx_types[72].call(null, pattern), + m = Sx_runtime[4].call(null, l); + Sx_runtime[78].call(null, env, m, value); return iB; } - var and$3 = Sx_runtime[37].call(null, pattern); - if(Sx_types[67].call(null, and$3)){ + var and$3 = Sx_runtime[38].call(null, pattern); + if(Sx_types[71].call(null, and$3)){ var - n = Sx_runtime[33].call(null, pattern), - and$4 = [0, 1 - Sx_types[67].call(null, n)]; - if(Sx_types[67].call(null, and$4)){ + n = Sx_runtime[34].call(null, pattern), + and$4 = [0, 1 - Sx_types[71].call(null, n)]; + if(Sx_types[71].call(null, and$4)){ var - o = Sx_runtime[14].call(null, pattern), - and$5 = Sx_runtime[39].call(null, o); - if(Sx_types[67].call(null, and$5)) + o = Sx_runtime[15].call(null, pattern), + and$5 = Sx_runtime[40].call(null, o); + if(Sx_types[71].call(null, and$5)) var - and$6 = Sx_runtime[38].call(null, value), + and$6 = Sx_runtime[39].call(null, value), a = - Sx_types[67].call(null, and$6) - ? Sx_runtime[25].call(null, value, iC) + Sx_types[71].call(null, and$6) + ? Sx_runtime[26].call(null, value, iC) : and$6; else var a = and$5; @@ -55677,157 +62695,313 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and$3; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - p = Sx_runtime[14].call(null, pattern), - ctor_name = Sx_types[68].call(null, p), - field_patterns = Sx_runtime[15].call(null, pattern), - fields = Sx_runtime[25].call(null, value, iD), - q = [0, Sx_runtime[25].call(null, value, iE), [0, ctor_name, 0]], - and$7 = Sx_runtime[1].call(null, cst, q); - if(! Sx_types[67].call(null, and$7)) return and$7; + p = Sx_runtime[15].call(null, pattern), + ctor_name = Sx_types[72].call(null, p), + field_patterns = Sx_runtime[16].call(null, pattern), + fields = Sx_runtime[26].call(null, value, iD), + q = [0, Sx_runtime[26].call(null, value, iE), [0, ctor_name, 0]], + and$7 = Sx_runtime[2].call(null, cst, q); + if(! Sx_types[71].call(null, and$7)) return and$7; var - r = [0, Sx_runtime[24].call(null, fields), 0], - s = [0, Sx_runtime[24].call(null, field_patterns), r], - and$8 = Sx_runtime[1].call(null, cst, s); - if(! Sx_types[67].call(null, and$8)) return and$8; + r = [0, Sx_runtime[25].call(null, fields), 0], + s = [0, Sx_runtime[25].call(null, field_patterns), r], + and$8 = Sx_runtime[2].call(null, cst, s); + if(! Sx_types[71].call(null, and$8)) return and$8; var t = - Sx_runtime[1].call(null, cst_zip, [0, field_patterns, [0, fields, 0]]), - u = Sx_runtime[5].call(null, t); + Sx_runtime[2].call(null, cst_zip, [0, field_patterns, [0, fields, 0]]), + u = Sx_runtime[6].call(null, t); return [0, Stdlib_List[33].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, iF), - b = match_pattern(Sx_runtime[14].call(null, pair), a, env); - return Sx_types[67].call(null, b); + a = Sx_runtime[18].call(null, pair, iF), + b = match_pattern(Sx_runtime[15].call(null, pair), a, env); + return Sx_types[71].call(null, b); }, u)]; } var - and$9 = Sx_runtime[38].call(null, pattern), + and$9 = Sx_runtime[39].call(null, pattern), v = - Sx_types[67].call(null, and$9) - ? Sx_runtime[38].call(null, value) + Sx_types[71].call(null, and$9) + ? Sx_runtime[39].call(null, value) : and$9; - if(Sx_types[67].call(null, v)){ + if(Sx_types[71].call(null, v)){ var - w = Sx_runtime[1].call(null, cst_keys, [0, pattern, 0]), - x = Sx_runtime[5].call(null, w); + w = Sx_runtime[2].call(null, cst_keys, [0, pattern, 0]), + x = Sx_runtime[6].call(null, w); return [0, Stdlib_List[33].call (null, function(k){ var - a = Sx_runtime[25].call(null, value, k), + a = Sx_runtime[26].call(null, value, k), b = - match_pattern(Sx_runtime[25].call(null, pattern, k), a, env); - return Sx_types[67].call(null, b); + match_pattern(Sx_runtime[26].call(null, pattern, k), a, env); + return Sx_types[71].call(null, b); }, x)]; } - var and$10 = Sx_runtime[37].call(null, pattern); - if(Sx_types[67].call(null, and$10)) + var and$10 = Sx_runtime[38].call(null, pattern); + if(Sx_types[71].call(null, and$10)) var - and$11 = Sx_runtime[37].call(null, value), + and$11 = Sx_runtime[38].call(null, value), d = - Sx_types[67].call(null, and$11) - ? Sx_runtime[1].call(null, cst_contains, [0, pattern, iG]) + Sx_types[71].call(null, and$11) + ? Sx_runtime[2].call(null, cst_contains, [0, pattern, iG]) : and$11; else var d = and$10; - if(Sx_types[67].call(null, d)){ + if(Sx_types[71].call(null, d)){ var - rest_idx = Sx_runtime[1].call(null, cst_index_of, [0, pattern, iH]), - y = [0, Sx_runtime[24].call(null, value), [0, rest_idx, 0]], - and$12 = Sx_runtime[1].call(null, cst$2, y); - if(! Sx_types[67].call(null, and$12)) return and$12; + rest_idx = Sx_runtime[2].call(null, cst_index_of, [0, pattern, iH]), + y = [0, Sx_runtime[25].call(null, value), [0, rest_idx, 0]], + and$12 = Sx_runtime[2].call(null, cst$2, y); + if(! Sx_types[71].call(null, and$12)) return and$12; var z = [0, - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_slice, [0, value, [0, iI, [0, rest_idx, 0]]]), 0], A = [0, - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_slice, [0, pattern, [0, iJ, [0, rest_idx, 0]]]), z], - B = Sx_runtime[1].call(null, cst_zip, A), - C = Sx_runtime[5].call(null, B), + B = Sx_runtime[2].call(null, cst_zip, A), + C = Sx_runtime[6].call(null, B), and$13 = [0, Stdlib_List[33].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, iK), - b = match_pattern(Sx_runtime[14].call(null, pair), a, env); - return Sx_types[67].call(null, b); + a = Sx_runtime[18].call(null, pair, iK), + b = match_pattern(Sx_runtime[15].call(null, pair), a, env); + return Sx_types[71].call(null, b); }, C)]; - if(! Sx_types[67].call(null, and$13)) return and$13; + if(! Sx_types[71].call(null, and$13)) return and$13; var - D = Sx_runtime[1].call(null, cst$8, [0, rest_idx, iL]), - rest_name = Sx_runtime[17].call(null, pattern, D), - E = Sx_runtime[1].call(null, cst_slice, [0, value, [0, rest_idx, 0]]), - F = Sx_types[68].call(null, rest_name), - G = Sx_runtime[3].call(null, F); - Sx_runtime[77].call(null, env, G, E); + D = Sx_runtime[2].call(null, cst$8, [0, rest_idx, iL]), + rest_name = Sx_runtime[18].call(null, pattern, D), + E = Sx_runtime[2].call(null, cst_slice, [0, value, [0, rest_idx, 0]]), + F = Sx_types[72].call(null, rest_name), + G = Sx_runtime[4].call(null, F); + Sx_runtime[78].call(null, env, G, E); return iM; } var - and$14 = Sx_runtime[37].call(null, pattern), + and$14 = Sx_runtime[38].call(null, pattern), H = - Sx_types[67].call(null, and$14) - ? Sx_runtime[37].call(null, value) + Sx_types[71].call(null, and$14) + ? Sx_runtime[38].call(null, value) : and$14; - if(! Sx_types[67].call(null, H)) - return Sx_runtime[1].call(null, cst, [0, pattern, [0, value, 0]]); + if(! Sx_types[71].call(null, H)) + return Sx_runtime[2].call(null, cst, [0, pattern, [0, value, 0]]); var - I = [0, Sx_runtime[24].call(null, value), 0], - J = [0, Sx_runtime[24].call(null, pattern), I], - K = Sx_runtime[1].call(null, cst, J), - L = [0, 1 - Sx_types[67].call(null, K)]; - if(Sx_types[67].call(null, L)) return iN; + I = [0, Sx_runtime[25].call(null, value), 0], + J = [0, Sx_runtime[25].call(null, pattern), I], + K = Sx_runtime[2].call(null, cst, J), + L = [0, 1 - Sx_types[71].call(null, K)]; + if(Sx_types[71].call(null, L)) return iN; var - pairs = Sx_runtime[1].call(null, cst_zip, [0, pattern, [0, value, 0]]), - M = Sx_runtime[5].call(null, pairs); + pairs = Sx_runtime[2].call(null, cst_zip, [0, pattern, [0, value, 0]]), + M = Sx_runtime[6].call(null, pairs); return [0, Stdlib_List[33].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, iO), - b = match_pattern(Sx_runtime[14].call(null, pair), a, env); - return Sx_types[67].call(null, b); + a = Sx_runtime[18].call(null, pair, iO), + b = match_pattern(Sx_runtime[15].call(null, pair), a, env); + return Sx_types[71].call(null, b); }, M)]; } var iP = [0, 0], iQ = [3, "match: no clause matched "], iR = [2, 1.]; function step_sf_match(args, env, kont){ var - val = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - clauses = Sx_runtime[15].call(null, args), + val = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + clauses = Sx_runtime[16].call(null, args); + match_check_exhaustiveness(val, clauses, env); + var result = match_find_clause(val, clauses, env), - a = Sx_runtime[83].call(null, result); - if(Sx_types[67].call(null, a)){ + a = Sx_runtime[84].call(null, result); + if(Sx_types[71].call(null, a)){ var b = kont_push(make_raise_eval_frame(env, iP), kont), - c = [0, iQ, [0, Sx_runtime[68].call(null, val), 0]]; - return make_cek_value([3, Sx_runtime[4].call(null, c)], env, b); + c = [0, iQ, [0, Sx_runtime[69].call(null, val), 0]]; + return make_cek_value([3, Sx_runtime[5].call(null, c)], env, b); } - var d = Sx_runtime[14].call(null, result); - return make_cek_state(Sx_runtime[17].call(null, result, iR), d, kont); + var d = Sx_runtime[15].call(null, result); + return make_cek_state(Sx_runtime[18].call(null, result, iR), d, kont); } - var iS = [2, 1.]; + var + cst_adt_registry = "*adt-registry*", + cst_adt_warned = "*adt-warned*", + iS = [3, cst_adt_registry], + iT = [3, cst_adt_registry], + iU = [3, cst_adt_warned], + iV = [3, cst_adt_warned], + iW = [3, cst_adt_warned], + iX = [0, 1]; + function match_check_exhaustiveness(val, clauses, env){ + function clause_is_else(c){ + if(typeof c !== "number" && 6 === c[0]){ + var match = c[1]; + if(match){ + var p = match[1]; + if(typeof p !== "number") + switch(p[0]){ + case 4: + var a = p[1]; if(a !== cst$14 && a !== cst_else) break; return 1; + case 5: + if(p[1] === cst_else) return 1; break; + } + return 0; + } + } + return 0; + } + function clause_ctor_name(c){ + if(typeof c !== "number" && 6 === c[0]){ + var b = c[1]; + if(b){ + var a = b[1]; + if(typeof a !== "number" && 6 === a[0]){ + var d = a[1]; + if(d){ + var match = d[1]; + if(typeof match !== "number" && 4 === match[0]){var n = match[1]; return [0, n];} + } + } + } + } + return 0; + } + a: + { + if(typeof val !== "number") + switch(val[0]){ + case 7: + var d = val[1], match$2 = Stdlib_Hashtbl[7].call(null, d, cst_adt); + if(match$2){ + var c = match$2[1]; + if(typeof c !== "number" && 0 === c[0] && c[1]){ + var match$3 = Stdlib_Hashtbl[7].call(null, d, "_type"); + if(match$3){ + var match$4 = match$3[1]; + if(typeof match$4 !== "number" && 3 === match$4[0]){ + var s = match$4[1], type_name_opt = [0, s]; + break a; + } + } + var type_name_opt = 0; + break a; + } + } + var type_name_opt = 0; + break a; + case 38: + var a = val[1], type_name_opt = [0, a[1]]; break a; + } + var type_name_opt = 0; + } + if(! type_name_opt) return 0; + var type_name = type_name_opt[1], e = Sx_runtime[76].call(null, env, iS); + if(! Sx_types[71].call(null, e)) return 0; + var registry = Sx_runtime[77].call(null, env, iT); + a: + { + if(typeof registry !== "number" && 7 === registry[0]){ + var + r = registry[1], + match$0 = Stdlib_Hashtbl[7].call(null, r, type_name); + if(match$0){ + var match$1 = match$0[1]; + if(typeof match$1 !== "number" && 6 === match$1[0]){ + var ctors = match$1[1], registered = [0, ctors]; + break a; + } + } + var registered = 0; + break a; + } + var registered = 0; + } + if(! registered) return 0; + var ctor_vals = registered[1]; + a: + { + if(typeof clauses !== "number" && 6 === clauses[0]){var xs = clauses[1], clauses_list = xs; break a;} + var clauses_list = 0; + } + if(Stdlib_List[34].call(null, clause_is_else, clauses_list)) return 0; + var + clause_ctors = Stdlib_List[23].call(null, clause_ctor_name, clauses_list), + registered_names = + Stdlib_List[23].call + (null, + function(param){ + if(typeof param !== "number" && 3 === param[0]){var s = param[1]; return [0, s];} + return 0; + }, + ctor_vals), + missing = + Stdlib_List[44].call + (null, + function(c){return 1 - Stdlib_List[37].call(null, c, clause_ctors);}, + registered_names); + if(0 === missing) return 0; + var f = Sx_runtime[76].call(null, env, iU); + if(1 - Sx_types[71].call(null, f)){ + var g = [7, Stdlib_Hashtbl[1].call(null, 0, 4)]; + Sx_runtime[78].call(null, env, iV, g); + } + var + warned = Sx_runtime[77].call(null, env, iW), + h = Stdlib_String[7].call(null, ",", missing), + i = Stdlib[28].call(null, "|", h), + key = Stdlib[28].call(null, type_name, i); + a: + { + if(typeof warned !== "number" && 7 === warned[0]){ + var w$0 = warned[1], match = Stdlib_Hashtbl[7].call(null, w$0, key); + if(match){ + var b = match[1]; + if(typeof b !== "number" && 0 === b[0] && b[1]){var already = 1; break a;} + } + var already = 0; + break a; + } + var already = 0; + } + if(already) return 0; + if(typeof warned !== "number" && 7 === warned[0]){ + var w = warned[1]; + Stdlib_Hashtbl[11].call(null, w, key, iX); + } + var + j = Stdlib_String[7].call(null, ", ", missing), + k = Stdlib[28].call(null, ": missing ", j), + l = Stdlib[28].call(null, type_name, k), + msg = + Stdlib[28].call(null, "[sx] match: non-exhaustive \xe2\x80\x94 ", l); + Sx_runtime[103].call(null, [3, msg]); + return 0; + } + var iY = [2, 1.]; function step_sf_handler_bind(args, env, kont){ var - handler_specs = Sx_runtime[14].call(null, args), - body = Sx_runtime[15].call(null, args), - a = Sx_runtime[5].call(null, handler_specs), + handler_specs = Sx_runtime[15].call(null, args), + body = Sx_runtime[16].call(null, args), + a = Sx_runtime[6].call(null, handler_specs), handlers = [6, Stdlib_List[20].call @@ -55836,60 +63010,60 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = [0, - trampoline(eval_expr(Sx_runtime[17].call(null, spec, iS), env)), + trampoline(eval_expr(Sx_runtime[18].call(null, spec, iY), env)), 0]; return [6, [0, - trampoline(eval_expr(Sx_runtime[14].call(null, spec), env)), + trampoline(eval_expr(Sx_runtime[15].call(null, spec), env)), a]]; }, a)], - b = Sx_runtime[33].call(null, body); - if(Sx_types[67].call(null, b)) return make_cek_value(0, env, kont); + b = Sx_runtime[34].call(null, body); + if(Sx_types[71].call(null, b)) return make_cek_value(0, env, kont); var c = kont_push - (make_handler_frame(handlers, Sx_runtime[15].call(null, body), env), + (make_handler_frame(handlers, Sx_runtime[16].call(null, body), env), kont); - return make_cek_state(Sx_runtime[14].call(null, body), env, c); + return make_cek_state(Sx_runtime[15].call(null, body), env, c); } - var iT = [2, 2.], iU = [2, 1.], iV = [6, 0]; + var iZ = [2, 2.], i0 = [2, 1.], i1 = [6, 0]; function step_sf_restart_case(args, env, kont){ var - body = Sx_runtime[14].call(null, args), - restart_specs = Sx_runtime[15].call(null, args), - a = Sx_runtime[5].call(null, restart_specs), + body = Sx_runtime[15].call(null, args), + restart_specs = Sx_runtime[16].call(null, args), + a = Sx_runtime[6].call(null, restart_specs), restarts = [6, Stdlib_List[20].call (null, function(spec){ var - b = [0, Sx_runtime[17].call(null, spec, iT), 0], - c = [0, Sx_runtime[17].call(null, spec, iU), b], - d = Sx_runtime[14].call(null, spec), - e = Sx_runtime[39].call(null, d); - if(Sx_types[67].call(null, e)) + b = [0, Sx_runtime[18].call(null, spec, iZ), 0], + c = [0, Sx_runtime[18].call(null, spec, i0), b], + d = Sx_runtime[15].call(null, spec), + e = Sx_runtime[40].call(null, d); + if(Sx_types[71].call(null, e)) var - f = Sx_runtime[14].call(null, spec), - a = Sx_types[68].call(null, f); + f = Sx_runtime[15].call(null, spec), + a = Sx_types[72].call(null, f); else - var a = Sx_runtime[14].call(null, spec); + var a = Sx_runtime[15].call(null, spec); return [6, [0, a, c]]; }, a)]; return make_cek_state (body, env, - kont_push(make_restart_frame(restarts, iV, env), kont)); + kont_push(make_restart_frame(restarts, i1, env), kont)); } - var iW = [3, "Unhandled condition: "]; + var i2 = [3, "Unhandled condition: "]; function step_sf_signal(args, env, kont){ var - condition = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + condition = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), handler_fn = kont_find_handler(kont, condition), - a = Sx_runtime[83].call(null, handler_fn); - if(! Sx_types[67].call(null, a)) + a = Sx_runtime[84].call(null, handler_fn); + if(! Sx_types[71].call(null, a)) return continue_with_call (handler_fn, [6, [0, condition, 0]], @@ -55897,168 +63071,168 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [6, [0, condition, 0]], kont_push(make_signal_return_frame(env, kont), kont)); var - b = [0, iW, [0, Sx_runtime[68].call(null, condition), 0]], - c = [3, Sx_runtime[4].call(null, b)], - d = Sx_runtime[2].call(null, c); + b = [0, i2, [0, Sx_runtime[69].call(null, condition), 0]], + c = [3, Sx_runtime[5].call(null, b)], + d = Sx_runtime[3].call(null, c); throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); } var - iX = [0, [2, 2.], 0], - iY = [2, 1.], - iZ = [3, "No restart named: "], - i0 = [2, 1.], - i1 = [2, 2.], - i2 = [2, 1.], - i3 = [2, 2.], - i4 = [3, cst_env]; + i3 = [0, [2, 2.], 0], + i4 = [2, 1.], + i5 = [3, "No restart named: "], + i6 = [2, 1.], + i7 = [2, 2.], + i8 = [2, 1.], + i9 = [2, 2.], + i_ = [3, cst_env]; function step_sf_invoke_restart(args, env, kont){ - var a = Sx_runtime[14].call(null, args), b = Sx_runtime[39].call(null, a); - if(Sx_types[67].call(null, b)) - var c = Sx_runtime[14].call(null, args), rn = Sx_types[68].call(null, c); + var a = Sx_runtime[15].call(null, args), b = Sx_runtime[40].call(null, a); + if(Sx_types[71].call(null, b)) + var c = Sx_runtime[15].call(null, args), rn = Sx_types[72].call(null, c); else - var rn = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)); + var rn = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)); var - d = Sx_runtime[39].call(null, rn), + d = Sx_runtime[40].call(null, rn), restart_name = - Sx_types[67].call(null, d) ? Sx_types[68].call(null, rn) : rn, - e = [0, Sx_runtime[24].call(null, args), iX], - f = Sx_runtime[1].call(null, cst$2, e), + Sx_types[71].call(null, d) ? Sx_types[72].call(null, rn) : rn, + e = [0, Sx_runtime[25].call(null, args), i3], + f = Sx_runtime[2].call(null, cst$2, e), restart_arg = - Sx_types[67].call(null, f) - ? trampoline(eval_expr(Sx_runtime[17].call(null, args, iY), env)) + Sx_types[71].call(null, f) + ? trampoline(eval_expr(Sx_runtime[18].call(null, args, i4), env)) : 0, found = kont_find_restart(kont, restart_name), - g = Sx_runtime[83].call(null, found); - if(Sx_types[67].call(null, g)){ + g = Sx_runtime[84].call(null, found); + if(Sx_types[71].call(null, g)){ var - h = [0, iZ, [0, Sx_runtime[68].call(null, restart_name), 0]], - i = [3, Sx_runtime[4].call(null, h)], - j = Sx_runtime[2].call(null, i); + h = [0, i5, [0, Sx_runtime[69].call(null, restart_name), 0]], + i = [3, Sx_runtime[5].call(null, h)], + j = Sx_runtime[3].call(null, i); throw caml_maybe_attach_backtrace([0, Sx_types[9], j], 1); } var - entry = Sx_runtime[14].call(null, found), - restart_frame = Sx_runtime[17].call(null, found, i0), - rest_kont = Sx_runtime[17].call(null, found, i1), - params = Sx_runtime[17].call(null, entry, i2), - body = Sx_runtime[17].call(null, entry, i3), - k = Sx_runtime[25].call(null, restart_frame, i4), - restart_env = Sx_runtime[80].call(null, k), - l = Sx_runtime[33].call(null, params), - m = [0, 1 - Sx_types[67].call(null, l)]; - if(Sx_types[67].call(null, m)){ + entry = Sx_runtime[15].call(null, found), + restart_frame = Sx_runtime[18].call(null, found, i6), + rest_kont = Sx_runtime[18].call(null, found, i7), + params = Sx_runtime[18].call(null, entry, i8), + body = Sx_runtime[18].call(null, entry, i9), + k = Sx_runtime[26].call(null, restart_frame, i_), + restart_env = Sx_runtime[81].call(null, k), + l = Sx_runtime[34].call(null, params), + m = [0, 1 - Sx_types[71].call(null, l)]; + if(Sx_types[71].call(null, m)){ var - n = Sx_runtime[14].call(null, params), - o = Sx_runtime[3].call(null, n); - Sx_runtime[77].call(null, restart_env, o, restart_arg); + n = Sx_runtime[15].call(null, params), + o = Sx_runtime[4].call(null, n); + Sx_runtime[78].call(null, restart_env, o, restart_arg); } return make_cek_state(body, restart_env, rest_kont); } - var i5 = [0, [2, 2.], 0], i6 = [2, 2.], i7 = [2, 1.]; + var i$ = [0, [2, 2.], 0], ja = [2, 2.], jb = [2, 1.]; function step_sf_if(args, env, kont){ var - a = [0, Sx_runtime[24].call(null, args), i5], - b = Sx_runtime[1].call(null, cst$0, a), - c = Sx_types[67].call(null, b) ? Sx_runtime[17].call(null, args, i6) : 0, + a = [0, Sx_runtime[25].call(null, args), i$], + b = Sx_runtime[2].call(null, cst$0, a), + c = Sx_types[71].call(null, b) ? Sx_runtime[18].call(null, args, ja) : 0, d = kont_push - (make_if_frame(Sx_runtime[17].call(null, args, i7), c, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, d); + (make_if_frame(Sx_runtime[18].call(null, args, jb), c, env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, d); } function step_sf_when(args, env, kont){ var a = - kont_push(make_when_frame(Sx_runtime[15].call(null, args), env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + kont_push(make_when_frame(Sx_runtime[16].call(null, args), env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var i8 = [0, [2, 1.], 0]; + var jc = [0, [2, 1.], 0]; function step_sf_begin(args, env, kont){ - var a = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, a)) return make_cek_value(0, env, kont); + var a = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, a)) return make_cek_value(0, env, kont); var - b = [0, Sx_runtime[24].call(null, args), i8], - c = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, c)) - return make_cek_state(Sx_runtime[14].call(null, args), env, kont); + b = [0, Sx_runtime[25].call(null, args), jc], + c = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, c)) + return make_cek_state(Sx_runtime[15].call(null, args), env, kont); var d = - kont_push(make_begin_frame(Sx_runtime[15].call(null, args), env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, d); + kont_push(make_begin_frame(Sx_runtime[16].call(null, args), env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, d); } var - i9 = [0, [3, cst_symbol], 0], - i_ = [0, [3, cst_list], 0], - i$ = [0, [2, 2.], 0], - ja = [0, [3, cst_list], 0], - jb = [0, [2, 2.], 0], - jc = [0, [3, cst_symbol], 0], - jd = [2, 1.], - je = [6, 0], + jd = [0, [3, cst_symbol], 0], + je = [0, [3, cst_list], 0], jf = [0, [2, 2.], 0], - jg = [2, 1.], + jg = [0, [3, cst_list], 0], jh = [0, [2, 2.], 0], - ji = [0, [2, 2.], 0], - jj = [2, 1.]; + ji = [0, [3, cst_symbol], 0], + jj = [2, 1.], + jk = [6, 0], + jl = [0, [2, 2.], 0], + jm = [2, 1.], + jn = [0, [2, 2.], 0], + jo = [0, [2, 2.], 0], + jp = [2, 1.]; function step_sf_let(args, env, kont){ var - c = Sx_runtime[14].call(null, args), - d = [0, Sx_runtime[73].call(null, c), i9], - e = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, e)) + c = Sx_runtime[15].call(null, args), + d = [0, Sx_runtime[74].call(null, c), jd], + e = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, e)) return make_cek_value(sf_named_let(args, env), env, kont); var - bindings = Sx_runtime[14].call(null, args), - body = Sx_runtime[15].call(null, args), - local = Sx_runtime[80].call(null, env), - f = Sx_runtime[33].call(null, bindings); - if(Sx_types[67].call(null, f)) return step_sf_begin(body, local, kont); + bindings = Sx_runtime[15].call(null, args), + body = Sx_runtime[16].call(null, args), + local = Sx_runtime[81].call(null, env), + f = Sx_runtime[34].call(null, bindings); + if(Sx_types[71].call(null, f)) return step_sf_begin(body, local, kont); var - g = Sx_runtime[14].call(null, bindings), - h = [0, Sx_runtime[73].call(null, g), i_], - and = Sx_runtime[1].call(null, cst, h); - if(Sx_types[67].call(null, and)) + g = Sx_runtime[15].call(null, bindings), + h = [0, Sx_runtime[74].call(null, g), je], + and = Sx_runtime[2].call(null, cst, h); + if(Sx_types[71].call(null, and)) var - i = Sx_runtime[14].call(null, bindings), - j = [0, Sx_runtime[24].call(null, i), i$], - a = Sx_runtime[1].call(null, cst, j); + i = Sx_runtime[15].call(null, bindings), + j = [0, Sx_runtime[25].call(null, i), jf], + a = Sx_runtime[2].call(null, cst, j); else var a = and; - if(Sx_types[67].call(null, a)) - var first_binding = Sx_runtime[14].call(null, bindings); + if(Sx_types[71].call(null, a)) + var first_binding = Sx_runtime[15].call(null, bindings); else var - x = [0, Sx_runtime[17].call(null, bindings, jj), 0], - first_binding = [6, [0, Sx_runtime[14].call(null, bindings), x]]; + x = [0, Sx_runtime[18].call(null, bindings, jp), 0], + first_binding = [6, [0, Sx_runtime[15].call(null, bindings), x]]; var - k = Sx_runtime[14].call(null, bindings), - l = [0, Sx_runtime[73].call(null, k), ja], - and$0 = Sx_runtime[1].call(null, cst, l); - if(Sx_types[67].call(null, and$0)) + k = Sx_runtime[15].call(null, bindings), + l = [0, Sx_runtime[74].call(null, k), jg], + and$0 = Sx_runtime[2].call(null, cst, l); + if(Sx_types[71].call(null, and$0)) var - m = Sx_runtime[14].call(null, bindings), - n = [0, Sx_runtime[24].call(null, m), jb], - b = Sx_runtime[1].call(null, cst, n); + m = Sx_runtime[15].call(null, bindings), + n = [0, Sx_runtime[25].call(null, m), jh], + b = Sx_runtime[2].call(null, cst, n); else var b = and$0; - if(Sx_types[67].call(null, b)) - var rest_bindings = Sx_runtime[15].call(null, bindings); + if(Sx_types[71].call(null, b)) + var rest_bindings = Sx_runtime[16].call(null, bindings); else{ var - t = [0, Sx_runtime[24].call(null, bindings), jf], - u = [0, jg, [0, Sx_runtime[1].call(null, cst$12, t), 0]], - v = Sx_runtime[1].call(null, cst_range, u), - w = Sx_runtime[5].call(null, v), - pairs = [0, je]; + t = [0, Sx_runtime[25].call(null, bindings), jl], + u = [0, jm, [0, Sx_runtime[2].call(null, cst$12, t), 0]], + v = Sx_runtime[2].call(null, cst_range, u), + w = Sx_runtime[6].call(null, v), + pairs = [0, jk]; Stdlib_List[26].call (null, function(acc, i){ var - a = [0, Sx_runtime[1].call(null, cst$11, [0, i, jh]), 0], - b = Sx_runtime[1].call(null, cst_inc, a), - c = [0, Sx_runtime[17].call(null, bindings, b), 0], - d = Sx_runtime[1].call(null, cst$11, [0, i, ji]), - e = [6, [0, Sx_runtime[17].call(null, bindings, d), c]]; - pairs[1] = Sx_runtime[10].call(null, pairs[1], e); + a = [0, Sx_runtime[2].call(null, cst$11, [0, i, jn]), 0], + b = Sx_runtime[2].call(null, cst_inc, a), + c = [0, Sx_runtime[18].call(null, bindings, b), 0], + d = Sx_runtime[2].call(null, cst$11, [0, i, jo]), + e = [6, [0, Sx_runtime[18].call(null, bindings, d), c]]; + pairs[1] = Sx_runtime[11].call(null, pairs[1], e); return 0; }, 0, @@ -56066,42 +63240,42 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var rest_bindings = pairs[1]; } var - o = Sx_runtime[14].call(null, first_binding), - p = [0, Sx_runtime[73].call(null, o), jc], - q = Sx_runtime[1].call(null, cst, p); - if(Sx_types[67].call(null, q)) + o = Sx_runtime[15].call(null, first_binding), + p = [0, Sx_runtime[74].call(null, o), ji], + q = Sx_runtime[2].call(null, cst, p); + if(Sx_types[71].call(null, q)) var - r = Sx_runtime[14].call(null, first_binding), - vname = Sx_types[68].call(null, r); + r = Sx_runtime[15].call(null, first_binding), + vname = Sx_types[72].call(null, r); else - var vname = Sx_runtime[14].call(null, first_binding); + var vname = Sx_runtime[15].call(null, first_binding); var s = kont_push(make_let_frame(vname, rest_bindings, body, local), kont); return make_cek_state - (Sx_runtime[17].call(null, first_binding, jd), local, s); + (Sx_runtime[18].call(null, first_binding, jj), local, s); } var - jk = [0, [2, 4.], 0], - jl = [0, [3, cst_keyword], 0], - jm = [2, 1.], - jn = [0, [3, cst_effects], 0], - jo = [2, 1.], - jp = [0, [2, 4.], 0], - jq = [0, [3, cst_keyword], 0], - jr = [2, 1.], - js = [0, [3, cst_effects], 0], - jt = [2, 1.], - ju = [2, 3.], + jq = [0, [2, 4.], 0], + jr = [0, [3, cst_keyword], 0], + js = [2, 1.], + jt = [0, [3, cst_effects], 0], + ju = [2, 1.], jv = [0, [2, 4.], 0], jw = [0, [3, cst_keyword], 0], jx = [2, 1.], jy = [0, [3, cst_effects], 0], jz = [2, 1.], - jA = [2, 2.], - jB = [2, 1.], - jC = [4, cst_fn]; + jA = [2, 3.], + jB = [0, [2, 4.], 0], + jC = [0, [3, cst_keyword], 0], + jD = [2, 1.], + jE = [0, [3, cst_effects], 0], + jF = [2, 1.], + jG = [2, 2.], + jH = [2, 1.], + jI = [4, cst_fn]; function step_sf_define(args, env, kont){ - var match = Sx_runtime[14].call(null, args); + var match = Sx_runtime[15].call(null, args); if(typeof match === "number" || ! (6 === match[0])) var args$0 = args; else{ @@ -56110,64 +63284,64 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var params = match$0[2], fn_name = match$0[1], - s = Sx_runtime[15].call(null, args), - body_parts = Sx_runtime[5].call(null, s), + s = Sx_runtime[16].call(null, args), + body_parts = Sx_runtime[6].call(null, s), args$0 = - [6, [0, fn_name, [0, [6, [0, jC, [0, [6, params], body_parts]]], 0]]]; + [6, [0, fn_name, [0, [6, [0, jI, [0, [6, params], body_parts]]], 0]]]; else var args$0 = args; } var - name_sym = Sx_runtime[14].call(null, args$0), - c = [0, Sx_runtime[24].call(null, args$0), jk], - and = Sx_runtime[1].call(null, cst$2, c); - if(Sx_types[67].call(null, and)){ + name_sym = Sx_runtime[15].call(null, args$0), + c = [0, Sx_runtime[25].call(null, args$0), jq], + and = Sx_runtime[2].call(null, cst$2, c); + if(Sx_types[71].call(null, and)){ var - d = Sx_runtime[17].call(null, args$0, jm), - e = [0, Sx_runtime[73].call(null, d), jl], - and$0 = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, and$0)) + d = Sx_runtime[18].call(null, args$0, js), + e = [0, Sx_runtime[74].call(null, d), jr], + and$0 = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, and$0)) var - f = Sx_runtime[17].call(null, args$0, jo), - g = [0, Sx_types[69].call(null, f), jn], - has_effects = Sx_runtime[1].call(null, cst, g); + f = Sx_runtime[18].call(null, args$0, ju), + g = [0, Sx_types[73].call(null, f), jt], + has_effects = Sx_runtime[2].call(null, cst, g); else var has_effects = and$0; } else var has_effects = and; var - h = [0, Sx_runtime[24].call(null, args$0), jp], - and$1 = Sx_runtime[1].call(null, cst$2, h); - if(Sx_types[67].call(null, and$1)){ + h = [0, Sx_runtime[25].call(null, args$0), jv], + and$1 = Sx_runtime[2].call(null, cst$2, h); + if(Sx_types[71].call(null, and$1)){ var - i = Sx_runtime[17].call(null, args$0, jr), - j = [0, Sx_runtime[73].call(null, i), jq], - and$2 = Sx_runtime[1].call(null, cst, j); - if(Sx_types[67].call(null, and$2)) + i = Sx_runtime[18].call(null, args$0, jx), + j = [0, Sx_runtime[74].call(null, i), jw], + and$2 = Sx_runtime[2].call(null, cst, j); + if(Sx_types[71].call(null, and$2)) var - k = Sx_runtime[17].call(null, args$0, jt), - l = [0, Sx_types[69].call(null, k), js], - a = Sx_runtime[1].call(null, cst, l); + k = Sx_runtime[18].call(null, args$0, jz), + l = [0, Sx_types[73].call(null, k), jy], + a = Sx_runtime[2].call(null, cst, l); else var a = and$2; } else var a = and$1; var - val_idx = Sx_types[67].call(null, a) ? ju : jB, - m = [0, Sx_runtime[24].call(null, args$0), jv], - and$3 = Sx_runtime[1].call(null, cst$2, m); - if(Sx_types[67].call(null, and$3)){ + val_idx = Sx_types[71].call(null, a) ? jA : jH, + m = [0, Sx_runtime[25].call(null, args$0), jB], + and$3 = Sx_runtime[2].call(null, cst$2, m); + if(Sx_types[71].call(null, and$3)){ var - n = Sx_runtime[17].call(null, args$0, jx), - o = [0, Sx_runtime[73].call(null, n), jw], - and$4 = Sx_runtime[1].call(null, cst, o); - if(Sx_types[67].call(null, and$4)) + n = Sx_runtime[18].call(null, args$0, jD), + o = [0, Sx_runtime[74].call(null, n), jC], + and$4 = Sx_runtime[2].call(null, cst, o); + if(Sx_types[71].call(null, and$4)) var - p = Sx_runtime[17].call(null, args$0, jz), - q = [0, Sx_types[69].call(null, p), jy], - b = Sx_runtime[1].call(null, cst, q); + p = Sx_runtime[18].call(null, args$0, jF), + q = [0, Sx_types[73].call(null, p), jE], + b = Sx_runtime[2].call(null, cst, q); else var b = and$4; } @@ -56175,354 +63349,354 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var b = and$3; var effect_list = - Sx_types[67].call(null, b) ? Sx_runtime[17].call(null, args$0, jA) : 0, + Sx_types[71].call(null, b) ? Sx_runtime[18].call(null, args$0, jG) : 0, r = kont_push (make_define_frame - (Sx_types[68].call(null, name_sym), env, has_effects, effect_list), + (Sx_types[72].call(null, name_sym), env, has_effects, effect_list), kont); - return make_cek_state(Sx_runtime[17].call(null, args$0, val_idx), env, r); + return make_cek_state(Sx_runtime[18].call(null, args$0, val_idx), env, r); } - var jD = [2, 1.]; + var jJ = [2, 1.]; function step_sf_set_b(args, env, kont){ var - a = Sx_runtime[14].call(null, args), - b = kont_push(make_set_frame(Sx_types[68].call(null, a), env), kont); - return make_cek_state(Sx_runtime[17].call(null, args, jD), env, b); + a = Sx_runtime[15].call(null, args), + b = kont_push(make_set_frame(Sx_types[72].call(null, a), env), kont); + return make_cek_state(Sx_runtime[18].call(null, args, jJ), env, b); } - var jE = [0, 1]; + var jK = [0, 1]; function step_sf_and(args, env, kont){ - var a = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, a)) return make_cek_value(jE, env, kont); + var a = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, a)) return make_cek_value(jK, env, kont); var - b = kont_push(make_and_frame(Sx_runtime[15].call(null, args), env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, b); + b = kont_push(make_and_frame(Sx_runtime[16].call(null, args), env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, b); } - var jF = [0, 0]; + var jL = [0, 0]; function step_sf_or(args, env, kont){ - var a = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, a)) return make_cek_value(jF, env, kont); + var a = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, a)) return make_cek_value(jL, env, kont); var - b = kont_push(make_or_frame(Sx_runtime[15].call(null, args), env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, b); + b = kont_push(make_or_frame(Sx_runtime[16].call(null, args), env), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, b); } var - jG = [2, 1.], - jH = [0, 1], - jI = [0, [2, 2.], 0], - jJ = [2, 1.], - jK = [0, 0]; + jM = [2, 1.], + jN = [0, 1], + jO = [0, [2, 2.], 0], + jP = [2, 1.], + jQ = [0, 0]; function step_sf_cond(args, env, kont){ var scheme_p = cond_scheme_p(args); - if(Sx_types[67].call(null, scheme_p)){ - var a = Sx_runtime[33].call(null, args); - if(Sx_types[67].call(null, a)) return make_cek_value(0, env, kont); + if(Sx_types[71].call(null, scheme_p)){ + var a = Sx_runtime[34].call(null, args); + if(Sx_types[71].call(null, a)) return make_cek_value(0, env, kont); var - clause = Sx_runtime[14].call(null, args), - test = Sx_runtime[14].call(null, clause), + clause = Sx_runtime[15].call(null, args), + test = Sx_runtime[15].call(null, clause), b = is_else_clause(test); - return Sx_types[67].call(null, b) + return Sx_types[71].call(null, b) ? make_cek_state - (Sx_runtime[17].call(null, clause, jG), env, kont) + (Sx_runtime[18].call(null, clause, jM), env, kont) : make_cek_state - (test, env, kont_push(make_cond_frame(args, env, jH), kont)); + (test, env, kont_push(make_cond_frame(args, env, jN), kont)); } var - c = [0, Sx_runtime[24].call(null, args), jI], - d = Sx_runtime[1].call(null, cst$3, c); - if(Sx_types[67].call(null, d)) return make_cek_value(0, env, kont); - var test$0 = Sx_runtime[14].call(null, args), e = is_else_clause(test$0); - return Sx_types[67].call(null, e) - ? make_cek_state(Sx_runtime[17].call(null, args, jJ), env, kont) + c = [0, Sx_runtime[25].call(null, args), jO], + d = Sx_runtime[2].call(null, cst$3, c); + if(Sx_types[71].call(null, d)) return make_cek_value(0, env, kont); + var test$0 = Sx_runtime[15].call(null, args), e = is_else_clause(test$0); + return Sx_types[71].call(null, e) + ? make_cek_state(Sx_runtime[18].call(null, args, jP), env, kont) : make_cek_state - (test$0, env, kont_push(make_cond_frame(args, env, jK), kont)); + (test$0, env, kont_push(make_cond_frame(args, env, jQ), kont)); } - var jL = [3, cst_first]; + var jR = [3, cst_first]; function step_sf_thread_first(args, env, kont){ var a = kont_push - (make_thread_frame(Sx_runtime[15].call(null, args), env, jL, 0), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + (make_thread_frame(Sx_runtime[16].call(null, args), env, jR, 0), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var cst_last = "last", jM = [3, cst_last]; + var cst_last = "last", jS = [3, cst_last]; function step_sf_thread_last(args, env, kont){ var a = kont_push - (make_thread_frame(Sx_runtime[15].call(null, args), env, jM, 0), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + (make_thread_frame(Sx_runtime[16].call(null, args), env, jS, 0), kont); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var jN = [2, 1.], jO = [3, cst_as]; + var jT = [2, 1.], jU = [3, cst_as]; function step_sf_thread_as(args, env, kont){ var - init = Sx_runtime[14].call(null, args), - name = Sx_runtime[17].call(null, args, jN), - a = Sx_runtime[15].call(null, args), - forms = Sx_runtime[15].call(null, a); + init = Sx_runtime[15].call(null, args), + name = Sx_runtime[18].call(null, args, jT), + a = Sx_runtime[16].call(null, args), + forms = Sx_runtime[16].call(null, a); return make_cek_state (init, env, - kont_push(make_thread_frame(forms, env, jO, name), kont)); + kont_push(make_thread_frame(forms, env, jU, name), kont)); } function step_sf_lambda(args, env, kont){ return make_cek_value(sf_lambda(args, env), env, kont); } var - jP = [0, [2, 1.], 0], - jQ = [0, [2, 2.], 0], - jR = [0, [3, cst_keyword], 0], - jS = [0, [3, cst_value], 0], - jT = [2, 1.], - jU = [0, [2, 2.], 0]; + jV = [0, [2, 1.], 0], + jW = [0, [2, 2.], 0], + jX = [0, [3, cst_keyword], 0], + jY = [0, [3, cst_value], 0], + jZ = [2, 1.], + j0 = [0, [2, 2.], 0]; function step_sf_scope(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - rest_args = Sx_runtime[1].call(null, cst_slice, [0, args, jP]), - b = [0, Sx_runtime[24].call(null, rest_args), jQ], - and = Sx_runtime[1].call(null, cst$2, b); - if(Sx_types[67].call(null, and)){ + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + rest_args = Sx_runtime[2].call(null, cst_slice, [0, args, jV]), + b = [0, Sx_runtime[25].call(null, rest_args), jW], + and = Sx_runtime[2].call(null, cst$2, b); + if(Sx_types[71].call(null, and)){ var - c = Sx_runtime[14].call(null, rest_args), - d = [0, Sx_runtime[73].call(null, c), jR], - and$0 = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and$0)) + c = Sx_runtime[15].call(null, rest_args), + d = [0, Sx_runtime[74].call(null, c), jX], + and$0 = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and$0)) var - e = Sx_runtime[14].call(null, rest_args), - f = [0, Sx_types[69].call(null, e), jS], - a = Sx_runtime[1].call(null, cst, f); + e = Sx_runtime[15].call(null, rest_args), + f = [0, Sx_types[73].call(null, e), jY], + a = Sx_runtime[2].call(null, cst, f); else var a = and$0; } else var a = and; - if(Sx_types[67].call(null, a)) + if(Sx_types[71].call(null, a)) var - g = trampoline(eval_expr(Sx_runtime[17].call(null, rest_args, jT), env)), - body = Sx_runtime[1].call(null, cst_slice, [0, rest_args, jU]), + g = trampoline(eval_expr(Sx_runtime[18].call(null, rest_args, jZ), env)), + body = Sx_runtime[2].call(null, cst_slice, [0, rest_args, j0]), val = g; else var body = rest_args, val = 0; - var h = Sx_runtime[33].call(null, body); - if(Sx_types[67].call(null, h)) return make_cek_value(0, env, kont); + var h = Sx_runtime[34].call(null, body); + if(Sx_types[71].call(null, h)) return make_cek_value(0, env, kont); var i = kont_push - (make_scope_acc_frame(name, val, Sx_runtime[15].call(null, body), env), + (make_scope_acc_frame(name, val, Sx_runtime[16].call(null, body), env), kont); - return make_cek_state(Sx_runtime[14].call(null, body), env, i); + return make_cek_state(Sx_runtime[15].call(null, body), env, i); } - var jV = [2, 1.], jW = [0, [2, 2.], 0]; + var j1 = [2, 1.], j2 = [0, [2, 2.], 0]; function step_sf_provide(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - val = trampoline(eval_expr(Sx_runtime[17].call(null, args, jV), env)), - body = Sx_runtime[1].call(null, cst_slice, [0, args, jW]); - Sx_runtime[103].call(null, name, val); - var a = Sx_runtime[33].call(null, body); - if(Sx_types[67].call(null, a)){ - Sx_runtime[104].call(null, name); + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[18].call(null, args, j1), env)), + body = Sx_runtime[2].call(null, cst_slice, [0, args, j2]); + Sx_runtime[105].call(null, name, val); + var a = Sx_runtime[34].call(null, body); + if(Sx_types[71].call(null, a)){ + Sx_runtime[106].call(null, name); return make_cek_value(0, env, kont); } var b = kont_push - (make_provide_frame(name, val, Sx_runtime[15].call(null, body), env), + (make_provide_frame(name, val, Sx_runtime[16].call(null, body), env), kont); - return make_cek_state(Sx_runtime[14].call(null, body), env, b); + return make_cek_state(Sx_runtime[15].call(null, body), env, b); } - var jX = [0, [2, 2.], 0], jY = [2, 1.], jZ = [3, cst_value]; + var j3 = [0, [2, 2.], 0], j4 = [2, 1.], j5 = [3, cst_value]; function step_sf_context(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - a = [0, Sx_runtime[24].call(null, args), jX], - b = Sx_runtime[1].call(null, cst$2, a), + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + a = [0, Sx_runtime[25].call(null, args), j3], + b = Sx_runtime[2].call(null, cst$2, a), default_val = - Sx_types[67].call(null, b) - ? trampoline(eval_expr(Sx_runtime[17].call(null, args, jY), env)) + Sx_types[71].call(null, b) + ? trampoline(eval_expr(Sx_runtime[18].call(null, args, j4), env)) : 0, frame = kont_find_provide(kont, name); - if(Sx_types[67].call(null, bind_tracking_ref[1])){ + if(Sx_types[71].call(null, bind_tracking_ref[1])){ var c = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_contains, [0, bind_tracking_ref[1], [0, name, 0]]), - d = [0, 1 - Sx_types[67].call(null, c)]; - if(Sx_types[67].call(null, d)) + d = [0, 1 - Sx_types[71].call(null, c)]; + if(Sx_types[71].call(null, d)) bind_tracking_ref[1] = - Sx_runtime[10].call(null, bind_tracking_ref[1], name); + Sx_runtime[11].call(null, bind_tracking_ref[1], name); } var - sv = Sx_runtime[105].call(null, name), - e = Sx_runtime[83].call(null, sv), + sv = Sx_runtime[107].call(null, name), + e = Sx_runtime[84].call(null, sv), f = - Sx_types[67].call(null, e) + Sx_types[71].call(null, e) ? Sx_types - [67].call + [71].call (null, frame) - ? Sx_runtime[25].call(null, frame, jZ) + ? Sx_runtime[26].call(null, frame, j5) : default_val : sv; return make_cek_value(f, env, kont); } var - j0 = [0, [2, 2.], 0], - j1 = [2, 1.], - j2 = [3, cst_value], - j3 = [3, cst_peek], - j4 = [3, cst_peek]; + j6 = [0, [2, 2.], 0], + j7 = [2, 1.], + j8 = [3, cst_value], + j9 = [3, cst_peek], + j_ = [3, cst_peek]; function step_sf_peek(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - b = [0, Sx_runtime[24].call(null, args), j0], - c = Sx_runtime[1].call(null, cst$2, b), + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + b = [0, Sx_runtime[25].call(null, args), j6], + c = Sx_runtime[2].call(null, cst$2, b), default_val = - Sx_types[67].call(null, c) - ? trampoline(eval_expr(Sx_runtime[17].call(null, args, j1), env)) + Sx_types[71].call(null, c) + ? trampoline(eval_expr(Sx_runtime[18].call(null, args, j7), env)) : 0, frame = kont_find_provide(kont, name); - if(Sx_types[67].call(null, frame)) - var a = Sx_runtime[25].call(null, frame, j2); + if(Sx_types[71].call(null, frame)) + var a = Sx_runtime[26].call(null, frame, j8); else{ - var d = Sx_runtime[75].call(null, env, j3); - if(Sx_types[67].call(null, d)) + var d = Sx_runtime[76].call(null, env, j9); + if(Sx_types[71].call(null, d)) var - e = Sx_runtime[76].call(null, env, j4), - a = Sx_runtime[7].call(null, e, [6, [0, name, [0, default_val, 0]]]); + e = Sx_runtime[77].call(null, env, j_), + a = Sx_runtime[8].call(null, e, [6, [0, name, [0, default_val, 0]]]); else var a = default_val; } return make_cek_value(a, env, kont); } - var j5 = [2, 1.]; + var j$ = [2, 1.]; function step_sf_provide_b(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), a = kont_push(make_provide_set_frame(name, env), kont); - return make_cek_state(Sx_runtime[17].call(null, args, j5), env, a); + return make_cek_state(Sx_runtime[18].call(null, args, j$), env, a); } var cst_scope_emit = "scope-emit!", - j6 = [2, 1.], - j7 = [3, cst_emitted], - j8 = [3, cst_emitted], - j9 = [3, cst_scope_emit], - j_ = [3, cst_scope_emit]; + ka = [2, 1.], + kb = [3, cst_emitted], + kc = [3, cst_emitted], + kd = [3, cst_scope_emit], + ke = [3, cst_scope_emit]; function step_sf_emit(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), - val = trampoline(eval_expr(Sx_runtime[17].call(null, args, j6), env)), + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), + val = trampoline(eval_expr(Sx_runtime[18].call(null, args, ka), env)), frame = kont_find_scope_acc(kont, name); - if(Sx_types[67].call(null, frame)){ + if(Sx_types[71].call(null, frame)){ var - a = [0, Sx_runtime[25].call(null, frame, j7), [0, [6, [0, val, 0]], 0]], - b = Sx_runtime[1].call(null, cst_append, a); - Sx_runtime[11].call(null, frame, j8, b); + a = [0, Sx_runtime[26].call(null, frame, kb), [0, [6, [0, val, 0]], 0]], + b = Sx_runtime[2].call(null, cst_append, a); + Sx_runtime[12].call(null, frame, kc, b); return make_cek_value(0, env, kont); } - var c = Sx_runtime[75].call(null, env, j9); - if(Sx_types[67].call(null, c)){ - var d = Sx_runtime[76].call(null, env, j_); - Sx_runtime[7].call(null, d, [6, [0, name, [0, val, 0]]]); + var c = Sx_runtime[76].call(null, env, kd); + if(Sx_types[71].call(null, c)){ + var d = Sx_runtime[77].call(null, env, ke); + Sx_runtime[8].call(null, d, [6, [0, name, [0, val, 0]]]); } return make_cek_value(0, env, kont); } var - j$ = [3, cst_emitted], - ka = [3, cst_emitted], - kb = [3, cst_emitted], - kc = [6, 0]; + kf = [3, cst_emitted], + kg = [3, cst_emitted], + kh = [3, cst_emitted], + ki = [6, 0]; function step_sf_emitted(args, env, kont){ var - name = trampoline(eval_expr(Sx_runtime[14].call(null, args), env)), + name = trampoline(eval_expr(Sx_runtime[15].call(null, args), env)), frame = kont_find_scope_acc(kont, name); - if(Sx_types[67].call(null, frame)) - var a = Sx_runtime[25].call(null, frame, j$); + if(Sx_types[71].call(null, frame)) + var a = Sx_runtime[26].call(null, frame, kf); else{ - var b = Sx_runtime[75].call(null, env, ka); - if(Sx_types[67].call(null, b)) + var b = Sx_runtime[76].call(null, env, kg); + if(Sx_types[71].call(null, b)) var - c = Sx_runtime[76].call(null, env, kb), - a = Sx_runtime[7].call(null, c, [6, [0, name, 0]]); + c = Sx_runtime[77].call(null, env, kh), + a = Sx_runtime[8].call(null, c, [6, [0, name, 0]]); else - var a = kc; + var a = ki; } return make_cek_value(a, env, kont); } function step_sf_reset(args, env, kont){ var a = kont_push(make_reset_frame(env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var kd = [2, 1.], ke = [2, 1.]; + var kj = [2, 1.], kk = [2, 1.]; function step_sf_shift(args, env, kont){ var - a = Sx_runtime[14].call(null, args), - k_name = Sx_types[68].call(null, a), - body = Sx_runtime[17].call(null, args, kd), + a = Sx_runtime[15].call(null, args), + k_name = Sx_types[72].call(null, a), + body = Sx_runtime[18].call(null, args, kj), captured_result = kont_capture_to_reset(kont), - captured = Sx_runtime[14].call(null, captured_result), - rest_kont = Sx_runtime[17].call(null, captured_result, ke), - k = Sx_runtime[95].call(null, captured, rest_kont), - shift_env = Sx_runtime[80].call(null, env), - b = Sx_runtime[3].call(null, k_name); - Sx_runtime[77].call(null, shift_env, b, k); + captured = Sx_runtime[15].call(null, captured_result), + rest_kont = Sx_runtime[18].call(null, captured_result, kk), + k = Sx_runtime[96].call(null, captured, rest_kont), + shift_env = Sx_runtime[81].call(null, env), + b = Sx_runtime[4].call(null, k_name); + Sx_runtime[78].call(null, shift_env, b, k); return make_cek_state(body, shift_env, rest_kont); } function step_sf_deref(args, env, kont){ var a = kont_push(make_deref_frame(env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var kf = [6, 0], kg = [6, 0]; + var kl = [6, 0], km = [6, 0]; function cek_call(f, args){ var - b = Sx_runtime[83].call(null, args), - a = Sx_types[67].call(null, b) ? kf : args, - c = Sx_runtime[83].call(null, f); - if(Sx_types[67].call(null, c)) return 0; + b = Sx_runtime[84].call(null, args), + a = Sx_types[71].call(null, b) ? kl : args, + c = Sx_runtime[84].call(null, f); + if(Sx_types[71].call(null, c)) return 0; var - or = Sx_runtime[85].call(null, f), - or$0 = Sx_types[67].call(null, or) ? or : Sx_runtime[90].call(null, f); - return Sx_types[67].call(null, or$0) + or = Sx_runtime[86].call(null, f), + or$0 = Sx_types[71].call(null, or) ? or : Sx_runtime[91].call(null, f); + return Sx_types[71].call(null, or$0) ? cek_run - (continue_with_call(f, a, Sx_runtime[79].call(null, 0), a, kg)) + (continue_with_call(f, a, Sx_runtime[80].call(null, 0), a, km)) : 0; } var cst_update_fn = "update-fn", - kh = [2, 1.], - ki = [2, 2.], - kj = [3, cst_update_fn], - kk = [0, 0]; + kn = [2, 1.], + ko = [2, 2.], + kp = [3, cst_update_fn], + kq = [0, 0]; function reactive_shift_deref(sig, env, kont){ var scan_result = kont_capture_to_reactive_reset(kont), - captured_frames = Sx_runtime[14].call(null, scan_result), - reset_frame = Sx_runtime[17].call(null, scan_result, kh), - remaining_kont = Sx_runtime[17].call(null, scan_result, ki), - update_fn = Sx_runtime[25].call(null, reset_frame, kj), + captured_frames = Sx_runtime[15].call(null, scan_result), + reset_frame = Sx_runtime[18].call(null, scan_result, kn), + remaining_kont = Sx_runtime[18].call(null, scan_result, ko), + update_fn = Sx_runtime[26].call(null, reset_frame, kp), subscriber = [15, cst$9, function(args){ - var a = Sx_runtime[5].call(null, 0); + var a = Sx_runtime[6].call(null, 0); Stdlib_List[18].call(null, function(d){cek_call(d, 0); return 0;}, a); var - new_reset = make_reactive_reset_frame(env, update_fn, kk), + new_reset = make_reactive_reset_frame(env, update_fn, kq), new_kont = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_concat, [0, captured_frames, [0, [6, [0, new_reset, 0]], [0, remaining_kont, 0]]]); - return Sx_runtime[117].call + return Sx_runtime[119].call (null, [15, cst$9, function(args){ if(args && ! args[2]){ var d = args[1]; - Sx_runtime[10].call(null, 0, d); + Sx_runtime[11].call(null, 0, d); return 0; } return 0; @@ -56532,329 +63706,329 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(args){ return cek_run (make_cek_value - (Sx_runtime[114].call(null, sig), env, new_kont)); + (Sx_runtime[116].call(null, sig), env, new_kont)); }]); }]; - Sx_runtime[115].call(null, sig, subscriber); + Sx_runtime[117].call(null, sig, subscriber); var initial_kont = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_concat, [0, captured_frames, [0, [6, [0, reset_frame, 0]], [0, remaining_kont, 0]]]); - return make_cek_value(Sx_runtime[114].call(null, sig), env, initial_kont); + return make_cek_value(Sx_runtime[116].call(null, sig), env, initial_kont); } - var kl = [0, [3, cst_symbol], 0], km = [6, 0]; + var kr = [0, [3, cst_symbol], 0], ks = [6, 0]; function step_eval_call(head, args, env, kont){ var - a = [0, Sx_runtime[73].call(null, head), kl], - b = Sx_runtime[1].call(null, cst, a), - hname = Sx_types[67].call(null, b) ? Sx_types[68].call(null, head) : 0; + a = [0, Sx_runtime[74].call(null, head), kr], + b = Sx_runtime[2].call(null, cst, a), + hname = Sx_types[71].call(null, b) ? Sx_types[72].call(null, head) : 0; return make_cek_state (head, env, - kont_push(make_arg_frame(0, km, args, env, args, hname), kont)); + kont_push(make_arg_frame(0, ks, args, env, args, hname), kont)); } var - kn = [0, [3, cst_map], 0], - ko = [0, [3, cst_map_indexed], 0], - kp = [0, [3, cst_filter], 0], - kq = [0, [3, cst_reduce], 0], - kr = [0, [3, cst_some], 0], - ks = [0, [3, cst_every$0], 0], - kt = [0, [3, cst_for_each], 0]; + kt = [0, [3, cst_map], 0], + ku = [0, [3, cst_map_indexed], 0], + kv = [0, [3, cst_filter], 0], + kw = [0, [3, cst_reduce], 0], + kx = [0, [3, cst_some], 0], + ky = [0, [3, cst_every$0], 0], + kz = [0, [3, cst_for_each], 0]; function ho_form_name_p(name){ - var or = Sx_runtime[1].call(null, cst, [0, name, kn]); - if(Sx_types[67].call(null, or)) return or; - var or$0 = Sx_runtime[1].call(null, cst, [0, name, ko]); - if(Sx_types[67].call(null, or$0)) return or$0; - var or$1 = Sx_runtime[1].call(null, cst, [0, name, kp]); - if(Sx_types[67].call(null, or$1)) return or$1; - var or$2 = Sx_runtime[1].call(null, cst, [0, name, kq]); - if(Sx_types[67].call(null, or$2)) return or$2; - var or$3 = Sx_runtime[1].call(null, cst, [0, name, kr]); - if(Sx_types[67].call(null, or$3)) return or$3; - var or$4 = Sx_runtime[1].call(null, cst, [0, name, ks]); - return Sx_types[67].call(null, or$4) + var or = Sx_runtime[2].call(null, cst, [0, name, kt]); + if(Sx_types[71].call(null, or)) return or; + var or$0 = Sx_runtime[2].call(null, cst, [0, name, ku]); + if(Sx_types[71].call(null, or$0)) return or$0; + var or$1 = Sx_runtime[2].call(null, cst, [0, name, kv]); + if(Sx_types[71].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[2].call(null, cst, [0, name, kw]); + if(Sx_types[71].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[2].call(null, cst, [0, name, kx]); + if(Sx_types[71].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[2].call(null, cst, [0, name, ky]); + return Sx_types[71].call(null, or$4) ? or$4 - : Sx_runtime[1].call(null, cst, [0, name, kt]); + : Sx_runtime[2].call(null, cst, [0, name, kz]); } function ho_fn_p(v){ - var or = Sx_runtime[90].call(null, v); - return Sx_types[67].call(null, or) ? or : Sx_runtime[85].call(null, v); + var or = Sx_runtime[91].call(null, v); + return Sx_types[71].call(null, or) ? or : Sx_runtime[86].call(null, v); } - var ku = [0, [3, cst_reduce], 0], kv = [2, 1.], kw = [2, 2.], kx = [2, 1.]; + var kA = [0, [3, cst_reduce], 0], kB = [2, 1.], kC = [2, 2.], kD = [2, 1.]; function ho_swap_args(ho_type, evaled){ - var c = Sx_runtime[1].call(null, cst, [0, ho_type, ku]); - if(Sx_types[67].call(null, c)){ + var c = Sx_runtime[2].call(null, cst, [0, ho_type, kA]); + if(Sx_types[71].call(null, c)){ var - a = Sx_runtime[14].call(null, evaled), - b = Sx_runtime[17].call(null, evaled, kv), + a = Sx_runtime[15].call(null, evaled), + b = Sx_runtime[18].call(null, evaled, kB), d = ho_fn_p(a), - and = [0, 1 - Sx_types[67].call(null, d)], - e = Sx_types[67].call(null, and) ? ho_fn_p(b) : and; - return Sx_types[67].call(null, e) + and = [0, 1 - Sx_types[71].call(null, d)], + e = Sx_types[71].call(null, and) ? ho_fn_p(b) : and; + return Sx_types[71].call(null, e) ? [6, - [0, b, [0, Sx_runtime[17].call(null, evaled, kw), [0, a, 0]]]] + [0, b, [0, Sx_runtime[18].call(null, evaled, kC), [0, a, 0]]]] : evaled; } var - a$0 = Sx_runtime[14].call(null, evaled), - b$0 = Sx_runtime[17].call(null, evaled, kx), + a$0 = Sx_runtime[15].call(null, evaled), + b$0 = Sx_runtime[18].call(null, evaled, kD), f = ho_fn_p(a$0), - and$0 = [0, 1 - Sx_types[67].call(null, f)], - g = Sx_types[67].call(null, and$0) ? ho_fn_p(b$0) : and$0; - return Sx_types[67].call(null, g) ? [6, [0, b$0, [0, a$0, 0]]] : evaled; + and$0 = [0, 1 - Sx_types[71].call(null, f)], + g = Sx_types[71].call(null, and$0) ? ho_fn_p(b$0) : and$0; + return Sx_types[71].call(null, g) ? [6, [0, b$0, [0, a$0, 0]]] : evaled; } var - ky = [0, [3, cst_map], 0], - kz = [0, [2, 2.], 0], - kA = [6, 0], - kB = [6, 0], - kC = [6, 0], - kD = [2, 1.], - kE = [6, 0], - kF = [6, 0], + kE = [0, [3, cst_map], 0], + kF = [0, [2, 2.], 0], kG = [6, 0], - kH = [0, [3, cst_map_indexed], 0], - kI = [2, 1.], - kJ = [6, 0], + kH = [6, 0], + kI = [6, 0], + kJ = [2, 1.], kK = [6, 0], kL = [6, 0], - kM = [2, 0.], - kN = [0, [3, cst_filter], 0], + kM = [6, 0], + kN = [0, [3, cst_map_indexed], 0], kO = [2, 1.], kP = [6, 0], kQ = [6, 0], kR = [6, 0], - kS = [0, [3, cst_reduce], 0], - kT = [2, 1.], - kU = [2, 2.], + kS = [2, 0.], + kT = [0, [3, cst_filter], 0], + kU = [2, 1.], kV = [6, 0], - kW = [0, [3, cst_some], 0], - kX = [2, 1.], - kY = [0, 0], - kZ = [6, 0], - k0 = [0, [3, cst_every], 0], - k1 = [2, 1.], - k2 = [0, 1], - k3 = [6, 0], - k4 = [0, [3, cst_for_each], 0], - k5 = [2, 1.], - k6 = [6, 0], - k7 = [3, "Unknown HO type: "]; + kW = [6, 0], + kX = [6, 0], + kY = [0, [3, cst_reduce], 0], + kZ = [2, 1.], + k0 = [2, 2.], + k1 = [6, 0], + k2 = [0, [3, cst_some], 0], + k3 = [2, 1.], + k4 = [0, 0], + k5 = [6, 0], + k6 = [0, [3, cst_every], 0], + k7 = [2, 1.], + k8 = [0, 1], + k9 = [6, 0], + k_ = [0, [3, cst_for_each], 0], + k$ = [2, 1.], + la = [6, 0], + lb = [3, "Unknown HO type: "]; function ho_setup_dispatch(ho_type, evaled, env, kont){ var ordered = ho_swap_args(ho_type, evaled), - f = Sx_runtime[14].call(null, ordered), - a = Sx_runtime[1].call(null, cst, [0, ho_type, ky]); - if(Sx_types[67].call(null, a)){ + f = Sx_runtime[15].call(null, ordered), + a = Sx_runtime[2].call(null, cst, [0, ho_type, kE]); + if(Sx_types[71].call(null, a)){ var - b = [0, Sx_runtime[24].call(null, ordered), kz], - c = Sx_runtime[1].call(null, cst$0, b); - if(Sx_types[67].call(null, c)){ + b = [0, Sx_runtime[25].call(null, ordered), kF], + c = Sx_runtime[2].call(null, cst$0, b); + if(Sx_types[71].call(null, c)){ var - colls = Sx_runtime[15].call(null, ordered), - d = Sx_runtime[5].call(null, colls), + colls = Sx_runtime[16].call(null, ordered), + d = Sx_runtime[6].call(null, colls), e = [0, Stdlib_List[34].call (null, function(c){ - var a = Sx_runtime[33].call(null, c); - return Sx_types[67].call(null, a); + var a = Sx_runtime[34].call(null, c); + return Sx_types[71].call(null, a); }, d)]; - if(Sx_types[67].call(null, e)) return make_cek_value(kA, env, kont); + if(Sx_types[71].call(null, e)) return make_cek_value(kG, env, kont); var - g = Sx_runtime[5].call(null, colls), + g = Sx_runtime[6].call(null, colls), heads = [6, Stdlib_List[20].call - (null, function(c){return Sx_runtime[14].call(null, c);}, g)], - h = Sx_runtime[5].call(null, colls), + (null, function(c){return Sx_runtime[15].call(null, c);}, g)], + h = Sx_runtime[6].call(null, colls), tails = [6, Stdlib_List[20].call - (null, function(c){return Sx_runtime[15].call(null, c);}, h)]; + (null, function(c){return Sx_runtime[16].call(null, c);}, h)]; return continue_with_call (f, heads, env, - kC, - kont_push(make_multi_map_frame(f, tails, kB, env), kont)); + kI, + kont_push(make_multi_map_frame(f, tails, kH, env), kont)); } var - coll = seq_to_list(Sx_runtime[17].call(null, ordered, kD)), - i = Sx_runtime[33].call(null, coll); - if(Sx_types[67].call(null, i)) return make_cek_value(kE, env, kont); + coll = seq_to_list(Sx_runtime[18].call(null, ordered, kJ)), + i = Sx_runtime[34].call(null, coll); + if(Sx_types[71].call(null, i)) return make_cek_value(kK, env, kont); var j = kont_push - (make_map_frame(f, Sx_runtime[15].call(null, coll), kF, env), kont); + (make_map_frame(f, Sx_runtime[16].call(null, coll), kL, env), kont); return continue_with_call - (f, [6, [0, Sx_runtime[14].call(null, coll), 0]], env, kG, j); + (f, [6, [0, Sx_runtime[15].call(null, coll), 0]], env, kM, j); } - var k = Sx_runtime[1].call(null, cst, [0, ho_type, kH]); - if(Sx_types[67].call(null, k)){ + var k = Sx_runtime[2].call(null, cst, [0, ho_type, kN]); + if(Sx_types[71].call(null, k)){ var - coll$0 = seq_to_list(Sx_runtime[17].call(null, ordered, kI)), - l = Sx_runtime[33].call(null, coll$0); - if(Sx_types[67].call(null, l)) return make_cek_value(kJ, env, kont); + coll$0 = seq_to_list(Sx_runtime[18].call(null, ordered, kO)), + l = Sx_runtime[34].call(null, coll$0); + if(Sx_types[71].call(null, l)) return make_cek_value(kP, env, kont); var m = kont_push (make_map_indexed_frame - (f, Sx_runtime[15].call(null, coll$0), kK, env), + (f, Sx_runtime[16].call(null, coll$0), kQ, env), kont); return continue_with_call (f, - [6, [0, kM, [0, Sx_runtime[14].call(null, coll$0), 0]]], + [6, [0, kS, [0, Sx_runtime[15].call(null, coll$0), 0]]], env, - kL, + kR, m); } - var n = Sx_runtime[1].call(null, cst, [0, ho_type, kN]); - if(Sx_types[67].call(null, n)){ + var n = Sx_runtime[2].call(null, cst, [0, ho_type, kT]); + if(Sx_types[71].call(null, n)){ var - coll$1 = seq_to_list(Sx_runtime[17].call(null, ordered, kO)), - o = Sx_runtime[33].call(null, coll$1); - if(Sx_types[67].call(null, o)) return make_cek_value(kP, env, kont); + coll$1 = seq_to_list(Sx_runtime[18].call(null, ordered, kU)), + o = Sx_runtime[34].call(null, coll$1); + if(Sx_types[71].call(null, o)) return make_cek_value(kV, env, kont); var - p = Sx_runtime[14].call(null, coll$1), + p = Sx_runtime[15].call(null, coll$1), q = kont_push - (make_filter_frame(f, Sx_runtime[15].call(null, coll$1), kQ, p, env), + (make_filter_frame(f, Sx_runtime[16].call(null, coll$1), kW, p, env), kont); return continue_with_call - (f, [6, [0, Sx_runtime[14].call(null, coll$1), 0]], env, kR, q); + (f, [6, [0, Sx_runtime[15].call(null, coll$1), 0]], env, kX, q); } - var r = Sx_runtime[1].call(null, cst, [0, ho_type, kS]); - if(Sx_types[67].call(null, r)){ + var r = Sx_runtime[2].call(null, cst, [0, ho_type, kY]); + if(Sx_types[71].call(null, r)){ var - init = Sx_runtime[17].call(null, ordered, kT), - coll$2 = seq_to_list(Sx_runtime[17].call(null, ordered, kU)), - s = Sx_runtime[33].call(null, coll$2); - if(Sx_types[67].call(null, s)) return make_cek_value(init, env, kont); + init = Sx_runtime[18].call(null, ordered, kZ), + coll$2 = seq_to_list(Sx_runtime[18].call(null, ordered, k0)), + s = Sx_runtime[34].call(null, coll$2); + if(Sx_types[71].call(null, s)) return make_cek_value(init, env, kont); var t = kont_push - (make_reduce_frame(f, Sx_runtime[15].call(null, coll$2), env), kont); + (make_reduce_frame(f, Sx_runtime[16].call(null, coll$2), env), kont); return continue_with_call (f, - [6, [0, init, [0, Sx_runtime[14].call(null, coll$2), 0]]], + [6, [0, init, [0, Sx_runtime[15].call(null, coll$2), 0]]], env, - kV, + k1, t); } - var u = Sx_runtime[1].call(null, cst, [0, ho_type, kW]); - if(Sx_types[67].call(null, u)){ + var u = Sx_runtime[2].call(null, cst, [0, ho_type, k2]); + if(Sx_types[71].call(null, u)){ var - coll$3 = seq_to_list(Sx_runtime[17].call(null, ordered, kX)), - v = Sx_runtime[33].call(null, coll$3); - if(Sx_types[67].call(null, v)) return make_cek_value(kY, env, kont); + coll$3 = seq_to_list(Sx_runtime[18].call(null, ordered, k3)), + v = Sx_runtime[34].call(null, coll$3); + if(Sx_types[71].call(null, v)) return make_cek_value(k4, env, kont); var w = kont_push - (make_some_frame(f, Sx_runtime[15].call(null, coll$3), env), kont); + (make_some_frame(f, Sx_runtime[16].call(null, coll$3), env), kont); return continue_with_call - (f, [6, [0, Sx_runtime[14].call(null, coll$3), 0]], env, kZ, w); + (f, [6, [0, Sx_runtime[15].call(null, coll$3), 0]], env, k5, w); } - var x = Sx_runtime[1].call(null, cst, [0, ho_type, k0]); - if(Sx_types[67].call(null, x)){ + var x = Sx_runtime[2].call(null, cst, [0, ho_type, k6]); + if(Sx_types[71].call(null, x)){ var - coll$4 = seq_to_list(Sx_runtime[17].call(null, ordered, k1)), - y = Sx_runtime[33].call(null, coll$4); - if(Sx_types[67].call(null, y)) return make_cek_value(k2, env, kont); + coll$4 = seq_to_list(Sx_runtime[18].call(null, ordered, k7)), + y = Sx_runtime[34].call(null, coll$4); + if(Sx_types[71].call(null, y)) return make_cek_value(k8, env, kont); var z = kont_push - (make_every_frame(f, Sx_runtime[15].call(null, coll$4), env), kont); + (make_every_frame(f, Sx_runtime[16].call(null, coll$4), env), kont); return continue_with_call - (f, [6, [0, Sx_runtime[14].call(null, coll$4), 0]], env, k3, z); + (f, [6, [0, Sx_runtime[15].call(null, coll$4), 0]], env, k9, z); } - var A = Sx_runtime[1].call(null, cst, [0, ho_type, k4]); - if(! Sx_types[67].call(null, A)){ + var A = Sx_runtime[2].call(null, cst, [0, ho_type, k_]); + if(! Sx_types[71].call(null, A)){ var - D = [3, Sx_runtime[4].call(null, [0, k7, [0, ho_type, 0]])], - E = Sx_runtime[2].call(null, D); + D = [3, Sx_runtime[5].call(null, [0, lb, [0, ho_type, 0]])], + E = Sx_runtime[3].call(null, D); throw caml_maybe_attach_backtrace([0, Sx_types[9], E], 1); } var - coll$5 = seq_to_list(Sx_runtime[17].call(null, ordered, k5)), - B = Sx_runtime[33].call(null, coll$5); - if(Sx_types[67].call(null, B)) return make_cek_value(0, env, kont); + coll$5 = seq_to_list(Sx_runtime[18].call(null, ordered, k$)), + B = Sx_runtime[34].call(null, coll$5); + if(Sx_types[71].call(null, B)) return make_cek_value(0, env, kont); var C = kont_push - (make_for_each_frame(f, Sx_runtime[15].call(null, coll$5), env), kont); + (make_for_each_frame(f, Sx_runtime[16].call(null, coll$5), env), kont); return continue_with_call - (f, [6, [0, Sx_runtime[14].call(null, coll$5), 0]], env, k6, C); + (f, [6, [0, Sx_runtime[15].call(null, coll$5), 0]], env, la, C); } - var k8 = [6, 0], k9 = [3, cst_map]; + var lc = [6, 0], ld = [3, cst_map]; function step_ho_map(args, env, kont){ var a = kont_push - (make_ho_setup_frame(k9, Sx_runtime[15].call(null, args), k8, env), + (make_ho_setup_frame(ld, Sx_runtime[16].call(null, args), lc, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var k_ = [6, 0], k$ = [3, cst_map_indexed]; + var le = [6, 0], lf = [3, cst_map_indexed]; function step_ho_map_indexed(args, env, kont){ var a = kont_push - (make_ho_setup_frame(k$, Sx_runtime[15].call(null, args), k_, env), + (make_ho_setup_frame(lf, Sx_runtime[16].call(null, args), le, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var la = [6, 0], lb = [3, cst_filter]; + var lg = [6, 0], lh = [3, cst_filter]; function step_ho_filter(args, env, kont){ var a = kont_push - (make_ho_setup_frame(lb, Sx_runtime[15].call(null, args), la, env), + (make_ho_setup_frame(lh, Sx_runtime[16].call(null, args), lg, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var lc = [6, 0], ld = [3, cst_reduce]; + var li = [6, 0], lj = [3, cst_reduce]; function step_ho_reduce(args, env, kont){ var a = kont_push - (make_ho_setup_frame(ld, Sx_runtime[15].call(null, args), lc, env), + (make_ho_setup_frame(lj, Sx_runtime[16].call(null, args), li, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var le = [6, 0], lf = [3, cst_some]; + var lk = [6, 0], ll = [3, cst_some]; function step_ho_some(args, env, kont){ var a = kont_push - (make_ho_setup_frame(lf, Sx_runtime[15].call(null, args), le, env), + (make_ho_setup_frame(ll, Sx_runtime[16].call(null, args), lk, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var lg = [6, 0], lh = [3, cst_every]; + var lm = [6, 0], ln = [3, cst_every]; function step_ho_every(args, env, kont){ var a = kont_push - (make_ho_setup_frame(lh, Sx_runtime[15].call(null, args), lg, env), + (make_ho_setup_frame(ln, Sx_runtime[16].call(null, args), lm, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } - var li = [6, 0], lj = [3, cst_for_each]; + var lo = [6, 0], lp = [3, cst_for_each]; function step_ho_for_each(args, env, kont){ var a = kont_push - (make_ho_setup_frame(lj, Sx_runtime[15].call(null, args), li, env), + (make_ho_setup_frame(lp, Sx_runtime[16].call(null, args), lo, env), kont); - return make_cek_state(Sx_runtime[14].call(null, args), env, a); + return make_cek_state(Sx_runtime[15].call(null, args), env, a); } var cst_vm_suspended = "__vm_suspended", @@ -56867,608 +64041,608 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cst_scheme = "scheme", cst_subscribers = "subscribers", last_error_kont_ref = [0, 0], - lk = [0, [3, cst_if], 0], - ll = [3, cst_env], - lm = [3, "then"], - ln = [3, cst_else], - lo = [3, cst_env], - lp = [3, cst_else], - lq = [0, [3, cst_when], 0], - lr = [3, cst_body], - ls = [3, cst_env], - lt = [0, [2, 1.], 0], - lu = [0, [3, cst_begin], 0], - lv = [3, cst_remaining], - lw = [3, cst_env], - lx = [0, [2, 1.], 0], - ly = [0, [3, cst_let], 0], - lz = [3, cst_name], - lA = [3, cst_remaining], - lB = [3, cst_body], + lq = [0, [3, cst_if], 0], + lr = [3, cst_env], + ls = [3, "then"], + lt = [3, cst_else], + lu = [3, cst_env], + lv = [3, cst_else], + lw = [0, [3, cst_when], 0], + lx = [3, cst_body], + ly = [3, cst_env], + lz = [0, [2, 1.], 0], + lA = [0, [3, cst_begin], 0], + lB = [3, cst_remaining], lC = [3, cst_env], - lD = [0, [3, cst_symbol], 0], - lE = [2, 1.], - lF = [0, [3, cst_define], 0], - lG = [3, cst_name], - lH = [3, cst_env], - lI = [3, "has-effects"], - lJ = [3, "effect-list"], - lK = [0, [3, cst_symbol], 0], - lL = [3, cst_effect_annotations], - lM = [3, cst_effect_annotations], - lN = [3, cst_effect_annotations], - lO = [0, [3, cst_define_foreign], 0], - lP = [3, cst_name], - lQ = [3, cst_env], - lR = [0, [3, cst_set], 0], - lS = [3, cst_name], - lT = [3, cst_env], - lU = [0, [3, cst_and], 0], - lV = [3, cst_remaining], - lW = [0, [2, 1.], 0], - lX = [3, cst_env], - lY = [3, cst_env], - lZ = [0, [3, cst_or], 0], - l0 = [3, cst_remaining], - l1 = [0, 0], + lD = [0, [2, 1.], 0], + lE = [0, [3, cst_let], 0], + lF = [3, cst_name], + lG = [3, cst_remaining], + lH = [3, cst_body], + lI = [3, cst_env], + lJ = [0, [3, cst_symbol], 0], + lK = [2, 1.], + lL = [0, [3, cst_define], 0], + lM = [3, cst_name], + lN = [3, cst_env], + lO = [3, "has-effects"], + lP = [3, "effect-list"], + lQ = [0, [3, cst_symbol], 0], + lR = [3, cst_effect_annotations], + lS = [3, cst_effect_annotations], + lT = [3, cst_effect_annotations], + lU = [0, [3, cst_define_foreign], 0], + lV = [3, cst_name], + lW = [3, cst_env], + lX = [0, [3, cst_set], 0], + lY = [3, cst_name], + lZ = [3, cst_env], + l0 = [0, [3, cst_and], 0], + l1 = [3, cst_remaining], l2 = [0, [2, 1.], 0], l3 = [3, cst_env], l4 = [3, cst_env], - l5 = [0, [3, cst_cond], 0], + l5 = [0, [3, cst_or], 0], l6 = [3, cst_remaining], - l7 = [3, cst_env], - l8 = [3, cst_scheme], - l9 = [0, [2, 2.], 0], - l_ = [0, [3, cst_symbol], 0], - l$ = [2, 1.], - ma = [0, [3, cst$10], 0], - mb = [2, 1.], - mc = [2, 2.], - md = [2, 1.], - me = [2, 1.], - mf = [0, 1], - mg = [2, 1.], - mh = [2, 2.], - mi = [0, [2, 2.], 0], + l7 = [0, 0], + l8 = [0, [2, 1.], 0], + l9 = [3, cst_env], + l_ = [3, cst_env], + l$ = [0, [3, cst_cond], 0], + ma = [3, cst_remaining], + mb = [3, cst_env], + mc = [3, cst_scheme], + md = [0, [2, 2.], 0], + me = [0, [3, cst_symbol], 0], + mf = [2, 1.], + mg = [0, [3, cst$10], 0], + mh = [2, 1.], + mi = [2, 2.], mj = [2, 1.], - mk = [0, 0], - ml = [0, [3, cst_case], 0], - mm = [3, cst_match_val], - mn = [3, cst_remaining], - mo = [3, cst_env], - mp = [0, [3, cst_thread], 0], - mq = [3, cst_remaining], - mr = [3, cst_env], - ms = [3, "extra"], - mt = [3, cst_name], - mu = [0, [3, cst_as], 0], - mv = [0, [3, cst_list], 0], - mw = [0, [3, cst_symbol], 0], - mx = [4, cst_quote], - my = [0, [3, cst_last], 0], - mz = [0, [3, cst_arg], 0], - mA = [3, cst_f], - mB = [3, cst_evaled], - mC = [3, cst_remaining], - mD = [3, cst_env], - mE = [3, "raw-args"], - mF = [3, "head-name"], - mG = [6, 0], - mH = [6, 0], - mI = [6, 0], - mJ = [0, [3, cst_dict], 0], - mK = [3, cst_remaining], - mL = [3, cst_results], - mM = [3, cst_env], - mN = [2, 0.], - mO = [2, 1.], - mP = [2, 1.], - mQ = [0, [3, cst_ho_setup], 0], - mR = [3, "ho-type"], - mS = [3, cst_remaining], - mT = [3, cst_evaled], - mU = [3, cst_env], - mV = [0, [3, cst_reset], 0], - mW = [0, [3, cst_deref], 0], - mX = [3, cst_env], - mY = [3, "sx-reactive"], - mZ = [3, "deps"], - m0 = [3, "notify"], - m1 = [0, [3, cst_reactive_reset], 0], - m2 = [3, cst_update_fn], - m3 = [3, "first-render"], - m4 = [0, [3, cst_scope], 0], - m5 = [3, cst_name], - m6 = [3, cst_remaining], - m7 = [3, cst_env], - m8 = [0, [3, cst_provide], 0], - m9 = [3, cst_remaining], - m_ = [3, cst_env], + mk = [2, 1.], + ml = [0, 1], + mm = [2, 1.], + mn = [2, 2.], + mo = [0, [2, 2.], 0], + mp = [2, 1.], + mq = [0, 0], + mr = [0, [3, cst_case], 0], + ms = [3, cst_match_val], + mt = [3, cst_remaining], + mu = [3, cst_env], + mv = [0, [3, cst_thread], 0], + mw = [3, cst_remaining], + mx = [3, cst_env], + my = [3, "extra"], + mz = [3, cst_name], + mA = [0, [3, cst_as], 0], + mB = [0, [3, cst_list], 0], + mC = [0, [3, cst_symbol], 0], + mD = [4, cst_quote], + mE = [0, [3, cst_last], 0], + mF = [0, [3, cst_arg], 0], + mG = [3, cst_f], + mH = [3, cst_evaled], + mI = [3, cst_remaining], + mJ = [3, cst_env], + mK = [3, "raw-args"], + mL = [3, "head-name"], + mM = [6, 0], + mN = [6, 0], + mO = [6, 0], + mP = [0, [3, cst_dict], 0], + mQ = [3, cst_remaining], + mR = [3, cst_results], + mS = [3, cst_env], + mT = [2, 0.], + mU = [2, 1.], + mV = [2, 1.], + mW = [0, [3, cst_ho_setup], 0], + mX = [3, "ho-type"], + mY = [3, cst_remaining], + mZ = [3, cst_evaled], + m0 = [3, cst_env], + m1 = [0, [3, cst_reset], 0], + m2 = [0, [3, cst_deref], 0], + m3 = [3, cst_env], + m4 = [3, "sx-reactive"], + m5 = [3, "deps"], + m6 = [3, "notify"], + m7 = [0, [3, cst_reactive_reset], 0], + m8 = [3, cst_update_fn], + m9 = [3, "first-render"], + m_ = [0, [3, cst_scope], 0], m$ = [3, cst_name], - na = [3, cst_value], - nb = [3, cst_name], - nc = [3, cst_subscribers], - nd = [3, cst_subscribers], - ne = [0, [3, cst_bind], 0], - nf = [3, cst_body], - ng = [3, cst_env], - nh = [3, "prev-tracking"], - ni = [6, 0], - nj = [6, 0], - nk = [0, [3, cst_provide_set], 0], - nl = [3, cst_name], + na = [3, cst_remaining], + nb = [3, cst_env], + nc = [0, [3, cst_provide], 0], + nd = [3, cst_remaining], + ne = [3, cst_env], + nf = [3, cst_name], + ng = [3, cst_value], + nh = [3, cst_name], + ni = [3, cst_subscribers], + nj = [3, cst_subscribers], + nk = [0, [3, cst_bind], 0], + nl = [3, cst_body], nm = [3, cst_env], - nn = [3, cst_value], - no = [3, cst_value], - np = [0, [3, cst_scope_acc], 0], - nq = [3, cst_remaining], - nr = [3, cst_env], - ns = [3, cst_value], - nt = [3, cst_name], - nu = [3, cst_emitted], - nv = [3, cst_emitted], - nw = [0, [3, cst_map], 0], - nx = [3, cst_f], - ny = [3, cst_remaining], - nz = [3, cst_results], - nA = [3, "indexed"], - nB = [3, cst_env], - nC = [6, 0], - nD = [0, [3, cst_filter], 0], - nE = [3, cst_f], - nF = [3, cst_remaining], - nG = [3, cst_results], - nH = [3, "current-item"], - nI = [3, cst_env], - nJ = [6, 0], - nK = [0, [3, cst_reduce], 0], - nL = [3, cst_f], - nM = [3, cst_remaining], - nN = [3, cst_env], - nO = [6, 0], - nP = [0, [3, cst_for_each], 0], - nQ = [3, cst_f], - nR = [3, cst_remaining], - nS = [3, cst_env], - nT = [6, 0], - nU = [0, [3, cst_some], 0], - nV = [3, cst_f], - nW = [3, cst_remaining], - nX = [3, cst_env], - nY = [0, 0], + nn = [3, "prev-tracking"], + no = [6, 0], + np = [6, 0], + nq = [0, [3, cst_provide_set], 0], + nr = [3, cst_name], + ns = [3, cst_env], + nt = [3, cst_value], + nu = [3, cst_value], + nv = [0, [3, cst_scope_acc], 0], + nw = [3, cst_remaining], + nx = [3, cst_env], + ny = [3, cst_value], + nz = [3, cst_name], + nA = [3, cst_emitted], + nB = [3, cst_emitted], + nC = [0, [3, cst_map], 0], + nD = [3, cst_f], + nE = [3, cst_remaining], + nF = [3, cst_results], + nG = [3, "indexed"], + nH = [3, cst_env], + nI = [6, 0], + nJ = [0, [3, cst_filter], 0], + nK = [3, cst_f], + nL = [3, cst_remaining], + nM = [3, cst_results], + nN = [3, "current-item"], + nO = [3, cst_env], + nP = [6, 0], + nQ = [0, [3, cst_reduce], 0], + nR = [3, cst_f], + nS = [3, cst_remaining], + nT = [3, cst_env], + nU = [6, 0], + nV = [0, [3, cst_for_each], 0], + nW = [3, cst_f], + nX = [3, cst_remaining], + nY = [3, cst_env], nZ = [6, 0], - n0 = [0, [3, cst_every], 0], + n0 = [0, [3, cst_some], 0], n1 = [3, cst_f], n2 = [3, cst_remaining], n3 = [3, cst_env], n4 = [0, 0], - n5 = [0, 1], - n6 = [6, 0], - n7 = [0, [3, cst_handler], 0], + n5 = [6, 0], + n6 = [0, [3, cst_every], 0], + n7 = [3, cst_f], n8 = [3, cst_remaining], n9 = [3, cst_env], - n_ = [3, cst_f], - n$ = [0, [3, cst_restart], 0], - oa = [0, [3, cst_signal_return], 0], - ob = [3, "saved-kont"], - oc = [3, cst_env], - od = [0, [3, cst_comp_trace], 0], - oe = [0, [3, cst_cond_arrow], 0], - of = [3, cst_match_val], - og = [3, cst_env], - oh = [0, [3, cst_wind_after], 0], - oi = [3, cst_after_thunk], - oj = [3, cst_winders_len], - ok = [3, cst_env], - ol = [6, 0], - om = [6, 0], - on = [0, [3, cst_wind_return], 0], - oo = [3, cst_env], - op = [3, "body-result"], - oq = [0, [3, cst_raise_eval], 0], - or = [3, cst_env], - os = [3, cst_scheme], - ot = [3, cst_handler], - ou = [3, cst_kont], - ov = [3, "Unhandled exception: "], - ow = [0, [3, cst_raise_guard], 0], - ox = [3, "exception handler returned from non-continuable raise"], - oy = [0, [3, cst_multi_map], 0], - oz = [3, cst_f], - oA = [3, cst_remaining], - oB = [3, cst_results], - oC = [3, cst_env], - oD = [6, 0], - oE = [0, [3, cst_callcc], 0], - oF = [3, cst_env], - oG = [0, [3, cst_vm_resume], 0], - oH = [3, cst_f], - oI = [3, cst_vm_suspended], - oJ = [3, cst_env], - oK = [3, cst_resume], + n_ = [0, 0], + n$ = [0, 1], + oa = [6, 0], + ob = [0, [3, cst_handler], 0], + oc = [3, cst_remaining], + od = [3, cst_env], + oe = [3, cst_f], + of = [0, [3, cst_restart], 0], + og = [0, [3, cst_signal_return], 0], + oh = [3, "saved-kont"], + oi = [3, cst_env], + oj = [0, [3, cst_comp_trace], 0], + ok = [0, [3, cst_cond_arrow], 0], + ol = [3, cst_match_val], + om = [3, cst_env], + on = [0, [3, cst_wind_after], 0], + oo = [3, cst_after_thunk], + op = [3, cst_winders_len], + oq = [3, cst_env], + or = [6, 0], + os = [6, 0], + ot = [0, [3, cst_wind_return], 0], + ou = [3, cst_env], + ov = [3, "body-result"], + ow = [0, [3, cst_raise_eval], 0], + ox = [3, cst_env], + oy = [3, cst_scheme], + oz = [3, cst_handler], + oA = [3, cst_kont], + oB = [3, "Unhandled exception: "], + oC = [0, [3, cst_raise_guard], 0], + oD = [3, "exception handler returned from non-continuable raise"], + oE = [0, [3, cst_multi_map], 0], + oF = [3, cst_f], + oG = [3, cst_remaining], + oH = [3, cst_results], + oI = [3, cst_env], + oJ = [6, 0], + oK = [0, [3, cst_callcc], 0], oL = [3, cst_env], - oM = [3, cst_request], - oN = [3, cst_env], - oO = [0, [3, cst_perform], 0], + oM = [0, [3, cst_vm_resume], 0], + oN = [3, cst_f], + oO = [3, cst_vm_suspended], oP = [3, cst_env], - oQ = [0, [3, cst_import], 0], - oR = [3, cst_args], - oS = [3, cst_remaining], + oQ = [3, cst_resume], + oR = [3, cst_env], + oS = [3, cst_request], oT = [3, cst_env], - oU = [0, [3, cst_parameterize], 0], - oV = [3, cst_remaining], - oW = [3, cst_f], - oX = [3, cst_results], - oY = [3, cst_body], + oU = [0, [3, cst_perform], 0], + oV = [3, cst_env], + oW = [0, [3, cst_import], 0], + oX = [3, cst_args], + oY = [3, cst_remaining], oZ = [3, cst_env], - o0 = [2, 1.], - o1 = [0, [2, 1.], 0], - o2 = [4, cst_begin], - o3 = [3, "Unknown frame type: "]; + o0 = [0, [3, cst_parameterize], 0], + o1 = [3, cst_remaining], + o2 = [3, cst_f], + o3 = [3, cst_results], + o4 = [3, cst_body], + o5 = [3, cst_env], + o6 = [2, 1.], + o7 = [0, [2, 1.], 0], + o8 = [4, cst_begin], + o9 = [3, "Unknown frame type: "]; function step_continue(state){ var converted_val = cek_value(state), env = cek_env(state), kont = cek_kont(state), i = kont_empty_p(kont); - if(Sx_types[67].call(null, i)) return state; + if(Sx_types[71].call(null, i)) return state; var frame = kont_top(kont), rest_k = kont_pop(kont), match_val = frame_type(frame), - j = Sx_runtime[1].call(null, cst, [0, match_val, lk]); - if(Sx_types[67].call(null, j)){ - if(Sx_types[67].call(null, converted_val)) + j = Sx_runtime[2].call(null, cst, [0, match_val, lq]); + if(Sx_types[71].call(null, j)){ + if(Sx_types[71].call(null, converted_val)) var - l = Sx_runtime[83].call(null, converted_val), - c = [0, 1 - Sx_types[67].call(null, l)]; + l = Sx_runtime[84].call(null, converted_val), + c = [0, 1 - Sx_types[71].call(null, l)]; else var c = converted_val; - if(Sx_types[67].call(null, c)){ - var m = Sx_runtime[25].call(null, frame, ll); - return make_cek_state(Sx_runtime[25].call(null, frame, lm), m, rest_k); + if(Sx_types[71].call(null, c)){ + var m = Sx_runtime[26].call(null, frame, lr); + return make_cek_state(Sx_runtime[26].call(null, frame, ls), m, rest_k); } var - n = Sx_runtime[25].call(null, frame, ln), - o = Sx_runtime[83].call(null, n); - if(Sx_types[67].call(null, o)) return make_cek_value(0, env, rest_k); - var p = Sx_runtime[25].call(null, frame, lo); - return make_cek_state(Sx_runtime[25].call(null, frame, lp), p, rest_k); + n = Sx_runtime[26].call(null, frame, lt), + o = Sx_runtime[84].call(null, n); + if(Sx_types[71].call(null, o)) return make_cek_value(0, env, rest_k); + var p = Sx_runtime[26].call(null, frame, lu); + return make_cek_state(Sx_runtime[26].call(null, frame, lv), p, rest_k); } - var q = Sx_runtime[1].call(null, cst, [0, match_val, lq]); - if(Sx_types[67].call(null, q)){ - if(Sx_types[67].call(null, converted_val)) + var q = Sx_runtime[2].call(null, cst, [0, match_val, lw]); + if(Sx_types[71].call(null, q)){ + if(Sx_types[71].call(null, converted_val)) var - r = Sx_runtime[83].call(null, converted_val), - e = [0, 1 - Sx_types[67].call(null, r)]; + r = Sx_runtime[84].call(null, converted_val), + e = [0, 1 - Sx_types[71].call(null, r)]; else var e = converted_val; - if(! Sx_types[67].call(null, e)) return make_cek_value(0, env, rest_k); + if(! Sx_types[71].call(null, e)) return make_cek_value(0, env, rest_k); var - body = Sx_runtime[25].call(null, frame, lr), - fenv = Sx_runtime[25].call(null, frame, ls), - s = Sx_runtime[33].call(null, body); - if(Sx_types[67].call(null, s)) return make_cek_value(0, fenv, rest_k); + body = Sx_runtime[26].call(null, frame, lx), + fenv = Sx_runtime[26].call(null, frame, ly), + s = Sx_runtime[34].call(null, body); + if(Sx_types[71].call(null, s)) return make_cek_value(0, fenv, rest_k); var - t = [0, Sx_runtime[24].call(null, body), lt], - u = Sx_runtime[1].call(null, cst, t); - if(Sx_types[67].call(null, u)) - return make_cek_state(Sx_runtime[14].call(null, body), fenv, rest_k); + t = [0, Sx_runtime[25].call(null, body), lz], + u = Sx_runtime[2].call(null, cst, t); + if(Sx_types[71].call(null, u)) + return make_cek_state(Sx_runtime[15].call(null, body), fenv, rest_k); var v = kont_push - (make_begin_frame(Sx_runtime[15].call(null, body), fenv), rest_k); - return make_cek_state(Sx_runtime[14].call(null, body), fenv, v); + (make_begin_frame(Sx_runtime[16].call(null, body), fenv), rest_k); + return make_cek_state(Sx_runtime[15].call(null, body), fenv, v); } - var w = Sx_runtime[1].call(null, cst, [0, match_val, lu]); - if(Sx_types[67].call(null, w)){ + var w = Sx_runtime[2].call(null, cst, [0, match_val, lA]); + if(Sx_types[71].call(null, w)){ var - remaining = Sx_runtime[25].call(null, frame, lv), - fenv$0 = Sx_runtime[25].call(null, frame, lw), - x = Sx_runtime[33].call(null, remaining); - if(Sx_types[67].call(null, x)) + remaining = Sx_runtime[26].call(null, frame, lB), + fenv$0 = Sx_runtime[26].call(null, frame, lC), + x = Sx_runtime[34].call(null, remaining); + if(Sx_types[71].call(null, x)) return make_cek_value(converted_val, fenv$0, rest_k); var - y = [0, Sx_runtime[24].call(null, remaining), lx], - z = Sx_runtime[1].call(null, cst, y); - if(Sx_types[67].call(null, z)) + y = [0, Sx_runtime[25].call(null, remaining), lD], + z = Sx_runtime[2].call(null, cst, y); + if(Sx_types[71].call(null, z)) return make_cek_state - (Sx_runtime[14].call(null, remaining), fenv$0, rest_k); + (Sx_runtime[15].call(null, remaining), fenv$0, rest_k); var A = kont_push - (make_begin_frame(Sx_runtime[15].call(null, remaining), fenv$0), + (make_begin_frame(Sx_runtime[16].call(null, remaining), fenv$0), rest_k); - return make_cek_state(Sx_runtime[14].call(null, remaining), fenv$0, A); + return make_cek_state(Sx_runtime[15].call(null, remaining), fenv$0, A); } - var B = Sx_runtime[1].call(null, cst, [0, match_val, ly]); - if(Sx_types[67].call(null, B)){ + var B = Sx_runtime[2].call(null, cst, [0, match_val, lE]); + if(Sx_types[71].call(null, B)){ var - name = Sx_runtime[25].call(null, frame, lz), - remaining$0 = Sx_runtime[25].call(null, frame, lA), - body$0 = Sx_runtime[25].call(null, frame, lB), - local = Sx_runtime[25].call(null, frame, lC), - C = Sx_runtime[3].call(null, name); - Sx_runtime[77].call(null, local, C, converted_val); - var D = Sx_runtime[33].call(null, remaining$0); - if(Sx_types[67].call(null, D)) + name = Sx_runtime[26].call(null, frame, lF), + remaining$0 = Sx_runtime[26].call(null, frame, lG), + body$0 = Sx_runtime[26].call(null, frame, lH), + local = Sx_runtime[26].call(null, frame, lI), + C = Sx_runtime[4].call(null, name); + Sx_runtime[78].call(null, local, C, converted_val); + var D = Sx_runtime[34].call(null, remaining$0); + if(Sx_types[71].call(null, D)) return step_sf_begin(body$0, local, rest_k); var - next_binding = Sx_runtime[14].call(null, remaining$0), - E = Sx_runtime[14].call(null, next_binding), - F = [0, Sx_runtime[73].call(null, E), lD], - G = Sx_runtime[1].call(null, cst, F); - if(Sx_types[67].call(null, G)) + next_binding = Sx_runtime[15].call(null, remaining$0), + E = Sx_runtime[15].call(null, next_binding), + F = [0, Sx_runtime[74].call(null, E), lJ], + G = Sx_runtime[2].call(null, cst, F); + if(Sx_types[71].call(null, G)) var - H = Sx_runtime[14].call(null, next_binding), - vname = Sx_types[68].call(null, H); + H = Sx_runtime[15].call(null, next_binding), + vname = Sx_types[72].call(null, H); else - var vname = Sx_runtime[14].call(null, next_binding); + var vname = Sx_runtime[15].call(null, next_binding); var I = kont_push (make_let_frame - (vname, Sx_runtime[15].call(null, remaining$0), body$0, local), + (vname, Sx_runtime[16].call(null, remaining$0), body$0, local), rest_k); return make_cek_state - (Sx_runtime[17].call(null, next_binding, lE), local, I); + (Sx_runtime[18].call(null, next_binding, lK), local, I); } - var J = Sx_runtime[1].call(null, cst, [0, match_val, lF]); - if(Sx_types[67].call(null, J)){ + var J = Sx_runtime[2].call(null, cst, [0, match_val, lL]); + if(Sx_types[71].call(null, J)){ var - name$0 = Sx_runtime[25].call(null, frame, lG), - fenv$1 = Sx_runtime[25].call(null, frame, lH), - has_effects = Sx_runtime[25].call(null, frame, lI), - effect_list = Sx_runtime[25].call(null, frame, lJ), - and = Sx_runtime[85].call(null, converted_val); - if(Sx_types[67].call(null, and)) + name$0 = Sx_runtime[26].call(null, frame, lM), + fenv$1 = Sx_runtime[26].call(null, frame, lN), + has_effects = Sx_runtime[26].call(null, frame, lO), + effect_list = Sx_runtime[26].call(null, frame, lP), + and = Sx_runtime[86].call(null, converted_val); + if(Sx_types[71].call(null, and)) var - K = Sx_types[73].call(null, converted_val), - g = Sx_runtime[83].call(null, K); + K = Sx_types[77].call(null, converted_val), + g = Sx_runtime[84].call(null, K); else var g = and; - if(Sx_types[67].call(null, g)){ - var L = Sx_runtime[3].call(null, name$0); - Sx_runtime[82].call(null, converted_val, L); + if(Sx_types[71].call(null, g)){ + var L = Sx_runtime[4].call(null, name$0); + Sx_runtime[83].call(null, converted_val, L); } - var M = Sx_runtime[3].call(null, name$0); - Sx_runtime[77].call(null, fenv$1, M, converted_val); - if(Sx_types[67].call(null, has_effects)){ + var M = Sx_runtime[4].call(null, name$0); + Sx_runtime[78].call(null, fenv$1, M, converted_val); + if(Sx_types[71].call(null, has_effects)){ var - N = Sx_runtime[5].call(null, effect_list), + N = Sx_runtime[6].call(null, effect_list), effect_names = [6, Stdlib_List[20].call (null, function(e){ var - a = [0, Sx_runtime[73].call(null, e), lK], - b = Sx_runtime[1].call(null, cst, a); - return Sx_types[67].call(null, b) - ? Sx_types[68].call(null, e) + a = [0, Sx_runtime[74].call(null, e), lQ], + b = Sx_runtime[2].call(null, cst, a); + return Sx_types[71].call(null, b) + ? Sx_types[72].call(null, e) : e; }, N)], - O = Sx_runtime[75].call(null, fenv$1, lL), + O = Sx_runtime[76].call(null, fenv$1, lR), effect_anns = - Sx_types[67].call(null, O) - ? Sx_runtime[76].call(null, fenv$1, lM) + Sx_types[71].call(null, O) + ? Sx_runtime[77].call(null, fenv$1, lS) : [7, Stdlib_Hashtbl[1].call(null, 0, 0)]; - Sx_runtime[11].call(null, effect_anns, name$0, effect_names); - var P = Sx_runtime[3].call(null, lN); - Sx_runtime[77].call(null, fenv$1, P, effect_anns); + Sx_runtime[12].call(null, effect_anns, name$0, effect_names); + var P = Sx_runtime[4].call(null, lT); + Sx_runtime[78].call(null, fenv$1, P, effect_anns); } return make_cek_value(converted_val, fenv$1, rest_k); } - var Q = Sx_runtime[1].call(null, cst, [0, match_val, lO]); - if(Sx_types[67].call(null, Q)){ + var Q = Sx_runtime[2].call(null, cst, [0, match_val, lU]); + if(Sx_types[71].call(null, Q)){ var - name$1 = Sx_runtime[25].call(null, frame, lP), - fenv$2 = Sx_runtime[25].call(null, frame, lQ), - and$0 = Sx_runtime[85].call(null, converted_val); - if(Sx_types[67].call(null, and$0)) + name$1 = Sx_runtime[26].call(null, frame, lV), + fenv$2 = Sx_runtime[26].call(null, frame, lW), + and$0 = Sx_runtime[86].call(null, converted_val); + if(Sx_types[71].call(null, and$0)) var - R = Sx_types[73].call(null, converted_val), - h = Sx_runtime[83].call(null, R); + R = Sx_types[77].call(null, converted_val), + h = Sx_runtime[84].call(null, R); else var h = and$0; - if(Sx_types[67].call(null, h)){ - var S = Sx_runtime[3].call(null, name$1); - Sx_runtime[82].call(null, converted_val, S); + if(Sx_types[71].call(null, h)){ + var S = Sx_runtime[4].call(null, name$1); + Sx_runtime[83].call(null, converted_val, S); } - var T = Sx_runtime[3].call(null, name$1); - Sx_runtime[77].call(null, fenv$2, T, converted_val); + var T = Sx_runtime[4].call(null, name$1); + Sx_runtime[78].call(null, fenv$2, T, converted_val); return make_cek_value(converted_val, fenv$2, rest_k); } - var U = Sx_runtime[1].call(null, cst, [0, match_val, lR]); - if(Sx_types[67].call(null, U)){ + var U = Sx_runtime[2].call(null, cst, [0, match_val, lX]); + if(Sx_types[71].call(null, U)){ var - name$2 = Sx_runtime[25].call(null, frame, lS), - fenv$3 = Sx_runtime[25].call(null, frame, lT), - V = Sx_runtime[3].call(null, name$2); - Sx_runtime[78].call(null, fenv$3, V, converted_val); + name$2 = Sx_runtime[26].call(null, frame, lY), + fenv$3 = Sx_runtime[26].call(null, frame, lZ), + V = Sx_runtime[4].call(null, name$2); + Sx_runtime[79].call(null, fenv$3, V, converted_val); return make_cek_value(converted_val, env, rest_k); } - var W = Sx_runtime[1].call(null, cst, [0, match_val, lU]); - if(Sx_types[67].call(null, W)){ - var X = [0, 1 - Sx_types[67].call(null, converted_val)]; - if(Sx_types[67].call(null, X)) + var W = Sx_runtime[2].call(null, cst, [0, match_val, l0]); + if(Sx_types[71].call(null, W)){ + var X = [0, 1 - Sx_types[71].call(null, converted_val)]; + if(Sx_types[71].call(null, X)) return make_cek_value(converted_val, env, rest_k); var - remaining$1 = Sx_runtime[25].call(null, frame, lV), - Y = Sx_runtime[33].call(null, remaining$1); - if(Sx_types[67].call(null, Y)) + remaining$1 = Sx_runtime[26].call(null, frame, l1), + Y = Sx_runtime[34].call(null, remaining$1); + if(Sx_types[71].call(null, Y)) return make_cek_value(converted_val, env, rest_k); var - Z = [0, Sx_runtime[24].call(null, remaining$1), lW], - _ = Sx_runtime[1].call(null, cst, Z); - if(Sx_types[67].call(null, _)) + Z = [0, Sx_runtime[25].call(null, remaining$1), l2], + _ = Sx_runtime[2].call(null, cst, Z); + if(Sx_types[71].call(null, _)) var rest_k$0 = rest_k; else var - aa = Sx_runtime[25].call(null, frame, lY), + aa = Sx_runtime[26].call(null, frame, l4), rest_k$0 = kont_push - (make_and_frame(Sx_runtime[15].call(null, remaining$1), aa), rest_k); - var $ = Sx_runtime[25].call(null, frame, lX); + (make_and_frame(Sx_runtime[16].call(null, remaining$1), aa), rest_k); + var $ = Sx_runtime[26].call(null, frame, l3); return make_cek_state - (Sx_runtime[14].call(null, remaining$1), $, rest_k$0); + (Sx_runtime[15].call(null, remaining$1), $, rest_k$0); } - var ab = Sx_runtime[1].call(null, cst, [0, match_val, lZ]); - if(Sx_types[67].call(null, ab)){ - if(Sx_types[67].call(null, converted_val)) + var ab = Sx_runtime[2].call(null, cst, [0, match_val, l5]); + if(Sx_types[71].call(null, ab)){ + if(Sx_types[71].call(null, converted_val)) return make_cek_value(converted_val, env, rest_k); var - remaining$2 = Sx_runtime[25].call(null, frame, l0), - ac = Sx_runtime[33].call(null, remaining$2); - if(Sx_types[67].call(null, ac)) return make_cek_value(l1, env, rest_k); + remaining$2 = Sx_runtime[26].call(null, frame, l6), + ac = Sx_runtime[34].call(null, remaining$2); + if(Sx_types[71].call(null, ac)) return make_cek_value(l7, env, rest_k); var - ad = [0, Sx_runtime[24].call(null, remaining$2), l2], - ae = Sx_runtime[1].call(null, cst, ad); - if(Sx_types[67].call(null, ae)) + ad = [0, Sx_runtime[25].call(null, remaining$2), l8], + ae = Sx_runtime[2].call(null, cst, ad); + if(Sx_types[71].call(null, ae)) var rest_k$1 = rest_k; else var - ag = Sx_runtime[25].call(null, frame, l4), + ag = Sx_runtime[26].call(null, frame, l_), rest_k$1 = kont_push - (make_or_frame(Sx_runtime[15].call(null, remaining$2), ag), rest_k); - var af = Sx_runtime[25].call(null, frame, l3); + (make_or_frame(Sx_runtime[16].call(null, remaining$2), ag), rest_k); + var af = Sx_runtime[26].call(null, frame, l9); return make_cek_state - (Sx_runtime[14].call(null, remaining$2), af, rest_k$1); + (Sx_runtime[15].call(null, remaining$2), af, rest_k$1); } - var ah = Sx_runtime[1].call(null, cst, [0, match_val, l5]); - if(Sx_types[67].call(null, ah)){ + var ah = Sx_runtime[2].call(null, cst, [0, match_val, l$]); + if(Sx_types[71].call(null, ah)){ var - remaining$3 = Sx_runtime[25].call(null, frame, l6), - fenv$4 = Sx_runtime[25].call(null, frame, l7), - scheme_p = Sx_runtime[25].call(null, frame, l8); - if(! Sx_types[67].call(null, scheme_p)){ - if(Sx_types[67].call(null, converted_val)) + remaining$3 = Sx_runtime[26].call(null, frame, ma), + fenv$4 = Sx_runtime[26].call(null, frame, mb), + scheme_p = Sx_runtime[26].call(null, frame, mc); + if(! Sx_types[71].call(null, scheme_p)){ + if(Sx_types[71].call(null, converted_val)) return make_cek_state - (Sx_runtime[17].call(null, remaining$3, mg), fenv$4, rest_k); + (Sx_runtime[18].call(null, remaining$3, mm), fenv$4, rest_k); var aq = [0, remaining$3, - [0, mh, [0, Sx_runtime[24].call(null, remaining$3), 0]]], - next = Sx_runtime[1].call(null, cst_slice, aq), - ar = [0, Sx_runtime[24].call(null, next), mi], - as = Sx_runtime[1].call(null, cst$3, ar); - if(Sx_types[67].call(null, as)) + [0, mn, [0, Sx_runtime[25].call(null, remaining$3), 0]]], + next = Sx_runtime[2].call(null, cst_slice, aq), + ar = [0, Sx_runtime[25].call(null, next), mo], + as = Sx_runtime[2].call(null, cst$3, ar); + if(Sx_types[71].call(null, as)) return make_cek_value(0, fenv$4, rest_k); var - next_test$0 = Sx_runtime[14].call(null, next), + next_test$0 = Sx_runtime[15].call(null, next), at = is_else_clause(next_test$0); - return Sx_types[67].call(null, at) + return Sx_types[71].call(null, at) ? make_cek_state - (Sx_runtime[17].call(null, next, mj), fenv$4, rest_k) + (Sx_runtime[18].call(null, next, mp), fenv$4, rest_k) : make_cek_state (next_test$0, fenv$4, - kont_push(make_cond_frame(next, fenv$4, mk), rest_k)); + kont_push(make_cond_frame(next, fenv$4, mq), rest_k)); } - if(! Sx_types[67].call(null, converted_val)){ + if(! Sx_types[71].call(null, converted_val)){ var - next_clauses = Sx_runtime[15].call(null, remaining$3), - ao = Sx_runtime[33].call(null, next_clauses); - if(Sx_types[67].call(null, ao)) + next_clauses = Sx_runtime[16].call(null, remaining$3), + ao = Sx_runtime[34].call(null, next_clauses); + if(Sx_types[71].call(null, ao)) return make_cek_value(0, fenv$4, rest_k); var - next_clause = Sx_runtime[14].call(null, next_clauses), - next_test = Sx_runtime[14].call(null, next_clause), + next_clause = Sx_runtime[15].call(null, next_clauses), + next_test = Sx_runtime[15].call(null, next_clause), ap = is_else_clause(next_test); - return Sx_types[67].call(null, ap) + return Sx_types[71].call(null, ap) ? make_cek_state - (Sx_runtime[17].call(null, next_clause, me), fenv$4, rest_k) + (Sx_runtime[18].call(null, next_clause, mk), fenv$4, rest_k) : make_cek_state (next_test, fenv$4, - kont_push(make_cond_frame(next_clauses, fenv$4, mf), rest_k)); + kont_push(make_cond_frame(next_clauses, fenv$4, ml), rest_k)); } var - clause = Sx_runtime[14].call(null, remaining$3), - ai = [0, Sx_runtime[24].call(null, clause), l9], - and$1 = Sx_runtime[1].call(null, cst$0, ai); - if(Sx_types[67].call(null, and$1)){ + clause = Sx_runtime[15].call(null, remaining$3), + ai = [0, Sx_runtime[25].call(null, clause), md], + and$1 = Sx_runtime[2].call(null, cst$0, ai); + if(Sx_types[71].call(null, and$1)){ var - aj = Sx_runtime[17].call(null, clause, l$), - ak = [0, Sx_runtime[73].call(null, aj), l_], - and$2 = Sx_runtime[1].call(null, cst, ak); - if(Sx_types[67].call(null, and$2)) + aj = Sx_runtime[18].call(null, clause, mf), + ak = [0, Sx_runtime[74].call(null, aj), me], + and$2 = Sx_runtime[2].call(null, cst, ak); + if(Sx_types[71].call(null, and$2)) var - al = Sx_runtime[17].call(null, clause, mb), - am = [0, Sx_types[68].call(null, al), ma], - b = Sx_runtime[1].call(null, cst, am); + al = Sx_runtime[18].call(null, clause, mh), + am = [0, Sx_types[72].call(null, al), mg], + b = Sx_runtime[2].call(null, cst, am); else var b = and$2; } else var b = and$1; - if(! Sx_types[67].call(null, b)) + if(! Sx_types[71].call(null, b)) return make_cek_state - (Sx_runtime[17].call(null, clause, md), fenv$4, rest_k); + (Sx_runtime[18].call(null, clause, mj), fenv$4, rest_k); var an = kont_push(make_cond_arrow_frame(converted_val, fenv$4), rest_k); - return make_cek_state(Sx_runtime[17].call(null, clause, mc), fenv$4, an); + return make_cek_state(Sx_runtime[18].call(null, clause, mi), fenv$4, an); } - var au = Sx_runtime[1].call(null, cst, [0, match_val, ml]); - if(Sx_types[67].call(null, au)){ + var au = Sx_runtime[2].call(null, cst, [0, match_val, mr]); + if(Sx_types[71].call(null, au)){ var - match_val$0 = Sx_runtime[25].call(null, frame, mm), - remaining$4 = Sx_runtime[25].call(null, frame, mn), - fenv$5 = Sx_runtime[25].call(null, frame, mo), - av = Sx_runtime[83].call(null, match_val$0); - return Sx_types[67].call(null, av) + match_val$0 = Sx_runtime[26].call(null, frame, ms), + remaining$4 = Sx_runtime[26].call(null, frame, mt), + fenv$5 = Sx_runtime[26].call(null, frame, mu), + av = Sx_runtime[84].call(null, match_val$0); + return Sx_types[71].call(null, av) ? sf_case_step_loop(converted_val, remaining$4, fenv$5, rest_k) : sf_case_step_loop(match_val$0, remaining$4, fenv$5, rest_k); } - var aw = Sx_runtime[1].call(null, cst, [0, match_val, mp]); - if(Sx_types[67].call(null, aw)){ + var aw = Sx_runtime[2].call(null, cst, [0, match_val, mv]); + if(Sx_types[71].call(null, aw)){ var - remaining$5 = Sx_runtime[25].call(null, frame, mq), - fenv$6 = Sx_runtime[25].call(null, frame, mr), - mode = Sx_runtime[25].call(null, frame, ms), - bind_name = Sx_runtime[25].call(null, frame, mt), - ax = Sx_runtime[33].call(null, remaining$5); - if(Sx_types[67].call(null, ax)) + remaining$5 = Sx_runtime[26].call(null, frame, mw), + fenv$6 = Sx_runtime[26].call(null, frame, mx), + mode = Sx_runtime[26].call(null, frame, my), + bind_name = Sx_runtime[26].call(null, frame, mz), + ax = Sx_runtime[34].call(null, remaining$5); + if(Sx_types[71].call(null, ax)) return make_cek_value(converted_val, fenv$6, rest_k); var - form = Sx_runtime[14].call(null, remaining$5), - rest_forms = Sx_runtime[15].call(null, remaining$5), - ay = Sx_runtime[15].call(null, remaining$5), - az = Sx_runtime[33].call(null, ay), + form = Sx_runtime[15].call(null, remaining$5), + rest_forms = Sx_runtime[16].call(null, remaining$5), + ay = Sx_runtime[16].call(null, remaining$5), + az = Sx_runtime[34].call(null, ay), new_kont = - Sx_types[67].call(null, az) + Sx_types[71].call(null, az) ? rest_k : kont_push (make_thread_frame - (Sx_runtime[15].call(null, remaining$5), fenv$6, mode, bind_name), + (Sx_runtime[16].call(null, remaining$5), fenv$6, mode, bind_name), rest_k), - aA = Sx_runtime[1].call(null, cst, [0, mode, mu]); - if(Sx_types[67].call(null, aA)){ + aA = Sx_runtime[2].call(null, cst, [0, mode, mA]); + if(Sx_types[71].call(null, aA)){ var - new_env = Sx_runtime[80].call(null, fenv$6), - aB = Sx_types[68].call(null, bind_name), - aC = Sx_runtime[3].call(null, aB); - Sx_runtime[77].call(null, new_env, aC, converted_val); + new_env = Sx_runtime[81].call(null, fenv$6), + aB = Sx_types[72].call(null, bind_name), + aC = Sx_runtime[4].call(null, aB); + Sx_runtime[78].call(null, new_env, aC, converted_val); return make_cek_state(form, new_env, new_kont); } var - aD = [0, Sx_runtime[73].call(null, form), mv], - and$3 = Sx_runtime[1].call(null, cst, aD); - if(Sx_types[67].call(null, and$3)){ + aD = [0, Sx_runtime[74].call(null, form), mB], + and$3 = Sx_runtime[2].call(null, cst, aD); + if(Sx_types[71].call(null, and$3)){ var - aE = Sx_runtime[33].call(null, form), - and$4 = [0, 1 - Sx_types[67].call(null, aE)]; - if(Sx_types[67].call(null, and$4)){ + aE = Sx_runtime[34].call(null, form), + and$4 = [0, 1 - Sx_types[71].call(null, aE)]; + if(Sx_types[71].call(null, and$4)){ var - aF = Sx_runtime[14].call(null, form), - aG = [0, Sx_runtime[73].call(null, aF), mw], - and$5 = Sx_runtime[1].call(null, cst, aG); - if(Sx_types[67].call(null, and$5)) + aF = Sx_runtime[15].call(null, form), + aG = [0, Sx_runtime[74].call(null, aF), mC], + and$5 = Sx_runtime[2].call(null, cst, aG); + if(Sx_types[71].call(null, and$5)) var - aH = Sx_runtime[14].call(null, form), - a = ho_form_name_p(Sx_types[68].call(null, aH)); + aH = Sx_runtime[15].call(null, form), + a = ho_form_name_p(Sx_types[72].call(null, aH)); else var a = and$5; } @@ -57477,20 +64651,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and$3; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - aI = Sx_runtime[15].call(null, form), - aJ = Sx_runtime[18].call(null, [6, [0, mx, [0, converted_val, 0]]], aI), - aK = Sx_runtime[14].call(null, form); + aI = Sx_runtime[16].call(null, form), + aJ = Sx_runtime[19].call(null, [6, [0, mD, [0, converted_val, 0]]], aI), + aK = Sx_runtime[15].call(null, form); return make_cek_state - (Sx_runtime[18].call(null, aK, aJ), fenv$6, new_kont); + (Sx_runtime[19].call(null, aK, aJ), fenv$6, new_kont); } - var aL = Sx_runtime[1].call(null, cst, [0, mode, my]); - if(Sx_types[67].call(null, aL)){ + var aL = Sx_runtime[2].call(null, cst, [0, mode, mE]); + if(Sx_types[71].call(null, aL)){ var result = thread_insert_arg_last(form, converted_val, fenv$6), - aM = Sx_runtime[33].call(null, rest_forms); - return Sx_types[67].call(null, aM) + aM = Sx_runtime[34].call(null, rest_forms); + return Sx_types[71].call(null, aM) ? make_cek_value(result, fenv$6, rest_k) : make_cek_value (result, @@ -57501,8 +64675,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var result$0 = thread_insert_arg(form, converted_val, fenv$6), - aN = Sx_runtime[33].call(null, rest_forms); - return Sx_types[67].call(null, aN) + aN = Sx_runtime[34].call(null, rest_forms); + return Sx_types[71].call(null, aN) ? make_cek_value(result$0, fenv$6, rest_k) : make_cek_value (result$0, @@ -57511,234 +64685,234 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (make_thread_frame(rest_forms, fenv$6, mode, bind_name), rest_k)); } - var aO = Sx_runtime[1].call(null, cst, [0, match_val, mz]); - if(Sx_types[67].call(null, aO)){ + var aO = Sx_runtime[2].call(null, cst, [0, match_val, mF]); + if(Sx_types[71].call(null, aO)){ var - f = Sx_runtime[25].call(null, frame, mA), - evaled = Sx_runtime[25].call(null, frame, mB), - remaining$6 = Sx_runtime[25].call(null, frame, mC), - fenv$7 = Sx_runtime[25].call(null, frame, mD), - raw_args = Sx_runtime[25].call(null, frame, mE), - hname = Sx_runtime[25].call(null, frame, mF), - aP = Sx_runtime[83].call(null, f); - if(Sx_types[67].call(null, aP)){ + f = Sx_runtime[26].call(null, frame, mG), + evaled = Sx_runtime[26].call(null, frame, mH), + remaining$6 = Sx_runtime[26].call(null, frame, mI), + fenv$7 = Sx_runtime[26].call(null, frame, mJ), + raw_args = Sx_runtime[26].call(null, frame, mK), + hname = Sx_runtime[26].call(null, frame, mL), + aP = Sx_runtime[84].call(null, f); + if(Sx_types[71].call(null, aP)){ var and$6 = strict_ref[1], - hname$0 = Sx_types[67].call(null, and$6) ? hname : and$6; - if(Sx_types[67].call(null, hname$0)) strict_check_args(hname, mG); - var aQ = Sx_runtime[33].call(null, remaining$6); - if(Sx_types[67].call(null, aQ)) - return continue_with_call(converted_val, mH, fenv$7, raw_args, rest_k); + hname$0 = Sx_types[71].call(null, and$6) ? hname : and$6; + if(Sx_types[71].call(null, hname$0)) strict_check_args(hname, mM); + var aQ = Sx_runtime[34].call(null, remaining$6); + if(Sx_types[71].call(null, aQ)) + return continue_with_call(converted_val, mN, fenv$7, raw_args, rest_k); var aR = kont_push (make_arg_frame (converted_val, - mI, - Sx_runtime[15].call(null, remaining$6), + mO, + Sx_runtime[16].call(null, remaining$6), fenv$7, raw_args, hname), rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$6), fenv$7, aR); + (Sx_runtime[15].call(null, remaining$6), fenv$7, aR); } var new_evaled = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, evaled, [0, [6, [0, converted_val, 0]], 0]]), - aS = Sx_runtime[33].call(null, remaining$6); - if(! Sx_types[67].call(null, aS)){ + aS = Sx_runtime[34].call(null, remaining$6); + if(! Sx_types[71].call(null, aS)){ var aT = kont_push (make_arg_frame (f, new_evaled, - Sx_runtime[15].call(null, remaining$6), + Sx_runtime[16].call(null, remaining$6), fenv$7, raw_args, hname), rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$6), fenv$7, aT); + (Sx_runtime[15].call(null, remaining$6), fenv$7, aT); } var and$7 = strict_ref[1], - hname$1 = Sx_types[67].call(null, and$7) ? hname : and$7; - if(Sx_types[67].call(null, hname$1)) + hname$1 = Sx_types[71].call(null, and$7) ? hname : and$7; + if(Sx_types[71].call(null, hname$1)) strict_check_args(hname, new_evaled); return continue_with_call(f, new_evaled, fenv$7, raw_args, rest_k); } - var aU = Sx_runtime[1].call(null, cst, [0, match_val, mJ]); - if(Sx_types[67].call(null, aU)){ + var aU = Sx_runtime[2].call(null, cst, [0, match_val, mP]); + if(Sx_types[71].call(null, aU)){ var - remaining$7 = Sx_runtime[25].call(null, frame, mK), - results = Sx_runtime[25].call(null, frame, mL), - fenv$8 = Sx_runtime[25].call(null, frame, mM), - last_result = Sx_runtime[16].call(null, results), + remaining$7 = Sx_runtime[26].call(null, frame, mQ), + results = Sx_runtime[26].call(null, frame, mR), + fenv$8 = Sx_runtime[26].call(null, frame, mS), + last_result = Sx_runtime[17].call(null, results), aV = [0, [6, [0, [6, - [0, Sx_runtime[14].call(null, last_result), [0, converted_val, 0]]], + [0, Sx_runtime[15].call(null, last_result), [0, converted_val, 0]]], 0]], 0], - aW = [0, Sx_runtime[24].call(null, results), 0], + aW = [0, Sx_runtime[25].call(null, results), 0], aX = - [0, results, [0, mN, [0, Sx_runtime[1].call(null, cst_dec, aW), 0]]], - aY = [0, Sx_runtime[1].call(null, cst_slice, aX), aV], - completed = Sx_runtime[1].call(null, cst_append, aY), - aZ = Sx_runtime[33].call(null, remaining$7); - if(Sx_types[67].call(null, aZ)){ + [0, results, [0, mT, [0, Sx_runtime[2].call(null, cst_dec, aW), 0]]], + aY = [0, Sx_runtime[2].call(null, cst_slice, aX), aV], + completed = Sx_runtime[2].call(null, cst_append, aY), + aZ = Sx_runtime[34].call(null, remaining$7); + if(Sx_types[71].call(null, aZ)){ var d = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - a0 = Sx_runtime[5].call(null, completed); + a0 = Sx_runtime[6].call(null, completed); Stdlib_List[18].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, mO), - b = Sx_runtime[14].call(null, pair); - Sx_runtime[11].call(null, d, b, a); + a = Sx_runtime[18].call(null, pair, mU), + b = Sx_runtime[15].call(null, pair); + Sx_runtime[12].call(null, d, b, a); return 0; }, a0); return make_cek_value(d, fenv$8, rest_k); } var - next_entry = Sx_runtime[14].call(null, remaining$7), + next_entry = Sx_runtime[15].call(null, remaining$7), a1 = [0, completed, [0, - [6, [0, [6, [0, Sx_runtime[14].call(null, next_entry), 0]], 0]], + [6, [0, [6, [0, Sx_runtime[15].call(null, next_entry), 0]], 0]], 0]], - a2 = Sx_runtime[1].call(null, cst_append, a1), + a2 = Sx_runtime[2].call(null, cst_append, a1), a3 = kont_push - (make_dict_frame(Sx_runtime[15].call(null, remaining$7), a2, fenv$8), + (make_dict_frame(Sx_runtime[16].call(null, remaining$7), a2, fenv$8), rest_k); return make_cek_state - (Sx_runtime[17].call(null, next_entry, mP), fenv$8, a3); + (Sx_runtime[18].call(null, next_entry, mV), fenv$8, a3); } - var a4 = Sx_runtime[1].call(null, cst, [0, match_val, mQ]); - if(Sx_types[67].call(null, a4)){ + var a4 = Sx_runtime[2].call(null, cst, [0, match_val, mW]); + if(Sx_types[71].call(null, a4)){ var - ho_type = Sx_runtime[25].call(null, frame, mR), - remaining$8 = Sx_runtime[25].call(null, frame, mS), + ho_type = Sx_runtime[26].call(null, frame, mX), + remaining$8 = Sx_runtime[26].call(null, frame, mY), a5 = [0, - Sx_runtime[25].call(null, frame, mT), + Sx_runtime[26].call(null, frame, mZ), [0, [6, [0, converted_val, 0]], 0]], - evaled$0 = Sx_runtime[1].call(null, cst_append, a5), - fenv$9 = Sx_runtime[25].call(null, frame, mU), - a6 = Sx_runtime[33].call(null, remaining$8); - if(Sx_types[67].call(null, a6)) + evaled$0 = Sx_runtime[2].call(null, cst_append, a5), + fenv$9 = Sx_runtime[26].call(null, frame, m0), + a6 = Sx_runtime[34].call(null, remaining$8); + if(Sx_types[71].call(null, a6)) return ho_setup_dispatch(ho_type, evaled$0, fenv$9, rest_k); var a7 = kont_push (make_ho_setup_frame - (ho_type, Sx_runtime[15].call(null, remaining$8), evaled$0, fenv$9), + (ho_type, Sx_runtime[16].call(null, remaining$8), evaled$0, fenv$9), rest_k); - return make_cek_state(Sx_runtime[14].call(null, remaining$8), fenv$9, a7); + return make_cek_state(Sx_runtime[15].call(null, remaining$8), fenv$9, a7); } - var a8 = Sx_runtime[1].call(null, cst, [0, match_val, mV]); - if(Sx_types[67].call(null, a8)) + var a8 = Sx_runtime[2].call(null, cst, [0, match_val, m1]); + if(Sx_types[71].call(null, a8)) return make_cek_value(converted_val, env, rest_k); - var a9 = Sx_runtime[1].call(null, cst, [0, match_val, mW]); - if(Sx_types[67].call(null, a9)){ + var a9 = Sx_runtime[2].call(null, cst, [0, match_val, m2]); + if(Sx_types[71].call(null, a9)){ var - fenv$10 = Sx_runtime[25].call(null, frame, mX), - a_ = Sx_runtime[89].call(null, converted_val), - a$ = [0, 1 - Sx_types[67].call(null, a_)]; - if(Sx_types[67].call(null, a$)) + fenv$10 = Sx_runtime[26].call(null, frame, m3), + a_ = Sx_runtime[90].call(null, converted_val), + a$ = [0, 1 - Sx_types[71].call(null, a_)]; + if(Sx_types[71].call(null, a$)) return make_cek_value(converted_val, fenv$10, rest_k); var ba = has_reactive_reset_frame_p(rest_k); - if(Sx_types[67].call(null, ba)) + if(Sx_types[71].call(null, ba)) return reactive_shift_deref(converted_val, fenv$10, rest_k); - var ctx = Sx_runtime[71].call(null, mY, 0); - if(Sx_types[67].call(null, ctx)){ + var ctx = Sx_runtime[72].call(null, m4, 0); + if(Sx_types[71].call(null, ctx)){ var - dep_list = Sx_runtime[25].call(null, ctx, mZ), - notify_fn = Sx_runtime[25].call(null, ctx, m0), + dep_list = Sx_runtime[26].call(null, ctx, m5), + notify_fn = Sx_runtime[26].call(null, ctx, m6), bb = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_contains, [0, dep_list, [0, converted_val, 0]]), - bc = [0, 1 - Sx_types[67].call(null, bb)]; - if(Sx_types[67].call(null, bc)){ - Sx_runtime[10].call(null, dep_list, converted_val); - Sx_runtime[115].call(null, converted_val, notify_fn); + bc = [0, 1 - Sx_types[71].call(null, bb)]; + if(Sx_types[71].call(null, bc)){ + Sx_runtime[11].call(null, dep_list, converted_val); + Sx_runtime[117].call(null, converted_val, notify_fn); } } return make_cek_value - (Sx_runtime[114].call(null, converted_val), fenv$10, rest_k); + (Sx_runtime[116].call(null, converted_val), fenv$10, rest_k); } - var bd = Sx_runtime[1].call(null, cst, [0, match_val, m1]); - if(Sx_types[67].call(null, bd)){ + var bd = Sx_runtime[2].call(null, cst, [0, match_val, m7]); + if(Sx_types[71].call(null, bd)){ var - update_fn = Sx_runtime[25].call(null, frame, m2), - first_p = Sx_runtime[25].call(null, frame, m3), + update_fn = Sx_runtime[26].call(null, frame, m8), + first_p = Sx_runtime[26].call(null, frame, m9), be = - Sx_types[67].call(null, update_fn) - ? [0, 1 - Sx_types[67].call(null, first_p)] + Sx_types[71].call(null, update_fn) + ? [0, 1 - Sx_types[71].call(null, first_p)] : update_fn; - if(Sx_types[67].call(null, be)) + if(Sx_types[71].call(null, be)) cek_call(update_fn, [6, [0, converted_val, 0]]); return make_cek_value(converted_val, env, rest_k); } - var bf = Sx_runtime[1].call(null, cst, [0, match_val, m4]); - if(Sx_types[67].call(null, bf)){ + var bf = Sx_runtime[2].call(null, cst, [0, match_val, m_]); + if(Sx_types[71].call(null, bf)){ var - name$3 = Sx_runtime[25].call(null, frame, m5), - remaining$9 = Sx_runtime[25].call(null, frame, m6), - fenv$11 = Sx_runtime[25].call(null, frame, m7), - bg = Sx_runtime[33].call(null, remaining$9); - if(Sx_types[67].call(null, bg)){ - Sx_runtime[104].call(null, name$3); + name$3 = Sx_runtime[26].call(null, frame, m$), + remaining$9 = Sx_runtime[26].call(null, frame, na), + fenv$11 = Sx_runtime[26].call(null, frame, nb), + bg = Sx_runtime[34].call(null, remaining$9); + if(Sx_types[71].call(null, bg)){ + Sx_runtime[106].call(null, name$3); return make_cek_value(converted_val, fenv$11, rest_k); } var bh = kont_push (make_scope_frame - (name$3, Sx_runtime[15].call(null, remaining$9), fenv$11), + (name$3, Sx_runtime[16].call(null, remaining$9), fenv$11), rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$9), fenv$11, bh); + (Sx_runtime[15].call(null, remaining$9), fenv$11, bh); } - var bi = Sx_runtime[1].call(null, cst, [0, match_val, m8]); - if(Sx_types[67].call(null, bi)){ + var bi = Sx_runtime[2].call(null, cst, [0, match_val, nc]); + if(Sx_types[71].call(null, bi)){ var - remaining$10 = Sx_runtime[25].call(null, frame, m9), - fenv$12 = Sx_runtime[25].call(null, frame, m_), - bj = Sx_runtime[33].call(null, remaining$10); - if(Sx_types[67].call(null, bj)){ - var bk = Sx_runtime[25].call(null, frame, m$); - Sx_runtime[104].call(null, bk); + remaining$10 = Sx_runtime[26].call(null, frame, nd), + fenv$12 = Sx_runtime[26].call(null, frame, ne), + bj = Sx_runtime[34].call(null, remaining$10); + if(Sx_types[71].call(null, bj)){ + var bk = Sx_runtime[26].call(null, frame, nf); + Sx_runtime[106].call(null, bk); return make_cek_value(converted_val, fenv$12, rest_k); } var - bl = Sx_runtime[15].call(null, remaining$10), - bm = Sx_runtime[25].call(null, frame, na), + bl = Sx_runtime[16].call(null, remaining$10), + bm = Sx_runtime[26].call(null, frame, ng), new_frame = make_provide_frame - (Sx_runtime[25].call(null, frame, nb), bm, bl, fenv$12), - bn = Sx_runtime[25].call(null, frame, nc); - Sx_runtime[11].call(null, new_frame, nd, bn); + (Sx_runtime[26].call(null, frame, nh), bm, bl, fenv$12), + bn = Sx_runtime[26].call(null, frame, ni); + Sx_runtime[12].call(null, new_frame, nj, bn); var bo = kont_push(new_frame, rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$10), fenv$12, bo); + (Sx_runtime[15].call(null, remaining$10), fenv$12, bo); } - var bp = Sx_runtime[1].call(null, cst, [0, match_val, ne]); - if(Sx_types[67].call(null, bp)){ + var bp = Sx_runtime[2].call(null, cst, [0, match_val, nk]); + if(Sx_types[71].call(null, bp)){ var tracked = bind_tracking_ref[1], - body$1 = Sx_runtime[25].call(null, frame, nf), - fenv$13 = Sx_runtime[25].call(null, frame, ng), - prev = Sx_runtime[25].call(null, frame, nh); + body$1 = Sx_runtime[26].call(null, frame, nl), + fenv$13 = Sx_runtime[26].call(null, frame, nm), + prev = Sx_runtime[26].call(null, frame, nn); bind_tracking_ref[1] = prev; var subscriber = @@ -57746,274 +64920,274 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cst$9, function(args){ if(args && ! args[2]) - return cek_run(make_cek_state(body$1, fenv$13, ni)); + return cek_run(make_cek_state(body$1, fenv$13, no)); return 0; }], - bq = Sx_runtime[5].call(null, tracked); + bq = Sx_runtime[6].call(null, tracked); Stdlib_List[18].call (null, function(name){ var existing = - Sx_runtime[25].call(null, provide_subscribers_ref[1], name), - existing$0 = Sx_types[67].call(null, existing) ? existing : nj, + Sx_runtime[26].call(null, provide_subscribers_ref[1], name), + existing$0 = Sx_types[71].call(null, existing) ? existing : np, a = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, existing$0, [0, [6, [0, subscriber, 0]], 0]]); - Sx_runtime[11].call(null, provide_subscribers_ref[1], name, a); + Sx_runtime[12].call(null, provide_subscribers_ref[1], name, a); return 0; }, bq); return make_cek_value(converted_val, fenv$13, rest_k); } - var br = Sx_runtime[1].call(null, cst, [0, match_val, nk]); - if(Sx_types[67].call(null, br)){ + var br = Sx_runtime[2].call(null, cst, [0, match_val, nq]); + if(Sx_types[71].call(null, br)){ var - name$4 = Sx_runtime[25].call(null, frame, nl), - fenv$14 = Sx_runtime[25].call(null, frame, nm), + name$4 = Sx_runtime[26].call(null, frame, nr), + fenv$14 = Sx_runtime[26].call(null, frame, ns), target = kont_find_provide(rest_k, name$4), old_val = - Sx_types[67].call(null, target) - ? Sx_runtime[25].call(null, target, nn) - : Sx_runtime[105].call(null, name$4); - if(Sx_types[67].call(null, target)) - Sx_runtime[11].call(null, target, no, converted_val); - Sx_runtime[104].call(null, name$4); - Sx_runtime[103].call(null, name$4, converted_val); + Sx_types[71].call(null, target) + ? Sx_runtime[26].call(null, target, nt) + : Sx_runtime[107].call(null, name$4); + if(Sx_types[71].call(null, target)) + Sx_runtime[12].call(null, target, nu, converted_val); + Sx_runtime[106].call(null, name$4); + Sx_runtime[105].call(null, name$4, converted_val); var - bs = Sx_runtime[1].call(null, cst, [0, old_val, [0, converted_val, 0]]), - bt = [0, 1 - Sx_types[67].call(null, bs)]; - if(Sx_types[67].call(null, bt)) fire_provide_subscribers(name$4); + bs = Sx_runtime[2].call(null, cst, [0, old_val, [0, converted_val, 0]]), + bt = [0, 1 - Sx_types[71].call(null, bs)]; + if(Sx_types[71].call(null, bt)) fire_provide_subscribers(name$4); return make_cek_value(converted_val, fenv$14, rest_k); } - var bu = Sx_runtime[1].call(null, cst, [0, match_val, np]); - if(Sx_types[67].call(null, bu)){ + var bu = Sx_runtime[2].call(null, cst, [0, match_val, nv]); + if(Sx_types[71].call(null, bu)){ var - remaining$11 = Sx_runtime[25].call(null, frame, nq), - fenv$15 = Sx_runtime[25].call(null, frame, nr), - bv = Sx_runtime[33].call(null, remaining$11); - if(Sx_types[67].call(null, bv)) + remaining$11 = Sx_runtime[26].call(null, frame, nw), + fenv$15 = Sx_runtime[26].call(null, frame, nx), + bv = Sx_runtime[34].call(null, remaining$11); + if(Sx_types[71].call(null, bv)) return make_cek_value(converted_val, fenv$15, rest_k); var - bw = Sx_runtime[15].call(null, remaining$11), - bx = Sx_runtime[25].call(null, frame, ns), + bw = Sx_runtime[16].call(null, remaining$11), + bx = Sx_runtime[26].call(null, frame, ny), new_frame$0 = make_scope_acc_frame - (Sx_runtime[25].call(null, frame, nt), bx, bw, fenv$15), - by = Sx_runtime[25].call(null, frame, nu); - Sx_runtime[11].call(null, new_frame$0, nv, by); + (Sx_runtime[26].call(null, frame, nz), bx, bw, fenv$15), + by = Sx_runtime[26].call(null, frame, nA); + Sx_runtime[12].call(null, new_frame$0, nB, by); var bz = kont_push(new_frame$0, rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$11), fenv$15, bz); + (Sx_runtime[15].call(null, remaining$11), fenv$15, bz); } - var bA = Sx_runtime[1].call(null, cst, [0, match_val, nw]); - if(Sx_types[67].call(null, bA)){ + var bA = Sx_runtime[2].call(null, cst, [0, match_val, nC]); + if(Sx_types[71].call(null, bA)){ var - f$0 = Sx_runtime[25].call(null, frame, nx), - remaining$12 = Sx_runtime[25].call(null, frame, ny), - results$0 = Sx_runtime[25].call(null, frame, nz), - indexed = Sx_runtime[25].call(null, frame, nA), - fenv$16 = Sx_runtime[25].call(null, frame, nB), + f$0 = Sx_runtime[26].call(null, frame, nD), + remaining$12 = Sx_runtime[26].call(null, frame, nE), + results$0 = Sx_runtime[26].call(null, frame, nF), + indexed = Sx_runtime[26].call(null, frame, nG), + fenv$16 = Sx_runtime[26].call(null, frame, nH), new_results = - Sx_runtime[1].call + Sx_runtime[2].call (null, cst_append, [0, results$0, [0, [6, [0, converted_val, 0]], 0]]), - bB = Sx_runtime[33].call(null, remaining$12); - if(Sx_types[67].call(null, bB)) + bB = Sx_runtime[34].call(null, remaining$12); + if(Sx_types[71].call(null, bB)) return make_cek_value(new_results, fenv$16, rest_k); - if(Sx_types[67].call(null, indexed)) + if(Sx_types[71].call(null, indexed)) var - bC = [0, Sx_runtime[14].call(null, remaining$12), 0], - call_args = [6, [0, Sx_runtime[24].call(null, new_results), bC]]; + bC = [0, Sx_runtime[15].call(null, remaining$12), 0], + call_args = [6, [0, Sx_runtime[25].call(null, new_results), bC]]; else - var call_args = [6, [0, Sx_runtime[14].call(null, remaining$12), 0]]; + var call_args = [6, [0, Sx_runtime[15].call(null, remaining$12), 0]]; var next_frame = - Sx_types[67].call(null, indexed) + Sx_types[71].call(null, indexed) ? make_map_indexed_frame (f$0, - Sx_runtime[15].call(null, remaining$12), + Sx_runtime[16].call(null, remaining$12), new_results, fenv$16) : make_map_frame (f$0, - Sx_runtime[15].call(null, remaining$12), + Sx_runtime[16].call(null, remaining$12), new_results, fenv$16); return continue_with_call - (f$0, call_args, fenv$16, nC, kont_push(next_frame, rest_k)); + (f$0, call_args, fenv$16, nI, kont_push(next_frame, rest_k)); } - var bD = Sx_runtime[1].call(null, cst, [0, match_val, nD]); - if(Sx_types[67].call(null, bD)){ + var bD = Sx_runtime[2].call(null, cst, [0, match_val, nJ]); + if(Sx_types[71].call(null, bD)){ var - f$1 = Sx_runtime[25].call(null, frame, nE), - remaining$13 = Sx_runtime[25].call(null, frame, nF), - results$1 = Sx_runtime[25].call(null, frame, nG), - current_item = Sx_runtime[25].call(null, frame, nH), - fenv$17 = Sx_runtime[25].call(null, frame, nI), + f$1 = Sx_runtime[26].call(null, frame, nK), + remaining$13 = Sx_runtime[26].call(null, frame, nL), + results$1 = Sx_runtime[26].call(null, frame, nM), + current_item = Sx_runtime[26].call(null, frame, nN), + fenv$17 = Sx_runtime[26].call(null, frame, nO), new_results$0 = - Sx_types[67].call(null, converted_val) + Sx_types[71].call(null, converted_val) ? Sx_runtime - [1].call + [2].call (null, cst_append, [0, results$1, [0, [6, [0, current_item, 0]], 0]]) : results$1, - bE = Sx_runtime[33].call(null, remaining$13); - if(Sx_types[67].call(null, bE)) + bE = Sx_runtime[34].call(null, remaining$13); + if(Sx_types[71].call(null, bE)) return make_cek_value(new_results$0, fenv$17, rest_k); var - bF = Sx_runtime[14].call(null, remaining$13), + bF = Sx_runtime[15].call(null, remaining$13), bG = kont_push (make_filter_frame (f$1, - Sx_runtime[15].call(null, remaining$13), + Sx_runtime[16].call(null, remaining$13), new_results$0, bF, fenv$17), rest_k); return continue_with_call (f$1, - [6, [0, Sx_runtime[14].call(null, remaining$13), 0]], + [6, [0, Sx_runtime[15].call(null, remaining$13), 0]], fenv$17, - nJ, + nP, bG); } - var bH = Sx_runtime[1].call(null, cst, [0, match_val, nK]); - if(Sx_types[67].call(null, bH)){ + var bH = Sx_runtime[2].call(null, cst, [0, match_val, nQ]); + if(Sx_types[71].call(null, bH)){ var - f$2 = Sx_runtime[25].call(null, frame, nL), - remaining$14 = Sx_runtime[25].call(null, frame, nM), - fenv$18 = Sx_runtime[25].call(null, frame, nN), - bI = Sx_runtime[33].call(null, remaining$14); - if(Sx_types[67].call(null, bI)) + f$2 = Sx_runtime[26].call(null, frame, nR), + remaining$14 = Sx_runtime[26].call(null, frame, nS), + fenv$18 = Sx_runtime[26].call(null, frame, nT), + bI = Sx_runtime[34].call(null, remaining$14); + if(Sx_types[71].call(null, bI)) return make_cek_value(converted_val, fenv$18, rest_k); var bJ = kont_push (make_reduce_frame - (f$2, Sx_runtime[15].call(null, remaining$14), fenv$18), + (f$2, Sx_runtime[16].call(null, remaining$14), fenv$18), rest_k); return continue_with_call (f$2, [6, [0, converted_val, - [0, Sx_runtime[14].call(null, remaining$14), 0]]], + [0, Sx_runtime[15].call(null, remaining$14), 0]]], fenv$18, - nO, + nU, bJ); } - var bK = Sx_runtime[1].call(null, cst, [0, match_val, nP]); - if(Sx_types[67].call(null, bK)){ + var bK = Sx_runtime[2].call(null, cst, [0, match_val, nV]); + if(Sx_types[71].call(null, bK)){ var - f$3 = Sx_runtime[25].call(null, frame, nQ), - remaining$15 = Sx_runtime[25].call(null, frame, nR), - fenv$19 = Sx_runtime[25].call(null, frame, nS), - bL = Sx_runtime[33].call(null, remaining$15); - if(Sx_types[67].call(null, bL)) + f$3 = Sx_runtime[26].call(null, frame, nW), + remaining$15 = Sx_runtime[26].call(null, frame, nX), + fenv$19 = Sx_runtime[26].call(null, frame, nY), + bL = Sx_runtime[34].call(null, remaining$15); + if(Sx_types[71].call(null, bL)) return make_cek_value(0, fenv$19, rest_k); var bM = kont_push (make_for_each_frame - (f$3, Sx_runtime[15].call(null, remaining$15), fenv$19), + (f$3, Sx_runtime[16].call(null, remaining$15), fenv$19), rest_k); return continue_with_call (f$3, - [6, [0, Sx_runtime[14].call(null, remaining$15), 0]], + [6, [0, Sx_runtime[15].call(null, remaining$15), 0]], fenv$19, - nT, + nZ, bM); } - var bN = Sx_runtime[1].call(null, cst, [0, match_val, nU]); - if(Sx_types[67].call(null, bN)){ + var bN = Sx_runtime[2].call(null, cst, [0, match_val, n0]); + if(Sx_types[71].call(null, bN)){ var - f$4 = Sx_runtime[25].call(null, frame, nV), - remaining$16 = Sx_runtime[25].call(null, frame, nW), - fenv$20 = Sx_runtime[25].call(null, frame, nX); - if(Sx_types[67].call(null, converted_val)) + f$4 = Sx_runtime[26].call(null, frame, n1), + remaining$16 = Sx_runtime[26].call(null, frame, n2), + fenv$20 = Sx_runtime[26].call(null, frame, n3); + if(Sx_types[71].call(null, converted_val)) return make_cek_value(converted_val, fenv$20, rest_k); - var bO = Sx_runtime[33].call(null, remaining$16); - if(Sx_types[67].call(null, bO)) - return make_cek_value(nY, fenv$20, rest_k); + var bO = Sx_runtime[34].call(null, remaining$16); + if(Sx_types[71].call(null, bO)) + return make_cek_value(n4, fenv$20, rest_k); var bP = kont_push (make_some_frame - (f$4, Sx_runtime[15].call(null, remaining$16), fenv$20), + (f$4, Sx_runtime[16].call(null, remaining$16), fenv$20), rest_k); return continue_with_call (f$4, - [6, [0, Sx_runtime[14].call(null, remaining$16), 0]], + [6, [0, Sx_runtime[15].call(null, remaining$16), 0]], fenv$20, - nZ, + n5, bP); } - var bQ = Sx_runtime[1].call(null, cst, [0, match_val, n0]); - if(Sx_types[67].call(null, bQ)){ + var bQ = Sx_runtime[2].call(null, cst, [0, match_val, n6]); + if(Sx_types[71].call(null, bQ)){ var - f$5 = Sx_runtime[25].call(null, frame, n1), - remaining$17 = Sx_runtime[25].call(null, frame, n2), - fenv$21 = Sx_runtime[25].call(null, frame, n3), - bR = [0, 1 - Sx_types[67].call(null, converted_val)]; - if(Sx_types[67].call(null, bR)) - return make_cek_value(n4, fenv$21, rest_k); - var bS = Sx_runtime[33].call(null, remaining$17); - if(Sx_types[67].call(null, bS)) - return make_cek_value(n5, fenv$21, rest_k); + f$5 = Sx_runtime[26].call(null, frame, n7), + remaining$17 = Sx_runtime[26].call(null, frame, n8), + fenv$21 = Sx_runtime[26].call(null, frame, n9), + bR = [0, 1 - Sx_types[71].call(null, converted_val)]; + if(Sx_types[71].call(null, bR)) + return make_cek_value(n_, fenv$21, rest_k); + var bS = Sx_runtime[34].call(null, remaining$17); + if(Sx_types[71].call(null, bS)) + return make_cek_value(n$, fenv$21, rest_k); var bT = kont_push (make_every_frame - (f$5, Sx_runtime[15].call(null, remaining$17), fenv$21), + (f$5, Sx_runtime[16].call(null, remaining$17), fenv$21), rest_k); return continue_with_call (f$5, - [6, [0, Sx_runtime[14].call(null, remaining$17), 0]], + [6, [0, Sx_runtime[15].call(null, remaining$17), 0]], fenv$21, - n6, + oa, bT); } - var bU = Sx_runtime[1].call(null, cst, [0, match_val, n7]); - if(Sx_types[67].call(null, bU)){ + var bU = Sx_runtime[2].call(null, cst, [0, match_val, ob]); + if(Sx_types[71].call(null, bU)){ var - remaining$18 = Sx_runtime[25].call(null, frame, n8), - fenv$22 = Sx_runtime[25].call(null, frame, n9), - bV = Sx_runtime[33].call(null, remaining$18); - if(Sx_types[67].call(null, bV)) + remaining$18 = Sx_runtime[26].call(null, frame, oc), + fenv$22 = Sx_runtime[26].call(null, frame, od), + bV = Sx_runtime[34].call(null, remaining$18); + if(Sx_types[71].call(null, bV)) return make_cek_value(converted_val, fenv$22, rest_k); var - bW = Sx_runtime[15].call(null, remaining$18), + bW = Sx_runtime[16].call(null, remaining$18), bX = kont_push (make_handler_frame - (Sx_runtime[25].call(null, frame, n_), bW, fenv$22), + (Sx_runtime[26].call(null, frame, oe), bW, fenv$22), rest_k); return make_cek_state - (Sx_runtime[14].call(null, remaining$18), fenv$22, bX); + (Sx_runtime[15].call(null, remaining$18), fenv$22, bX); } - var bY = Sx_runtime[1].call(null, cst, [0, match_val, n$]); - if(Sx_types[67].call(null, bY)) + var bY = Sx_runtime[2].call(null, cst, [0, match_val, of]); + if(Sx_types[71].call(null, bY)) return make_cek_value(converted_val, env, rest_k); - var bZ = Sx_runtime[1].call(null, cst, [0, match_val, oa]); - if(Sx_types[67].call(null, bZ)){ - var saved_kont = Sx_runtime[25].call(null, frame, ob); + var bZ = Sx_runtime[2].call(null, cst, [0, match_val, og]); + if(Sx_types[71].call(null, bZ)){ + var saved_kont = Sx_runtime[26].call(null, frame, oh); return make_cek_value - (converted_val, Sx_runtime[25].call(null, frame, oc), saved_kont); + (converted_val, Sx_runtime[26].call(null, frame, oi), saved_kont); } - var b0 = Sx_runtime[1].call(null, cst, [0, match_val, od]); - if(Sx_types[67].call(null, b0)) + var b0 = Sx_runtime[2].call(null, cst, [0, match_val, oj]); + if(Sx_types[71].call(null, b0)) return make_cek_value(converted_val, env, rest_k); - var b1 = Sx_runtime[1].call(null, cst, [0, match_val, oe]); - if(Sx_types[67].call(null, b1)){ + var b1 = Sx_runtime[2].call(null, cst, [0, match_val, ok]); + if(Sx_types[71].call(null, b1)){ var - test_value = Sx_runtime[25].call(null, frame, of), - fenv$23 = Sx_runtime[25].call(null, frame, og); + test_value = Sx_runtime[26].call(null, frame, ol), + fenv$23 = Sx_runtime[26].call(null, frame, om); return continue_with_call (converted_val, [6, [0, test_value, 0]], @@ -58021,48 +65195,48 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [6, [0, test_value, 0]], rest_k); } - var b2 = Sx_runtime[1].call(null, cst, [0, match_val, oh]); - if(Sx_types[67].call(null, b2)){ + var b2 = Sx_runtime[2].call(null, cst, [0, match_val, on]); + if(Sx_types[71].call(null, b2)){ var - after_thunk = Sx_runtime[25].call(null, frame, oi), - winders_len = Sx_runtime[25].call(null, frame, oj), - fenv$24 = Sx_runtime[25].call(null, frame, ok), - b3 = [0, Sx_runtime[24].call(null, winders_ref[1]), [0, winders_len, 0]], - b4 = Sx_runtime[1].call(null, cst$0, b3); - if(Sx_types[67].call(null, b4)) - winders_ref[1] = Sx_runtime[15].call(null, winders_ref[1]); + after_thunk = Sx_runtime[26].call(null, frame, oo), + winders_len = Sx_runtime[26].call(null, frame, op), + fenv$24 = Sx_runtime[26].call(null, frame, oq), + b3 = [0, Sx_runtime[25].call(null, winders_ref[1]), [0, winders_len, 0]], + b4 = Sx_runtime[2].call(null, cst$0, b3); + if(Sx_types[71].call(null, b4)) + winders_ref[1] = Sx_runtime[16].call(null, winders_ref[1]); return continue_with_call (after_thunk, - om, + os, fenv$24, - ol, + or, kont_push (make_wind_return_frame(converted_val, fenv$24), rest_k)); } - var b5 = Sx_runtime[1].call(null, cst, [0, match_val, on]); - if(Sx_types[67].call(null, b5)){ - var b6 = Sx_runtime[25].call(null, frame, oo); - return make_cek_value(Sx_runtime[25].call(null, frame, op), b6, rest_k); + var b5 = Sx_runtime[2].call(null, cst, [0, match_val, ot]); + if(Sx_types[71].call(null, b5)){ + var b6 = Sx_runtime[26].call(null, frame, ou); + return make_cek_value(Sx_runtime[26].call(null, frame, ov), b6, rest_k); } - var b7 = Sx_runtime[1].call(null, cst, [0, match_val, oq]); - if(Sx_types[67].call(null, b7)){ + var b7 = Sx_runtime[2].call(null, cst, [0, match_val, ow]); + if(Sx_types[71].call(null, b7)){ var - fenv$25 = Sx_runtime[25].call(null, frame, or), - continuable_p = Sx_runtime[25].call(null, frame, os), + fenv$25 = Sx_runtime[26].call(null, frame, ox), + continuable_p = Sx_runtime[26].call(null, frame, oy), unwind_result = kont_unwind_to_handler(rest_k, converted_val), - handler_fn = Sx_runtime[25].call(null, unwind_result, ot), - unwound_k = Sx_runtime[25].call(null, unwind_result, ou), - b8 = Sx_runtime[83].call(null, handler_fn); - if(Sx_types[67].call(null, b8)){ + handler_fn = Sx_runtime[26].call(null, unwind_result, oz), + unwound_k = Sx_runtime[26].call(null, unwind_result, oA), + b8 = Sx_runtime[84].call(null, handler_fn); + if(Sx_types[71].call(null, b8)){ last_error_kont_ref[1] = unwound_k; var - b9 = [0, ov, [0, Sx_runtime[68].call(null, converted_val), 0]], - b_ = [3, Sx_runtime[4].call(null, b9)]; - return Sx_runtime[101].call(null, b_); + b9 = [0, oB, [0, Sx_runtime[69].call(null, converted_val), 0]], + b_ = [3, Sx_runtime[5].call(null, b9)]; + return Sx_runtime[102].call(null, b_); } var b$ = - Sx_types[67].call(null, continuable_p) + Sx_types[71].call(null, continuable_p) ? kont_push(make_signal_return_frame(fenv$25, unwound_k), unwound_k) : kont_push(make_raise_guard_frame(fenv$25, unwound_k), unwound_k); return continue_with_call @@ -58072,125 +65246,125 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [6, [0, converted_val, 0]], b$); } - var ca = Sx_runtime[1].call(null, cst, [0, match_val, ow]); - if(Sx_types[67].call(null, ca)){ + var ca = Sx_runtime[2].call(null, cst, [0, match_val, oC]); + if(Sx_types[71].call(null, ca)){ last_error_kont_ref[1] = rest_k; - return Sx_runtime[101].call(null, ox); + return Sx_runtime[102].call(null, oD); } - var cb = Sx_runtime[1].call(null, cst, [0, match_val, oy]); - if(Sx_types[67].call(null, cb)){ + var cb = Sx_runtime[2].call(null, cst, [0, match_val, oE]); + if(Sx_types[71].call(null, cb)){ var - f$6 = Sx_runtime[25].call(null, frame, oz), - remaining$19 = Sx_runtime[25].call(null, frame, oA), + f$6 = Sx_runtime[26].call(null, frame, oF), + remaining$19 = Sx_runtime[26].call(null, frame, oG), cc = [0, - Sx_runtime[25].call(null, frame, oB), + Sx_runtime[26].call(null, frame, oH), [0, [6, [0, converted_val, 0]], 0]], - new_results$1 = Sx_runtime[1].call(null, cst_append, cc), - fenv$26 = Sx_runtime[25].call(null, frame, oC), - cd = Sx_runtime[5].call(null, remaining$19), + new_results$1 = Sx_runtime[2].call(null, cst_append, cc), + fenv$26 = Sx_runtime[26].call(null, frame, oI), + cd = Sx_runtime[6].call(null, remaining$19), ce = [0, Stdlib_List[34].call (null, function(c){ - var a = Sx_runtime[33].call(null, c); - return Sx_types[67].call(null, a); + var a = Sx_runtime[34].call(null, c); + return Sx_types[71].call(null, a); }, cd)]; - if(Sx_types[67].call(null, ce)) + if(Sx_types[71].call(null, ce)) return make_cek_value(new_results$1, fenv$26, rest_k); var - cf = Sx_runtime[5].call(null, remaining$19), + cf = Sx_runtime[6].call(null, remaining$19), heads = [6, Stdlib_List[20].call - (null, function(c){return Sx_runtime[14].call(null, c);}, cf)], - cg = Sx_runtime[5].call(null, remaining$19), + (null, function(c){return Sx_runtime[15].call(null, c);}, cf)], + cg = Sx_runtime[6].call(null, remaining$19), tails = [6, Stdlib_List[20].call - (null, function(c){return Sx_runtime[15].call(null, c);}, cg)]; + (null, function(c){return Sx_runtime[16].call(null, c);}, cg)]; return continue_with_call (f$6, heads, fenv$26, - oD, + oJ, kont_push (make_multi_map_frame(f$6, tails, new_results$1, fenv$26), rest_k)); } - var ch = Sx_runtime[1].call(null, cst, [0, match_val, oE]); - if(Sx_types[67].call(null, ch)){ + var ch = Sx_runtime[2].call(null, cst, [0, match_val, oK]); + if(Sx_types[71].call(null, ch)){ var - ci = Sx_runtime[24].call(null, winders_ref[1]), - k = Sx_runtime[98].call(null, rest_k, ci); + ci = Sx_runtime[25].call(null, winders_ref[1]), + k = Sx_runtime[99].call(null, rest_k, ci); return continue_with_call (converted_val, [6, [0, k, 0]], - Sx_runtime[25].call(null, frame, oF), + Sx_runtime[26].call(null, frame, oL), [6, [0, k, 0]], rest_k); } - var cj = Sx_runtime[1].call(null, cst, [0, match_val, oG]); - if(Sx_types[67].call(null, cj)){ + var cj = Sx_runtime[2].call(null, cst, [0, match_val, oM]); + if(Sx_types[71].call(null, cj)){ var - resume_fn = Sx_runtime[25].call(null, frame, oH), + resume_fn = Sx_runtime[26].call(null, frame, oN), result$1 = - Sx_runtime[7].call(null, resume_fn, [6, [0, converted_val, 0]]), - and$8 = Sx_runtime[38].call(null, result$1), + Sx_runtime[8].call(null, resume_fn, [6, [0, converted_val, 0]]), + and$8 = Sx_runtime[39].call(null, result$1), ck = - Sx_types[67].call(null, and$8) - ? Sx_runtime[25].call(null, result$1, oI) + Sx_types[71].call(null, and$8) + ? Sx_runtime[26].call(null, result$1, oO) : and$8; - if(! Sx_types[67].call(null, ck)) + if(! Sx_types[71].call(null, ck)) return make_cek_value - (result$1, Sx_runtime[25].call(null, frame, oN), rest_k); + (result$1, Sx_runtime[26].call(null, frame, oT), rest_k); var - cl = Sx_runtime[25].call(null, frame, oJ), + cl = Sx_runtime[26].call(null, frame, oP), cm = kont_push - (make_vm_resume_frame(Sx_runtime[25].call(null, result$1, oK), cl), + (make_vm_resume_frame(Sx_runtime[26].call(null, result$1, oQ), cl), rest_k), - cn = Sx_runtime[25].call(null, frame, oL); + cn = Sx_runtime[26].call(null, frame, oR); return make_cek_suspended - (Sx_runtime[25].call(null, result$1, oM), cn, cm); + (Sx_runtime[26].call(null, result$1, oS), cn, cm); } - var co = Sx_runtime[1].call(null, cst, [0, match_val, oO]); - if(Sx_types[67].call(null, co)) + var co = Sx_runtime[2].call(null, cst, [0, match_val, oU]); + if(Sx_types[71].call(null, co)) return make_cek_suspended - (converted_val, Sx_runtime[25].call(null, frame, oP), rest_k); - var cp = Sx_runtime[1].call(null, cst, [0, match_val, oQ]); - if(Sx_types[67].call(null, cp)){ + (converted_val, Sx_runtime[26].call(null, frame, oV), rest_k); + var cp = Sx_runtime[2].call(null, cst, [0, match_val, oW]); + if(Sx_types[71].call(null, cp)){ var - import_set = Sx_runtime[25].call(null, frame, oR), - remaining_sets = Sx_runtime[25].call(null, frame, oS), - fenv$27 = Sx_runtime[25].call(null, frame, oT); + import_set = Sx_runtime[26].call(null, frame, oX), + remaining_sets = Sx_runtime[26].call(null, frame, oY), + fenv$27 = Sx_runtime[26].call(null, frame, oZ); bind_import_set(import_set, fenv$27); - var cq = Sx_runtime[33].call(null, remaining_sets); - return Sx_types[67].call(null, cq) + var cq = Sx_runtime[34].call(null, remaining_sets); + return Sx_types[71].call(null, cq) ? make_cek_value(0, fenv$27, rest_k) : step_sf_import(remaining_sets, fenv$27, rest_k); } - var cr = Sx_runtime[1].call(null, cst, [0, match_val, oU]); - if(! Sx_types[67].call(null, cr)){ + var cr = Sx_runtime[2].call(null, cst, [0, match_val, o0]); + if(! Sx_types[71].call(null, cr)){ last_error_kont_ref[1] = rest_k; var - cA = [3, Sx_runtime[4].call(null, [0, o3, [0, match_val, 0]])], - cB = Sx_runtime[2].call(null, cA); + cA = [3, Sx_runtime[5].call(null, [0, o9, [0, match_val, 0]])], + cB = Sx_runtime[3].call(null, cA); throw caml_maybe_attach_backtrace([0, Sx_types[9], cB], 1); } var - remaining$20 = Sx_runtime[25].call(null, frame, oV), - current_param = Sx_runtime[25].call(null, frame, oW), - results$2 = Sx_runtime[25].call(null, frame, oX), - body$2 = Sx_runtime[25].call(null, frame, oY), - fenv$28 = Sx_runtime[25].call(null, frame, oZ), - cs = Sx_runtime[83].call(null, current_param); - if(Sx_types[67].call(null, cs)){ + remaining$20 = Sx_runtime[26].call(null, frame, o1), + current_param = Sx_runtime[26].call(null, frame, o2), + results$2 = Sx_runtime[26].call(null, frame, o3), + body$2 = Sx_runtime[26].call(null, frame, o4), + fenv$28 = Sx_runtime[26].call(null, frame, o5), + cs = Sx_runtime[84].call(null, current_param); + if(Sx_types[71].call(null, cs)){ var - ct = Sx_runtime[14].call(null, remaining$20), - val_expr = Sx_runtime[17].call(null, ct, o0); + ct = Sx_runtime[15].call(null, remaining$20), + val_expr = Sx_runtime[18].call(null, ct, o6); return make_cek_state (val_expr, fenv$28, @@ -58208,21 +65382,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [0, [6, [0, - Sx_types[102].call(null, current_param), + Sx_types[106].call(null, current_param), [0, converted_val, 0]]], 0]], 0]], - new_results$2 = Sx_runtime[1].call(null, cst_append, cu), - rest_bindings = Sx_runtime[15].call(null, remaining$20), - cv = Sx_runtime[33].call(null, rest_bindings); - if(Sx_types[67].call(null, cv)){ + new_results$2 = Sx_runtime[2].call(null, cst_append, cu), + rest_bindings = Sx_runtime[16].call(null, remaining$20), + cv = Sx_runtime[34].call(null, rest_bindings); + if(Sx_types[71].call(null, cv)){ var - cw = [0, Sx_runtime[24].call(null, body$2), o1], - cx = Sx_runtime[1].call(null, cst, cw), + cw = [0, Sx_runtime[25].call(null, body$2), o7], + cx = Sx_runtime[2].call(null, cst, cw), body_expr = - Sx_types[67].call(null, cx) - ? Sx_runtime[14].call(null, body$2) - : Sx_runtime[18].call(null, o2, body$2), + Sx_types[71].call(null, cx) + ? Sx_runtime[15].call(null, body$2) + : Sx_runtime[19].call(null, o8, body$2), provide_kont = kont_push_provides(new_results$2, fenv$28, rest_k); return make_cek_state(body_expr, fenv$28, provide_kont); } @@ -58232,72 +65406,72 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (make_parameterize_frame (rest_bindings, 0, new_results$2, body$2, fenv$28), rest_k), - cz = Sx_runtime[14].call(null, rest_bindings); - return make_cek_state(Sx_runtime[14].call(null, cz), fenv$28, cy); + cz = Sx_runtime[15].call(null, rest_bindings); + return make_cek_state(Sx_runtime[15].call(null, cz), fenv$28, cy); } var - o4 = [3, cst_value], - o5 = [3, "captured"], - o6 = [0, 0], - o7 = [3, "message"], - o8 = [3, cst_vm_suspended], - o9 = [3, cst_resume], - o_ = [3, cst_request], - o$ = [3, cst_args_got], - pa = [3, cst_expects], - pb = [3, cst_lambda], - pc = [2, 1.], - pd = [3, cst_vm_suspended], - pe = [3, cst_resume], - pf = [3, cst_request], - pg = [2, 1.], - ph = [3, cst_children], - pi = [3, "Not callable: "]; + o_ = [3, cst_value], + o$ = [3, "captured"], + pa = [0, 0], + pb = [3, "message"], + pc = [3, cst_vm_suspended], + pd = [3, cst_resume], + pe = [3, cst_request], + pf = [3, cst_args_got], + pg = [3, cst_expects], + ph = [3, cst_lambda], + pi = [2, 1.], + pj = [3, cst_vm_suspended], + pk = [3, cst_resume], + pl = [3, cst_request], + pm = [2, 1.], + pn = [3, cst_children], + po = [3, "Not callable: "]; function continue_with_call(f, args, env, raw_args, kont){ - var b = Sx_types[101].call(null, f); - if(Sx_types[67].call(null, b)){ + var b = Sx_types[105].call(null, f); + if(Sx_types[71].call(null, b)){ var - uid = Sx_types[102].call(null, f), + uid = Sx_types[106].call(null, f), frame = kont_find_provide(kont, uid), c = - Sx_types[67].call(null, frame) - ? Sx_runtime[25].call(null, frame, o4) - : Sx_types[103].call(null, f); + Sx_types[71].call(null, frame) + ? Sx_runtime[26].call(null, frame, o_) + : Sx_types[107].call(null, f); return make_cek_value(c, env, kont); } - var d = Sx_runtime[97].call(null, f); - if(Sx_types[67].call(null, d)){ + var d = Sx_runtime[98].call(null, f); + if(Sx_types[71].call(null, d)){ var - e = Sx_runtime[33].call(null, args), - arg = Sx_types[67].call(null, e) ? 0 : Sx_runtime[14].call(null, args), - captured = Sx_runtime[99].call(null, f), - w_len = Sx_runtime[100].call(null, f); + e = Sx_runtime[34].call(null, args), + arg = Sx_types[71].call(null, e) ? 0 : Sx_runtime[15].call(null, args), + captured = Sx_runtime[100].call(null, f), + w_len = Sx_runtime[101].call(null, f); wind_escape_to(w_len); return make_cek_value(arg, env, captured); } - var g = Sx_runtime[94].call(null, f); - if(Sx_types[67].call(null, g)){ + var g = Sx_runtime[95].call(null, f); + if(Sx_types[71].call(null, g)){ var - h = Sx_runtime[33].call(null, args), - arg$0 = Sx_types[67].call(null, h) ? 0 : Sx_runtime[14].call(null, args), - cont_data = Sx_runtime[96].call(null, f), - captured$0 = Sx_runtime[25].call(null, cont_data, o5), + h = Sx_runtime[34].call(null, args), + arg$0 = Sx_types[71].call(null, h) ? 0 : Sx_runtime[15].call(null, args), + cont_data = Sx_runtime[97].call(null, f), + captured$0 = Sx_runtime[26].call(null, cont_data, o$), result = cek_run(make_cek_value(arg$0, env, captured$0)); return make_cek_value(result, env, kont); } - var and = Sx_runtime[90].call(null, f); - if(Sx_types[67].call(null, and)){ + var and = Sx_runtime[91].call(null, f); + if(Sx_types[71].call(null, and)){ var - i = Sx_runtime[85].call(null, f), - and$0 = [0, 1 - Sx_types[67].call(null, i)]; - if(Sx_types[67].call(null, and$0)){ + i = Sx_runtime[86].call(null, f), + and$0 = [0, 1 - Sx_types[71].call(null, i)]; + if(Sx_types[71].call(null, and$0)){ var - j = Sx_runtime[86].call(null, f), - and$1 = [0, 1 - Sx_types[67].call(null, j)]; - if(Sx_types[67].call(null, and$1)) + j = Sx_runtime[87].call(null, f), + and$1 = [0, 1 - Sx_types[71].call(null, j)]; + if(Sx_types[71].call(null, and$1)) var - k = Sx_runtime[87].call(null, f), - a = [0, 1 - Sx_types[67].call(null, k)]; + k = Sx_runtime[88].call(null, f), + a = [0, 1 - Sx_types[71].call(null, k)]; else var a = and$1; } @@ -58306,179 +65480,179 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - result$0 = Sx_runtime[8].call(null, f, args), - l = [0, Sx_runtime[9].call(null, result$0)]; - if(Sx_types[67].call(null, l)){ - var m = kont_push(make_raise_eval_frame(env, o6), kont); - return make_cek_value(Sx_runtime[25].call(null, result$0, o7), env, m); + result$0 = Sx_runtime[9].call(null, f, args), + l = [0, Sx_runtime[10].call(null, result$0)]; + if(Sx_types[71].call(null, l)){ + var m = kont_push(make_raise_eval_frame(env, pa), kont); + return make_cek_value(Sx_runtime[26].call(null, result$0, pb), env, m); } var - and$2 = Sx_runtime[38].call(null, result$0), + and$2 = Sx_runtime[39].call(null, result$0), n = - Sx_types[67].call(null, and$2) - ? Sx_runtime[25].call(null, result$0, o8) + Sx_types[71].call(null, and$2) + ? Sx_runtime[26].call(null, result$0, pc) : and$2; - if(! Sx_types[67].call(null, n)) + if(! Sx_types[71].call(null, n)) return make_cek_value(result$0, env, kont); var o = kont_push - (make_vm_resume_frame(Sx_runtime[25].call(null, result$0, o9), env), + (make_vm_resume_frame(Sx_runtime[26].call(null, result$0, pd), env), kont); return make_cek_suspended - (Sx_runtime[25].call(null, result$0, o_), env, o); + (Sx_runtime[26].call(null, result$0, pe), env, o); } - var p = Sx_runtime[85].call(null, f); - if(! Sx_types[67].call(null, p)){ + var p = Sx_runtime[86].call(null, f); + if(! Sx_types[71].call(null, p)){ var - or$1 = Sx_runtime[86].call(null, f), + or$1 = Sx_runtime[87].call(null, f), or$2 = - Sx_types[67].call(null, or$1) ? or$1 : Sx_runtime[87].call(null, f); - if(! Sx_types[67].call(null, or$2)){ + Sx_types[71].call(null, or$1) ? or$1 : Sx_runtime[88].call(null, f); + if(! Sx_types[71].call(null, or$2)){ var - P = [0, pi, [0, Sx_runtime[68].call(null, f), 0]], - Q = [3, Sx_runtime[4].call(null, P)], - R = Sx_runtime[2].call(null, Q); + P = [0, po, [0, Sx_runtime[69].call(null, f), 0]], + Q = [3, Sx_runtime[5].call(null, P)], + R = Sx_runtime[3].call(null, Q); throw caml_maybe_attach_backtrace([0, Sx_types[9], R], 1); } var parsed = parse_keyword_args(raw_args, env), - kwargs = Sx_runtime[14].call(null, parsed), - children = Sx_runtime[17].call(null, parsed, pg), - I = Sx_types[81].call(null, f), - local$0 = Sx_runtime[81].call(null, I, env), - J = Sx_types[79].call(null, f), - K = Sx_runtime[5].call(null, J); + kwargs = Sx_runtime[15].call(null, parsed), + children = Sx_runtime[18].call(null, parsed, pm), + I = Sx_types[85].call(null, f), + local$0 = Sx_runtime[82].call(null, I, env), + J = Sx_types[83].call(null, f), + K = Sx_runtime[6].call(null, J); Stdlib_List[18].call (null, function(p){ var - or = Sx_runtime[56].call(null, kwargs, p), - or$0 = Sx_types[67].call(null, or) ? or : 0, - a = Sx_runtime[3].call(null, p); - Sx_runtime[77].call(null, local$0, a, or$0); + or = Sx_runtime[57].call(null, kwargs, p), + or$0 = Sx_types[71].call(null, or) ? or : 0, + a = Sx_runtime[4].call(null, p); + Sx_runtime[78].call(null, local$0, a, or$0); return 0; }, K); - var L = Sx_types[82].call(null, f); - if(Sx_types[67].call(null, L)){ - var M = Sx_runtime[3].call(null, ph); - Sx_runtime[77].call(null, local$0, M, children); + var L = Sx_types[86].call(null, f); + if(Sx_types[71].call(null, L)){ + var M = Sx_runtime[4].call(null, pn); + Sx_runtime[78].call(null, local$0, M, children); } var - N = Sx_types[76].call(null, f), + N = Sx_types[80].call(null, f), O = - kont_push(make_comp_trace_frame(Sx_types[75].call(null, f), N), kont); - return make_cek_state(Sx_types[80].call(null, f), local$0, O); + kont_push(make_comp_trace_frame(Sx_types[79].call(null, f), N), kont); + return make_cek_state(Sx_types[84].call(null, f), local$0, O); } var - params = Sx_types[70].call(null, f), - q = Sx_types[72].call(null, f), - local = Sx_runtime[81].call(null, q, env), + params = Sx_types[74].call(null, f), + q = Sx_types[76].call(null, f), + local = Sx_runtime[82].call(null, q, env), r = bind_lambda_params(params, args, local), - s = [0, 1 - Sx_types[67].call(null, r)]; - if(Sx_types[67].call(null, s)){ + s = [0, 1 - Sx_types[71].call(null, r)]; + if(Sx_types[71].call(null, s)){ var - t = [0, Sx_runtime[24].call(null, params), 0], - u = [0, Sx_runtime[24].call(null, args), t], - v = Sx_runtime[1].call(null, cst$0, u); - if(Sx_types[67].call(null, v)){ + t = [0, Sx_runtime[25].call(null, params), 0], + u = [0, Sx_runtime[25].call(null, args), t], + v = Sx_runtime[2].call(null, cst$0, u); + if(Sx_types[71].call(null, v)){ var - w = [0, o$, [0, Sx_runtime[24].call(null, args), 0]], - x = [0, pa, [0, Sx_runtime[24].call(null, params), w]], - or = Sx_types[73].call(null, f), - or$0 = Sx_types[67].call(null, or) ? or : pb, - y = [3, Sx_runtime[4].call(null, [0, or$0, x])], - z = Sx_runtime[2].call(null, y); + w = [0, pf, [0, Sx_runtime[25].call(null, args), 0]], + x = [0, pg, [0, Sx_runtime[25].call(null, params), w]], + or = Sx_types[77].call(null, f), + or$0 = Sx_types[71].call(null, or) ? or : ph, + y = [3, Sx_runtime[5].call(null, [0, or$0, x])], + z = Sx_runtime[3].call(null, y); throw caml_maybe_attach_backtrace([0, Sx_types[9], z], 1); } var - A = Sx_runtime[1].call(null, cst_zip, [0, params, [0, args, 0]]), - B = Sx_runtime[5].call(null, A); + A = Sx_runtime[2].call(null, cst_zip, [0, params, [0, args, 0]]), + B = Sx_runtime[6].call(null, A); Stdlib_List[18].call (null, function(pair){ var - a = Sx_runtime[17].call(null, pair, pc), - b = Sx_runtime[14].call(null, pair), - c = Sx_runtime[3].call(null, b); - Sx_runtime[77].call(null, local, c, a); + a = Sx_runtime[18].call(null, pair, pi), + b = Sx_runtime[15].call(null, pair), + c = Sx_runtime[4].call(null, b); + Sx_runtime[78].call(null, local, c, a); return 0; }, B); var - C = [0, params, [0, Sx_runtime[24].call(null, args), 0]], - D = Sx_runtime[1].call(null, cst_slice, C), - E = Sx_runtime[5].call(null, D); + C = [0, params, [0, Sx_runtime[25].call(null, args), 0]], + D = Sx_runtime[2].call(null, cst_slice, C), + E = Sx_runtime[6].call(null, D); Stdlib_List[18].call (null, function(p){ - var a = Sx_runtime[3].call(null, p); - Sx_runtime[77].call(null, local, a, 0); + var a = Sx_runtime[4].call(null, p); + Sx_runtime[78].call(null, local, a, 0); return 0; }, E); } var - jit_result = Sx_runtime[137].call(null, f, args), - F = Sx_runtime[136].call(null, jit_result); - if(Sx_types[67].call(null, F)) - return make_cek_state(Sx_types[71].call(null, f), local, kont); + jit_result = Sx_runtime[139].call(null, f, args), + F = Sx_runtime[138].call(null, jit_result); + if(Sx_types[71].call(null, F)) + return make_cek_state(Sx_types[75].call(null, f), local, kont); var - and$3 = Sx_runtime[38].call(null, jit_result), + and$3 = Sx_runtime[39].call(null, jit_result), G = - Sx_types[67].call(null, and$3) - ? Sx_runtime[25].call(null, jit_result, pd) + Sx_types[71].call(null, and$3) + ? Sx_runtime[26].call(null, jit_result, pj) : and$3; - if(! Sx_types[67].call(null, G)) + if(! Sx_types[71].call(null, G)) return make_cek_value(jit_result, local, kont); var H = kont_push - (make_vm_resume_frame(Sx_runtime[25].call(null, jit_result, pe), env), + (make_vm_resume_frame(Sx_runtime[26].call(null, jit_result, pk), env), kont); return make_cek_suspended - (Sx_runtime[25].call(null, jit_result, pf), env, H); + (Sx_runtime[26].call(null, jit_result, pl), env, H); } - var pj = [0, [2, 2.], 0], pk = [2, 1.], pl = [0, [2, 2.], 0]; + var pp = [0, [2, 2.], 0], pq = [2, 1.], pr = [0, [2, 2.], 0]; function sf_case_step_loop(match_val, clauses$1, env, kont){ var clauses = clauses$1; for(;;){ var - a = [0, Sx_runtime[24].call(null, clauses), pj], - b = Sx_runtime[1].call(null, cst$3, a); - if(Sx_types[67].call(null, b)) return make_cek_value(0, env, kont); + a = [0, Sx_runtime[25].call(null, clauses), pp], + b = Sx_runtime[2].call(null, cst$3, a); + if(Sx_types[71].call(null, b)) return make_cek_value(0, env, kont); var - test = Sx_runtime[14].call(null, clauses), - body = Sx_runtime[17].call(null, clauses, pk), + test = Sx_runtime[15].call(null, clauses), + body = Sx_runtime[18].call(null, clauses, pq), c = is_else_clause(test); - if(Sx_types[67].call(null, c)) return make_cek_state(body, env, kont); + if(Sx_types[71].call(null, c)) return make_cek_state(body, env, kont); var test_val = trampoline(eval_expr(test, env)), - d = Sx_runtime[1].call(null, cst, [0, match_val, [0, test_val, 0]]); - if(Sx_types[67].call(null, d)) return make_cek_state(body, env, kont); - var clauses$0 = Sx_runtime[1].call(null, cst_slice, [0, clauses, pl]); + d = Sx_runtime[2].call(null, cst, [0, match_val, [0, test_val, 0]]); + if(Sx_types[71].call(null, d)) return make_cek_state(body, env, kont); + var clauses$0 = Sx_runtime[2].call(null, cst_slice, [0, clauses, pr]); clauses = clauses$0; } } - var pm = [6, 0]; + var ps = [6, 0]; function eval_expr_cek(expr, env){ - return cek_run(make_cek_state(expr, env, pm)); + return cek_run(make_cek_state(expr, env, ps)); } function trampoline_cek(val){ - var a = Sx_runtime[84].call(null, val); - if(! Sx_types[67].call(null, a)) return val; - var b = Sx_types[89].call(null, val); - return eval_expr_cek(Sx_types[88].call(null, val), b); + var a = Sx_runtime[85].call(null, val); + if(! Sx_types[71].call(null, a)) return val; + var b = Sx_types[93].call(null, val); + return eval_expr_cek(Sx_types[92].call(null, val), b); } function make_coroutine(thunk){ return [23, [0, "coroutine", 0, 0, 0, 0, 0, 0, 0, 0, 0]]; } - var pn = [6, 0]; + var pt = [6, 0]; function eval_expr(expr, env){ - return cek_run(make_cek_state(expr, env, pn)); + return cek_run(make_cek_state(expr, env, pt)); } caml_update_dummy (custom_special_forms, [7, Stdlib_Hashtbl[1].call(null, 0, 0)]); @@ -58518,20 +65692,28 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = 0; } if(! a){ - var match$1 = cek_suspended_p(s[1]); + var match$2 = cek_suspended_p(s[1]); a: { - if(typeof match$1 !== "number" && 0 === match$1[0] && match$1[1]){var b = 1; break a;} - var b = 0; + if(typeof match$2 !== "number" && 0 === match$2[0] && match$2[1]){var c = 1; break a;} + var c = 0; } - if(! b){s[1] = cek_step(s[1]); continue;} + if(! c){s[1] = cek_step(s[1]); continue;} } var match$0 = cek_suspended_p(s[1]); - if(typeof match$0 !== "number" && 0 === match$0[0] && match$0[1]) - throw caml_maybe_attach_backtrace - ([0, Sx_types[9], cst_IO_suspension_in_non_IO_co], 1); - var c = cek_value(s[1]); - return c; + a: + { + if(typeof match$0 !== "number" && 0 === match$0[0] && match$0[1]){ + var match$1 = Sx_types[13][1]; + if(! match$1) + throw caml_maybe_attach_backtrace + ([0, Sx_types[9], cst_IO_suspension_in_non_IO_co], 1); + var hook = match$1[1], b = caml_call1(hook, s[1]); + break a; + } + var b = cek_value(s[1]); + } + return b; } } catch(exn$0){ @@ -58669,17 +65851,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return Stdlib[28].call(null, msg, a); } var - po = [0, 0], - pp = [0, 0], - pq = + pu = [0, 0], + pv = [0, 0], + pw = [0, [2, 0, [11, cst_expected, [4, 0, 0, 0, [11, cst_args_got, [4, 0, 0, 0, 0]]]]], "%s: expected %d args, got %d"], - pr = [0, 1], - ps = [0, 0], - pt = [0, 0]; + px = [0, 0], + py = [0, 0]; function sf_define_type(args, env_val){ a: { @@ -58691,16 +65872,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= type_name = Sx_types[35].call(null, type_sym), ctor_specs = Stdlib_List[7].call(null, items); function env_bind_v(k, v){ - Sx_runtime[77].call(null, env_val, [3, k], v); + Sx_runtime[78].call(null, env_val, [3, k], v); return 0; } - var - cst_adt_registry = "*adt-registry*", - a = Sx_runtime[75].call(null, env_val, [3, cst_adt_registry]); - if(1 - Sx_types[67].call(null, a)) + var a = Sx_runtime[76].call(null, env_val, [3, cst_adt_registry]); + if(1 - Sx_types[71].call(null, a)) env_bind_v(cst_adt_registry, [7, Stdlib_Hashtbl[1].call(null, 0, 8)]); var - registry = Sx_runtime[76].call(null, env_val, [3, cst_adt_registry]), + registry = Sx_runtime[77].call(null, env_val, [3, cst_adt_registry]), ctor_names = Stdlib_List[20].call (null, @@ -58720,34 +65899,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Hashtbl[11].call(null, d, type_name, [6, ctor_names]); } var - cst_type = "_type", b = [15, Stdlib[28].call(null, type_name, cst$4), function(pargs){ if(pargs && ! pargs[2]){ var v = pargs[1]; - if(typeof v !== "number" && 7 === v[0]){ - var d = v[1], b = Stdlib_Hashtbl[9].call(null, d, cst_adt); - a: - if(b){ - var match = Stdlib_Hashtbl[7].call(null, d, cst_type); - if(match){ - var match$0 = match[1]; - if(typeof match$0 !== "number" && 3 === match$0[0]){ - var t = match$0[1], a = t === type_name ? 1 : 0; - break a; - } - } - var a = 0; - } - else - var a = b; - return [0, a]; + if(typeof v !== "number" && 38 === v[0]){ + var a = v[1]; + return [0, a[1] === type_name ? 1 : 0]; } - return pp; + return pv; } - return po; + return pu; }]; env_bind_v(Stdlib[28].call(null, type_name, cst$4), b); Stdlib_List[18].call @@ -58767,18 +65931,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= [15, cn, function(ctor_args){ - if(Stdlib_List[1].call(null, ctor_args) !== arity){ - var - a = Stdlib_List[1].call(null, ctor_args), - b = caml_call3(Stdlib_Printf[4].call(null, pq), cn, arity, a); - throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); - } - var d = Stdlib_Hashtbl[1].call(null, 0, 4); - Stdlib_Hashtbl[11].call(null, d, cst_adt, pr); - Stdlib_Hashtbl[11].call(null, d, cst_type, [3, type_name]); - Stdlib_Hashtbl[11].call(null, d, cst_ctor, [3, cn]); - Stdlib_Hashtbl[11].call(null, d, cst_fields, [6, ctor_args]); - return [7, d]; + if(Stdlib_List[1].call(null, ctor_args) === arity) + return [38, + [0, type_name, cn, Stdlib_Array[11].call(null, ctor_args)]]; + var + a = Stdlib_List[1].call(null, ctor_args), + b = caml_call3(Stdlib_Printf[4].call(null, pw), cn, arity, a); + throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); }]); var a = @@ -58787,25 +65946,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(pargs){ if(pargs && ! pargs[2]){ var v = pargs[1]; - if(typeof v !== "number" && 7 === v[0]){ - var d = v[1], b = Stdlib_Hashtbl[9].call(null, d, cst_adt); - a: - if(b){ - var match = Stdlib_Hashtbl[7].call(null, d, cst_ctor); - if(match){ - var match$0 = match[1]; - if(typeof match$0 !== "number" && 3 === match$0[0]){var c = match$0[1], a = c === cn ? 1 : 0; break a; - } - } - var a = 0; - } - else - var a = b; - return [0, a]; + if(typeof v !== "number" && 38 === v[0]){ + var a = v[1]; + return [0, a[2] === cn ? 1 : 0]; } - return pt; + return py; } - return ps; + return px; }]; env_bind_v(Stdlib[28].call(null, cn, cst$4), a); return Stdlib_List[19].call @@ -58819,40 +65966,27 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function(pargs){ if(pargs && ! pargs[2]){ var v = pargs[1]; - if(typeof v !== "number" && 7 === v[0]){ + if(typeof v !== "number" && 38 === v[0]){ + var a = v[1]; + if(idx < a[3].length - 1) + return runtime.caml_check_bound(a[3], idx)[idx + 1]; var - d = v[1], - match = Stdlib_Hashtbl[7].call(null, d, cst_fields); - if(match){ - var match$0 = match[1]; - if(typeof match$0 !== "number" && 6 === match$0[0]){ - var fs = match$0[1]; - if(idx < Stdlib_List[1].call(null, fs)) - return Stdlib_List[8].call(null, fs, idx); - var - k = Stdlib[28].call(null, fname, ": index out of bounds"), - l = Stdlib[28].call(null, cst$5, k), - m = Stdlib[28].call(null, cn, l); - throw caml_maybe_attach_backtrace([0, Sx_types[9], m], 1); - } - } - var - h = Stdlib[28].call(null, fname, ": not an ADT"), + h = Stdlib[28].call(null, fname, ": index out of bounds"), i = Stdlib[28].call(null, cst$5, h), j = Stdlib[28].call(null, cn, i); throw caml_maybe_attach_backtrace([0, Sx_types[9], j], 1); } var - e = Stdlib[28].call(null, fname, ": not a dict"), + e = Stdlib[28].call(null, fname, ": not an ADT"), f = Stdlib[28].call(null, cst$5, e), g = Stdlib[28].call(null, cn, f); throw caml_maybe_attach_backtrace([0, Sx_types[9], g], 1); } var - a = Stdlib[28].call(null, fname, ": expected 1 arg"), - b = Stdlib[28].call(null, cst$5, a), - c = Stdlib[28].call(null, cn, b); - throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); + b = Stdlib[28].call(null, fname, ": expected 1 arg"), + c = Stdlib[28].call(null, cst$5, b), + d = Stdlib[28].call(null, cn, c); + throw caml_maybe_attach_backtrace([0, Sx_types[9], d], 1); }], c = Stdlib[28].call(null, cst$5, fname); return env_bind_v(Stdlib[28].call(null, cn, c), b); @@ -58880,10 +66014,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }]); - var cst_list$0 = "_list", cst_values = "_values", pu = [0, 1]; + var cst_list$0 = "_list", cst_values = "_values", pz = [0, 1]; function make_values_dict(vs){ var d = Stdlib_Hashtbl[1].call(null, 0, 2); - Stdlib_Hashtbl[11].call(null, d, cst_values, pu); + Stdlib_Hashtbl[11].call(null, d, cst_values, pz); Stdlib_Hashtbl[11].call(null, d, cst_list$0, [6, vs]); return [7, d]; } @@ -58929,7 +66063,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 1 < Stdlib_List[1].call(null, items) ? Stdlib_List[7].call(null, items) : 0, - local_env = Sx_runtime[80].call(null, env_val); + local_env = Sx_runtime[81].call(null, env_val); Stdlib_List[18].call (null, function(clause){ @@ -58971,7 +66105,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= idx < Stdlib_List[1].call(null, vs) ? Stdlib_List[8].call(null, vs, idx) : 0; - Sx_runtime[77].call(null, local_env, [3, n], v); + Sx_runtime[78].call(null, local_env, [3, n], v); return 0; }, names); @@ -59015,7 +66149,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= idx < Stdlib_List[1].call(null, vs) ? Stdlib_List[8].call(null, vs, idx) : 0; - Sx_runtime[77].call(null, env_val, [3, n], v); + Sx_runtime[78].call(null, env_val, [3, n], v); return 0; }, names); @@ -59056,19 +66190,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= cst_promise = "_promise", cst_forced = "forced", cst_thunk = "thunk", - pv = [0, 1], - pw = [0, 0], - px = [0, 1]; + pA = [0, 1], + pB = [0, 0], + pC = [0, 1]; function make_promise_dict(opt, thunk){ var iterative = opt ? opt[1] : 0, d = Stdlib_Hashtbl[1].call(null, 0, 4); - Stdlib_Hashtbl[11].call(null, d, cst_promise, pv); - Stdlib_Hashtbl[11].call(null, d, cst_forced, pw); + Stdlib_Hashtbl[11].call(null, d, cst_promise, pA); + Stdlib_Hashtbl[11].call(null, d, cst_forced, pB); Stdlib_Hashtbl[11].call(null, d, cst_thunk, thunk); Stdlib_Hashtbl[11].call(null, d, cst_value, 0); - if(iterative) Stdlib_Hashtbl[11].call(null, d, cst_iterative, px); + if(iterative) Stdlib_Hashtbl[11].call(null, d, cst_iterative, pC); return [7, d]; } - var py = [6, 0]; + var pD = [6, 0]; function sf_delay(args, env_val){ a: { @@ -59078,10 +66212,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var expr = 0; } - var thunk = Sx_types[42].call(null, py, expr, env_val); + var thunk = Sx_types[42].call(null, pD, expr, env_val); return make_promise_dict(0, thunk); } - var pz = [6, 0], pA = [0, 1]; + var pE = [6, 0], pF = [0, 1]; function sf_delay_force(args, env_val){ a: { @@ -59091,8 +66225,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var expr = 0; } - var thunk = Sx_types[42].call(null, pz, expr, env_val); - return make_promise_dict(pA, thunk); + var thunk = Sx_types[42].call(null, pE, expr, env_val); + return make_promise_dict(pF, thunk); } function is_promise(v){ if(typeof v !== "number" && 7 === v[0]){ @@ -59105,7 +66239,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; } - var pB = [6, 0], pC = [0, 1]; + var pG = [6, 0], pH = [0, 1]; function force_promise(p){ if(! is_promise(p)) return p; if(typeof p !== "number" && 7 === p[0]){ @@ -59122,7 +66256,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match$0 = Stdlib_Hashtbl[7].call(null, d, cst_thunk); if(match$0) var t = match$0[1], thunk = t; else var thunk = 0; var - result = cek_call(thunk, pB), + result = cek_call(thunk, pG), match$1 = Stdlib_Hashtbl[7].call(null, d, cst_iterative); a: { @@ -59137,7 +66271,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= iterative ? is_promise(result) ? force_promise(result) : result : result; - Stdlib_Hashtbl[11].call(null, d, cst_forced, pC); + Stdlib_Hashtbl[11].call(null, d, cst_forced, pH); Stdlib_Hashtbl[11].call(null, d, cst_value, final_val); return final_val; } @@ -59174,7 +66308,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; }]); runtime.caml_register_global - (1730, + (1734, [0, trampoline_fn, trampoline, @@ -59369,6 +66503,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= match_find_clause, match_pattern, step_sf_match, + match_check_exhaustiveness, step_sf_handler_bind, step_sf_restart_case, step_sf_signal, @@ -59436,14 +66571,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 22691 "../lib/.sx.objs/jsoo/default/sx.cma.js" -//# shape: Sx_vm:[N,N,N,F(1)*,N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1),F(1)*,F(2),N,N,N,N,N,F(1),F(1),N,F(3),F(1),F(6),F(3),F(3),F(2),F(3),F(1),F(2),F(2),F(2),F(1)*,F(2),F(1),F(1)*,F(2),F(1)] +//# 28169 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# shape: Sx_vm:[N,N,N,N,N,N,F(1)*,N,F(1)*,F(2),F(1),F(1),F(1),F(1),F(1),F(1)*,F(2),N,N,N,N,N,F(1),F(1),N,F(3),F(1),F(6),F(3),F(3),F(2),F(3),F(1),F(2),F(2),F(2),F(1)*,F(3),F(2),F(1),F(1),F(2),F(1),F(1)*,F(2),F(1)] (function (globalThis){ "use strict"; var runtime = globalThis.jsoo_runtime, caml_check_bound = runtime.caml_check_bound, + caml_fresh_oo_id = runtime.caml_fresh_oo_id, caml_make_vect = runtime.caml_make_vect, caml_maybe_attach_backtrace = runtime.caml_maybe_attach_backtrace, caml_ml_string_length = runtime.caml_ml_string_length, @@ -59482,8 +66618,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= dummy = 0, global_data = runtime.caml_get_global_data(), Stdlib_List = global_data.Stdlib__List, - Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Sx_types = global_data.Sx_types, + Stdlib_Hashtbl = global_data.Stdlib__Hashtbl, Stdlib_Queue = global_data.Stdlib__Queue, Stdlib = global_data.Stdlib, Sx_runtime = global_data.Sx_runtime, @@ -59494,7 +66630,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Array = global_data.Stdlib__Array, Sx_parser = global_data.Sx_parser, Stdlib_Printexc = global_data.Stdlib__Printexc, - VmSuspended = [248, "Sx_vm.VmSuspended", runtime.caml_fresh_oo_id(0)]; + VmSuspended = [248, "Sx_vm.VmSuspended", caml_fresh_oo_id(0)], + Invalid_opcode = [248, "Sx_vm.Invalid_opcode", caml_fresh_oo_id(0)]; Sx_types[15][1] = function(exn){ if(exn[1] !== VmSuspended) return 0; @@ -59503,6 +66640,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= }; var jit_compile_ref = [0, function(a, param){return 0;}], + extension_dispatch_ref = + [0, + function(op, vm, frame){ + throw caml_maybe_attach_backtrace([0, Invalid_opcode, op], 1); + }], + extension_opcode_name_ref = [0, function(param){return 0;}], jit_failed_sentinel = [0, [0, -1, -1, 0, [0], [0], 0, 0], @@ -59556,7 +66699,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = cl[3]; function a(args){ var - a = Stdlib_List[20].call(null, Sx_runtime[2], args), + a = Stdlib_List[20].call(null, Sx_runtime[3], args), b = Stdlib_String[7].call(null, ",", a), c = Stdlib[28].call(null, "VM_CLOSURE_CALL:", b); throw caml_maybe_attach_backtrace([0, Sx_types[9], c], 1); @@ -59915,7 +67058,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= globals); var result = - Sx_ref[241].call + Sx_ref[242].call (null, [6, [0, j, [0, [6, [0, i, [0, fn_expr, 0]]], 0]]], [20, compile_env]); @@ -59975,16 +67118,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= active_vm[1] = [0, create(vm[4])]; var b = [20, Sx_types[20].call(null, 0)], - state = Sx_ref[236].call(null, f, [6, a], b, [6, a], k), + state = Sx_ref[237].call(null, f, [6, a], b, [6, a], k), final = Sx_ref[156].call(null, state); active_vm[1] = saved_active; - var match = Sx_runtime[12].call(null, final, l); + var match = Sx_runtime[13].call(null, final, l); if (typeof match !== "number" && 3 === match[0] && match[1] === cst_io_suspended){ vm[5] = [0, final]; throw caml_maybe_attach_backtrace - ([0, VmSuspended, Sx_runtime[12].call(null, final, m), vm], 1); + ([0, VmSuspended, Sx_runtime[13].call(null, final, m), vm], 1); } return Sx_ref[18].call(null, final); } @@ -60009,19 +67152,47 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= push_closure_frame(vm, cl, args); var saved_frames = Stdlib_List[7].call(null, vm[3]); vm[3] = [0, Stdlib_List[6].call(null, vm[3]), 0]; - try{run(vm);} + try{ + run(vm); + if(saved_sp < vm[2]) + var a = vm[2] - 1 | 0, b = caml_check_bound(vm[1], a)[a + 1]; + else + var b = 0; + var result = b; + } catch(e$0){ var e = caml_wrap_exception(e$0); - if(e[1] === VmSuspended){ + if(e[1] !== VmSuspended){ + vm[3] = saved_frames; + vm[2] = saved_sp; + throw caml_maybe_attach_backtrace(e, 0); + } + var req = e[2], match$0 = Sx_types[12][1]; + if(! match$0){ vm[7] = [0, [0, saved_frames, saved_sp], vm[7]]; throw caml_maybe_attach_backtrace(e, 0); } - vm[3] = saved_frames; - vm[2] = saved_sp; - throw caml_maybe_attach_backtrace(e, 0); + var resolver = match$0[1], saved_reuse = vm[7]; + vm[7] = 0; + var req$0 = req; + for(;;){ + var r = caml_call2(resolver, req$0, 0); + try{var cb = resume_vm(vm, r);} + catch(exn$0){ + var exn = caml_wrap_exception(exn$0); + if(exn[1] !== VmSuspended) throw caml_maybe_attach_backtrace(exn, 0); + var req2 = exn[2]; + req$0 = req2; + continue; + } + vm[7] = saved_reuse; + var result = cb; + break; + } } vm[3] = saved_frames; - return pop(vm); + vm[2] = saved_sp; + return result; } function vm_call(vm, f, args){ if(typeof f !== "number") @@ -60036,7 +67207,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } if(0 === l[4]) return push(vm, cek_call_or_suspend(vm, f, [6, args])); l[6] = l[6] + 1 | 0; - if(Sx_types[43][1] <= l[6] && 0 < Sx_types[47][1]){ + if(Sx_types[43][1] <= l[6] && 0 < Sx_types[51][1]){ l[5] = [0, jit_failed_sentinel]; var match$0 = caml_call2(jit_compile_ref[1], l, vm[4]); if(! match$0){ @@ -60046,16 +67217,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cl$0 = match$0[1]; Sx_types[44][1]++; l[5] = [0, cl$0]; - Stdlib_Queue[3].call(null, [0, l[7], [8, l]], Sx_types[49]); + Stdlib_Queue[3].call(null, [0, l[7], [8, l]], Sx_types[53]); for(;;){ - var d = Sx_types[47][1]; - if(d >= Stdlib_Queue[14].call(null, Sx_types[49])) + var d = Sx_types[51][1]; + if(d >= Stdlib_Queue[14].call(null, Sx_types[53])) return push_closure_frame(vm, cl$0, args); - var match$1 = Stdlib_Queue[7].call(null, Sx_types[49])[2]; + var match$1 = Stdlib_Queue[7].call(null, Sx_types[53])[2]; if(typeof match$1 !== "number" && 8 === match$1[0]){ var ev_l = match$1[1]; ev_l[5] = 0; - Sx_types[48][1]++; + Sx_types[52][1]++; } } } @@ -60174,7 +67345,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var cl$7 = f[1]; return push_closure_frame(vm, cl$7, args); } var - a = Sx_runtime[2].call(null, f), + a = Sx_runtime[3].call(null, f), b = Stdlib[28].call(null, "VM: not callable: ", a); throw caml_maybe_attach_backtrace([0, Sx_types[9], b], 1); } @@ -60249,8 +67420,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= "VM: unknown opcode ", [4, 0, 0, 0, [11, cst_at_ip, [4, 0, 0, 0, 0]]]], "VM: unknown opcode %d at ip=%d"], - q = [1, 0], - r = + q = [0, 1], + r = [1, 0], + s = [0, [11, "VM: CONST index ", @@ -60260,9 +67432,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 0, [11, " out of bounds (pool size ", [4, 0, 0, 0, [12, 41, 0]]]]], "VM: CONST index %d out of bounds (pool size %d)"], - s = [0, 1], - t = [0, 0], - u = + t = [0, 1], + u = [0, 0], + v = [0, [11, "VM: LOCAL_GET slot=", @@ -60274,21 +67446,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= " base=", [4, 0, 0, 0, [11, cst_sp, [4, 0, 0, 0, [11, " out of bounds", 0]]]]]]], "VM: LOCAL_GET slot=%d base=%d sp=%d out of bounds"], - v = + w = [0, [11, "VM: UPVALUE_GET idx=", [4, 0, 0, 0, [11, " out of bounds (have ", [4, 0, 0, 0, [12, 41, 0]]]]], "VM: UPVALUE_GET idx=%d out of bounds (have %d)"], - w = - [0, [11, "Unhandled exception: ", [2, 0, 0]], "Unhandled exception: %s"], x = + [0, [11, "Unhandled exception: ", [2, 0, 0]], "Unhandled exception: %s"], + y = [0, [11, "VM: CLOSURE idx ", [4, 0, 0, 0, [11, " >= consts ", [4, 0, 0, 0, 0]]]], "VM: CLOSURE idx %d >= consts %d"], - y = + z = [0, [2, 0, @@ -60313,10 +67485,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else var fn_name = cst; var - R = Stdlib_List[1].call(null, rest_frames), - S = vm[2], - T = frame[3]; - caml_call4(Stdlib_Printf[3].call(null, n), fn_name, T, S, R); + T = Stdlib_List[1].call(null, rest_frames), + U = vm[2], + V = frame[3]; + caml_call4(Stdlib_Printf[3].call(null, n), fn_name, V, U, T); var result = frame[3] < vm[2] ? pop(vm) : 0; vm[3] = rest_frames; vm[2] = frame[3]; @@ -60325,16 +67497,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else{ var saved_ip = frame[2], - B = frame[2], - op = caml_check_bound(bc, B)[B + 1]; + H = frame[2], + op = caml_check_bound(bc, H)[H + 1]; frame[2] = frame[2] + 1 | 0; vm_insn_count[1]++; - var C = 0 === (vm_insn_count[1] & 65535); - if(C) - var D = 0 < Sx_ref[3][1], E = D ? Sx_ref[3][1] < vm_insn_count[1] : D; + var I = 0 === (vm_insn_count[1] & 65535); + if(I) + var J = 0 < Sx_ref[3][1], K = J ? Sx_ref[3][1] < vm_insn_count[1] : J; else - var E = C; - if(E) + var K = I; + if(K) throw caml_maybe_attach_backtrace ([0, Sx_types[9], "TIMEOUT: step limit exceeded"], 1); try{ @@ -60367,93 +67539,231 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 32: var count = read_u8(frame), - Z = + $ = Stdlib_List[11].call (null, count, function(param){return pop(vm);}), - parts = Stdlib_List[10].call(null, Z), - _ = Stdlib_List[20].call(null, Sx_runtime[2], parts), - s$1 = Stdlib_String[7].call(null, cst$1, _); + parts = Stdlib_List[10].call(null, $), + aa = Stdlib_List[20].call(null, Sx_runtime[3], parts), + s$1 = Stdlib_String[7].call(null, cst$1, aa); push(vm, [3, s$1]); break a; case 48: var b$0 = pop(vm), a = pop(vm); b: { - if - (typeof a !== "number" - && 2 === a[0] && typeof b$0 !== "number" && 2 === b$0[0]){ - var y$0 = b$0[1], x$0 = a[1], F = [2, x$0 + y$0]; - break b; - } + if(typeof a !== "number") + switch(a[0]){ + case 1: + var x$0 = a[1]; + if(typeof b$0 !== "number") + switch(b$0[0]){ + case 1: + var y$0 = b$0[1], j = [1, x$0 + y$0 | 0]; break b; + case 2: + var y$1 = b$0[1], j = [2, x$0 + y$1]; break b; + } + break; + case 2: + var x$1 = a[1]; + if(typeof b$0 !== "number") + switch(b$0[0]){ + case 1: + var y$2 = b$0[1], j = [2, x$1 + y$2]; break b; + case 2: + var y$3 = b$0[1], j = [2, x$1 + y$3]; break b; + } + break; + } var - F = + j = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "+"), [0, a, [0, b$0, 0]]); } - push(vm, F); + push(vm, j); break a; case 49: var b$1 = pop(vm), a$0 = pop(vm); b: { - if - (typeof a$0 !== "number" - && 2 === a$0[0] && typeof b$1 !== "number" && 2 === b$1[0]){ - var y$1 = b$1[1], x$1 = a$0[1], G = [2, x$1 - y$1]; - break b; - } + if(typeof a$0 !== "number") + switch(a$0[0]){ + case 1: + var x$2 = a$0[1]; + if(typeof b$1 !== "number") + switch(b$1[0]){ + case 1: + var y$4 = b$1[1], m = [1, x$2 - y$4 | 0]; break b; + case 2: + var y$5 = b$1[1], m = [2, x$2 - y$5]; break b; + } + break; + case 2: + var x$3 = a$0[1]; + if(typeof b$1 !== "number") + switch(b$1[0]){ + case 1: + var y$6 = b$1[1], m = [2, x$3 - y$6]; break b; + case 2: + var y$7 = b$1[1], m = [2, x$3 - y$7]; break b; + } + break; + } var - G = + m = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], cst$0), [0, a$0, [0, b$1, 0]]); } - push(vm, G); + push(vm, m); break a; case 50: var b$2 = pop(vm), a$1 = pop(vm); b: { - if - (typeof a$1 !== "number" - && 2 === a$1[0] && typeof b$2 !== "number" && 2 === b$2[0]){ - var y$2 = b$2[1], x$2 = a$1[1], H = [2, x$2 * y$2]; - break b; - } + if(typeof a$1 !== "number") + switch(a$1[0]){ + case 1: + var x$4 = a$1[1]; + if(typeof b$2 !== "number") + switch(b$2[0]){ + case 1: + var y$8 = b$2[1], A = [1, runtime.caml_mul(x$4, y$8)]; + break b; + case 2: + var y$9 = b$2[1], A = [2, x$4 * y$9]; break b; + } + break; + case 2: + var x$5 = a$1[1]; + if(typeof b$2 !== "number") + switch(b$2[0]){ + case 1: + var y$10 = b$2[1], A = [2, x$5 * y$10]; break b; + case 2: + var y$11 = b$2[1], A = [2, x$5 * y$11]; break b; + } + break; + } var - H = + A = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "*"), [0, a$1, [0, b$2, 0]]); } - push(vm, H); + push(vm, A); break a; case 51: var b$3 = pop(vm), a$2 = pop(vm); b: { - if - (typeof a$2 !== "number" - && 2 === a$2[0] && typeof b$3 !== "number" && 2 === b$3[0]){ - var y$3 = b$3[1], x$3 = a$2[1], I = [2, x$3 / y$3]; - break b; - } + if(typeof a$2 !== "number") + switch(a$2[0]){ + case 1: + var x$6 = a$2[1]; + if(typeof b$3 !== "number") + switch(b$3[0]){ + case 1: + var y$12 = b$3[1]; + if(0 !== y$12 && 0 === runtime.caml_mod(x$6, y$12)){var B = [1, runtime.caml_div(x$6, y$12)]; break b; + } + break; + case 2: + var y$13 = b$3[1], B = [2, x$6 / y$13]; break b; + } + break; + case 2: + var x$7 = a$2[1]; + if(typeof b$3 !== "number") + switch(b$3[0]){ + case 1: + var y$14 = b$3[1], B = [2, x$7 / y$14]; break b; + case 2: + var y$15 = b$3[1], B = [2, x$7 / y$15]; break b; + } + break; + } var - I = + B = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "/"), [0, a$2, [0, b$3, 0]]); } - push(vm, I); + push(vm, B); break a; case 52: var b$4 = pop(vm), a$3 = pop(vm); - push - (vm, - caml_call1 - (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "="), - [0, a$3, [0, b$4, 0]])); + b: + { + if(typeof a$3 === "number"){ + if(0 === a$3 && typeof b$4 === "number" && ! b$4){var c = q; break b;} + } + else + switch(a$3[0]){ + case 0: + if(typeof b$4 !== "number" && 0 === b$4[0]){ + var + y$16 = b$4[1], + x$8 = a$3[1], + c = [0, x$8 === y$16 ? 1 : 0]; + break b; + } + break; + case 1: + var x$9 = a$3[1]; + if(typeof b$4 !== "number") + switch(b$4[0]){ + case 1: + var y$17 = b$4[1], c = [0, x$9 === y$17 ? 1 : 0]; break b; + case 2: + var y$18 = b$4[1], c = [0, x$9 === y$18 ? 1 : 0]; break b; + } + break; + case 2: + var x$10 = a$3[1]; + if(typeof b$4 !== "number") + switch(b$4[0]){ + case 1: + var y$19 = b$4[1], c = [0, x$10 === y$19 ? 1 : 0]; break b; + case 2: + var y$20 = b$4[1], c = [0, x$10 === y$20 ? 1 : 0]; break b; + } + break; + case 3: + if(typeof b$4 !== "number" && 3 === b$4[0]){ + var + y$21 = b$4[1], + x$11 = a$3[1], + c = [0, x$11 === y$21 ? 1 : 0]; + break b; + } + break; + case 4: + if(typeof b$4 !== "number" && 4 === b$4[0]){ + var + y$22 = b$4[1], + x$12 = a$3[1], + c = [0, x$12 === y$22 ? 1 : 0]; + break b; + } + break; + case 5: + if(typeof b$4 !== "number" && 5 === b$4[0]){ + var + y$23 = b$4[1], + x$13 = a$3[1], + c = [0, x$13 === y$23 ? 1 : 0]; + break b; + } + break; + } + var + c = + caml_call1 + (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "="), + [0, a$3, [0, b$4, 0]]); + } + push(vm, c); break a; case 53: var b$5 = pop(vm), a$4 = pop(vm); @@ -60461,29 +67771,39 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= { if(typeof a$4 !== "number") switch(a$4[0]){ + case 1: + var x$14 = a$4[1]; + if(typeof b$5 !== "number") + switch(b$5[0]){ + case 1: + var y$24 = b$5[1], g = [0, x$14 < y$24 ? 1 : 0]; break b; + case 2: + var y$25 = b$5[1], g = [0, x$14 < y$25 ? 1 : 0]; break b; + } + break; case 2: - if(typeof b$5 !== "number" && 2 === b$5[0]){ - var y$4 = b$5[1], x$4 = a$4[1], z = [0, x$4 < y$4 ? 1 : 0]; - break b; - } + var x$15 = a$4[1]; + if(typeof b$5 !== "number") + switch(b$5[0]){ + case 1: + var y$26 = b$5[1], g = [0, x$15 < y$26 ? 1 : 0]; break b; + case 2: + var y$27 = b$5[1], g = [0, x$15 < y$27 ? 1 : 0]; break b; + } break; case 3: if(typeof b$5 !== "number" && 3 === b$5[0]){ var - y$5 = b$5[1], - x$5 = a$4[1], - z = [0, runtime.caml_string_lessthan(x$5, y$5)]; + y$28 = b$5[1], + x$16 = a$4[1], + g = [0, runtime.caml_string_lessthan(x$16, y$28)]; break b; } break; } - var - z = - caml_call1 - (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "<"), - [0, a$4, [0, b$5, 0]]); + var g = Sx_runtime[2].call(null, "<", [0, a$4, [0, b$5, 0]]); } - push(vm, z); + push(vm, g); break a; case 54: var b$6 = pop(vm), a$5 = pop(vm); @@ -60491,33 +67811,43 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= { if(typeof a$5 !== "number") switch(a$5[0]){ + case 1: + var x$17 = a$5[1]; + if(typeof b$6 !== "number") + switch(b$6[0]){ + case 1: + var y$29 = b$6[1], h = [0, y$29 < x$17 ? 1 : 0]; break b; + case 2: + var y$30 = b$6[1], h = [0, y$30 < x$17 ? 1 : 0]; break b; + } + break; case 2: - if(typeof b$6 !== "number" && 2 === b$6[0]){ - var y$6 = b$6[1], x$6 = a$5[1], A = [0, y$6 < x$6 ? 1 : 0]; - break b; - } + var x$18 = a$5[1]; + if(typeof b$6 !== "number") + switch(b$6[0]){ + case 1: + var y$31 = b$6[1], h = [0, y$31 < x$18 ? 1 : 0]; break b; + case 2: + var y$32 = b$6[1], h = [0, y$32 < x$18 ? 1 : 0]; break b; + } break; case 3: if(typeof b$6 !== "number" && 3 === b$6[0]){ var - y$7 = b$6[1], - x$7 = a$5[1], - A = [0, runtime.caml_string_greaterthan(x$7, y$7)]; + y$33 = b$6[1], + x$19 = a$5[1], + h = [0, runtime.caml_string_greaterthan(x$19, y$33)]; break b; } break; } - var - A = - caml_call1 - (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], ">"), - [0, a$5, [0, b$6, 0]]); + var h = Sx_runtime[2].call(null, ">", [0, a$5, [0, b$6, 0]]); } - push(vm, A); + push(vm, h); break a; case 55: var v$1 = pop(vm); - push(vm, [0, 1 - Sx_types[67].call(null, v$1)]); + push(vm, [0, 1 - Sx_types[71].call(null, v$1)]); break a; case 56: var v$2 = pop(vm); @@ -60528,29 +67858,29 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof v$2 !== "number"){ switch(v$2[0]){ case 3: - var s$2 = v$2[1], c = [1, caml_ml_string_length(s$2)]; + var s$2 = v$2[1], C = [1, caml_ml_string_length(s$2)]; break b; case 6: var l = v$2[1]; break; case 7: - var d = v$2[1], c = [1, Stdlib_Hashtbl[15].call(null, d)]; + var d = v$2[1], C = [1, Stdlib_Hashtbl[15].call(null, d)]; break b; case 21: var l = v$2[1][1]; break; default: break c; } - var c = [1, Stdlib_List[1].call(null, l)]; + var C = [1, Stdlib_List[1].call(null, l)]; break b; } - if(0 === v$2){var c = q; break b;} + if(0 === v$2){var C = r; break b;} } var - c = + C = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "len"), [0, v$2, 0]); } - push(vm, c); + push(vm, C); break a; case 57: var v$3 = pop(vm); @@ -60562,21 +67892,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else switch(v$3[0]){ case 6: - var J = v$3[1]; if(J){var j = J[1]; break b;} break; + var L = v$3[1]; if(L){var F = L[1]; break b;} break; case 21: - var K = v$3[1][1]; if(K){var j = K[1]; break b;} break; + var M = v$3[1][1]; if(M){var F = M[1]; break b;} break; default: break c; } - var j = 0; + var F = 0; break b; } var - j = + F = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "first"), [0, v$3, 0]); } - push(vm, j); + push(vm, F); break a; case 58: var v$4 = pop(vm); @@ -60587,29 +67917,29 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof v$4 !== "number"){ switch(v$4[0]){ case 6: - var L = v$4[1]; - if(! L){var g = b; break b;} - var xs = L[2]; + var N = v$4[1]; + if(! N){var D = b; break b;} + var xs = N[2]; break; case 21: - var M = v$4[1][1]; - if(! M){var g = b; break b;} - var xs = M[2]; + var O = v$4[1][1]; + if(! O){var D = b; break b;} + var xs = O[2]; break; default: break c; } - var g = [6, xs]; + var D = [6, xs]; break b; } - if(0 === v$4){var g = b; break b;} + if(0 === v$4){var D = b; break b;} } var - g = + D = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "rest"), [0, v$4, 0]); } - push(vm, g); + push(vm, D); break a; case 59: var n$2 = pop(vm), coll = pop(vm); @@ -60624,11 +67954,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var f$0 = n$2[1], s$3 = coll[1], i = f$0 | 0; if(0 <= i && i < caml_ml_string_length(s$3)){ var - $ = runtime.caml_string_get(s$3, i), - h = [3, Stdlib_String[1].call(null, 1, $)]; + ab = runtime.caml_string_get(s$3, i), + E = [3, Stdlib_String[1].call(null, 1, ab)]; break b; } - var h = 0; + var E = 0; break b; case 6: var l$0 = coll[1]; break; @@ -60639,87 +67969,89 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof n$2 !== "number" && 2 === n$2[0]){ var f$1 = n$2[1]; try{ - var aa = Stdlib_List[8].call(null, l$0, f$1 | 0), h = aa; + var ac = Stdlib_List[8].call(null, l$0, f$1 | 0), E = ac; break b; } - catch(exn){var h = 0; break b;} + catch(exn){var E = 0; break b;} } } var - h = + E = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "nth"), [0, coll, [0, n$2, 0]]); } - push(vm, h); + push(vm, E); break a; case 60: - var coll$0 = pop(vm), x$8 = pop(vm); + var coll$0 = pop(vm), x$20 = pop(vm); b: { if(typeof coll$0 === "number"){ - if(0 === coll$0){var m = [6, [0, x$8, 0]]; break b;} + if(0 === coll$0){var G = [6, [0, x$20, 0]]; break b;} } else switch(coll$0[0]){ case 6: - var l$1 = coll$0[1], m = [6, [0, x$8, l$1]]; break b; + var l$1 = coll$0[1], G = [6, [0, x$20, l$1]]; break b; case 21: - var l$2 = coll$0[1][1], m = [6, [0, x$8, l$2]]; break b; + var l$2 = coll$0[1][1], G = [6, [0, x$20, l$2]]; break b; } var - m = + G = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "cons"), - [0, x$8, [0, coll$0, 0]]); + [0, x$20, [0, coll$0, 0]]); } - push(vm, m); + push(vm, G); break a; case 61: var v$5 = pop(vm); b: { - if(typeof v$5 !== "number" && 2 === v$5[0]){var x$9 = v$5[1], N = [2, - x$9]; break b; + if(typeof v$5 !== "number" && 2 === v$5[0]){ + var x$21 = v$5[1], P = [2, - x$21]; + break b; } var - N = + P = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], cst$0), [0, v$5, 0]); } - push(vm, N); + push(vm, P); break a; case 62: var v$6 = pop(vm); b: { if(typeof v$6 !== "number" && 2 === v$6[0]){ - var x$10 = v$6[1], O = [2, x$10 + 1.]; + var x$22 = v$6[1], Q = [2, x$22 + 1.]; break b; } var - O = + Q = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "inc"), [0, v$6, 0]); } - push(vm, O); + push(vm, Q); break a; case 63: var v$7 = pop(vm); b: { if(typeof v$7 !== "number" && 2 === v$7[0]){ - var x$11 = v$7[1], P = [2, x$11 - 1.]; + var x$23 = v$7[1], R = [2, x$23 - 1.]; break b; } var - P = + R = caml_call1 (Stdlib_Hashtbl[6].call(null, Sx_primitives[1], "dec"), [0, v$7, 0]); } - push(vm, P); + push(vm, R); break a; } } @@ -60730,19 +68062,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var idx$0 = read_u16(frame); if(consts.length - 1 <= idx$0){ var - ab = + ad = caml_call2 - (Stdlib_Printf[4].call(null, r), idx$0, consts.length - 1); - throw caml_maybe_attach_backtrace([0, Sx_types[9], ab], 1); + (Stdlib_Printf[4].call(null, s), idx$0, consts.length - 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ad], 1); } push(vm, caml_check_bound(consts, idx$0)[idx$0 + 1]); break a; case 1: push(vm, 0); break a; case 2: - push(vm, s); break a; - case 3: push(vm, t); break a; + case 3: + push(vm, u); break a; case 4: pop(vm); break a; case 5: @@ -60762,10 +68094,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var idx$1 = frame[3] + slot | 0; if(vm[2] <= idx$1){ var - ac = vm[2], - ad = frame[3], - ae = caml_call3(Stdlib_Printf[4].call(null, u), slot, ad, ac); - throw caml_maybe_attach_backtrace([0, Sx_types[9], ae], 1); + ae = vm[2], + af = frame[3], + ag = caml_call3(Stdlib_Printf[4].call(null, v), slot, af, ae); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ag], 1); } var v$8 = caml_check_bound(vm[1], idx$1)[idx$1 + 1]; } @@ -60777,22 +68109,22 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= v$9 = peek(vm), match$5 = Stdlib_Hashtbl[7].call(null, frame[4], slot$0); if(match$5){var cell$0 = match$5[1]; cell$0[1] = v$9; break a;} - var Q = frame[3] + slot$0 | 0; - caml_check_bound(vm[1], Q)[Q + 1] = v$9; + var S = frame[3] + slot$0 | 0; + caml_check_bound(vm[1], S)[S + 1] = v$9; break a; case 17: var idx$2 = read_u8(frame); if(frame[1][2].length - 1 <= idx$2){ var - af = frame[1][2].length - 1, - ag = caml_call2(Stdlib_Printf[4].call(null, v), idx$2, af); - throw caml_maybe_attach_backtrace([0, Sx_types[9], ag], 1); + ah = frame[1][2].length - 1, + ai = caml_call2(Stdlib_Printf[4].call(null, w), idx$2, ah); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ai], 1); } push(vm, caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1]); break a; case 18: - var idx$3 = read_u8(frame), ah = peek(vm); - caml_check_bound(frame[1][2], idx$3)[idx$3 + 1][1] = ah; + var idx$3 = read_u8(frame), aj = peek(vm); + caml_check_bound(frame[1][2], idx$3)[idx$3 + 1][1] = aj; break a; case 19: var @@ -60808,8 +68140,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= for(;;) try{ var - ai = [0, Stdlib_Hashtbl[6].call(null, e[1], id)], - found_in_env = ai; + ak = [0, Stdlib_Hashtbl[6].call(null, e[1], id)], + found_in_env = ak; break; } catch(exn){ @@ -60829,36 +68161,36 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else try{ var - an = Stdlib_Hashtbl[6].call(null, vm[4], name$0), - v$11 = an; + ap = Stdlib_Hashtbl[6].call(null, vm[4], name$0), + v$11 = ap; } catch(exn){ var exn$1 = caml_wrap_exception(exn); if(exn$1 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$1, 0); - try{var am = Sx_primitives[15].call(null, name$0), v$11 = am;} + try{var ao = Sx_primitives[15].call(null, name$0), v$11 = ao;} catch(exn){ try{ var resolve_fn = Stdlib_Hashtbl[6].call(null, vm[4], "__resolve-symbol"); - Sx_runtime[6].call(null, resolve_fn, [0, [3, name$0], 0]); - try{var al = Stdlib_Hashtbl[6].call(null, vm[4], name$0);} + Sx_runtime[7].call(null, resolve_fn, [0, [3, name$0], 0]); + try{var an = Stdlib_Hashtbl[6].call(null, vm[4], name$0);} catch(exn){ var exn$3 = caml_wrap_exception(exn); if(exn$3 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$3, 0); - var ak = Stdlib[28].call(null, cst_VM_undefined, name$0); - throw caml_maybe_attach_backtrace([0, Sx_types[9], ak], 1); + var am = Stdlib[28].call(null, cst_VM_undefined, name$0); + throw caml_maybe_attach_backtrace([0, Sx_types[9], am], 1); } - var v$11 = al; + var v$11 = an; } catch(exn){ var exn$2 = caml_wrap_exception(exn); if(exn$2 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$2, 0); - var aj = Stdlib[28].call(null, cst_VM_undefined, name$0); - throw caml_maybe_attach_backtrace([0, Sx_types[9], aj], 1); + var al = Stdlib[28].call(null, cst_VM_undefined, name$0); + throw caml_maybe_attach_backtrace([0, Sx_types[9], al], 1); } } } @@ -60880,8 +68212,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= e$0 = env$0; for(;;){ if(Stdlib_Hashtbl[9].call(null, e$0[1], id$0)){ - var ao = peek(vm); - Stdlib_Hashtbl[11].call(null, e$0[1], id$0, ao); + var aq = peek(vm); + Stdlib_Hashtbl[11].call(null, e$0[1], id$0, aq); var written = 1; break; } @@ -60907,20 +68239,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= break a; case 32: var offset$0 = read_i16(frame), v$13 = pop(vm); - if(! (1 - Sx_types[67].call(null, v$13))) break a; + if(! (1 - Sx_types[71].call(null, v$13))) break a; frame[2] = frame[2] + offset$0 | 0; break a; case 33: var offset$1 = read_i16(frame), v$14 = pop(vm); - if(! Sx_types[67].call(null, v$14)) break a; + if(! Sx_types[71].call(null, v$14)) break a; frame[2] = frame[2] + offset$1 | 0; break a; case 34: var catch_offset = read_i16(frame), - ap = vm[2], - aq = Stdlib_List[1].call(null, vm[3]), - entry = [0, frame[2] + catch_offset | 0, aq, ap, frame]; + ar = vm[2], + as = Stdlib_List[1].call(null, vm[3]), + entry = [0, frame[2] + catch_offset | 0, as, ar, frame]; vm[6] = [0, entry, vm[6]]; break a; case 35: @@ -60933,15 +68265,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var exn_val = pop(vm), match$14 = vm[6]; if(! match$14){ var - as = Sx_runtime[2].call(null, exn_val), - at = caml_call1(Stdlib_Printf[4].call(null, w), as); - throw caml_maybe_attach_backtrace([0, Sx_types[9], at], 1); + au = Sx_runtime[3].call(null, exn_val), + av = caml_call1(Stdlib_Printf[4].call(null, x), au); + throw caml_maybe_attach_backtrace([0, Sx_types[9], av], 1); } var rest$0 = match$14[2], entry$0 = match$14[1]; vm[6] = rest$0; for(;;){ - var ar = entry$0[2]; - if(ar >= Stdlib_List[1].call(null, vm[3])){ + var at = entry$0[2]; + if(at >= Stdlib_List[1].call(null, vm[3])){ vm[2] = entry$0[3]; entry$0[4][2] = entry$0[1]; push(vm, exn_val); @@ -60958,8 +68290,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Array[1].call (null, argc, function(param){return pop(vm);}), f$3 = pop(vm), - au = Stdlib_Array[10].call(null, args), - args_list = Stdlib_List[10].call(null, au); + aw = Stdlib_Array[10].call(null, args), + args_list = Stdlib_List[10].call(null, aw); vm_call(vm, f$3, args_list); break a; case 48: @@ -60969,8 +68301,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Array[1].call (null, argc$0, function(param){return pop(vm);}), f$4 = pop(vm), - av = Stdlib_Array[10].call(null, args$0), - args_list$0 = Stdlib_List[10].call(null, av); + ax = Stdlib_Array[10].call(null, args$0), + args_list$0 = Stdlib_List[10].call(null, ax); vm[3] = rest_frames; vm[2] = frame[3]; vm_call(vm, f$4, args_list$0); @@ -60985,10 +68317,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var idx$6 = read_u16(frame); if(consts.length - 1 <= idx$6){ var - aw = + ay = caml_call2 - (Stdlib_Printf[4].call(null, x), idx$6, consts.length - 1); - throw caml_maybe_attach_backtrace([0, Sx_types[9], aw], 1); + (Stdlib_Printf[4].call(null, y), idx$6, consts.length - 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], ay], 1); } var code_val = caml_check_bound(consts, idx$6)[idx$6 + 1], @@ -61002,7 +68334,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_Hashtbl[7].call(null, d$0, cst_upvalue_count); if(match$16){ var match$17 = match$16[1]; - if(typeof match$17 !== "number" && 2 === match$17[0]){var n$3 = match$17[1], uv_count = n$3 | 0; break b;} + if(typeof match$17 !== "number") + switch(match$17[0]){ + case 1: + var n$3 = match$17[1], uv_count = n$3; break b; + case 2: + var n$4 = match$17[1], uv_count = n$4 | 0; break b; + } } var uv_count = 0; break b; @@ -61044,10 +68382,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else var s$6 = match$18[1], name$2 = s$6; var - ax = + az = Stdlib_List[11].call (null, argc$1, function(param){return pop(vm);}), - args$1 = Stdlib_List[10].call(null, ax), + args$1 = Stdlib_List[10].call(null, az), args$2 = Stdlib_List[20].call (null, @@ -61060,19 +68398,19 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= try{ try{ var - aB = Stdlib_Hashtbl[6].call(null, vm[4], name$2), - fn_val = aB; + aD = Stdlib_Hashtbl[6].call(null, vm[4], name$2), + fn_val = aD; } catch(exn){ var exn$5 = caml_wrap_exception(exn); if(exn$5 !== Stdlib[8]) throw caml_maybe_attach_backtrace(exn$5, 0); - try{var aA = Sx_primitives[15].call(null, name$2), fn_val = aA; + try{var aC = Sx_primitives[15].call(null, name$2), fn_val = aC; } catch(exn){ var - az = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); - throw caml_maybe_attach_backtrace([0, Sx_types[9], az], 1); + aB = Stdlib[28].call(null, cst_VM_unknown_primitive, name$2); + throw caml_maybe_attach_backtrace([0, Sx_types[9], aB], 1); } } b: @@ -61086,7 +68424,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 9: case 10: case 24: - var result$1 = Sx_ref[221].call(null, fn_val, [6, args$2]); + var result$1 = Sx_ref[222].call(null, fn_val, [6, args$2]); break b; } var result$1 = 0; @@ -61098,20 +68436,20 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= throw caml_maybe_attach_backtrace(exn$4, 0); var msg$0 = exn$4[2], - ay = + aA = caml_call3 - (Stdlib_Printf[4].call(null, y), msg$0, name$2, argc$1); - throw caml_maybe_attach_backtrace([0, Sx_types[9], ay], 1); + (Stdlib_Printf[4].call(null, z), msg$0, name$2, argc$1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], aA], 1); } push(vm, result$1); break a; case 63: var count$0 = read_u16(frame), - aC = + aE = Stdlib_List[11].call (null, count$0, function(param){return pop(vm);}), - items = Stdlib_List[10].call(null, aC); + items = Stdlib_List[10].call(null, aE); push(vm, [6, items]); break a; case 64: @@ -61130,21 +68468,24 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 5: var s$7 = k[1], key = s$7; break b; } - var key = Sx_runtime[2].call(null, k); + var key = Sx_runtime[3].call(null, k); } Stdlib_Hashtbl[11].call(null, d$1, key, v$15); - var aD = for$ + 1 | 0; + var aF = for$ + 1 | 0; if(count$1 === for$) break; - for$ = aD; + for$ = aF; } } push(vm, [7, d$1]); break a; } - var - X = frame[2] - 1 | 0, - Y = caml_call2(Stdlib_Printf[4].call(null, p), op, X); - throw caml_maybe_attach_backtrace([0, Sx_types[9], Y], 1); + if(200 > op){ + var + Z = frame[2] - 1 | 0, + _ = caml_call2(Stdlib_Printf[4].call(null, p), op, Z); + throw caml_maybe_attach_backtrace([0, Sx_types[9], _], 1); + } + caml_call3(extension_dispatch_ref[1], op, vm, frame); } } catch(exn$0){var exn = caml_wrap_exception(exn$0); break;} @@ -61158,97 +68499,114 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= else var fn_name$0 = cst; var - U = vm[2], - V = frame[3], - W = + W = vm[2], + X = frame[3], + Y = caml_call8 (Stdlib_Printf[4].call(null, o), msg, saved_ip, op, fn_name$0, - V, - U, + X, + W, bc.length - 1, consts.length - 1); - throw caml_maybe_attach_backtrace([0, Sx_types[9], W], 1); + throw caml_maybe_attach_backtrace([0, Sx_types[9], Y], 1); } - var z = [3, cst_phase], A = [3, cst_request]; + var A = [3, cst_phase], B = [3, cst_request]; function resume_vm(vm, result){ - var match = vm[5]; - if(match){ - var cek_state = match[1]; - vm[5] = 0; - var - final = Sx_ref[158].call(null, cek_state, result), - match$0 = Sx_runtime[12].call(null, final, z); - if - (typeof match$0 !== "number" - && 3 === match$0[0] && match$0[1] === cst_io_suspended){ - vm[5] = [0, final]; - throw caml_maybe_attach_backtrace - ([0, VmSuspended, Sx_runtime[12].call(null, final, A), vm], 1); + var prev_active = active_vm[1]; + active_vm[1] = [0, vm]; + function restore(param){active_vm[1] = prev_active;} + try{ + var match = vm[5]; + if(match){ + var cek_state = match[1]; + vm[5] = 0; + var + final = Sx_ref[158].call(null, cek_state, result), + match$0 = Sx_runtime[13].call(null, final, A); + if + (typeof match$0 !== "number" + && 3 === match$0[0] && match$0[1] === cst_io_suspended){ + vm[5] = [0, final]; + throw caml_maybe_attach_backtrace + ([0, VmSuspended, Sx_runtime[13].call(null, final, B), vm], 1); + } + push(vm, Sx_ref[18].call(null, final)); } - push(vm, Sx_ref[18].call(null, final)); + else + push(vm, result); + try{run(vm);} + catch(e){ + var e$0 = caml_wrap_exception(e); + if(e$0[1] === VmSuspended) throw caml_maybe_attach_backtrace(e$0, 0); + if(e$0[1] !== Sx_types[9]) throw caml_maybe_attach_backtrace(e$0, 0); + var msg = e$0[2], match$1 = vm[6]; + if(! match$1) + throw caml_maybe_attach_backtrace([0, Sx_types[9], msg], 1); + var rest = match$1[2], entry = match$1[1]; + vm[6] = rest; + for(;;){ + var a = entry[2]; + if(a >= Stdlib_List[1].call(null, vm[3])){ + vm[2] = entry[3]; + entry[4][2] = entry[1]; + push(vm, [3, msg]); + run(vm); + break; + } + var match$2 = vm[3]; + if(match$2){var fs = match$2[2]; vm[3] = fs;} + } + } + vm[7] = 0; + var + restore_reuse = + function(pending){ + if(! pending) return; + var + rest = pending[2], + match = pending[1], + saved_sp = match[2], + saved_frames = match[1], + callback_result = pop(vm); + vm[3] = saved_frames; + if(saved_sp < vm[2]) vm[2] = saved_sp; + push(vm, callback_result); + try{ + run(vm); + var new_pending = Stdlib_List[10].call(null, vm[7]); + vm[7] = 0; + restore_reuse(Stdlib[37].call(null, new_pending, rest)); + return; + } + catch(e$0){ + var e = caml_wrap_exception(e$0); + if(e[1] !== VmSuspended) throw caml_maybe_attach_backtrace(e, 0); + var a = vm[7], b = Stdlib_List[10].call(null, rest); + vm[7] = Stdlib[37].call(null, b, a); + throw caml_maybe_attach_backtrace(e, 0); + } + }, + pending = Stdlib_List[10].call(null, vm[7]); + vm[7] = 0; + restore_reuse(pending); + var r = pop(vm); + restore(0); + return r; } - else - push(vm, result); - try{run(vm);} catch(e$0){ var e = caml_wrap_exception(e$0); - if(e[1] === VmSuspended) throw caml_maybe_attach_backtrace(e, 0); - if(e[1] !== Sx_types[9]) throw caml_maybe_attach_backtrace(e, 0); - var msg = e[2], match$1 = vm[6]; - if(! match$1) - throw caml_maybe_attach_backtrace([0, Sx_types[9], msg], 1); - var rest = match$1[2], entry = match$1[1]; - vm[6] = rest; - for(;;){ - var a = entry[2]; - if(a >= Stdlib_List[1].call(null, vm[3])){ - vm[2] = entry[3]; - entry[4][2] = entry[1]; - push(vm, [3, msg]); - run(vm); - break; - } - var match$2 = vm[3]; - if(match$2){var fs = match$2[2]; vm[3] = fs;} - } + restore(0); + throw caml_maybe_attach_backtrace(e, 0); } - vm[7] = 0; - function restore_reuse(pending){ - if(! pending) return; - var - rest = pending[2], - saved_frames = pending[1][1], - callback_result = pop(vm); - vm[3] = saved_frames; - push(vm, callback_result); - try{ - run(vm); - var new_pending = Stdlib_List[10].call(null, vm[7]); - vm[7] = 0; - restore_reuse(Stdlib[37].call(null, new_pending, rest)); - return; - } - catch(e$0){ - var e = caml_wrap_exception(e$0); - if(e[1] !== VmSuspended) throw caml_maybe_attach_backtrace(e, 0); - var a = vm[7], b = Stdlib_List[10].call(null, rest); - vm[7] = Stdlib[37].call(null, b, a); - throw caml_maybe_attach_backtrace(e, 0); - } - } - var pending = Stdlib_List[10].call(null, vm[7]); - vm[7] = 0; - restore_reuse(pending); - return pop(vm); } - var B = [0, "module"]; + var C = [0, "module"]; function execute_module(code, globals){ var - cl = [0, code, [0], B, globals, 0], + cl = [0, code, [0], C, globals, 0], vm = create(globals), frame = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], a = code[3] - 1 | 0; @@ -61479,23 +68837,189 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return a; } + function bytecode_find_opcode(pred, bc, consts){ + var len = bc.length - 1, found = 0, ip$0 = 0; + for(;;){ + if(! found && ip$0 < len){ + var op = caml_check_bound(bc, ip$0)[ip$0 + 1]; + if(caml_call1(pred, op)){found = 1; continue;} + var ip = ip$0 + 1 | 0; + a: + { + if(51 === op && (ip + 1 | 0) < len){ + var + lo = caml_check_bound(bc, ip)[ip + 1], + b = ip + 1 | 0, + hi = caml_check_bound(bc, b)[b + 1], + idx = lo | hi << 8; + b: + if(idx < consts.length - 1){ + var match = caml_check_bound(consts, idx)[idx + 1]; + if(typeof match !== "number" && 7 === match[0]){ + var + d = match[1], + match$0 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); + if(match$0){ + var match$1 = match$0[1]; + if(typeof match$1 !== "number") + switch(match$1[0]){ + case 1: + var n = match$1[1], uv_count = n; break b; + case 2: + var n$0 = match$1[1], uv_count = n$0 | 0; break b; + } + } + var uv_count = 0; + break b; + } + var uv_count = 0; + } + else + var uv_count = 0; + var extra = 2 + (uv_count * 2 | 0) | 0; + break a; + } + b: + { + c: + { + if(50 <= op){ + if(66 > op){ + if(52 === op){var extra = 3; break a;} + if(64 <= op) break c; + break b; + } + if(128 === op) break c; + if(144 !== op) break b; + } + else if(20 <= op){ + var a = op - 22 | 0; + if(25 >= a >>> 0){ + if(3 < a - 10 >>> 0) break b; + var extra = 2; + break a; + } + if(26 > a) break c; + } + else{if(1 === op) break c; if(16 > op) break b;} + var extra = 1; + break a; + } + var extra = 2; + break a; + } + var extra = 0; + } + ip$0 = ip + extra | 0; + continue; + } + return found; + } + } + function bytecode_uses_extension_opcode(bc, consts){ + return bytecode_find_opcode + (function(op){return 200 <= op ? 1 : 0;}, bc, consts); + } + function code_uses_handler(code){ + var + a = + bytecode_find_opcode + (function(op){return 35 === op ? 1 : 0;}, code[4], code[5]); + return a + ? a + : Stdlib_Array + [24].call + (null, + function(c){ + a: + if(typeof c !== "number" && 7 === c[0]){ + var d = c[1]; + if + (! + Stdlib_Hashtbl[9].call(null, d, cst_bytecode) + && ! Stdlib_Hashtbl[9].call(null, d, cst_vc_bytecode)) + break a; + try{var a = code_uses_handler(code_from_value(c)); return a;} + catch(exn){return 0;} + } + return 0; + }, + code[5]); + } + function code_refs_escaping_caller(code){ + return Stdlib_Array[24].call + (null, + function(c){ + if(typeof c !== "number") + switch(c[0]){ + case 3: + var s = c[1]; + return Stdlib_Hashtbl[9].call(null, Sx_types[50], s); + case 7: + var d = c[1]; + if + (! + Stdlib_Hashtbl[9].call(null, d, cst_bytecode) + && ! Stdlib_Hashtbl[9].call(null, d, cst_vc_bytecode)) + break; + try{ + var a = code_refs_escaping_caller(code_from_value(c)); + return a; + } + catch(exn){return 0;} + } + return 0; + }, + code[5]); + } var cst_jit_FAIL = "[jit] FAIL ", + cst_jit_SKIP = "[jit] SKIP ", jit_compiling = [0, 0], - C = + D = [0, [11, cst_jit_FAIL, [2, 0, [11, cst$2, [2, 0, [12, 10, [10, 0]]]]]], "[jit] FAIL %s: %s\n%!"], - D = [4, cst_fn], - E = [4, cst_quote], - F = [4, cst_compile], - G = + E = [4, cst_fn], + F = [4, cst_quote], + G = [4, cst_compile], + H = [0, [11, cst_jit_FAIL, [2, 0, [11, ": compiler returned ", [2, 0, [12, 10, [10, 0]]]]]], "[jit] FAIL %s: compiler returned %s\n%!"], - H = + I = + [0, + [11, + cst_jit_SKIP, + [2, + 0, + [11, + ": bytecode uses extension opcodes (interpret-only in v1)\n", + [10, 0]]]], + "[jit] SKIP %s: bytecode uses extension opcodes (interpret-only in v1)\n%!"], + J = + [0, + [11, + cst_jit_SKIP, + [2, + 0, + [11, + ": installs an exception handler (guard) \xe2\x80\x94 interpret-only\n", + [10, 0]]]], + "[jit] SKIP %s: installs an exception handler (guard) \xe2\x80\x94 interpret-only\n%!"], + K = + [0, + [11, + cst_jit_SKIP, + [2, + 0, + [11, + ": calls a call/cc-establishing form \xe2\x80\x94 interpret-only\n", + [10, 0]]]], + "[jit] SKIP %s: calls a call/cc-establishing form \xe2\x80\x94 interpret-only\n%!"], + L = [0, [11, cst_jit_FAIL, @@ -61509,17 +69033,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= 0, [11, " out of bounds (pool=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]], "[jit] FAIL %s: closure index %d out of bounds (pool=%d)\n%!"], - I = + M = [0, [11, - "[jit] SKIP ", + cst_jit_SKIP, [2, 0, [11, ": non-closure execution failed (bc[0]=", [4, 0, 0, 0, [11, ", len=", [4, 0, 0, 0, [11, cst$0, [10, 0]]]]]]]], "[jit] SKIP %s: non-closure execution failed (bc[0]=%d, len=%d)\n%!"], - J = + N = [0, [11, "[jit] RESOLVED ", @@ -61539,6 +69063,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= && ! Stdlib_List[37].call(null, ":as", l[1])){ if(0 !== l[4] && 0 === l[3][2]){ if(jit_is_broken_name(fn_name)) return 0; + if(Sx_types[49].call(null, fn_name)) return 0; try{ jit_compiling[1] = 1; try{ @@ -61554,7 +69079,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var param_syms = [6, Stdlib_List[20].call(null, function(s){return [4, s];}, l[1])], - fn_expr = [6, [0, D, [0, param_syms, [0, l[2], 0]]]]; + fn_expr = [6, [0, E, [0, param_syms, [0, l[2], 0]]]]; a: { if(typeof compile_fn !== "number" && 8 === compile_fn[0]){ @@ -61579,9 +69104,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= globals); var result = - Sx_ref[241].call + Sx_ref[242].call (null, - [6, [0, F, [0, [6, [0, E, [0, fn_expr, 0]]], 0]]], + [6, [0, G, [0, [6, [0, F, [0, fn_expr, 0]]], 0]]], [20, compile_env]); } jit_compiling[1] = 0; @@ -61623,24 +69148,41 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var g = caml_check_bound(bc, 2)[3] << 8, idx = caml_check_bound(bc, 1)[2] | g; - if(idx < outer_code[5].length - 1){ - var - inner_val = caml_check_bound(outer_code[5], idx)[idx + 1], - code = code_from_value(inner_val), - a = [0, [0, code, [0], l[4], effective_globals, [0, l[3]]]]; + if(idx >= outer_code[5].length - 1){ + var h = outer_code[5].length - 1; + caml_call3(Stdlib_Printf[3].call(null, L), fn_name, idx, h); + var a = 0; break a; } - var h = outer_code[5].length - 1; - caml_call3(Stdlib_Printf[3].call(null, H), fn_name, idx, h); - var a = 0; + var + inner_val = caml_check_bound(outer_code[5], idx)[idx + 1], + code = code_from_value(inner_val); + if(bytecode_uses_extension_opcode(code[4], code[5])){ + caml_call1(Stdlib_Printf[3].call(null, I), fn_name); + var a = 0; + break a; + } + if(code_uses_handler(code)){ + caml_call1(Stdlib_Printf[3].call(null, J), fn_name); + var a = 0; + break a; + } + if + (0 < Stdlib_Hashtbl[15].call(null, Sx_types[50]) + && code_refs_escaping_caller(code)){ + caml_call1(Stdlib_Printf[3].call(null, K), fn_name); + var a = 0; + break a; + } + var a = [0, [0, code, [0], l[4], effective_globals, [0, l[3]]]]; break a; } try{ var value = execute_module(outer_code, globals), k = 0 < bc.length - 1 ? caml_check_bound(bc, 0)[1] : -1, - m = Sx_types[57].call(null, value); - caml_call3(Stdlib_Printf[3].call(null, J), fn_name, m, k); + m = Sx_types[61].call(null, value); + caml_call3(Stdlib_Printf[3].call(null, N), fn_name, m, k); var a = 0; break a; } @@ -61648,13 +69190,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var i = bc.length - 1, j = 0 < bc.length - 1 ? caml_check_bound(bc, 0)[1] : -1; - caml_call3(Stdlib_Printf[3].call(null, I), fn_name, j, i); + caml_call3(Stdlib_Printf[3].call(null, M), fn_name, j, i); var a = 0; break a; } } - var f = Sx_types[57].call(null, result); - caml_call2(Stdlib_Printf[3].call(null, G), fn_name, f); + var f = Sx_types[61].call(null, result); + caml_call2(Stdlib_Printf[3].call(null, H), fn_name, f); var a = 0; } return a; @@ -61663,7 +69205,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var e = caml_wrap_exception(e$0); jit_compiling[1] = 0; var b = Stdlib_Printexc[1].call(null, e); - caml_call2(Stdlib_Printf[3].call(null, C), fn_name, b); + caml_call2(Stdlib_Printf[3].call(null, D), fn_name, b); return 0; } } @@ -61673,7 +69215,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } jit_compile_ref[1] = jit_compile_lambda; Sx_types[6][1] = function(cl, args){return call_closure_reuse(cl, args);}; - var K = [0, 1]; + var O = [0, 1]; Sx_types[16][1] = function(exn){ if(exn[1] !== VmSuspended) return 0; @@ -61683,7 +69225,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= saved_cek = vm[5], saved_reuse = vm[7], d = Stdlib_Hashtbl[1].call(null, 0, 3); - Stdlib_Hashtbl[11].call(null, d, "__vm_suspended", K); + Stdlib_Hashtbl[11].call(null, d, "__vm_suspended", O); Stdlib_Hashtbl[11].call(null, d, cst_request, request); Stdlib_Hashtbl[11].call (null, @@ -61724,14 +69266,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } throw caml_maybe_attach_backtrace([0, VmSuspended, request, vm], 1); }]; - var L = [6, 0], M = [3, cst_phase], N = [3, cst_request]; + var P = [6, 0], Q = [3, cst_phase], R = [3, cst_request]; Sx_types[8][1] = function(f, args){ var a = [20, Sx_types[20].call(null, 0)], - state = Sx_ref[236].call(null, f, [6, args], a, [6, args], L), + state = Sx_ref[237].call(null, f, [6, args], a, [6, args], P), final = Sx_ref[156].call(null, state), - match = Sx_runtime[12].call(null, final, M); + match = Sx_runtime[13].call(null, final, Q); if (typeof match !== "number" && 3 === match[0] && match[1] === cst_io_suspended){ @@ -61743,11 +69285,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(0 !== active[7]){vm[7] = active[7]; active[7] = 0;} } throw caml_maybe_attach_backtrace - ([0, VmSuspended, Sx_runtime[12].call(null, final, N), vm], 1); + ([0, VmSuspended, Sx_runtime[13].call(null, final, R), vm], 1); } return Sx_ref[18].call(null, final); }; - var O = [0, [11, "UNKNOWN_", [4, 0, 0, 0, 0]], "UNKNOWN_%d"]; + var S = [0, [11, "UNKNOWN_", [4, 0, 0, 0, 0]], "UNKNOWN_%d"]; function opcode_name(n){ if(66 <= n){ var switcher = n - 128 | 0; @@ -61846,7 +69388,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 64: return "DICT"; } - return caml_call1(Stdlib_Printf[4].call(null, O), n); + var match = caml_call1(extension_opcode_name_ref[1], n); + if(! match) return caml_call1(Stdlib_Printf[4].call(null, S), n); + var name = match[1]; + return name; } function opcode_operand_size(param){ a: @@ -61884,15 +69429,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var cst_opcode = "opcode", - S = [0, 0], - T = [0, 0], + W = [0, 0], + X = [0, 0], c = [2, 0.], a = [6, 0], - P = [4, "do"], - Q = [4, cst_quote], - R = [0, "trace"], - U = [0, 1], - V = [0, 0]; + T = [4, "do"], + U = [4, cst_quote], + V = [0, "trace"], + Y = [0, 1], + Z = [0, 0]; function trace_run(src, globals){ try{var compile_fn = Stdlib_Hashtbl[6].call(null, globals, cst_compile);} catch(exn$0){ @@ -61906,15 +69451,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= a: { if(exprs && ! exprs[2]){var e = exprs[1], expr = e; break a;} - var expr = [6, [0, P, exprs]]; + var expr = [6, [0, T, exprs]]; } var - quoted = [6, [0, Q, [0, expr, 0]]], + quoted = [6, [0, U, [0, expr, 0]]], K = [20, Sx_types[20].call(null, 0)], code_val = - Sx_ref[241].call(null, [6, [0, compile_fn, [0, quoted, 0]]], K), + Sx_ref[242].call(null, [6, [0, compile_fn, [0, quoted, 0]]], K), code = code_from_value(code_val), - cl = [0, code, [0], R, globals, 0], + cl = [0, code, [0], V, globals, 0], vm = create(globals), frame0 = [0, cl, 0, 0, Stdlib_Hashtbl[1].call(null, 0, 4)], m = code[3] - 1 | 0; @@ -61949,7 +69494,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = (vm[2] - 1 | 0) - i | 0, v = caml_check_bound(vm[1], a)[a + 1]; - return [3, Sx_types[112].call(null, v)]; + return [3, Sx_types[117].call(null, v)]; }), entry = Stdlib_Hashtbl[1].call(null, 0, 4), M = [3, opcode_name(op)]; @@ -61980,12 +69525,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 16: var count = read_u8(frame), - W = + P = Stdlib_List[11].call (null, count, function(param){return pop(vm);}), - parts = Stdlib_List[10].call(null, W), - X = Stdlib_List[20].call(null, Sx_runtime[2], parts); - push(vm, [3, Stdlib_String[7].call(null, cst$1, X)]); + parts = Stdlib_List[10].call(null, P), + Q = Stdlib_List[20].call(null, Sx_runtime[3], parts); + push(vm, [3, Stdlib_String[7].call(null, cst$1, Q)]); break; case 32: var b = pop(vm), a$0 = pop(vm); @@ -62052,7 +69597,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ! (2 === a$5[0] && ! (typeof b$4 === "number" || ! (2 === b$4[0])))) - var w = S; + var w = W; else var y$3 = b$4[1], x$3 = a$5[1], w = [0, x$3 < y$3 ? 1 : 0]; push(vm, w); @@ -62065,14 +69610,14 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ! (2 === a$6[0] && ! (typeof b$5 === "number" || ! (2 === b$5[0])))) - var z = T; + var z = X; else var y$4 = b$5[1], x$4 = a$6[1], z = [0, y$4 < x$4 ? 1 : 0]; push(vm, z); break; case 39: var v = pop(vm); - push(vm, [0, 1 - Sx_types[67].call(null, v)]); + push(vm, [0, 1 - Sx_types[71].call(null, v)]); break; case 40: var v$0 = pop(vm); @@ -62148,7 +69693,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(typeof n !== "number" && 2 === n[0]){ var f = n[1]; try{ - var Y = Stdlib_List[8].call(null, l$0, f | 0), j = Y; + var R = Stdlib_List[8].call(null, l$0, f | 0), j = R; break a; } catch(exn){var j = 0; break a;} @@ -62215,9 +69760,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 1: push(vm, 0); break; case 2: - push(vm, U); break; + push(vm, Y); break; case 3: - push(vm, V); break; + push(vm, Z); break; case 4: pop(vm); break; case 5: @@ -62258,8 +69803,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= push(vm, caml_check_bound(frame[1][2], idx$1)[idx$1 + 1][1]); break; case 18: - var idx$2 = read_u8(frame), Z = peek(vm); - caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1] = Z; + var idx$2 = read_u8(frame), S = peek(vm); + caml_check_bound(frame[1][2], idx$2)[idx$2 + 1][1] = S; break; case 19: var @@ -62301,12 +69846,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= break; case 32: var offset$0 = read_i16(frame), v$9 = pop(vm); - if(1 - Sx_types[67].call(null, v$9)) + if(1 - Sx_types[71].call(null, v$9)) frame[2] = frame[2] + offset$0 | 0; break; case 33: var offset$1 = read_i16(frame), v$10 = pop(vm); - if(Sx_types[67].call(null, v$10)) + if(Sx_types[71].call(null, v$10)) frame[2] = frame[2] + offset$1 | 0; break; case 34: @@ -62381,8 +69926,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= match$8 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); if(match$8){ var match$9 = match$8[1]; - if(typeof match$9 !== "number" && 2 === match$9[0]){var n$0 = match$9[1], uv_count = n$0 | 0; break a; - } + if(typeof match$9 !== "number") + switch(match$9[0]){ + case 1: + var n$0 = match$9[1], uv_count = n$0; break a; + case 2: + var n$1 = match$9[1], uv_count = n$1 | 0; break a; + } } var uv_count = 0; break a; @@ -62477,7 +70027,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= case 5: var s$4 = k[1], key = s$4; break a; } - var key = Sx_runtime[2].call(null, k); + var key = Sx_runtime[3].call(null, k); } Stdlib_Hashtbl[11].call(null, d$0, key, v$11); var an = for$ + 1 | 0; @@ -62581,7 +70131,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= match$0 = Stdlib_Hashtbl[7].call(null, d, cst_upvalue_count); if(match$0){ var match$1 = match$0[1]; - if(typeof match$1 !== "number" && 2 === match$1[0]){var n = match$1[1], uv_count = n | 0; break c;} + if(typeof match$1 !== "number") + switch(match$1[0]){ + case 1: + var n = match$1[1], uv_count = n; break c; + case 2: + var n$0 = match$1[1], uv_count = n$0 | 0; break c; + } } var uv_count = 0; break c; @@ -62624,7 +70180,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(idx < consts.length - 1) var h = caml_check_bound(consts, idx)[idx + 1], - const_str = Sx_types[112].call(null, h); + const_str = Sx_types[117].call(null, h); else var const_str = cst; var operands$1 = [0, [2, idx], [0, [3, const_str], 0]], ip$4 = ip$0; @@ -62651,7 +70207,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var j = Stdlib_Array[14].call - (null, function(v){return [3, Sx_types[112].call(null, v)];}, consts), + (null, function(v){return [3, Sx_types[117].call(null, v)];}, consts), k = [6, Stdlib_Array[10].call(null, j)]; Stdlib_Hashtbl[11].call(null, result, cst_constants, k); var l = [6, Stdlib_List[10].call(null, instrs)]; @@ -62659,10 +70215,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [7, result]; } runtime.caml_register_global - (237, + (247, [0, VmSuspended, + Invalid_opcode, jit_compile_ref, + extension_dispatch_ref, + extension_opcode_name_ref, jit_failed_sentinel, is_jit_failed, active_vm, @@ -62695,6 +70254,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= execute_module, execute_module_safe, jit_is_broken_name, + bytecode_find_opcode, + bytecode_uses_extension_opcode, + code_uses_handler, + code_refs_escaping_caller, jit_compile_lambda, opcode_name, opcode_operand_size, @@ -62705,7 +70268,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 25961 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# 32147 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_vm_ref:[F(2),F(2),F(1),F(1)*,N,F(2),F(1),F(1),F(1),F(1)*,F(1)*,F(2),F(1)*,F(1)*,F(2)*,F(4),F(5),F(2),F(1),F(2),F(1),F(1),F(1),F(1),F(1),F(3),F(4),F(2),F(3),F(1),F(2),F(1),F(1),F(1),F(1),F(1)*,F(1),F(1),F(1),F(1),F(2),F(1),F(2)*,F(1),F(2),F(1),F(3),F(4),F(3),F(1)*,F(3),N,F(1)*,F(1)*,F(1)*,F(2),F(1)*,F(3),F(2),F(3),N,N,N,F(3),F(3),F(2),F(2),F(2),F(3),F(2),F(3),F(1),F(5),F(2),F(2),F(1),F(3),F(1),N,N,F(1)*] (function (globalThis){ @@ -62736,12 +70299,12 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Sx_ref = global_data.Sx_ref, Stdlib_Array = global_data.Stdlib__Array, Stdlib = global_data.Stdlib, - cek_call = Sx_ref[221], - eval_expr = Sx_ref[241]; + cek_call = Sx_ref[222], + eval_expr = Sx_ref[242]; function trampoline(v){ if(typeof v !== "number" && 12 === v[0]){ var env = v[2], expr = v[1]; - return Sx_ref[241].call(null, expr, [20, env]); + return Sx_ref[242].call(null, expr, [20, env]); } return v; } @@ -62752,10 +70315,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } var str = - [15, "str", function(args){return [3, Sx_runtime[4].call(null, args)];}]; + [15, "str", function(args){return [3, Sx_runtime[5].call(null, args)];}]; function call_primitive(name, args){ var n = Sx_types[35].call(null, name), a = to_ocaml_list(args); - return Sx_runtime[1].call(null, n, a); + return Sx_runtime[2].call(null, n, a); } function unwrap_vm(v){ if(typeof v !== "number" && 26 === v[0]){var m = v[1]; return m;} @@ -62775,7 +70338,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function make_upvalue_cell(v){return 0;} function uv_get$0(param){return 0;} function uv_set_b(a, param){return 0;} - function code_from_value(v){return Sx_vm[24].call(null, v);} + function code_from_value(v){return Sx_vm[27].call(null, v);} function make_vm_code(arity, locals, bytecode, constants){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d, "arity", arity); @@ -62817,7 +70380,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } function make_vm_frame(closure, base){ var cl = unwrap_closure(closure), a = Stdlib_Hashtbl[1].call(null, 0, 4); - return [25, [0, cl, 0, Sx_types[90].call(null, base), a]]; + return [25, [0, cl, 0, Sx_types[94].call(null, base), a]]; } function make_vm(globals){ a: @@ -62882,9 +70445,9 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var m = unwrap_vm(vm_val), f = unwrap_frame(frame_val), - a = Sx_types[90].call(null, slot), + a = Sx_types[94].call(null, slot), idx = f[3] + a | 0, - b = Sx_types[90].call(null, slot), + b = Sx_types[94].call(null, slot), match = Stdlib_Hashtbl[7].call(null, f[4], b); if(! match) return caml_check_bound(m[1], idx)[idx + 1]; var cell = match[1]; @@ -62894,7 +70457,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var m = unwrap_vm(vm_val), f = unwrap_frame(frame_val), - s = Sx_types[90].call(null, slot), + s = Sx_types[94].call(null, slot), match = Stdlib_Hashtbl[7].call(null, f[4], s); if(match){ var cell = match[1]; @@ -62904,18 +70467,18 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; } function frame_upvalue_get(frame_val, idx){ - var f = unwrap_frame(frame_val), a = Sx_types[90].call(null, idx); + var f = unwrap_frame(frame_val), a = Sx_types[94].call(null, idx); return caml_check_bound(f[1][2], a)[a + 1][1]; } function frame_upvalue_set(frame_val, idx, v){ - var f = unwrap_frame(frame_val), a = Sx_types[90].call(null, idx); + var f = unwrap_frame(frame_val), a = Sx_types[94].call(null, idx); caml_check_bound(f[1][2], a)[a + 1][1] = v; return 0; } function frame_ip(f){var fr = unwrap_frame(f); return [2, fr[2]];} function frame_set_ip_b(f, v){ var fr = unwrap_frame(f); - fr[2] = Sx_types[90].call(null, v); + fr[2] = Sx_types[94].call(null, v); return 0; } function frame_base(f){var fr = unwrap_frame(f); return [2, fr[3]];} @@ -62953,15 +70516,15 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; } var a = [3, cst_vc_bytecode]; - function code_bytecode(code){return Sx_runtime[12].call(null, code, a);} + function code_bytecode(code){return Sx_runtime[13].call(null, code, a);} var b = [3, cst_vc_constants]; - function code_constants(code){return Sx_runtime[12].call(null, code, b);} + function code_constants(code){return Sx_runtime[13].call(null, code, b);} var c = [3, cst_vc_locals]; - function code_locals(code){return Sx_runtime[12].call(null, code, c);} + function code_locals(code){return Sx_runtime[13].call(null, code, c);} function vm_sp(v){var m = unwrap_vm(v); return [2, m[2]];} function vm_set_sp_b(v, s){ var m = unwrap_vm(v); - m[2] = Sx_types[90].call(null, s); + m[2] = Sx_types[94].call(null, s); return 0; } function vm_stack(v){unwrap_vm(v); return 0;} @@ -63007,7 +70570,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(found_in_env){var v$0 = found_in_env[1]; return v$0;} var match$2 = Stdlib_Hashtbl[7].call(null, m[4], n); if(match$2){var v$1 = match$2[1]; return v$1;} - try{var c = Sx_runtime[1].call(null, n, 0); return c;} + try{var c = Sx_runtime[2].call(null, n, 0); return c;} catch(exn){ var match$3 = Sx_types[25][1]; if(! match$3){ @@ -63095,7 +70658,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= match = Stdlib_Hashtbl[7].call(null, d, "upvalue-count"); if(match){ var match$0 = match[1]; - if(typeof match$0 !== "number" && 2 === match$0[0]){var n = match$0[1], uv_count = n | 0; break a;} + if(typeof match$0 !== "number") + switch(match$0[0]){ + case 1: + var n = match$0[1], uv_count = n; break a; + case 2: + var n$0 = match$0[1], uv_count = n$0 | 0; break a; + } } var uv_count = 0; break a; @@ -63180,17 +70749,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var a = to_ocaml_list(args), b = [20, Sx_types[20].call(null, 0)], - state = Sx_ref[236].call(null, f, [6, a], b, [6, a], h), + state = Sx_ref[237].call(null, f, [6, a], b, [6, a], h), final = Sx_ref[156].call(null, state), - match = Sx_runtime[12].call(null, final, i); + match = Sx_runtime[13].call(null, final, i); if (typeof match !== "number" && 3 === match[0] && match[1] === "io-suspended"){ var m = unwrap_vm(vm_val); m[5] = [0, final]; var - c = Sx_vm[6].call(null, m[4]), - d = Sx_runtime[12].call(null, final, j); + c = Sx_vm[9].call(null, m[4]), + d = Sx_runtime[13].call(null, final, j); throw caml_maybe_attach_backtrace([0, Sx_vm[1], d, c], 1); } return Sx_ref[18].call(null, final); @@ -63279,7 +70848,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= if(0 === l[4]) return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); l[5] = [0, jit_failed_sentinel]; - var match$0 = caml_call2(Sx_vm[2][1], l, m[4]); + var match$0 = caml_call2(Sx_vm[3][1], l, m[4]); if(! match$0) return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); var cl$0 = match$0[1]; @@ -63294,7 +70863,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return vm_push(vm_val, cek_call_or_suspend(vm_val, f, args)); } function collect_n_from_stack(vm_val, n){ - var m = unwrap_vm(vm_val), count = Sx_types[90].call(null, n), a = 0; + var m = unwrap_vm(vm_val), count = Sx_types[94].call(null, n), a = 0; if(count < 1) var result$0 = a; else{ @@ -63315,7 +70884,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function collect_n_pairs(vm_val, n){ var m = unwrap_vm(vm_val), - count = Sx_types[90].call(null, n), + count = Sx_types[94].call(null, n), d = Stdlib_Hashtbl[1].call(null, 0, count); if(count >= 1){ var for$ = 1; @@ -63336,7 +70905,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return [7, d]; } function pad_n_nils(vm_val, n){ - var m = unwrap_vm(vm_val), count = Sx_types[90].call(null, n); + var m = unwrap_vm(vm_val), count = Sx_types[94].call(null, n); if(count >= 1){ var for$ = 1; for(;;){ @@ -63357,27 +70926,27 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= m = [0, [3, "island"], 0]; function vm_call(vm, f, args){ var a = vm_closure_p(f); - if(Sx_types[67].call(null, a)) return vm_push_frame(vm, f, args); + if(Sx_types[71].call(null, a)) return vm_push_frame(vm, f, args); var b = is_lambda(f); - if(Sx_types[67].call(null, b)) return try_jit_call(vm, f, args); + if(Sx_types[71].call(null, b)) return try_jit_call(vm, f, args); var - c = [0, Sx_runtime[73].call(null, f), k], - or = Sx_runtime[1].call(null, cst, c); - if(Sx_types[67].call(null, or)) + c = [0, Sx_runtime[74].call(null, f), k], + or = Sx_runtime[2].call(null, cst, c); + if(Sx_types[71].call(null, or)) var or$0 = or; else var - i = [0, Sx_runtime[73].call(null, f), m], - or$0 = Sx_runtime[1].call(null, cst, i); - if(Sx_types[67].call(null, or$0)) + i = [0, Sx_runtime[74].call(null, f), m], + or$0 = Sx_runtime[2].call(null, cst, i); + if(Sx_types[71].call(null, or$0)) return vm_push(vm, cek_call_or_suspend(vm, f, args)); - var d = Sx_runtime[90].call(null, f); - if(Sx_types[67].call(null, d)) - return vm_push(vm, Sx_runtime[7].call(null, f, args)); + var d = Sx_runtime[91].call(null, f); + if(Sx_types[71].call(null, d)) + return vm_push(vm, Sx_runtime[8].call(null, f, args)); var - e = [0, l, [0, Sx_runtime[73].call(null, f), 0]], - g = [3, Sx_runtime[4].call(null, e)], - h = Sx_runtime[2].call(null, g); + e = [0, l, [0, Sx_runtime[74].call(null, f), 0]], + g = [3, Sx_runtime[5].call(null, e)], + h = Sx_runtime[3].call(null, g); throw caml_maybe_attach_backtrace([0, Sx_types[9], h], 1); } var @@ -63390,8 +70959,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= t = [0, [3, "every?"], 0], u = [3, cst_VM_undefined]; function vm_resolve_ho_form(vm, name){ - var a = Sx_runtime[1].call(null, cst, [0, name, n]), cst$0 = "\xce\xbb"; - if(Sx_types[67].call(null, a)) + var a = Sx_runtime[2].call(null, cst, [0, name, n]), cst$0 = "\xce\xbb"; + if(Sx_types[71].call(null, a)) return [15, cst$0, function(args){ @@ -63401,7 +70970,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); Stdlib_List[18].call (null, function(x){ @@ -63414,8 +70983,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }]; - var b = Sx_runtime[1].call(null, cst, [0, name, o]); - if(Sx_types[67].call(null, b)) + var b = Sx_runtime[2].call(null, cst, [0, name, o]); + if(Sx_types[71].call(null, b)) return [15, cst$0, function(args){ @@ -63425,7 +70994,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); return [6, Stdlib_List[20].call (null, @@ -63435,8 +71004,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }]; - var c = Sx_runtime[1].call(null, cst, [0, name, p]); - if(Sx_types[67].call(null, c)) + var c = Sx_runtime[2].call(null, cst, [0, name, p]); + if(Sx_types[71].call(null, c)) return [15, cst$0, function(args){ @@ -63446,7 +71015,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); return [6, Stdlib_List[21].call (null, @@ -63459,8 +71028,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }]; - var d = Sx_runtime[1].call(null, cst, [0, name, q]); - if(Sx_types[67].call(null, d)) + var d = Sx_runtime[2].call(null, cst, [0, name, q]); + if(Sx_types[71].call(null, d)) return [15, cst$0, function(args){ @@ -63470,21 +71039,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); return [6, Stdlib_List[44].call (null, function(x){ var a = vm_call_external(vm, f, [6, [0, x, 0]]); - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, b)]; } } return 0; }]; - var e = Sx_runtime[1].call(null, cst, [0, name, r]); - if(Sx_types[67].call(null, e)) + var e = Sx_runtime[2].call(null, cst, [0, name, r]); + if(Sx_types[71].call(null, e)) return [15, cst$0, function(args){ @@ -63497,7 +71066,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= coll = b[1], init = a[1], f = args[1], - c = Sx_runtime[5].call(null, coll); + c = Sx_runtime[6].call(null, coll); return Stdlib_List[26].call (null, function(acc, x){ @@ -63510,8 +71079,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } return 0; }]; - var f = Sx_runtime[1].call(null, cst, [0, name, s]); - if(Sx_types[67].call(null, f)) + var f = Sx_runtime[2].call(null, cst, [0, name, s]); + if(Sx_types[71].call(null, f)) return [15, cst$0, function(args){ @@ -63521,21 +71090,21 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); return [0, Stdlib_List[34].call (null, function(x){ var a = vm_call_external(vm, f, [6, [0, x, 0]]); - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, b)]; } } return 0; }]; - var g = Sx_runtime[1].call(null, cst, [0, name, t]); - if(Sx_types[67].call(null, g)) + var g = Sx_runtime[2].call(null, cst, [0, name, t]); + if(Sx_types[71].call(null, g)) return [15, cst$0, function(args){ @@ -63545,13 +71114,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var coll = a[1], f = args[1], - b = Sx_runtime[5].call(null, coll); + b = Sx_runtime[6].call(null, coll); return [0, Stdlib_List[33].call (null, function(x){ var a = vm_call_external(vm, f, [6, [0, x, 0]]); - return Sx_types[67].call(null, a); + return Sx_types[71].call(null, a); }, b)]; } @@ -63559,13 +71128,13 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; }]; var - h = [3, Sx_runtime[4].call(null, [0, u, [0, name, 0]])], - i = Sx_runtime[2].call(null, h); + h = [3, Sx_runtime[5].call(null, [0, u, [0, name, 0]])], + i = Sx_runtime[3].call(null, h); throw caml_maybe_attach_backtrace([0, Sx_types[9], i], 1); } function vm_call_external(vm, f, args){ var a = vm_closure_p(f); - return Sx_types[67].call(null, a) + return Sx_types[71].call(null, a) ? vm_call_closure(f, args, vm_globals_ref(vm)) : cek_call(f, args); } @@ -63574,26 +71143,26 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= for(;;){ var a = vm_frames(vm), - b = Sx_runtime[33].call(null, a), - c = [0, 1 - Sx_types[67].call(null, b)]; - if(! Sx_types[67].call(null, c)) return 0; + b = Sx_runtime[34].call(null, a), + c = [0, 1 - Sx_types[71].call(null, b)]; + if(! Sx_types[71].call(null, c)) return 0; var d = vm_frames(vm), - frame = Sx_runtime[14].call(null, d), + frame = Sx_runtime[15].call(null, d), e = vm_frames(vm), - rest_frames = Sx_runtime[15].call(null, e), + rest_frames = Sx_runtime[16].call(null, e), bc = code_bytecode(closure_code(frame_closure(frame))), consts = code_constants(closure_code(frame_closure(frame))), - f = [0, Sx_runtime[24].call(null, bc), 0], + f = [0, Sx_runtime[25].call(null, bc), 0], g = [0, frame_ip(frame), f], - h = Sx_runtime[1].call(null, ">=", g); - if(Sx_types[67].call(null, h)) return vm_set_frames_b(vm, v); + h = Sx_runtime[2].call(null, ">=", g); + if(Sx_types[71].call(null, h)) return vm_set_frames_b(vm, v); vm_step(vm, frame, rest_frames, bc, consts); var i = vm_globals_ref(vm), - j = Sx_runtime[25].call(null, i, w), - k = Sx_runtime[83].call(null, j); - if(! Sx_types[67].call(null, k)) return 0; + j = Sx_runtime[26].call(null, i, w), + k = Sx_runtime[84].call(null, j); + if(! Sx_types[71].call(null, k)) return 0; } } var @@ -63646,89 +71215,89 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function vm_step(vm, frame, rest_frames, bc, consts){ var op = frame_read_u8(frame), - c = Sx_runtime[1].call(null, cst, [0, op, x]); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, [0, op, x]); + if(Sx_types[71].call(null, c)){ var idx = frame_read_u16(frame); - return vm_push(vm, Sx_runtime[17].call(null, consts, idx)); + return vm_push(vm, Sx_runtime[18].call(null, consts, idx)); } - var e = Sx_runtime[1].call(null, cst, [0, op, y]); - if(Sx_types[67].call(null, e)) return vm_push(vm, 0); - var g = Sx_runtime[1].call(null, cst, [0, op, z]); - if(Sx_types[67].call(null, g)) return vm_push(vm, A); - var h = Sx_runtime[1].call(null, cst, [0, op, B]); - if(Sx_types[67].call(null, h)) return vm_push(vm, C); - var i = Sx_runtime[1].call(null, cst, [0, op, D]); - if(Sx_types[67].call(null, i)) return vm_pop(vm); - var j = Sx_runtime[1].call(null, cst, [0, op, E]); - if(Sx_types[67].call(null, j)) return vm_push(vm, vm_peek(vm)); - var k = Sx_runtime[1].call(null, cst, [0, op, F]); - if(Sx_types[67].call(null, k)){ + var e = Sx_runtime[2].call(null, cst, [0, op, y]); + if(Sx_types[71].call(null, e)) return vm_push(vm, 0); + var g = Sx_runtime[2].call(null, cst, [0, op, z]); + if(Sx_types[71].call(null, g)) return vm_push(vm, A); + var h = Sx_runtime[2].call(null, cst, [0, op, B]); + if(Sx_types[71].call(null, h)) return vm_push(vm, C); + var i = Sx_runtime[2].call(null, cst, [0, op, D]); + if(Sx_types[71].call(null, i)) return vm_pop(vm); + var j = Sx_runtime[2].call(null, cst, [0, op, E]); + if(Sx_types[71].call(null, j)) return vm_push(vm, vm_peek(vm)); + var k = Sx_runtime[2].call(null, cst, [0, op, F]); + if(Sx_types[71].call(null, k)){ var slot = frame_read_u8(frame); return vm_push(vm, frame_local_get(vm, frame, slot)); } - var l = Sx_runtime[1].call(null, cst, [0, op, G]); - if(Sx_types[67].call(null, l)){ + var l = Sx_runtime[2].call(null, cst, [0, op, G]); + if(Sx_types[71].call(null, l)){ var slot$0 = frame_read_u8(frame); return frame_local_set(vm, frame, slot$0, vm_peek(vm)); } - var m = Sx_runtime[1].call(null, cst, [0, op, H]); - if(Sx_types[67].call(null, m)){ + var m = Sx_runtime[2].call(null, cst, [0, op, H]); + if(Sx_types[71].call(null, m)){ var idx$0 = frame_read_u8(frame); return vm_push(vm, frame_upvalue_get(frame, idx$0)); } - var o = Sx_runtime[1].call(null, cst, [0, op, I]); - if(Sx_types[67].call(null, o)){ + var o = Sx_runtime[2].call(null, cst, [0, op, I]); + if(Sx_types[71].call(null, o)){ var idx$1 = frame_read_u8(frame); return frame_upvalue_set(frame, idx$1, vm_peek(vm)); } - var p = Sx_runtime[1].call(null, cst, [0, op, J]); - if(Sx_types[67].call(null, p)){ + var p = Sx_runtime[2].call(null, cst, [0, op, J]); + if(Sx_types[71].call(null, p)){ var idx$2 = frame_read_u16(frame), - name = Sx_runtime[17].call(null, consts, idx$2); + name = Sx_runtime[18].call(null, consts, idx$2); return vm_push(vm, vm_global_get(vm, frame, name)); } - var q = Sx_runtime[1].call(null, cst, [0, op, K]); - if(Sx_types[67].call(null, q)){ + var q = Sx_runtime[2].call(null, cst, [0, op, K]); + if(Sx_types[71].call(null, q)){ var idx$3 = frame_read_u16(frame), - name$0 = Sx_runtime[17].call(null, consts, idx$3); + name$0 = Sx_runtime[18].call(null, consts, idx$3); return vm_global_set(vm, frame, name$0, vm_peek(vm)); } - var r = Sx_runtime[1].call(null, cst, [0, op, L]), cst$0 = "+"; - if(Sx_types[67].call(null, r)){ + var r = Sx_runtime[2].call(null, cst, [0, op, L]), cst$0 = "+"; + if(Sx_types[71].call(null, r)){ var offset = frame_read_i16(frame), s = [0, frame_ip(frame), [0, offset, 0]]; - return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, s)); + return frame_set_ip_b(frame, Sx_runtime[2].call(null, cst$0, s)); } - var t = Sx_runtime[1].call(null, cst, [0, op, M]); - if(Sx_types[67].call(null, t)){ + var t = Sx_runtime[2].call(null, cst, [0, op, M]); + if(Sx_types[71].call(null, t)){ var offset$0 = frame_read_i16(frame), v = vm_pop(vm), - u = [0, 1 - Sx_types[67].call(null, v)]; - if(! Sx_types[67].call(null, u)) return 0; + u = [0, 1 - Sx_types[71].call(null, v)]; + if(! Sx_types[71].call(null, u)) return 0; var w = [0, frame_ip(frame), [0, offset$0, 0]]; - return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, w)); + return frame_set_ip_b(frame, Sx_runtime[2].call(null, cst$0, w)); } - var ap = Sx_runtime[1].call(null, cst, [0, op, N]); - if(Sx_types[67].call(null, ap)){ + var ap = Sx_runtime[2].call(null, cst, [0, op, N]); + if(Sx_types[71].call(null, ap)){ var offset$1 = frame_read_i16(frame), v$0 = vm_pop(vm); - if(! Sx_types[67].call(null, v$0)) return 0; + if(! Sx_types[71].call(null, v$0)) return 0; var aq = [0, frame_ip(frame), [0, offset$1, 0]]; - return frame_set_ip_b(frame, Sx_runtime[1].call(null, cst$0, aq)); + return frame_set_ip_b(frame, Sx_runtime[2].call(null, cst$0, aq)); } - var ar = Sx_runtime[1].call(null, cst, [0, op, O]); - if(Sx_types[67].call(null, ar)){ + var ar = Sx_runtime[2].call(null, cst, [0, op, O]); + if(Sx_types[71].call(null, ar)){ var argc = frame_read_u8(frame), args = collect_n_from_stack(vm, argc), f = vm_pop(vm); return vm_call(vm, f, args); } - var as = Sx_runtime[1].call(null, cst, [0, op, P]); - if(Sx_types[67].call(null, as)){ + var as = Sx_runtime[2].call(null, cst, [0, op, P]); + if(Sx_types[71].call(null, as)){ var argc$0 = frame_read_u8(frame), args$0 = collect_n_from_stack(vm, argc$0), @@ -63737,147 +71306,147 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= vm_set_sp_b(vm, frame_base(frame)); return vm_call(vm, f$0, args$0); } - var at = Sx_runtime[1].call(null, cst, [0, op, Q]); - if(Sx_types[67].call(null, at)){ + var at = Sx_runtime[2].call(null, cst, [0, op, Q]); + if(Sx_types[71].call(null, at)){ var result = vm_pop(vm); vm_set_frames_b(vm, rest_frames); vm_set_sp_b(vm, frame_base(frame)); return vm_push(vm, result); } - var au = Sx_runtime[1].call(null, cst, [0, op, R]); - if(Sx_types[67].call(null, au)){ + var au = Sx_runtime[2].call(null, cst, [0, op, R]); + if(Sx_types[71].call(null, au)){ var idx$4 = frame_read_u16(frame), - code_val = Sx_runtime[17].call(null, consts, idx$4), + code_val = Sx_runtime[18].call(null, consts, idx$4), cl = vm_create_closure(vm, frame, code_val); return vm_push(vm, cl); } - var av = Sx_runtime[1].call(null, cst, [0, op, S]); - if(Sx_types[67].call(null, av)){ + var av = Sx_runtime[2].call(null, cst, [0, op, S]); + if(Sx_types[71].call(null, av)){ var idx$5 = frame_read_u16(frame), argc$1 = frame_read_u8(frame), - name$1 = Sx_runtime[17].call(null, consts, idx$5), + name$1 = Sx_runtime[18].call(null, consts, idx$5), args$1 = collect_n_from_stack(vm, argc$1); return vm_push(vm, call_primitive(name$1, args$1)); } - var aw = Sx_runtime[1].call(null, cst, [0, op, T]); - if(Sx_types[67].call(null, aw)){ + var aw = Sx_runtime[2].call(null, cst, [0, op, T]); + if(Sx_types[71].call(null, aw)){ var count = frame_read_u16(frame), items = collect_n_from_stack(vm, count); return vm_push(vm, items); } - var ax = Sx_runtime[1].call(null, cst, [0, op, U]); - if(Sx_types[67].call(null, ax)){ + var ax = Sx_runtime[2].call(null, cst, [0, op, U]); + if(Sx_types[71].call(null, ax)){ var count$0 = frame_read_u16(frame), d = collect_n_pairs(vm, count$0); return vm_push(vm, d); } - var ay = Sx_runtime[1].call(null, cst, [0, op, V]); - if(Sx_types[67].call(null, ay)){ + var ay = Sx_runtime[2].call(null, cst, [0, op, V]); + if(Sx_types[71].call(null, ay)){ var count$1 = frame_read_u8(frame), parts = collect_n_from_stack(vm, count$1); - return vm_push(vm, Sx_runtime[7].call(null, str, parts)); + return vm_push(vm, Sx_runtime[8].call(null, str, parts)); } - var az = Sx_runtime[1].call(null, cst, [0, op, W]); - if(Sx_types[67].call(null, az)){ + var az = Sx_runtime[2].call(null, cst, [0, op, W]); + if(Sx_types[71].call(null, az)){ var idx$6 = frame_read_u16(frame), - name$2 = Sx_runtime[17].call(null, consts, idx$6), + name$2 = Sx_runtime[18].call(null, consts, idx$6), aA = vm_peek(vm), aB = vm_globals_ref(vm); - return Sx_runtime[11].call(null, aB, name$2, aA); + return Sx_runtime[12].call(null, aB, name$2, aA); } - var aC = Sx_runtime[1].call(null, cst, [0, op, X]); - if(Sx_types[67].call(null, aC)){ + var aC = Sx_runtime[2].call(null, cst, [0, op, X]); + if(Sx_types[71].call(null, aC)){ var b = vm_pop(vm), a = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, cst$0, [0, a, [0, b, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, cst$0, [0, a, [0, b, 0]])); } - var aD = Sx_runtime[1].call(null, cst, [0, op, Y]), cst$1 = "-"; - if(Sx_types[67].call(null, aD)){ + var aD = Sx_runtime[2].call(null, cst, [0, op, Y]), cst$1 = "-"; + if(Sx_types[71].call(null, aD)){ var b$0 = vm_pop(vm), a$0 = vm_pop(vm); return vm_push - (vm, Sx_runtime[1].call(null, cst$1, [0, a$0, [0, b$0, 0]])); + (vm, Sx_runtime[2].call(null, cst$1, [0, a$0, [0, b$0, 0]])); } - var aE = Sx_runtime[1].call(null, cst, [0, op, Z]); - if(Sx_types[67].call(null, aE)){ + var aE = Sx_runtime[2].call(null, cst, [0, op, Z]); + if(Sx_types[71].call(null, aE)){ var b$1 = vm_pop(vm), a$1 = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, "*", [0, a$1, [0, b$1, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, "*", [0, a$1, [0, b$1, 0]])); } - var aF = Sx_runtime[1].call(null, cst, [0, op, _]); - if(Sx_types[67].call(null, aF)){ + var aF = Sx_runtime[2].call(null, cst, [0, op, _]); + if(Sx_types[71].call(null, aF)){ var b$2 = vm_pop(vm), a$2 = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, "/", [0, a$2, [0, b$2, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, "/", [0, a$2, [0, b$2, 0]])); } - var aG = Sx_runtime[1].call(null, cst, [0, op, $]); - if(Sx_types[67].call(null, aG)){ + var aG = Sx_runtime[2].call(null, cst, [0, op, $]); + if(Sx_types[71].call(null, aG)){ var b$3 = vm_pop(vm), a$3 = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, cst, [0, a$3, [0, b$3, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, cst, [0, a$3, [0, b$3, 0]])); } - var aH = Sx_runtime[1].call(null, cst, [0, op, aa]); - if(Sx_types[67].call(null, aH)){ + var aH = Sx_runtime[2].call(null, cst, [0, op, aa]); + if(Sx_types[71].call(null, aH)){ var b$4 = vm_pop(vm), a$4 = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, "<", [0, a$4, [0, b$4, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, "<", [0, a$4, [0, b$4, 0]])); } - var aI = Sx_runtime[1].call(null, cst, [0, op, ab]); - if(Sx_types[67].call(null, aI)){ + var aI = Sx_runtime[2].call(null, cst, [0, op, ab]); + if(Sx_types[71].call(null, aI)){ var b$5 = vm_pop(vm), a$5 = vm_pop(vm); - return vm_push(vm, Sx_runtime[1].call(null, ">", [0, a$5, [0, b$5, 0]])); + return vm_push(vm, Sx_runtime[2].call(null, ">", [0, a$5, [0, b$5, 0]])); } - var aJ = Sx_runtime[1].call(null, cst, [0, op, ac]); - if(Sx_types[67].call(null, aJ)){ + var aJ = Sx_runtime[2].call(null, cst, [0, op, ac]); + if(Sx_types[71].call(null, aJ)){ var aK = vm_pop(vm); - return vm_push(vm, [0, 1 - Sx_types[67].call(null, aK)]); + return vm_push(vm, [0, 1 - Sx_types[71].call(null, aK)]); } - var aL = Sx_runtime[1].call(null, cst, [0, op, ad]); - if(Sx_types[67].call(null, aL)){ + var aL = Sx_runtime[2].call(null, cst, [0, op, ad]); + if(Sx_types[71].call(null, aL)){ var aM = vm_pop(vm); - return vm_push(vm, Sx_runtime[24].call(null, aM)); + return vm_push(vm, Sx_runtime[25].call(null, aM)); } - var aN = Sx_runtime[1].call(null, cst, [0, op, ae]); - if(Sx_types[67].call(null, aN)){ + var aN = Sx_runtime[2].call(null, cst, [0, op, ae]); + if(Sx_types[71].call(null, aN)){ var aO = vm_pop(vm); - return vm_push(vm, Sx_runtime[14].call(null, aO)); + return vm_push(vm, Sx_runtime[15].call(null, aO)); } - var aP = Sx_runtime[1].call(null, cst, [0, op, af]); - if(Sx_types[67].call(null, aP)){ + var aP = Sx_runtime[2].call(null, cst, [0, op, af]); + if(Sx_types[71].call(null, aP)){ var aQ = vm_pop(vm); - return vm_push(vm, Sx_runtime[15].call(null, aQ)); + return vm_push(vm, Sx_runtime[16].call(null, aQ)); } - var aR = Sx_runtime[1].call(null, cst, [0, op, ag]); - if(Sx_types[67].call(null, aR)){ + var aR = Sx_runtime[2].call(null, cst, [0, op, ag]); + if(Sx_types[71].call(null, aR)){ var n = vm_pop(vm), coll = vm_pop(vm); - return vm_push(vm, Sx_runtime[17].call(null, coll, n)); + return vm_push(vm, Sx_runtime[18].call(null, coll, n)); } - var aS = Sx_runtime[1].call(null, cst, [0, op, ah]); - if(Sx_types[67].call(null, aS)){ + var aS = Sx_runtime[2].call(null, cst, [0, op, ah]); + if(Sx_types[71].call(null, aS)){ var coll$0 = vm_pop(vm), x$0 = vm_pop(vm); - return vm_push(vm, Sx_runtime[18].call(null, x$0, coll$0)); + return vm_push(vm, Sx_runtime[19].call(null, x$0, coll$0)); } - var aT = Sx_runtime[1].call(null, cst, [0, op, ai]); - if(Sx_types[67].call(null, aT)){ + var aT = Sx_runtime[2].call(null, cst, [0, op, ai]); + if(Sx_types[71].call(null, aT)){ var aU = [0, aj, [0, vm_pop(vm), 0]]; - return vm_push(vm, Sx_runtime[1].call(null, cst$1, aU)); + return vm_push(vm, Sx_runtime[2].call(null, cst$1, aU)); } - var aV = Sx_runtime[1].call(null, cst, [0, op, ak]); - if(Sx_types[67].call(null, aV)){ + var aV = Sx_runtime[2].call(null, cst, [0, op, ak]); + if(Sx_types[71].call(null, aV)){ var aW = [0, vm_pop(vm), 0]; - return vm_push(vm, Sx_runtime[1].call(null, "inc", aW)); + return vm_push(vm, Sx_runtime[2].call(null, "inc", aW)); } - var aX = Sx_runtime[1].call(null, cst, [0, op, al]); - if(Sx_types[67].call(null, aX)){ + var aX = Sx_runtime[2].call(null, cst, [0, op, al]); + if(Sx_types[71].call(null, aX)){ var aY = [0, vm_pop(vm), 0]; - return vm_push(vm, Sx_runtime[1].call(null, "dec", aY)); + return vm_push(vm, Sx_runtime[2].call(null, "dec", aY)); } - var aZ = Sx_runtime[1].call(null, cst, [0, op, am]); - if(Sx_types[67].call(null, aZ)){ + var aZ = Sx_runtime[2].call(null, cst, [0, op, am]); + if(Sx_types[71].call(null, aZ)){ var request = vm_pop(vm), a0 = vm_globals_ref(vm); - return Sx_runtime[11].call(null, a0, an, request); + return Sx_runtime[12].call(null, a0, an, request); } var - a1 = [3, Sx_runtime[4].call(null, [0, ao, [0, op, 0]])], - a2 = Sx_runtime[2].call(null, a1); + a1 = [3, Sx_runtime[5].call(null, [0, ao, [0, op, 0]])], + a2 = Sx_runtime[3].call(null, a1); throw caml_maybe_attach_backtrace([0, Sx_types[9], a2], 1); } vm_run_fn[1] = vm_run; @@ -63887,7 +71456,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = Stdlib_Hashtbl[7].call(null, globals, cst_io_request); if(match){ var req = match[1]; - if(Sx_types[67].call(null, req)){ + if(Sx_types[71].call(null, req)){ var d = Stdlib_Hashtbl[1].call(null, 0, 4); Stdlib_Hashtbl[11].call(null, d, "suspended", ap); Stdlib_Hashtbl[11].call(null, d, "op", aq); @@ -63946,7 +71515,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function call_closure(cl, args, globals){ return vm_call_closure([24, cl], [6, args], [7, globals]); } - var jit_compile_ref = Sx_vm[2]; + var jit_compile_ref = Sx_vm[3]; runtime.caml_register_global (178, [0, @@ -64036,7 +71605,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } (globalThis)); -//# 27293 "../lib/.sx.objs/jsoo/default/sx.cma.js" +//# 33485 "../lib/.sx.objs/jsoo/default/sx.cma.js" //# shape: Sx_render:[F(2),F(1),F(1)*,F(1)*,F(2),F(1),F(2),F(2),F(1),F(1),F(1),F(1),F(1),N,N,N,F(2),F(2),F(3),F(2),F(1),F(3),F(2),F(1)*,N,F(1),N,N,N,N,N,N,N,N,F(1),F(1),F(1),F(1),F(1),N,F(1),N,N,F(1),F(2),F(2),F(2),F(2),F(2),F(1),F(2),F(2),F(2),F(1),F(2),F(3),F(3),F(3),F(3),F(2),F(2),F(3),F(3),F(2),F(2),F(3),F(1),F(1),F(1),F(1)] (function (globalThis){ @@ -64316,7 +71885,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= Stdlib_String = global_data.Stdlib__String, Sx_vm = global_data.Sx_vm, Stdlib_Printexc = global_data.Stdlib__Printexc; - function eval_expr(expr, env){return Sx_ref[241].call(null, expr, env);} + function eval_expr(expr, env){return Sx_ref[242].call(null, expr, env);} var cond_scheme_p = Sx_ref[137], cst$6 = "", a = [3, cst$6]; function raw_html_content(v){ if(typeof v !== "number" && 17 === v[0]){var s = v[1]; return [3, s];} @@ -64327,26 +71896,26 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return 0; } function scope_emit(v1, v2){ - return Sx_runtime[1].call(null, "scope-emit!", [0, v1, [0, v2, 0]]); + return Sx_runtime[2].call(null, "scope-emit!", [0, v1, [0, v2, 0]]); } - function init(v){return Sx_runtime[1].call(null, "init", [0, v, 0]);} + function init(v){return Sx_runtime[2].call(null, "init", [0, v, 0]);} function dict_has(a, b){ - return Sx_runtime[1].call(null, "dict-has?", [0, a, [0, b, 0]]); + return Sx_runtime[2].call(null, "dict-has?", [0, a, [0, b, 0]]); } function dict_get(a, b){ - return Sx_runtime[1].call(null, "dict-get", [0, a, [0, b, 0]]); + return Sx_runtime[2].call(null, "dict-get", [0, a, [0, b, 0]]); } function is_component(v){ - return Sx_runtime[1].call(null, "component?", [0, v, 0]); + return Sx_runtime[2].call(null, "component?", [0, v, 0]); } function is_island(v){ - return Sx_runtime[1].call(null, "island?", [0, v, 0]); + return Sx_runtime[2].call(null, "island?", [0, v, 0]); } - function is_macro(v){return Sx_runtime[1].call(null, "macro?", [0, v, 0]);} + function is_macro(v){return Sx_runtime[2].call(null, "macro?", [0, v, 0]);} function is_lambda(v){ - return Sx_runtime[1].call(null, "lambda?", [0, v, 0]); + return Sx_runtime[2].call(null, "lambda?", [0, v, 0]); } - function is_nil(v){return Sx_runtime[1].call(null, "nil?", [0, v, 0]);} + function is_nil(v){return Sx_runtime[2].call(null, "nil?", [0, v, 0]);} var b = [3, cst$6], render_html_lake_ref = [0, function(a, param){return b;}], @@ -64363,11 +71932,11 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function render_html_island(comp, args, env){ return caml_call3(render_html_island_ref[1], comp, args, env); } - var cek_call = Sx_ref[221]; + var cek_call = Sx_ref[222]; function trampoline(v){ if(typeof v !== "number" && 12 === v[0]){ var env = v[2], expr = v[1]; - return Sx_ref[241].call(null, expr, [20, env]); + return Sx_ref[242].call(null, expr, [20, env]); } return v; } @@ -64386,7 +71955,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var args = 0; } var - local = Sx_runtime[80].call(null, [20, mac[4]]), + local = Sx_runtime[81].call(null, [20, mac[4]]), ps$0 = Stdlib_List[20].call(null, function(p){return [3, p];}, mac[1]); a: { @@ -64396,37 +71965,37 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var match = mac[2]; if(! match) break a; var rp = match[1]; - Sx_runtime[77].call(null, local, [3, rp], [6, as]); + Sx_runtime[78].call(null, local, [3, rp], [6, as]); break a; } var ps_rest = ps[2], p = ps[1]; if(! as) break; var as_rest = as[2], a = as[1]; - Sx_runtime[77].call(null, local, p, a); + Sx_runtime[78].call(null, local, p, a); ps = ps_rest; as = as_rest; } var b = Stdlib_List[10].call(null, ps); Stdlib_List[18].call (null, - function(p){Sx_runtime[77].call(null, local, p, 0); return 0;}, + function(p){Sx_runtime[78].call(null, local, p, 0); return 0;}, b); } - return Sx_ref[241].call(null, mac[3], local); + return Sx_ref[242].call(null, mac[3], local); } return 0; } function try_catch(try_fn, catch_fn){ - try{var b = Sx_runtime[6].call(null, try_fn, 0); return b;} + try{var b = Sx_runtime[7].call(null, try_fn, 0); return b;} catch(e$0){ var e = caml_wrap_exception(e$0); if(e[1] === Sx_vm[1]) throw caml_maybe_attach_backtrace(e, 0); if(e[1] === Sx_types[9]){ var msg = e[2]; - return Sx_runtime[6].call(null, catch_fn, [0, [3, msg], 0]); + return Sx_runtime[7].call(null, catch_fn, [0, [3, msg], 0]); } var a = [0, [3, Stdlib_Printexc[1].call(null, e)], 0]; - return Sx_runtime[6].call(null, catch_fn, a); + return Sx_runtime[7].call(null, catch_fn, a); } } function set_render_active_b(v){return 0;} @@ -64487,7 +72056,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= (null, function(k, v){ if(is_boolean_attr(k)){ - var a = Sx_types[67].call(null, v); + var a = Sx_types[71].call(null, v); return a ? (Stdlib_Buffer [12].call @@ -64513,7 +72082,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= f = [3, cst$6], render_to_html_ref = [0, function(expr, env){return f;}]; function scope_emitted(name){ - return Sx_runtime[1].call(null, "scope-emitted", [0, name, 0]); + return Sx_runtime[2].call(null, "scope-emitted", [0, name, 0]); } var cst = "=", @@ -64527,23 +72096,23 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= l = [0, [3, cst_deftype], 0], m = [0, [3, cst_defeffect], 0]; function definition_form_p(name){ - var or = Sx_runtime[1].call(null, cst, [0, name, g]); - if(Sx_types[67].call(null, or)) return or; - var or$0 = Sx_runtime[1].call(null, cst, [0, name, h]); - if(Sx_types[67].call(null, or$0)) return or$0; - var or$1 = Sx_runtime[1].call(null, cst, [0, name, i]); - if(Sx_types[67].call(null, or$1)) return or$1; - var or$2 = Sx_runtime[1].call(null, cst, [0, name, j]); - if(Sx_types[67].call(null, or$2)) return or$2; - var or$3 = Sx_runtime[1].call(null, cst, [0, name, k]); - if(Sx_types[67].call(null, or$3)) return or$3; - var or$4 = Sx_runtime[1].call(null, cst, [0, name, l]); - if(Sx_types[67].call(null, or$4)) return or$4; - var or$5 = Sx_runtime[1].call(null, cst, [0, name, m]); - return Sx_types[67].call(null, or$5) + var or = Sx_runtime[2].call(null, cst, [0, name, g]); + if(Sx_types[71].call(null, or)) return or; + var or$0 = Sx_runtime[2].call(null, cst, [0, name, h]); + if(Sx_types[71].call(null, or$0)) return or$0; + var or$1 = Sx_runtime[2].call(null, cst, [0, name, i]); + if(Sx_types[71].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[2].call(null, cst, [0, name, j]); + if(Sx_types[71].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[2].call(null, cst, [0, name, k]); + if(Sx_types[71].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[2].call(null, cst, [0, name, l]); + if(Sx_types[71].call(null, or$4)) return or$4; + var or$5 = Sx_runtime[2].call(null, cst, [0, name, m]); + return Sx_types[71].call(null, or$5) ? or$5 : Sx_runtime - [1].call + [2].call (null, cst_contains, [0, definition_form_extensions, [0, name, 0]]); @@ -64576,61 +72145,61 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function parse_element_args(args, env){ var attrs = [7, Stdlib_Hashtbl[1].call(null, 0, 0)], - a = Sx_runtime[5].call(null, args), + a = Sx_runtime[6].call(null, args), d = Stdlib_Hashtbl[1].call(null, 0, 2), - b = Sx_runtime[2].call(null, p); + b = Sx_runtime[3].call(null, p); Stdlib_Hashtbl[11].call(null, d, b, o); - var c = Sx_runtime[2].call(null, r); + var c = Sx_runtime[3].call(null, r); Stdlib_Hashtbl[11].call(null, d, c, q); var children = [0, n]; Stdlib_List[26].call (null, function(state, arg){ - var skip = Sx_runtime[25].call(null, state, s); - if(Sx_types[67].call(null, skip)){ + var skip = Sx_runtime[26].call(null, state, s); + if(Sx_types[71].call(null, skip)){ var - b = [0, Sx_runtime[25].call(null, state, t), 0], + b = [0, Sx_runtime[26].call(null, state, t), 0], c = [0, state, [0, w, - [0, v, [0, u, [0, Sx_runtime[1].call(null, cst_inc, b), 0]]]]]; - return Sx_runtime[1].call(null, cst_assoc, c); + [0, v, [0, u, [0, Sx_runtime[2].call(null, cst_inc, b), 0]]]]]; + return Sx_runtime[2].call(null, cst_assoc, c); } var - d = [0, Sx_runtime[73].call(null, arg), x], - and = Sx_runtime[1].call(null, cst, d); - if(Sx_types[67].call(null, and)) + d = [0, Sx_runtime[74].call(null, arg), x], + and = Sx_runtime[2].call(null, cst, d); + if(Sx_types[71].call(null, and)) var - e = [0, Sx_runtime[24].call(null, args), 0], - f = [0, Sx_runtime[25].call(null, state, y), 0], - g = [0, Sx_runtime[1].call(null, cst_inc, f), e], - a = Sx_runtime[1].call(null, cst$0, g); + e = [0, Sx_runtime[25].call(null, args), 0], + f = [0, Sx_runtime[26].call(null, state, y), 0], + g = [0, Sx_runtime[2].call(null, cst_inc, f), e], + a = Sx_runtime[2].call(null, cst$0, g); else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - h = [0, Sx_runtime[25].call(null, state, z), 0], - i = Sx_runtime[1].call(null, cst_inc, h), - val = trampoline(eval_expr(Sx_runtime[17].call(null, args, i), env)), - j = Sx_types[69].call(null, arg); - Sx_runtime[11].call(null, attrs, j, val); + h = [0, Sx_runtime[26].call(null, state, z), 0], + i = Sx_runtime[2].call(null, cst_inc, h), + val = trampoline(eval_expr(Sx_runtime[18].call(null, args, i), env)), + j = Sx_types[73].call(null, arg); + Sx_runtime[12].call(null, attrs, j, val); var - k = [0, Sx_runtime[25].call(null, state, A), 0], + k = [0, Sx_runtime[26].call(null, state, A), 0], l = [0, state, [0, D, - [0, C, [0, B, [0, Sx_runtime[1].call(null, cst_inc, k), 0]]]]]; - return Sx_runtime[1].call(null, cst_assoc, l); + [0, C, [0, B, [0, Sx_runtime[2].call(null, cst_inc, k), 0]]]]]; + return Sx_runtime[2].call(null, cst_assoc, l); } - children[1] = Sx_runtime[10].call(null, children[1], arg); + children[1] = Sx_runtime[11].call(null, children[1], arg); var - m = [0, Sx_runtime[25].call(null, state, E), 0], - n = [0, state, [0, F, [0, Sx_runtime[1].call(null, cst_inc, m), 0]]]; - return Sx_runtime[1].call(null, cst_assoc, n); + m = [0, Sx_runtime[26].call(null, state, E), 0], + n = [0, state, [0, F, [0, Sx_runtime[2].call(null, cst_inc, m), 0]]]; + return Sx_runtime[2].call(null, cst_assoc, n); }, [7, d], a); @@ -64638,7 +72207,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= } function eval_cond(clauses, env){ var a = cond_scheme_p(clauses); - return Sx_types[67].call(null, a) + return Sx_types[71].call(null, a) ? eval_cond_scheme(clauses, env) : eval_cond_clojure(clauses, env); } @@ -64646,17 +72215,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function eval_cond_scheme(clauses$1, env){ var clauses = clauses$1; for(;;){ - var a = Sx_runtime[33].call(null, clauses); - if(Sx_types[67].call(null, a)) return 0; + var a = Sx_runtime[34].call(null, clauses); + if(Sx_types[71].call(null, a)) return 0; var - clause = Sx_runtime[14].call(null, clauses), - test = Sx_runtime[14].call(null, clause), - body = Sx_runtime[17].call(null, clause, G), - b = Sx_runtime[113].call(null, test); - if(Sx_types[67].call(null, b)) return body; + clause = Sx_runtime[15].call(null, clauses), + test = Sx_runtime[15].call(null, clause), + body = Sx_runtime[18].call(null, clause, G), + b = Sx_runtime[115].call(null, test); + if(Sx_types[71].call(null, b)) return body; var c = trampoline(eval_expr(test, env)); - if(Sx_types[67].call(null, c)) return body; - var clauses$0 = Sx_runtime[15].call(null, clauses); + if(Sx_types[71].call(null, c)) return body; + var clauses$0 = Sx_runtime[16].call(null, clauses); clauses = clauses$0; } } @@ -64669,17 +72238,17 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= var clauses = clauses$1; for(;;){ var - a = [0, Sx_runtime[24].call(null, clauses), H], - b = Sx_runtime[1].call(null, cst$0, a); - if(Sx_types[67].call(null, b)) return 0; + a = [0, Sx_runtime[25].call(null, clauses), H], + b = Sx_runtime[2].call(null, cst$0, a); + if(Sx_types[71].call(null, b)) return 0; var - test = Sx_runtime[14].call(null, clauses), - body = Sx_runtime[17].call(null, clauses, I), - c = Sx_runtime[113].call(null, test); - if(Sx_types[67].call(null, c)) return body; + test = Sx_runtime[15].call(null, clauses), + body = Sx_runtime[18].call(null, clauses, I), + c = Sx_runtime[115].call(null, test); + if(Sx_types[71].call(null, c)) return body; var d = trampoline(eval_expr(test, env)); - if(Sx_types[67].call(null, d)) return body; - var clauses$0 = Sx_runtime[1].call(null, cst_slice, [0, clauses, J]); + if(Sx_types[71].call(null, d)) return body; + var clauses$0 = Sx_runtime[2].call(null, cst_slice, [0, clauses, J]); clauses = clauses$0; } } @@ -64693,37 +72262,37 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= N = [2, 1.]; function process_bindings(bindings, env){ var - local = Sx_runtime[80].call(null, env), - a = Sx_runtime[5].call(null, bindings); + local = Sx_runtime[81].call(null, env), + a = Sx_runtime[6].call(null, bindings); Stdlib_List[18].call (null, function(pair){ var - b = [0, Sx_runtime[73].call(null, pair), K], - and = Sx_runtime[1].call(null, cst, b); - if(Sx_types[67].call(null, and)) + b = [0, Sx_runtime[74].call(null, pair), K], + and = Sx_runtime[2].call(null, cst, b); + if(Sx_types[71].call(null, and)) var - c = [0, Sx_runtime[24].call(null, pair), L], - a = Sx_runtime[1].call(null, cst$1, c); + c = [0, Sx_runtime[25].call(null, pair), L], + a = Sx_runtime[2].call(null, cst$1, c); else var a = and; - if(Sx_types[67].call(null, a)){ + if(Sx_types[71].call(null, a)){ var - d = Sx_runtime[14].call(null, pair), - e = [0, Sx_runtime[73].call(null, d), M], - f = Sx_runtime[1].call(null, cst, e); - if(Sx_types[67].call(null, f)) + d = Sx_runtime[15].call(null, pair), + e = [0, Sx_runtime[74].call(null, d), M], + f = Sx_runtime[2].call(null, cst, e); + if(Sx_types[71].call(null, f)) var - g = Sx_runtime[14].call(null, pair), - name = Sx_types[68].call(null, g); + g = Sx_runtime[15].call(null, pair), + name = Sx_types[72].call(null, g); else var - j = [0, Sx_runtime[14].call(null, pair), 0], - name = [3, Sx_runtime[4].call(null, j)]; + j = [0, Sx_runtime[15].call(null, pair), 0], + name = [3, Sx_runtime[5].call(null, j)]; var - h = trampoline(eval_expr(Sx_runtime[17].call(null, pair, N), local)), - i = Sx_runtime[3].call(null, name); - Sx_runtime[77].call(null, local, i, h); + h = trampoline(eval_expr(Sx_runtime[18].call(null, pair, N), local)), + i = Sx_runtime[4].call(null, name); + Sx_runtime[78].call(null, local, i, h); } return 0; }, @@ -64752,43 +72321,43 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= _ = [2, 1.]; function is_render_expr_p(expr){ var - a = [0, Sx_runtime[73].call(null, expr), O], - b = Sx_runtime[1].call(null, cst, a), - or = [0, 1 - Sx_types[67].call(null, b)], - or$0 = Sx_types[67].call(null, or) ? or : Sx_runtime[33].call(null, expr); - if(Sx_types[67].call(null, or$0)) return P; + a = [0, Sx_runtime[74].call(null, expr), O], + b = Sx_runtime[2].call(null, cst, a), + or = [0, 1 - Sx_types[71].call(null, b)], + or$0 = Sx_types[71].call(null, or) ? or : Sx_runtime[34].call(null, expr); + if(Sx_types[71].call(null, or$0)) return P; var - h = Sx_runtime[14].call(null, expr), - c = [0, Sx_runtime[73].call(null, h), Q], - d = Sx_runtime[1].call(null, cst, c), - e = [0, 1 - Sx_types[67].call(null, d)]; - if(Sx_types[67].call(null, e)) return R; + h = Sx_runtime[15].call(null, expr), + c = [0, Sx_runtime[74].call(null, h), Q], + d = Sx_runtime[2].call(null, cst, c), + e = [0, 1 - Sx_types[71].call(null, d)]; + if(Sx_types[71].call(null, e)) return R; var - n = Sx_types[68].call(null, h), - or$1 = Sx_runtime[1].call(null, cst, [0, n, S]); - if(Sx_types[67].call(null, or$1)) return or$1; - var or$2 = Sx_runtime[1].call(null, cst, [0, n, T]); - if(Sx_types[67].call(null, or$2)) return or$2; - var or$3 = Sx_runtime[1].call(null, cst_starts_with, [0, n, U]); - if(Sx_types[67].call(null, or$3)) return or$3; - var or$4 = Sx_runtime[1].call(null, cst_starts_with, [0, n, V]); - if(Sx_types[67].call(null, or$4)) return or$4; + n = Sx_types[72].call(null, h), + or$1 = Sx_runtime[2].call(null, cst, [0, n, S]); + if(Sx_types[71].call(null, or$1)) return or$1; + var or$2 = Sx_runtime[2].call(null, cst, [0, n, T]); + if(Sx_types[71].call(null, or$2)) return or$2; + var or$3 = Sx_runtime[2].call(null, cst_starts_with, [0, n, U]); + if(Sx_types[71].call(null, or$3)) return or$3; + var or$4 = Sx_runtime[2].call(null, cst_starts_with, [0, n, V]); + if(Sx_types[71].call(null, or$4)) return or$4; var or$5 = - Sx_runtime[1].call(null, cst_contains, [0, html_tags_val, [0, n, 0]]); - if(Sx_types[67].call(null, or$5)) return or$5; + Sx_runtime[2].call(null, cst_contains, [0, html_tags_val, [0, n, 0]]); + if(Sx_types[71].call(null, or$5)) return or$5; var - f = [0, Sx_runtime[1].call(null, "index-of", [0, n, X]), W], - and = Sx_runtime[1].call(null, cst$5, f); - if(! Sx_types[67].call(null, and)) return and; + f = [0, Sx_runtime[2].call(null, "index-of", [0, n, X]), W], + and = Sx_runtime[2].call(null, cst$5, f); + if(! Sx_types[71].call(null, and)) return and; var - g = [0, Sx_runtime[24].call(null, expr), Y], - and$0 = Sx_runtime[1].call(null, cst$5, g); - if(! Sx_types[67].call(null, and$0)) return and$0; + g = [0, Sx_runtime[25].call(null, expr), Y], + and$0 = Sx_runtime[2].call(null, cst$5, g); + if(! Sx_types[71].call(null, and$0)) return and$0; var - i = Sx_runtime[17].call(null, expr, _), - j = [0, Sx_runtime[73].call(null, i), Z]; - return Sx_runtime[1].call(null, cst, j); + i = Sx_runtime[18].call(null, expr, _), + j = [0, Sx_runtime[74].call(null, i), Z]; + return Sx_runtime[2].call(null, cst, j); } var cst_class = "class", @@ -64804,50 +72373,50 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ai = [3, cst_style]; function merge_spread_attrs(target, spread_dict){ var - a = Sx_runtime[1].call(null, "keys", [0, spread_dict, 0]), - b = Sx_runtime[5].call(null, a); + a = Sx_runtime[2].call(null, "keys", [0, spread_dict, 0]), + b = Sx_runtime[6].call(null, a); Stdlib_List[18].call (null, function(key){ var val = dict_get(spread_dict, key), - c = Sx_runtime[1].call(null, cst, [0, key, $]); - if(Sx_types[67].call(null, c)){ + c = Sx_runtime[2].call(null, cst, [0, key, $]); + if(Sx_types[71].call(null, c)){ var existing = dict_get(target, aa); - if(Sx_types[67].call(null, existing)) + if(Sx_types[71].call(null, existing)) var - d = Sx_runtime[1].call(null, cst, [0, existing, ab]), - a = [0, 1 - Sx_types[67].call(null, d)]; + d = Sx_runtime[2].call(null, cst, [0, existing, ab]), + a = [0, 1 - Sx_types[71].call(null, d)]; else var a = existing; var e = - Sx_types[67].call(null, a) + Sx_types[71].call(null, a) ? [3, - Sx_runtime[4].call(null, [0, existing, [0, ac, [0, val, 0]]])] + Sx_runtime[5].call(null, [0, existing, [0, ac, [0, val, 0]]])] : val; - Sx_runtime[11].call(null, target, ad, e); + Sx_runtime[12].call(null, target, ad, e); } else{ - var f = Sx_runtime[1].call(null, cst, [0, key, ae]); - if(Sx_types[67].call(null, f)){ + var f = Sx_runtime[2].call(null, cst, [0, key, ae]); + if(Sx_types[71].call(null, f)){ var existing$0 = dict_get(target, af); - if(Sx_types[67].call(null, existing$0)) + if(Sx_types[71].call(null, existing$0)) var - g = Sx_runtime[1].call(null, cst, [0, existing$0, ag]), - b = [0, 1 - Sx_types[67].call(null, g)]; + g = Sx_runtime[2].call(null, cst, [0, existing$0, ag]), + b = [0, 1 - Sx_types[71].call(null, g)]; else var b = existing$0; var h = - Sx_types[67].call(null, b) + Sx_types[71].call(null, b) ? [3, - Sx_runtime[4].call(null, [0, existing$0, [0, ah, [0, val, 0]]])] + Sx_runtime[5].call(null, [0, existing$0, [0, ah, [0, val, 0]]])] : val; - Sx_runtime[11].call(null, target, ai, h); + Sx_runtime[12].call(null, target, ai, h); } else - Sx_runtime[11].call(null, target, key, val); + Sx_runtime[12].call(null, target, key, val); } return 0; }, @@ -64884,16 +72453,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= function render_to_html$0(counter, expr$1, env$1){ var expr = expr$1, env = env$1; for(;;){ - var match_val = Sx_runtime[73].call(null, expr); + var match_val = Sx_runtime[74].call(null, expr); if(caml_equal(match_val, aj)) return ak; if(caml_equal(match_val, al)) return escape_html_val(expr); if(caml_equal(match_val, am)) - return [3, Sx_runtime[4].call(null, [0, expr, 0])]; + return [3, Sx_runtime[5].call(null, [0, expr, 0])]; if(caml_equal(match_val, an)) - return Sx_types[67].call(null, expr) ? ao : ap; + return Sx_types[71].call(null, expr) ? ao : ap; if(caml_equal(match_val, aq)){ - var c = Sx_runtime[33].call(null, expr); - return Sx_types[67].call(null, c) + var c = Sx_runtime[34].call(null, expr); + return Sx_types[71].call(null, c) ? ar : counter < 50 @@ -64908,10 +72477,10 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= : caml_trampoline_return(render_value_to_html$0, [0, a, env]); } if(caml_equal(match_val, at)) - return escape_html_val(Sx_types[69].call(null, expr)); + return escape_html_val(Sx_types[73].call(null, expr)); if(caml_equal(match_val, au)) return raw_html_content(expr); if(caml_equal(match_val, av)){ - scope_emit(aw, Sx_runtime[70].call(null, expr)); + scope_emit(aw, Sx_runtime[71].call(null, expr)); return ax; } if(! caml_equal(match_val, ay)){ @@ -64921,8 +72490,8 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= : caml_trampoline_return(render_value_to_html$0, [0, b, env]); } var - env$0 = Sx_types[89].call(null, expr), - expr$0 = Sx_types[88].call(null, expr); + env$0 = Sx_types[93].call(null, expr), + expr$0 = Sx_types[92].call(null, expr); expr = expr$0; env = env$0; } @@ -64945,25 +72514,25 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= aK = [3, cst$6], aL = [3, cst_thunk]; function render_value_to_html$0(counter, val, env){ - var match_val = Sx_runtime[73].call(null, val); + var match_val = Sx_runtime[74].call(null, val); if(caml_equal(match_val, az)) return aA; if(caml_equal(match_val, aB)) return escape_html_val(val); if(caml_equal(match_val, aC)) - return [3, Sx_runtime[4].call(null, [0, val, 0])]; + return [3, Sx_runtime[5].call(null, [0, val, 0])]; if(caml_equal(match_val, aD)) - return Sx_types[67].call(null, val) ? aE : aF; + return Sx_types[71].call(null, val) ? aE : aF; if(caml_equal(match_val, aG)) return counter < 50 ? render_list_to_html$0(counter + 1 | 0, val, env) : caml_trampoline_return(render_list_to_html$0, [0, val, env]); if(caml_equal(match_val, aH)) return raw_html_content(val); if(caml_equal(match_val, aI)){ - scope_emit(aJ, Sx_runtime[70].call(null, val)); + scope_emit(aJ, Sx_runtime[71].call(null, val)); return aK; } if(! caml_equal(match_val, aL)) - return escape_html_val([3, Sx_runtime[4].call(null, [0, val, 0])]); - var a = Sx_types[89].call(null, val), b = Sx_types[88].call(null, val); + return escape_html_val([3, Sx_runtime[5].call(null, [0, val, 0])]); + var a = Sx_types[93].call(null, val), b = Sx_types[92].call(null, val); return counter < 50 ? render_to_html$0(counter + 1 | 0, b, a) : caml_trampoline_return(render_to_html$0, [0, b, a]); @@ -64972,7 +72541,7 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= return caml_trampoline(render_value_to_html$0(0, val, env)); } function render_html_form_p(name){ - return Sx_runtime[1].call + return Sx_runtime[2].call (null, cst_contains, [0, render_html_forms, [0, name, 0]]); } var @@ -65010,16 +72579,16 @@ d5=133,bj=102,bi="Re__Hash_set",cC="Stdlib__Type",cD=114,fJ="Stdlib__Buffer",d0= ba = [3, "" "render-html-form?" "dispatch-html-form" "render-value-to-html" "trampoline" "eval-expr") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "dispatch-html-form" {:upvalue-count nil :arity nil :constants ("=" "if" "trampoline" "eval-expr" "nth" nil "render-to-html" nil ">" "len" nil "" "when" "not" "join" "map" {:upvalue-count nil :arity nil :constants ("render-to-html" "nth") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "range" "cond" "eval-cond" "rest" "case" "letrec" "slice" "env-extend" "for-each" {:upvalue-count nil :arity nil :constants ("=" "type-of" "first" "symbol" "symbol-name" "str" "env-bind!") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("=" "type-of" "first" "symbol" "symbol-name" "str" "env-set!" "trampoline" "eval-expr" "nth" nil) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("trampoline" "eval-expr") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil)} "init" "last" "let" "let*" "process-bindings" "begin" "do" "definition-form?" {:upvalue-count nil :arity nil :constants ("lambda?" "render-lambda-html" "list" "render-to-html" "apply") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "map-indexed" {:upvalue-count nil :arity nil :constants ("lambda?" "render-lambda-html" "list" "render-to-html" "apply") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "filter" "scope" ">=" "type-of" "first" "keyword" "keyword-name" "value" "scope-push!" {:upvalue-count nil :arity nil :constants ("render-to-html") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "scope-pop!" "provide" "-" "+" "render-value-to-html") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "render-lambda-html" {:upvalue-count nil :arity nil :constants ("env-merge" "lambda-closure" "for-each-indexed" {:upvalue-count nil :arity nil :constants ("env-bind!" "nth") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "lambda-params" "render-to-html" "lambda-body") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "render-html-component" {:upvalue-count nil :arity nil :constants ("dict" "list" "reduce" {:upvalue-count nil :arity nil :constants ("get" "skip" "assoc" "i" "inc" "=" "type-of" "keyword" "<" "len" "trampoline" "eval-expr" "nth" "dict-set!" "keyword-name" "append!") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "i" nil "skip" "env-merge" "component-closure" "for-each" {:upvalue-count nil :arity nil :constants ("env-bind!" "dict-has?" "dict-get") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "component-params" "component-has-children?" "env-bind!" "children" "make-raw-html" "join" "" "map" {:upvalue-count nil :arity nil :constants ("render-to-html") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "render-to-html" "component-body") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "render-html-element" {:upvalue-count nil :arity nil :constants ("parse-element-args" "first" "nth" nil "contains?" "VOID_ELEMENTS" "str" "<" "render-attrs" " />" "scope-push!" "element-attrs" "join" "" "map" {:upvalue-count nil :arity nil :constants ("render-to-html") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "for-each" {:upvalue-count nil :arity nil :constants ("merge-spread-attrs") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "scope-emitted" "scope-pop!" ">" "" "" "" "") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "serialize-island-state" {:upvalue-count nil :arity nil :constants ("empty-dict?" "sx-serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:library (web adapter-html) :op "import"}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil))) + :constants ("render-to-html" {:upvalue-count 0 :arity 2 :constants ("set-render-active!" "type-of" "nil" "=" "" "string" "escape-html" "number" "str" "boolean" "true" "false" "list" "empty?" "render-list-to-html" "symbol" "render-value-to-html" "eval-expr" "trampoline" "keyword" "keyword-name" "raw-html" "raw-html-content" "spread" "element-attrs" "spread-attrs" "scope-emit!" "thunk" "render-to-html" "thunk-expr" "thunk-env") :bytecode (3 52 0 0 1 5 16 0 52 1 0 1 6 1 2 0 52 3 0 2 33 7 0 5 1 4 0 32 20 1 6 1 5 0 52 3 0 2 33 11 0 5 20 6 0 16 0 49 1 32 254 0 6 1 7 0 52 3 0 2 33 10 0 5 16 0 52 8 0 1 32 233 0 6 1 9 0 52 3 0 2 33 18 0 5 16 0 33 6 0 1 10 0 32 3 0 1 11 0 32 204 0 6 1 12 0 52 3 0 2 33 28 0 5 16 0 52 13 0 1 33 6 0 1 4 0 32 9 0 20 14 0 16 0 16 1 49 2 32 165 0 6 1 15 0 52 3 0 2 33 23 0 5 20 16 0 16 0 16 1 52 17 0 2 52 18 0 1 16 1 49 2 32 131 0 6 1 19 0 52 3 0 2 33 15 0 5 20 6 0 16 0 52 20 0 1 49 1 32 105 0 6 1 21 0 52 3 0 2 33 10 0 5 16 0 52 22 0 1 32 84 0 6 1 23 0 52 3 0 2 33 21 0 5 1 24 0 16 0 52 25 0 1 52 26 0 2 5 1 4 0 32 52 0 6 1 27 0 52 3 0 2 33 21 0 5 20 28 0 16 0 52 29 0 1 16 0 52 30 0 1 49 2 32 20 0 5 20 16 0 16 0 16 1 52 17 0 2 52 18 0 1 16 1 49 2 50)} "render-value-to-html" {:upvalue-count 0 :arity 2 :constants ("type-of" "nil" "=" "" "string" "escape-html" "number" "str" "boolean" "true" "false" "list" "render-list-to-html" "raw-html" "raw-html-content" "spread" "element-attrs" "spread-attrs" "scope-emit!" "thunk" "render-to-html" "thunk-expr" "thunk-env") :bytecode (16 0 52 0 0 1 6 1 1 0 52 2 0 2 33 7 0 5 1 3 0 32 193 0 6 1 4 0 52 2 0 2 33 11 0 5 20 5 0 16 0 49 1 32 171 0 6 1 6 0 52 2 0 2 33 10 0 5 16 0 52 7 0 1 32 150 0 6 1 8 0 52 2 0 2 33 18 0 5 16 0 33 6 0 1 9 0 32 3 0 1 10 0 32 121 0 6 1 11 0 52 2 0 2 33 13 0 5 20 12 0 16 0 16 1 49 2 32 97 0 6 1 13 0 52 2 0 2 33 10 0 5 16 0 52 14 0 1 32 76 0 6 1 15 0 52 2 0 2 33 21 0 5 1 16 0 16 0 52 17 0 1 52 18 0 2 5 1 3 0 32 44 0 6 1 19 0 52 2 0 2 33 21 0 5 20 20 0 16 0 52 21 0 1 16 0 52 22 0 1 49 2 32 12 0 5 20 5 0 16 0 52 7 0 1 49 1 50)} "RENDER_HTML_FORMS" "if" "when" "cond" "case" "let" "let*" "letrec" "begin" "do" "define" "defcomp" "defisland" "defmacro" "defstyle" "deftype" "defeffect" "map" "map-indexed" "filter" "for-each" "scope" "provide" "list" "render-html-form?" {:upvalue-count 0 :arity 1 :constants ("RENDER_HTML_FORMS" "contains?") :bytecode (20 0 0 16 0 52 1 0 2 50)} "render-list-to-html" {:upvalue-count 0 :arity 2 :constants ("empty?" "" "type-of" "symbol" {:upvalue-count 1 :arity 1 :constants ("render-value-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "join" "symbol-name" "<>" {:upvalue-count 1 :arity 1 :constants ("render-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "raw!" {:upvalue-count 1 :arity 1 :constants ("eval-expr" "trampoline" "str") :bytecode (16 0 18 0 52 0 0 2 52 1 0 1 52 2 0 1 50)} "lake" "render-html-lake" "marsh" "render-html-marsh" "error-boundary" 1 "
      " {:upvalue-count 2 :arity 0 :constants ("" {:upvalue-count 1 :arity 1 :constants ("render-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "join") :bytecode (1 0 0 51 1 0 0 0 18 1 52 2 0 2 52 3 0 2 50)} {:upvalue-count 2 :arity 1 :constants ("str" "<" "<" "replace" ">" ">" "nil?" {:upvalue-count 3 :arity 0 :constants ("render-to-html" "eval-expr" "trampoline" "list") :bytecode (20 0 0 18 0 18 1 52 1 0 2 52 2 0 1 18 2 2 52 3 0 3 18 1 49 2 50)} {:upvalue-count 1 :arity 1 :constants ("
      Render error: " "
      " "str") :bytecode (1 0 0 18 0 1 1 0 52 2 0 3 50)} "try-catch" "
      Render error: " "
      ") :bytecode (16 0 52 0 0 1 1 1 0 1 2 0 52 3 0 3 1 4 0 1 5 0 52 3 0 3 17 1 18 0 6 33 8 0 5 18 0 52 6 0 1 167 33 21 0 51 7 0 0 0 0 1 1 0 51 8 0 1 1 52 9 0 2 32 12 0 1 10 0 16 1 1 11 0 52 0 0 3 50)} "try-catch" "
      " "str" "portal" "promise-delayed" "HTML_TAGS" "contains?" "render-html-element" "~" "starts-with?" "env-has?" "env-get" "island?" "render-html-island" "component?" "render-html-component" "macro?" "render-to-html" "expand-macro" "" "render-html-form?" "dispatch-html-form" "render-value-to-html" "eval-expr" "trampoline") :bytecode (16 0 52 0 0 1 33 6 0 1 1 0 32 36 2 16 0 169 17 2 16 2 52 2 0 1 1 3 0 164 167 33 21 0 1 1 0 51 4 0 1 1 16 0 52 5 0 2 52 6 0 2 32 252 1 16 2 52 7 0 1 17 3 16 0 170 17 4 16 3 1 8 0 164 33 21 0 1 1 0 51 9 0 1 1 16 4 52 5 0 2 52 6 0 2 32 209 1 16 3 1 10 0 164 33 21 0 1 1 0 51 11 0 1 1 16 4 52 5 0 2 52 6 0 2 32 179 1 16 3 1 12 0 164 33 12 0 20 13 0 16 4 16 1 49 2 32 158 1 16 3 1 14 0 164 33 12 0 20 15 0 16 4 16 1 49 2 32 137 1 16 3 1 16 0 164 33 69 0 16 4 168 1 17 0 166 17 5 16 5 33 6 0 16 4 170 32 2 0 16 4 17 6 16 5 33 6 0 16 4 169 32 1 0 2 17 7 1 18 0 51 19 0 1 1 1 6 51 20 0 1 7 1 1 52 21 0 2 1 22 0 52 23 0 3 32 59 1 16 3 1 24 0 164 6 34 7 0 5 16 3 1 25 0 164 33 21 0 1 1 0 51 9 0 1 1 16 4 52 5 0 2 52 6 0 2 32 18 1 20 26 0 16 3 52 27 0 2 33 14 0 20 28 0 16 3 16 4 16 1 49 3 32 248 0 16 3 1 29 0 52 30 0 2 6 33 26 0 5 16 1 16 3 52 31 0 2 6 33 13 0 5 16 1 16 3 52 32 0 2 52 33 0 1 33 20 0 20 34 0 16 1 16 3 52 32 0 2 16 4 16 1 49 3 32 186 0 16 3 1 29 0 52 30 0 2 33 77 0 16 1 16 3 52 32 0 2 17 5 16 5 52 35 0 1 33 14 0 20 36 0 16 5 16 4 16 1 49 3 32 41 0 16 5 52 37 0 1 33 20 0 20 38 0 16 5 16 4 16 1 52 39 0 3 16 1 49 2 32 12 0 1 40 0 16 3 1 41 0 52 23 0 3 32 97 0 20 42 0 16 3 48 1 33 14 0 20 43 0 16 3 16 0 16 1 49 3 32 73 0 16 1 16 3 52 31 0 2 6 33 13 0 5 16 1 16 3 52 32 0 2 52 37 0 1 33 26 0 20 38 0 16 1 16 3 52 32 0 2 16 4 16 1 52 39 0 3 16 1 49 2 32 19 0 20 44 0 16 0 16 1 52 45 0 2 52 46 0 1 16 1 49 2 50)} "dispatch-html-form" {:upvalue-count 0 :arity 3 :constants ("if" 1 "nth" "eval-expr" "trampoline" "render-to-html" 2 3 "" "when" {:upvalue-count 2 :arity 1 :constants ("render-to-html" "nth") :bytecode (20 0 0 18 0 16 0 52 1 0 2 18 1 49 2 50)} "range" "map" "join" "cond" "eval-cond" "case" "letrec" "slice" "env-extend" {:upvalue-count 1 :arity 1 :constants ("type-of" "symbol" "symbol-name" "str" "env-bind!") :bytecode (16 0 169 52 0 0 1 1 1 0 164 33 10 0 16 0 169 52 2 0 1 32 7 0 16 0 169 52 3 0 1 17 1 18 0 16 1 2 52 4 0 3 50)} "for-each" {:upvalue-count 1 :arity 1 :constants ("type-of" "symbol" "symbol-name" "str" 1 "nth" "eval-expr" "trampoline" "env-set!") :bytecode (16 0 169 52 0 0 1 1 1 0 164 33 10 0 16 0 169 52 2 0 1 32 7 0 16 0 169 52 3 0 1 17 1 18 0 16 1 16 0 1 4 0 52 5 0 2 18 0 52 6 0 2 52 7 0 1 52 8 0 3 50)} {:upvalue-count 1 :arity 1 :constants ("eval-expr" "trampoline") :bytecode (16 0 18 0 52 0 0 2 52 1 0 1 50)} "init" "last" "let" "let*" "process-bindings" "begin" "do" "definition-form?" {:upvalue-count 2 :arity 1 :constants ("lambda?" "render-lambda-html" "list" "render-to-html" "apply") :bytecode (18 0 52 0 0 1 33 18 0 20 1 0 18 0 16 0 52 2 0 1 18 1 49 3 32 19 0 20 3 0 18 0 16 0 52 2 0 1 52 4 0 2 18 1 49 2 50)} "map-indexed" {:upvalue-count 2 :arity 2 :constants ("lambda?" "render-lambda-html" "list" "render-to-html" "apply") :bytecode (18 0 52 0 0 1 33 20 0 20 1 0 18 0 16 0 16 1 52 2 0 2 18 1 49 3 32 21 0 20 3 0 18 0 16 0 16 1 52 2 0 2 52 4 0 2 18 1 49 2 50)} "filter" "scope" ">=" "type-of" "keyword" "keyword-name" "value" "scope-push!" {:upvalue-count 1 :arity 1 :constants ("render-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "scope-pop!" "provide" "render-value-to-html") :bytecode (16 0 1 0 0 164 33 80 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 3 33 19 0 20 5 0 16 1 1 6 0 52 2 0 2 16 2 49 2 32 32 0 16 1 168 1 7 0 166 33 19 0 20 5 0 16 1 1 7 0 52 2 0 2 16 2 49 2 32 3 0 1 8 0 32 78 4 16 0 1 9 0 164 33 89 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 167 33 6 0 1 8 0 32 57 0 16 1 168 1 7 0 164 33 19 0 20 5 0 16 1 1 6 0 52 2 0 2 16 2 49 2 32 28 0 1 8 0 51 10 0 1 1 1 2 1 6 0 16 1 168 52 11 0 2 52 12 0 2 52 13 0 2 32 236 3 16 0 1 14 0 164 33 35 0 20 15 0 16 1 170 16 2 48 2 17 3 16 3 33 12 0 20 5 0 16 3 16 2 49 2 32 3 0 1 8 0 32 192 3 16 0 1 16 0 164 33 22 0 20 5 0 16 1 16 2 52 3 0 2 52 4 0 1 16 2 49 2 32 161 3 16 0 1 17 0 164 33 100 0 16 1 1 1 0 52 2 0 2 17 3 16 1 1 6 0 52 18 0 2 17 4 16 2 52 19 0 1 17 5 51 20 0 1 5 16 3 52 21 0 2 5 51 22 0 1 5 16 3 52 21 0 2 5 16 4 168 1 1 0 166 33 18 0 51 23 0 1 5 16 4 52 24 0 1 52 21 0 2 32 1 0 2 5 20 5 0 16 4 52 25 0 1 16 5 49 2 32 52 3 16 0 1 26 0 164 6 34 7 0 5 16 0 1 27 0 164 33 78 0 20 28 0 16 1 1 1 0 52 2 0 2 16 2 48 2 17 3 16 1 168 1 7 0 164 33 19 0 20 5 0 16 1 1 6 0 52 2 0 2 16 3 49 2 32 28 0 1 8 0 51 10 0 1 1 1 3 1 6 0 16 1 168 52 11 0 2 52 12 0 2 52 13 0 2 32 210 2 16 0 1 29 0 164 6 34 7 0 5 16 0 1 30 0 164 33 60 0 16 1 168 1 6 0 164 33 19 0 20 5 0 16 1 1 1 0 52 2 0 2 16 2 49 2 32 28 0 1 8 0 51 10 0 1 1 1 2 1 1 0 16 1 168 52 11 0 2 52 12 0 2 52 13 0 2 32 130 2 20 31 0 16 0 48 1 33 19 0 16 1 16 2 52 3 0 2 52 4 0 1 5 1 8 0 32 101 2 16 0 1 12 0 164 33 65 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 1 1 6 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 4 1 8 0 51 32 0 1 3 1 2 16 4 52 12 0 2 52 13 0 2 32 27 2 16 0 1 33 0 164 33 65 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 1 1 6 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 4 1 8 0 51 34 0 1 3 1 2 16 4 52 33 0 2 52 13 0 2 32 209 1 16 0 1 35 0 164 33 22 0 20 5 0 16 1 16 2 52 3 0 2 52 4 0 1 16 2 49 2 32 178 1 16 0 1 21 0 164 33 65 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 1 1 6 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 4 1 8 0 51 32 0 1 3 1 2 16 4 52 12 0 2 52 13 0 2 32 104 1 16 0 1 36 0 164 33 188 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 1 1 6 0 52 18 0 2 17 4 2 17 5 2 17 6 16 4 168 1 6 0 52 37 0 2 6 33 28 0 5 16 4 169 52 38 0 1 1 39 0 164 6 33 12 0 5 16 4 169 52 40 0 1 1 41 0 164 33 36 0 16 4 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 5 5 16 4 1 6 0 52 18 0 2 17 6 32 4 0 16 4 17 6 5 16 3 16 5 52 42 0 2 5 16 6 168 1 1 0 164 33 13 0 20 5 0 16 6 169 16 2 48 2 32 18 0 1 8 0 51 43 0 1 2 16 6 52 12 0 2 52 13 0 2 17 7 16 3 52 44 0 1 5 16 7 32 163 0 16 0 1 45 0 164 33 135 0 16 1 1 1 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 3 16 1 1 6 0 52 2 0 2 16 2 52 3 0 2 52 4 0 1 17 4 1 7 0 17 5 16 1 168 1 7 0 161 17 6 16 3 16 4 52 42 0 2 5 16 6 1 1 0 164 33 18 0 20 5 0 16 1 16 5 52 2 0 2 16 2 48 2 32 29 0 1 8 0 51 10 0 1 1 1 2 16 5 16 5 16 6 160 52 11 0 2 52 12 0 2 52 13 0 2 17 7 16 3 52 44 0 1 5 16 7 32 19 0 20 46 0 16 1 16 2 52 3 0 2 52 4 0 1 16 2 49 2 50)} "render-lambda-html" {:upvalue-count 0 :arity 3 :constants ("lambda-closure" "env-merge" {:upvalue-count 2 :arity 2 :constants ("nth" "env-bind!") :bytecode (18 0 16 1 18 1 16 0 52 0 0 2 52 1 0 3 50)} "lambda-params" "for-each-indexed" "render-to-html" "lambda-body") :bytecode (16 0 52 0 0 1 16 2 52 1 0 2 17 3 51 2 0 1 3 1 1 16 0 52 3 0 1 52 4 0 2 5 20 5 0 16 0 52 6 0 1 16 3 49 2 50)} "render-html-component" {:upvalue-count 0 :arity 3 :constants ("dict" "list" {:upvalue-count 4 :arity 2 :constants ("skip" "get" "i" "inc" "assoc" "type-of" "keyword" "nth" "eval-expr" "trampoline" "keyword-name" "dict-set!" "append!") :bytecode (16 0 1 0 0 52 1 0 2 17 2 16 2 33 29 0 16 0 1 0 0 4 1 2 0 16 0 1 2 0 52 1 0 2 52 3 0 1 52 4 0 5 32 141 0 16 1 52 5 0 1 1 6 0 164 6 33 18 0 5 16 0 1 2 0 52 1 0 2 52 3 0 1 18 0 168 165 33 75 0 18 0 16 0 1 2 0 52 1 0 2 52 3 0 1 52 7 0 2 18 1 52 8 0 2 52 9 0 1 17 3 18 2 16 1 52 10 0 1 16 3 52 11 0 3 5 16 0 1 0 0 3 1 2 0 16 0 1 2 0 52 1 0 2 52 3 0 1 52 4 0 5 32 31 0 18 3 16 1 52 12 0 2 5 16 0 1 2 0 16 0 1 2 0 52 1 0 2 52 3 0 1 52 4 0 3 50)} "i" 0 "skip" "reduce" "component-closure" "env-merge" {:upvalue-count 2 :arity 1 :constants ("dict-has?" "dict-get" "env-bind!") :bytecode (18 0 16 0 18 1 16 0 52 0 0 2 33 11 0 18 1 16 0 52 1 0 2 32 1 0 2 52 2 0 3 50)} "component-params" "for-each" "component-has-children?" "children" "" {:upvalue-count 1 :arity 1 :constants ("render-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "join" "make-raw-html" "env-bind!" "render-to-html" "component-body") :bytecode (52 0 0 0 17 3 52 1 0 0 17 4 51 2 0 1 1 1 2 1 3 1 4 1 3 0 1 4 0 1 5 0 4 52 0 0 4 16 1 52 6 0 3 5 16 0 52 7 0 1 16 2 52 8 0 2 17 5 51 9 0 1 5 1 3 16 0 52 10 0 1 52 11 0 2 5 16 0 52 12 0 1 33 34 0 16 5 1 13 0 1 14 0 51 15 0 1 2 16 4 52 16 0 2 52 17 0 2 52 18 0 1 52 19 0 3 32 1 0 2 5 20 20 0 16 0 52 21 0 1 16 5 49 2 50)} "render-html-element" {:upvalue-count 0 :arity 3 :constants ("parse-element-args" 1 "nth" "VOID_ELEMENTS" "contains?" "<" "render-attrs" " />" "str" "element-attrs" "scope-push!" "" {:upvalue-count 1 :arity 1 :constants ("render-to-html") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "join" {:upvalue-count 1 :arity 1 :constants ("merge-spread-attrs") :bytecode (20 0 0 18 0 16 0 49 2 50)} "scope-emitted" "for-each" "scope-pop!" ">" "" "" "" "") :bytecode (52 0 0 0 17 3 52 1 0 0 17 4 51 2 0 1 1 1 2 1 3 1 4 1 3 0 1 4 0 1 5 0 4 52 0 0 4 16 1 52 6 0 3 5 16 0 52 7 0 1 16 2 52 8 0 2 17 5 16 0 52 9 0 1 17 6 51 10 0 1 5 1 3 16 0 52 11 0 1 52 12 0 2 5 16 0 52 13 0 1 33 34 0 16 5 1 14 0 1 15 0 51 16 0 1 2 16 4 52 17 0 2 52 18 0 2 52 19 0 1 52 20 0 3 32 1 0 2 5 20 21 0 16 0 52 22 0 1 16 5 48 2 17 7 20 23 0 16 3 48 1 17 8 1 24 0 20 25 0 16 6 48 1 1 26 0 16 8 33 20 0 1 27 0 20 25 0 16 8 48 1 1 26 0 52 28 0 3 32 3 0 1 15 0 1 29 0 16 7 1 30 0 52 28 0 7 50)} "serialize-island-state" {:upvalue-count 0 :arity 1 :constants ("empty-dict?" "sx-serialize") :bytecode (16 0 52 0 0 1 33 4 0 2 32 6 0 16 0 52 1 0 1 50)} {:library (web adapter-html) :op "import"}) :bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 1 5 0 1 6 0 1 7 0 1 8 0 1 9 0 1 10 0 1 11 0 1 12 0 1 13 0 1 14 0 1 15 0 1 16 0 1 17 0 1 18 0 1 19 0 1 20 0 1 21 0 1 22 0 1 23 0 1 24 0 1 25 0 1 26 0 52 27 0 22 128 4 0 5 51 29 0 128 28 0 5 51 31 0 128 30 0 5 51 33 0 128 32 0 5 51 35 0 128 34 0 5 51 37 0 128 36 0 5 51 39 0 128 38 0 5 51 41 0 128 40 0 5 51 43 0 128 42 0 5 51 45 0 128 44 0 5 51 47 0 128 46 0 5 1 48 0 112 50))) diff --git a/shared/static/wasm/sx/adapter-sx.sxbc b/shared/static/wasm/sx/adapter-sx.sxbc index 7cb6a2fd..2e89d671 100644 --- a/shared/static/wasm/sx/adapter-sx.sxbc +++ b/shared/static/wasm/sx/adapter-sx.sxbc @@ -1,3 +1,3 @@ (sxbc 1 "f9c42d6a634c0a3e" (code - :constants ("render-to-sx" {:upvalue-count nil :arity nil :constants ("aser" "=" "type-of" "sx-expr" "sx-expr-source" "string" "serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser" {:upvalue-count nil :arity nil :constants ("set-render-active!" "type-of" "number" "=" "string" "boolean" "nil" "symbol" "symbol-name" "env-has?" "env-get" "primitive?" "get-primitive" "true" "false" "error" "str" "Undefined symbol: " "keyword" "keyword-name" "list" "empty?" "aser-list" "spread" "scope-emit!" "element-attrs" "spread-attrs" "spread?") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-list" {:upvalue-count nil :arity nil :constants ("first" "rest" "not" "=" "type-of" "symbol" "map" {:upvalue-count nil :arity nil :constants ("aser") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "symbol-name" "<>" "aser-fragment" "raw!" "aser-call" "starts-with?" "~" "env-has?" "env-get" "expand-components?" "macro?" "aser" "expand-macro" "component?" "island?" "component-affinity" "server" "client" "aser-expand-component" "lake" "marsh" "error-boundary" ">" "len" nil "try-catch" {:upvalue-count nil :arity nil :constants ("join" "" "map" {:upvalue-count nil :arity nil :constants ("aser" "=" "type-of" "sx-expr" "sx-expr-source" "nil?" "" "serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("str") :bytecode (nil nil nil nil nil nil nil nil nil nil nil)} "make-sx-expr" "str" "(error-boundary " ")" "(div :data-sx-boundary \"true\" " "(div :class \"sx-render-error\" " ":style \"color:red;font-size:0.875rem;padding:0.5rem;border:1px solid red;border-radius:0.25rem;margin:0.5rem 0;\" " "\"Render error: " "replace" "\"" "'" "\\" "\\\\" "\"))" "contains?" "HTML_TAGS" "special-form?" "ho-form?" "aser-special" "trampoline" "eval-expr" {:upvalue-count nil :arity nil :constants ("trampoline" "eval-expr") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil)} "callable?" "lambda?" "apply" "call-lambda" "component-name" "error" "Not callable: " "inspect") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-reserialize" {:upvalue-count nil :arity nil :constants ("not" "=" "type-of" "list" "serialize" "empty?" "()" "first" "symbol" "symbol-name" "rest" nil "for-each" {:upvalue-count nil :arity nil :constants ("inc" "=" "type-of" "string" "<" "len" "not" "contains?" " " "starts-with?" "class" "id" "sx-" "data-" "style" "href" "src" "type" "name" "value" "placeholder" "action" "method" "target" "role" "for" "on" "append!" "str" ":" "serialize" "nth" "aser-reserialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "str" "(" "join" " " ")") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-fragment" {:upvalue-count nil :arity nil :constants ("list" "for-each" {:upvalue-count nil :arity nil :constants ("aser" "nil?" "=" "type-of" "sx-expr" "append!" "sx-expr-source" "list" "for-each" {:upvalue-count nil :arity nil :constants ("not" "nil?" "=" "type-of" "sx-expr" "append!" "sx-expr-source" "aser-reserialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "empty?" "" "=" "len" nil "make-sx-expr" "first" "str" "(<> " "join" " " ")") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-call" {:upvalue-count nil :arity nil :constants ("list" nil "scope-push!" "element-attrs" "for-each" {:upvalue-count nil :arity nil :constants ("inc" "=" "type-of" "keyword" "<" "len" "aser" "nth" "not" "nil?" "append!" "str" ":" "keyword-name" "sx-expr" "sx-expr-source" "serialize" "list" "for-each" {:upvalue-count nil :arity nil :constants ("not" "nil?" "=" "type-of" "sx-expr" "append!" "sx-expr-source" "serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("for-each" {:upvalue-count nil :arity nil :constants ("dict-get" "append!" "str" ":" "serialize") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "keys") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "scope-peek" "scope-pop!" "concat" "make-sx-expr" "str" "(" "join" " " ")") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-expand-component" {:upvalue-count nil :arity nil :constants ("component-params" "env-merge" "component-closure" nil "list" "for-each" {:upvalue-count nil :arity nil :constants ("env-bind!") :bytecode (nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("inc" "=" "type-of" "keyword" "<" "len" "env-bind!" "keyword-name" "aser" "nth" "append!") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "component-has-children" "map" {:upvalue-count nil :arity nil :constants ("aser") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "env-bind!" "children" "=" "len" nil "first" "aser" "component-body") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "SPECIAL_FORM_NAMES" "list" "if" "when" "cond" "case" "and" "or" "let" "let*" "lambda" "fn" "define" "defcomp" "defmacro" "defstyle" "defhandler" "defpage" "defquery" "defaction" "defrelation" "begin" "do" "quote" "quasiquote" "->" "set!" "letrec" "dynamic-wind" "defisland" "deftype" "defeffect" "scope" "provide" "context" "emit!" "emitted" "HO_FORM_NAMES" "map" "map-indexed" "filter" "reduce" "some" "every?" "for-each" "special-form?" {:upvalue-count nil :arity nil :constants ("contains?" "SPECIAL_FORM_NAMES") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "ho-form?" {:upvalue-count nil :arity nil :constants ("contains?" "HO_FORM_NAMES") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "aser-special" {:upvalue-count nil :arity nil :constants ("rest" "=" "if" "trampoline" "eval-expr" "first" "aser" "nth" nil ">" "len" nil "when" "not" "for-each" {:upvalue-count nil :arity nil :constants ("aser") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil)} "cond" "eval-cond" "case" "eval-case-aser" "let" "let*" "process-bindings" "begin" "do" "and" "some" {:upvalue-count nil :arity nil :constants ("trampoline" "eval-expr" "not") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "or" {:upvalue-count nil :arity nil :constants ("trampoline" "eval-expr") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "map" {:upvalue-count nil :arity nil :constants ("lambda?" "env-extend" "lambda-closure" "env-bind!" "first" "lambda-params" "aser" "lambda-body" "cek-call" "list") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "aser-fragment" "map-indexed" {:upvalue-count nil :arity nil :constants ("lambda?" "env-merge" "lambda-closure" "env-bind!" "first" "lambda-params" "nth" nil "aser" "lambda-body" "cek-call" "list") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "list" {:upvalue-count nil :arity nil :constants ("lambda?" "env-merge" "lambda-closure" "env-bind!" "first" "lambda-params" "append!" "aser" "lambda-body" "cek-call" "list") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "empty?" "defisland" "serialize" "define" "defcomp" "defmacro" "defstyle" "defhandler" "defpage" "defquery" "defaction" "defrelation" "deftype" "defeffect" "scope" ">=" "type-of" "keyword" "keyword-name" "value" "slice" "scope-push!" "scope-pop!" "provide" "context" "scope-peek" "nil?" "emit!" "scope-emit!" "emitted") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "eval-case-aser" {:upvalue-count nil :arity nil :constants ("<" "len" nil "first" "nth" nil "=" "type-of" "keyword" "keyword-name" "else" "symbol" "symbol-name" ":else" "aser" "trampoline" "eval-expr" "eval-case-aser" "slice") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:library (web adapter-sx) :op "import"}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil))) + :constants ("render-to-sx" {:upvalue-count 0 :arity 2 :constants ("aser" "type-of" "sx-expr" "sx-expr-source" "string" "serialize") :bytecode (20 0 0 16 0 16 1 48 2 17 2 16 2 52 1 0 1 1 2 0 164 33 9 0 16 2 52 3 0 1 32 24 0 16 2 52 1 0 1 1 4 0 164 33 5 0 16 2 32 6 0 16 2 52 5 0 1 50)} "aser" {:upvalue-count 0 :arity 2 :constants ("set-render-active!" "type-of" "number" "=" "string" "boolean" "nil" "symbol" "symbol-name" "env-has?" "env-get" "primitive?" "get-primitive" "true" "false" "Undefined symbol: " "str" "error" "keyword" "keyword-name" "list" "empty?" "aser-list" "spread" "element-attrs" "spread-attrs" "scope-emit!" "spread?") :bytecode (3 52 0 0 1 5 16 0 52 1 0 1 6 1 2 0 52 3 0 2 33 6 0 5 16 0 32 3 1 6 1 4 0 52 3 0 2 33 6 0 5 16 0 32 242 0 6 1 5 0 52 3 0 2 33 6 0 5 16 0 32 225 0 6 1 6 0 52 3 0 2 33 5 0 5 2 32 209 0 6 1 7 0 52 3 0 2 33 104 0 5 16 0 52 8 0 1 17 2 16 1 16 2 52 9 0 2 33 11 0 16 1 16 2 52 10 0 2 32 70 0 16 2 52 11 0 1 33 9 0 16 2 52 12 0 1 32 52 0 16 2 1 13 0 164 33 4 0 3 32 39 0 16 2 1 14 0 164 33 4 0 4 32 26 0 16 2 1 6 0 164 33 4 0 2 32 13 0 1 15 0 16 2 52 16 0 2 52 17 0 1 32 94 0 6 1 18 0 52 3 0 2 33 10 0 5 16 0 52 19 0 1 32 73 0 6 1 20 0 52 3 0 2 33 29 0 5 16 0 52 21 0 1 33 7 0 52 20 0 0 32 9 0 20 22 0 16 0 16 1 48 2 32 33 0 6 1 23 0 52 3 0 2 33 19 0 5 1 24 0 16 0 52 25 0 1 52 26 0 2 5 2 32 3 0 5 16 0 17 2 16 2 52 27 0 1 33 18 0 1 24 0 16 2 52 25 0 1 52 26 0 2 5 2 32 2 0 16 2 50)} "aser-list" {:upvalue-count 0 :arity 2 :constants ("type-of" "symbol" {:upvalue-count 1 :arity 1 :constants ("aser") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "symbol-name" "<>" "aser-fragment" "raw!" "aser-call" "~" "starts-with?" "env-has?" "env-get" "expand-components?" "macro?" "aser" "expand-macro" "component?" "island?" "component-affinity" "server" "client" "aser-expand-component" "lake" "marsh" "error-boundary" 1 {:upvalue-count 2 :arity 0 :constants ("" {:upvalue-count 1 :arity 1 :constants ("aser" "type-of" "sx-expr" "sx-expr-source" "nil?" "" "serialize") :bytecode (20 0 0 16 0 18 0 48 2 17 1 16 1 52 1 0 1 1 2 0 164 33 9 0 16 1 52 3 0 1 32 21 0 16 1 52 4 0 1 33 6 0 1 5 0 32 6 0 16 1 52 6 0 1 50)} "map" "join") :bytecode (1 0 0 51 1 0 0 0 18 1 52 2 0 2 52 3 0 2 50)} {:upvalue-count 1 :arity 1 :constants ("str") :bytecode (16 0 52 0 0 1 19 0 5 2 50)} "try-catch" "(error-boundary " ")" "str" "make-sx-expr" "(div :data-sx-boundary \"true\" " "(div :class \"sx-render-error\" " ":style \"color:red;font-size:0.875rem;padding:0.5rem;border:1px solid red;border-radius:0.25rem;margin:0.5rem 0;\" " "\"Render error: " "\"" "'" "replace" "\\" "\\\\" "\"))" "HTML_TAGS" "contains?" "special-form?" "ho-form?" "aser-special" "eval-expr" "trampoline" {:upvalue-count 1 :arity 1 :constants ("eval-expr" "trampoline") :bytecode (16 0 18 0 52 0 0 2 52 1 0 1 50)} "callable?" "lambda?" "apply" "call-lambda" "component-name" "Not callable: " "inspect" "error") :bytecode (16 0 169 17 2 16 0 170 17 3 16 2 52 0 0 1 1 1 0 164 167 33 14 0 51 2 0 1 1 16 0 52 3 0 2 32 214 2 16 2 52 4 0 1 17 4 16 4 1 5 0 164 33 12 0 20 6 0 16 3 16 1 49 2 32 185 2 16 4 1 7 0 164 33 15 0 20 8 0 1 7 0 16 3 16 1 49 3 32 161 2 16 4 1 9 0 52 10 0 2 33 178 0 16 1 16 4 52 11 0 2 33 11 0 16 1 16 4 52 12 0 2 32 1 0 2 17 5 16 1 1 13 0 52 11 0 2 33 8 0 20 13 0 48 0 32 1 0 4 17 6 16 5 6 33 7 0 5 16 5 52 14 0 1 33 20 0 20 15 0 16 5 16 3 16 1 52 16 0 3 16 1 49 2 32 91 0 16 5 6 33 57 0 5 16 5 52 17 0 1 6 33 46 0 5 16 5 52 18 0 1 167 6 33 34 0 5 16 6 6 34 11 0 5 16 5 52 19 0 1 1 20 0 164 6 33 12 0 5 16 5 52 19 0 1 1 21 0 164 167 33 14 0 20 22 0 16 5 16 3 16 1 49 3 32 11 0 20 8 0 16 4 16 3 16 1 49 3 32 227 1 16 4 1 23 0 164 33 14 0 20 8 0 16 4 16 3 16 1 49 3 32 204 1 16 4 1 24 0 164 33 14 0 20 8 0 16 4 16 3 16 1 49 3 32 181 1 16 4 1 25 0 164 33 117 0 16 3 168 1 26 0 166 17 5 16 5 33 6 0 16 3 170 32 2 0 16 3 17 6 2 17 7 51 27 0 1 1 1 6 51 28 0 1 7 52 29 0 2 17 8 16 8 33 19 0 1 30 0 16 8 1 31 0 52 32 0 3 52 33 0 1 32 45 0 1 34 0 1 35 0 1 36 0 1 37 0 16 7 1 38 0 1 39 0 52 40 0 3 1 41 0 1 42 0 52 40 0 3 1 43 0 52 32 0 6 52 33 0 1 32 55 1 20 44 0 16 4 52 45 0 2 33 14 0 20 8 0 16 4 16 3 16 1 49 3 32 29 1 20 46 0 16 4 48 1 6 34 8 0 5 20 47 0 16 4 48 1 33 14 0 20 48 0 16 4 16 0 16 1 49 3 32 249 0 16 1 16 4 52 11 0 2 6 33 13 0 5 16 1 16 4 52 12 0 2 52 14 0 1 33 26 0 20 15 0 16 1 16 4 52 12 0 2 16 3 16 1 52 16 0 3 16 1 49 2 32 195 0 16 2 16 1 52 49 0 2 52 50 0 1 17 5 51 51 0 1 1 16 3 52 3 0 2 17 6 20 52 0 16 5 48 1 6 33 32 0 5 16 5 52 53 0 1 167 6 33 20 0 5 16 5 52 17 0 1 167 6 33 8 0 5 16 5 52 18 0 1 167 33 11 0 16 5 16 6 52 54 0 2 32 111 0 16 5 52 53 0 1 33 17 0 16 5 16 6 16 1 52 55 0 3 52 50 0 1 32 85 0 16 5 52 17 0 1 33 25 0 20 8 0 1 9 0 16 5 52 56 0 1 52 32 0 2 16 3 16 1 49 3 32 51 0 16 5 52 18 0 1 33 25 0 20 8 0 1 9 0 16 5 52 56 0 1 52 32 0 2 16 3 16 1 49 3 32 17 0 1 57 0 16 5 52 58 0 1 52 32 0 2 52 59 0 1 50)} "aser-reserialize" {:upvalue-count 0 :arity 1 :constants ("type-of" "list" "serialize" "empty?" "()" "symbol" "symbol-name" 0 {:upvalue-count 4 :arity 1 :constants ("inc" "type-of" "string" " " "contains?" "class" "starts-with?" "id" "sx-" "data-" "style" "href" "src" "type" "name" "value" "placeholder" "action" "method" "target" "role" "for" "on" ":" "str" "append!" "nth" "serialize" "aser-reserialize") :bytecode (18 0 33 15 0 4 19 0 5 18 1 52 0 0 1 19 1 32 101 1 16 0 52 1 0 1 1 2 0 164 6 33 8 1 5 18 1 52 0 0 1 18 2 168 165 6 33 249 0 5 16 0 1 3 0 52 4 0 2 167 6 33 234 0 5 16 0 1 5 0 52 6 0 2 6 34 220 0 5 16 0 1 7 0 52 6 0 2 6 34 206 0 5 16 0 1 8 0 52 6 0 2 6 34 192 0 5 16 0 1 9 0 52 6 0 2 6 34 178 0 5 16 0 1 10 0 52 6 0 2 6 34 164 0 5 16 0 1 11 0 52 6 0 2 6 34 150 0 5 16 0 1 12 0 52 6 0 2 6 34 136 0 5 16 0 1 13 0 52 6 0 2 6 34 122 0 5 16 0 1 14 0 52 6 0 2 6 34 108 0 5 16 0 1 15 0 52 6 0 2 6 34 94 0 5 16 0 1 16 0 52 6 0 2 6 34 80 0 5 16 0 1 17 0 52 6 0 2 6 34 66 0 5 16 0 1 18 0 52 6 0 2 6 34 52 0 5 16 0 1 19 0 52 6 0 2 6 34 38 0 5 16 0 1 20 0 52 6 0 2 6 34 24 0 5 16 0 1 21 0 52 6 0 2 6 34 10 0 5 16 0 1 22 0 52 6 0 2 33 54 0 18 3 1 23 0 16 0 52 24 0 2 52 25 0 2 5 18 3 18 2 18 1 52 0 0 1 52 26 0 2 52 27 0 1 52 25 0 2 5 3 19 0 5 18 1 52 0 0 1 19 1 32 22 0 18 3 20 28 0 16 0 48 1 52 25 0 2 5 18 1 52 0 0 1 19 1 50)} "for-each" "(" " " "join" ")" "str") :bytecode (16 0 52 0 0 1 1 1 0 164 167 33 9 0 16 0 52 2 0 1 32 109 0 16 0 52 3 0 1 33 6 0 1 4 0 32 94 0 16 0 169 17 1 16 1 52 0 0 1 1 5 0 164 167 33 9 0 16 0 52 2 0 1 32 66 0 16 1 52 6 0 1 17 2 16 2 52 1 0 1 17 3 16 0 170 17 4 4 17 5 1 7 0 17 6 51 8 0 1 5 1 6 1 4 1 3 16 4 52 9 0 2 5 1 10 0 1 11 0 16 3 52 12 0 2 1 13 0 52 14 0 3 50)} "aser-fragment" {:upvalue-count 0 :arity 2 :constants ("list" {:upvalue-count 2 :arity 1 :constants ("aser" "nil?" "type-of" "sx-expr" "sx-expr-source" "append!" "list" {:upvalue-count 1 :arity 1 :constants ("nil?" "type-of" "sx-expr" "sx-expr-source" "append!" "aser-reserialize") :bytecode (16 0 52 0 0 1 167 33 44 0 16 0 52 1 0 1 1 2 0 164 33 15 0 18 0 16 0 52 3 0 1 52 4 0 2 32 13 0 18 0 20 5 0 16 0 48 1 52 4 0 2 32 1 0 2 50)} "for-each" "serialize") :bytecode (20 0 0 16 0 18 0 48 2 17 1 16 1 52 1 0 1 33 4 0 2 32 67 0 16 1 52 2 0 1 1 3 0 164 33 15 0 18 1 16 1 52 4 0 1 52 5 0 2 32 39 0 16 1 52 2 0 1 1 6 0 164 33 14 0 51 7 0 0 1 16 1 52 8 0 2 32 12 0 18 1 16 1 52 9 0 1 52 5 0 2 50)} "for-each" "empty?" "" 1 "make-sx-expr" "(<> " " " "join" ")" "str") :bytecode (52 0 0 0 17 2 51 1 0 1 1 1 2 16 0 52 2 0 2 5 16 2 52 3 0 1 33 6 0 1 4 0 32 43 0 16 2 168 1 5 0 164 33 10 0 16 2 169 52 6 0 1 32 23 0 1 7 0 1 8 0 16 2 52 9 0 2 1 10 0 52 11 0 3 52 6 0 1 50)} "aser-call" {:upvalue-count 0 :arity 3 :constants ("list" 0 "element-attrs" "scope-push!" {:upvalue-count 6 :arity 1 :constants ("inc" "type-of" "keyword" "aser" "nth" "nil?" ":" "keyword-name" "str" "append!" "sx-expr" "sx-expr-source" "serialize" "list" {:upvalue-count 1 :arity 1 :constants ("nil?" "type-of" "sx-expr" "sx-expr-source" "append!" "serialize") :bytecode (16 0 52 0 0 1 167 33 43 0 16 0 52 1 0 1 1 2 0 164 33 15 0 18 0 16 0 52 3 0 1 52 4 0 2 32 12 0 18 0 16 0 52 5 0 1 52 4 0 2 32 1 0 2 50)} "for-each") :bytecode (18 0 33 15 0 4 19 0 5 18 1 52 0 0 1 19 1 32 240 0 16 0 52 1 0 1 1 2 0 164 6 33 11 0 5 18 1 52 0 0 1 18 2 168 165 33 111 0 20 3 0 18 2 18 1 52 0 0 1 52 4 0 2 18 3 48 2 17 1 16 1 52 5 0 1 167 33 63 0 18 4 1 6 0 16 0 52 7 0 1 52 8 0 2 52 9 0 2 5 16 1 52 1 0 1 1 10 0 164 33 15 0 18 4 16 1 52 11 0 1 52 9 0 2 32 12 0 18 4 16 1 52 12 0 1 52 9 0 2 32 1 0 2 5 3 19 0 5 18 1 52 0 0 1 19 1 32 101 0 20 3 0 16 0 18 3 48 2 17 1 16 1 52 5 0 1 167 33 70 0 16 1 52 1 0 1 1 10 0 164 33 15 0 18 5 16 1 52 11 0 1 52 9 0 2 32 39 0 16 1 52 1 0 1 1 13 0 164 33 14 0 51 14 0 0 5 16 1 52 15 0 2 32 12 0 18 5 16 1 52 12 0 1 52 9 0 2 32 1 0 2 5 18 1 52 0 0 1 19 1 50)} "for-each" {:upvalue-count 1 :arity 1 :constants ({:upvalue-count 2 :arity 1 :constants ("dict-get" ":" "str" "append!" "serialize") :bytecode (18 0 16 0 52 0 0 2 17 1 18 1 1 1 0 16 0 52 2 0 2 52 3 0 2 5 18 1 16 1 52 4 0 1 52 3 0 2 50)} "keys" "for-each") :bytecode (51 0 0 1 0 0 0 16 0 52 1 0 1 52 2 0 2 50)} "scope-peek" "scope-pop!" "concat" "(" " " "join" ")" "str" "make-sx-expr") :bytecode (52 0 0 0 17 3 52 0 0 0 17 4 4 17 5 1 1 0 17 6 1 2 0 2 52 3 0 2 5 51 4 0 1 5 1 6 1 1 1 2 1 3 1 4 16 1 52 5 0 2 5 51 6 0 1 3 1 2 0 52 7 0 1 52 5 0 2 5 1 2 0 52 8 0 1 5 16 0 52 0 0 1 16 3 16 4 52 9 0 3 17 7 1 10 0 1 11 0 16 7 52 12 0 2 1 13 0 52 14 0 3 52 15 0 1 50)} "aser-expand-component" {:upvalue-count 0 :arity 3 :constants ("component-params" "component-closure" "env-merge" 0 "list" {:upvalue-count 1 :arity 1 :constants ("env-bind!") :bytecode (18 0 16 0 2 52 0 0 3 50)} "for-each" {:upvalue-count 6 :arity 1 :constants ("inc" "type-of" "keyword" "keyword-name" "aser" "nth" "env-bind!" "append!") :bytecode (18 0 33 15 0 4 19 0 5 18 1 52 0 0 1 19 1 32 92 0 16 0 52 1 0 1 1 2 0 164 6 33 11 0 5 18 1 52 0 0 1 18 2 168 165 33 47 0 18 3 16 0 52 3 0 1 20 4 0 18 2 18 1 52 0 0 1 52 5 0 2 18 4 48 2 52 6 0 3 5 3 19 0 5 18 1 52 0 0 1 19 1 32 17 0 18 5 16 0 52 7 0 2 5 18 1 52 0 0 1 19 1 50)} "component-has-children" {:upvalue-count 1 :arity 1 :constants ("aser") :bytecode (20 0 0 16 0 18 0 49 2 50)} "map" "children" 1 "env-bind!" "aser" "component-body") :bytecode (16 0 52 0 0 1 17 3 16 2 16 0 52 1 0 1 52 2 0 2 17 4 1 3 0 17 5 4 17 6 52 4 0 0 17 7 51 5 0 1 4 16 3 52 6 0 2 5 51 7 0 1 6 1 5 1 1 1 4 1 2 1 7 16 1 52 6 0 2 5 16 0 52 8 0 1 33 43 0 51 9 0 1 2 16 7 52 10 0 2 17 8 16 4 1 11 0 16 8 168 1 12 0 164 33 6 0 16 8 169 32 2 0 16 8 52 13 0 3 32 1 0 2 5 20 14 0 16 0 52 15 0 1 16 4 49 2 50)} "SPECIAL_FORM_NAMES" "if" "when" "cond" "case" "and" "or" "let" "let*" "lambda" "fn" "define" "defcomp" "defmacro" "defstyle" "defhandler" "defpage" "defquery" "defaction" "defrelation" "begin" "do" "quote" "quasiquote" "->" "set!" "letrec" "dynamic-wind" "defisland" "deftype" "defeffect" "scope" "provide" "context" "emit!" "emitted" "list" "HO_FORM_NAMES" "map" "map-indexed" "filter" "reduce" "some" "every?" "for-each" "special-form?" {:upvalue-count 0 :arity 1 :constants ("SPECIAL_FORM_NAMES" "contains?") :bytecode (20 0 0 16 0 52 1 0 2 50)} "ho-form?" {:upvalue-count 0 :arity 1 :constants ("HO_FORM_NAMES" "contains?") :bytecode (20 0 0 16 0 52 1 0 2 50)} "aser-special" {:upvalue-count 0 :arity 3 :constants ("if" "eval-expr" "trampoline" "aser" 1 "nth" 2 "when" {:upvalue-count 2 :arity 1 :constants ("aser") :bytecode (20 0 0 16 0 18 1 48 2 19 0 50)} "for-each" "cond" "eval-cond" "case" "eval-case-aser" "let" "let*" "process-bindings" "begin" "do" "and" {:upvalue-count 2 :arity 1 :constants ("eval-expr" "trampoline") :bytecode (16 0 18 1 52 0 0 2 52 1 0 1 19 0 5 18 0 167 50)} "some" "or" {:upvalue-count 2 :arity 1 :constants ("eval-expr" "trampoline") :bytecode (16 0 18 1 52 0 0 2 52 1 0 1 19 0 5 18 0 50)} "map" {:upvalue-count 1 :arity 1 :constants ("lambda?" "lambda-closure" "env-extend" "lambda-params" "env-bind!" "aser" "lambda-body" "list" "cek-call") :bytecode (18 0 52 0 0 1 33 44 0 18 0 52 1 0 1 52 2 0 1 17 1 16 1 18 0 52 3 0 1 169 16 0 52 4 0 3 5 20 5 0 18 0 52 6 0 1 16 1 49 2 32 12 0 18 0 16 0 52 7 0 1 52 8 0 2 50)} "aser-fragment" "map-indexed" {:upvalue-count 2 :arity 2 :constants ("lambda?" "lambda-closure" "env-merge" "lambda-params" "env-bind!" 1 "nth" "aser" "lambda-body" "list" "cek-call") :bytecode (18 0 52 0 0 1 33 68 0 18 0 52 1 0 1 18 1 52 2 0 2 17 2 16 2 18 0 52 3 0 1 169 16 0 52 4 0 3 5 16 2 18 0 52 3 0 1 1 5 0 52 6 0 2 16 1 52 4 0 3 5 20 7 0 18 0 52 8 0 1 16 2 49 2 32 14 0 18 0 16 0 16 1 52 9 0 2 52 10 0 2 50)} "list" {:upvalue-count 3 :arity 1 :constants ("lambda?" "lambda-closure" "env-merge" "lambda-params" "env-bind!" "aser" "lambda-body" "append!" "list" "cek-call") :bytecode (18 0 52 0 0 1 33 52 0 18 0 52 1 0 1 18 1 52 2 0 2 17 1 16 1 18 0 52 3 0 1 169 16 0 52 4 0 3 5 18 2 20 5 0 18 0 52 6 0 1 16 1 48 2 52 7 0 2 32 12 0 18 0 16 0 52 8 0 1 52 9 0 2 50)} "empty?" "defisland" "serialize" "define" "defcomp" "defmacro" "defstyle" "defhandler" "defpage" "defquery" "defaction" "defrelation" "deftype" "defeffect" "scope" ">=" "type-of" "keyword" "keyword-name" "value" "slice" "scope-push!" "scope-pop!" "provide" "context" "scope-peek" "nil?" "emit!" "scope-emit!" "emitted") :bytecode (16 1 170 17 3 16 0 1 0 0 164 33 68 0 16 3 169 16 2 52 1 0 2 52 2 0 1 33 19 0 20 3 0 16 3 1 4 0 52 5 0 2 16 2 49 2 32 30 0 16 3 168 1 6 0 166 33 19 0 20 3 0 16 3 1 6 0 52 5 0 2 16 2 49 2 32 1 0 2 32 105 4 16 0 1 7 0 164 33 44 0 16 3 169 16 2 52 1 0 2 52 2 0 1 167 33 4 0 2 32 20 0 2 17 4 51 8 0 1 4 1 2 16 3 170 52 9 0 2 5 16 4 32 52 4 16 0 1 10 0 164 33 32 0 20 11 0 16 3 16 2 48 2 17 4 16 4 33 12 0 20 3 0 16 4 16 2 49 2 32 1 0 2 32 11 4 16 0 1 12 0 164 33 34 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 170 17 5 20 13 0 16 4 16 5 16 2 49 3 32 224 3 16 0 1 14 0 164 6 34 7 0 5 16 0 1 15 0 164 33 35 0 20 16 0 16 3 169 16 2 48 2 17 4 2 17 5 51 8 0 1 5 1 4 16 3 170 52 9 0 2 5 16 5 32 169 3 16 0 1 17 0 164 6 34 7 0 5 16 0 1 18 0 164 33 22 0 2 17 4 51 8 0 1 4 1 2 16 3 52 9 0 2 5 16 4 32 127 3 16 0 1 19 0 164 33 22 0 3 17 4 51 20 0 1 4 1 2 16 3 52 21 0 2 5 16 4 32 96 3 16 0 1 22 0 164 33 22 0 4 17 4 51 23 0 1 4 1 2 16 3 52 21 0 2 5 16 4 32 65 3 16 0 1 24 0 164 33 61 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 5 51 25 0 1 4 16 5 52 24 0 2 17 6 20 26 0 16 6 16 2 49 2 32 251 2 16 0 1 27 0 164 33 52 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 5 51 28 0 1 4 1 2 16 5 52 27 0 2 32 190 2 16 0 1 9 0 164 33 76 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 5 52 29 0 0 17 6 51 30 0 1 4 1 2 1 6 16 5 52 9 0 2 5 16 6 52 31 0 1 33 4 0 2 32 2 0 16 6 32 105 2 16 0 1 32 0 164 33 22 0 16 1 16 2 52 1 0 2 52 2 0 1 5 16 1 52 33 0 1 32 74 2 16 0 1 34 0 164 6 34 106 0 5 16 0 1 35 0 164 6 34 95 0 5 16 0 1 36 0 164 6 34 84 0 5 16 0 1 37 0 164 6 34 73 0 5 16 0 1 38 0 164 6 34 62 0 5 16 0 1 39 0 164 6 34 51 0 5 16 0 1 40 0 164 6 34 40 0 5 16 0 1 41 0 164 6 34 29 0 5 16 0 1 42 0 164 6 34 18 0 5 16 0 1 43 0 164 6 34 7 0 5 16 0 1 44 0 164 33 17 0 16 1 16 2 52 1 0 2 52 2 0 1 5 2 32 194 1 16 0 1 45 0 164 33 150 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 170 17 5 2 17 6 2 17 7 16 5 168 1 6 0 52 46 0 2 6 33 28 0 5 16 5 169 52 47 0 1 1 48 0 164 6 33 12 0 5 16 5 169 52 49 0 1 1 50 0 164 33 36 0 16 5 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 6 5 16 5 1 6 0 52 51 0 2 17 7 32 4 0 16 5 17 7 5 16 4 16 6 52 52 0 2 5 2 17 8 51 8 0 1 8 1 2 16 7 52 9 0 2 5 16 4 52 53 0 1 5 16 8 32 35 1 16 0 1 54 0 164 33 81 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 5 2 17 6 16 4 16 5 52 52 0 2 5 51 8 0 1 6 1 2 16 3 1 6 0 52 51 0 2 52 9 0 2 5 16 4 52 53 0 1 5 16 6 32 201 0 16 0 1 55 0 164 33 80 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 168 1 6 0 52 46 0 2 33 22 0 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 32 1 0 2 17 5 16 4 52 56 0 1 17 6 16 6 52 57 0 1 33 5 0 16 5 32 2 0 16 6 32 112 0 16 0 1 58 0 164 33 49 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 3 1 4 0 52 5 0 2 16 2 52 1 0 2 52 2 0 1 17 5 16 4 16 5 52 59 0 2 5 2 32 54 0 16 0 1 60 0 164 33 33 0 16 3 169 16 2 52 1 0 2 52 2 0 1 17 4 16 4 52 56 0 1 6 34 5 0 5 52 29 0 0 32 12 0 16 1 16 2 52 1 0 2 52 2 0 1 50)} "eval-case-aser" {:upvalue-count 0 :arity 3 :constants (2 1 "nth" "type-of" "keyword" "keyword-name" "else" "symbol" "symbol-name" ":else" "aser" "eval-expr" "trampoline" "eval-case-aser" "slice") :bytecode (16 1 168 1 0 0 165 33 4 0 2 32 149 0 16 1 169 17 3 16 1 1 1 0 52 2 0 2 17 4 16 3 52 3 0 1 1 4 0 164 6 33 11 0 5 16 3 52 5 0 1 1 6 0 164 6 34 41 0 5 16 3 52 3 0 1 1 7 0 164 6 33 26 0 5 16 3 52 8 0 1 1 9 0 164 6 34 11 0 5 16 3 52 8 0 1 1 6 0 164 33 12 0 20 10 0 16 4 16 2 49 2 32 48 0 16 0 16 3 16 2 52 11 0 2 52 12 0 1 164 33 12 0 20 10 0 16 4 16 2 49 2 32 18 0 20 13 0 16 0 16 1 1 0 0 52 14 0 2 16 2 49 3 50)} {:library (web adapter-sx) :op "import"}) :bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 51 5 0 128 4 0 5 51 7 0 128 6 0 5 51 9 0 128 8 0 5 51 11 0 128 10 0 5 51 13 0 128 12 0 5 1 15 0 1 16 0 1 17 0 1 18 0 1 19 0 1 20 0 1 21 0 1 22 0 1 23 0 1 24 0 1 25 0 1 26 0 1 27 0 1 28 0 1 29 0 1 30 0 1 31 0 1 32 0 1 33 0 1 34 0 1 35 0 1 36 0 1 37 0 1 38 0 1 39 0 1 40 0 1 41 0 1 42 0 1 43 0 1 44 0 1 45 0 1 46 0 1 47 0 1 48 0 1 49 0 52 50 0 35 128 14 0 5 1 52 0 1 53 0 1 54 0 1 55 0 1 56 0 1 57 0 1 58 0 52 50 0 7 128 51 0 5 51 60 0 128 59 0 5 51 62 0 128 61 0 5 51 64 0 128 63 0 5 51 66 0 128 65 0 5 1 67 0 112 50))) diff --git a/shared/static/wasm/sx/boot-helpers.sxbc b/shared/static/wasm/sx/boot-helpers.sxbc index 70295e57..fe194571 100644 --- a/shared/static/wasm/sx/boot-helpers.sxbc +++ b/shared/static/wasm/sx/boot-helpers.sxbc @@ -1,3 +1,3 @@ (sxbc 1 "5928b113ea488a86" (code - :constants ("_sx-bound-prefix" "_sxBound" "mark-processed!" {:upvalue-count nil :arity nil :constants ("host-set!" "str" "_sx-bound-prefix") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "is-processed?" {:upvalue-count nil :arity nil :constants ("host-get" "str" "_sx-bound-prefix") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "clear-processed!" {:upvalue-count nil :arity nil :constants ("host-set!" "str" "_sx-bound-prefix") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "callable?" {:upvalue-count nil :arity nil :constants ("type-of" "=" "lambda" "function" "continuation") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "to-kebab" {:upvalue-count nil :arity nil :constants ("Convert camelCase to kebab-case." "list" nil {:upvalue-count nil :arity nil :constants ("<" "len" "nth" ">=" "A" "<=" "Z" ">" nil "append!" "-" "lower" "+" nil) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "join" "") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "sx-load-components" {:upvalue-count nil :arity nil :constants ("Parse and evaluate component definitions from text." ">" "len" nil "sx-parse" "for-each" {:upvalue-count nil :arity nil :constants ("cek-eval") :bytecode (nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "call-expr" {:upvalue-count nil :arity nil :constants ("Parse and evaluate an SX expression string." "sx-parse" "not" "empty?" "cek-eval" "first") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "base-env" {:upvalue-count nil :arity nil :constants ("Return the current global environment." "global-env") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "get-render-env" {:upvalue-count nil :arity nil :constants ("Get the rendering environment (global env, optionally merged with extra)." "base-env" "not" "nil?" "env-merge") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "merge-envs" {:upvalue-count nil :arity nil :constants ("Merge two environments." "env-merge" "global-env") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "sx-render-with-env" {:upvalue-count nil :arity nil :constants ("Parse SX source and render to DOM fragment." "host-global" "document" "host-call" "createDocumentFragment" "sx-parse" "for-each" {:upvalue-count nil :arity nil :constants ("render-to-html" ">" "len" nil "host-call" "createElement" "template" "host-set!" "innerHTML" "appendChild" "host-get" "content") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "parse-env-attr" {:upvalue-count nil :arity nil :constants ("Parse data-sx-env attribute (JSON key-value pairs).") :bytecode (nil nil nil nil nil nil)} "store-env-attr" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)} "resolve-mount-target" {:upvalue-count nil :arity nil :constants ("Resolve a CSS selector string to a DOM element." "string?" "dom-query") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "remove-head-element" {:upvalue-count nil :arity nil :constants ("Remove a element matching selector." "dom-query" "dom-remove") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "set-sx-comp-cookie" {:upvalue-count nil :arity nil :constants ("set-cookie" "sx-components") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "clear-sx-comp-cookie" {:upvalue-count nil :arity nil :constants ("set-cookie" "sx-components" "") :bytecode (nil nil nil nil nil nil nil nil nil nil nil)} "log-parse-error" {:upvalue-count nil :arity nil :constants ("log-error" "str" "Parse error in " ": ") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "loaded-component-names" {:upvalue-count nil :arity nil :constants ("dom-query-all" "dom-body" "script[data-components]" "list" "for-each" {:upvalue-count nil :arity nil :constants ("dom-get-attr" "data-components" "" ">" "len" nil "for-each" {:upvalue-count nil :arity nil :constants (">" "len" "trim" nil "append!") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "split" ",") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "csrf-token" {:upvalue-count nil :arity nil :constants ("dom-query" "meta[name=\"csrf-token\"]" "dom-get-attr" "content") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "validate-for-request" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)} "build-request-body" {:upvalue-count nil :arity nil :constants ("upper" "=" "GET" "HEAD" "dom-tag-name" "" "FORM" "host-new" "FormData" "URLSearchParams" "host-call" "toString" "dict" "url" ">" "len" nil "str" "contains?" "?" "&" "body" "content-type" "dom-get-attr" "enctype" "application/x-www-form-urlencoded" "multipart/form-data") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "abort-previous-target" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)} "abort-previous" "track-controller" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)} "track-controller-target" "new-abort-controller" {:upvalue-count nil :arity nil :constants ("host-new" "AbortController") :bytecode (nil nil nil nil nil nil nil nil)} "abort-signal" {:upvalue-count nil :arity nil :constants ("host-get" "signal") :bytecode (nil nil nil nil nil nil nil nil nil nil)} "apply-optimistic" "revert-optimistic" "dom-has-attr?" {:upvalue-count nil :arity nil :constants ("host-call" "hasAttribute") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil)} "show-indicator" {:upvalue-count nil :arity nil :constants ("dom-get-attr" "sx-indicator" "dom-query" "dom-remove-class" "hidden" "dom-add-class" "sx-indicator-visible") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "disable-elements" {:upvalue-count nil :arity nil :constants ("dom-get-attr" "sx-disabled-elt" "dom-query-all" "dom-body" "for-each" {:upvalue-count nil :arity nil :constants ("dom-set-attr" "disabled" "") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "list") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "clear-loading-state" {:upvalue-count nil :arity nil :constants ("dom-remove-class" "sx-request" "dom-remove-attr" "aria-busy" "dom-query" "dom-add-class" "hidden" "sx-indicator-visible" "for-each" {:upvalue-count nil :arity nil :constants ("dom-remove-attr" "disabled") :bytecode (nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "abort-error?" {:upvalue-count nil :arity nil :constants ("=" "host-get" "name" "AbortError") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "promise-catch" {:upvalue-count nil :arity nil :constants ("host-callback" "host-call" "catch") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "fetch-request" {:upvalue-count nil :arity nil :constants ("get" "url" "method" "GET" "headers" "dict" "body" "signal" "preloaded" nil {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)} "host-new" "Headers" "Object" "for-each" {:upvalue-count nil :arity nil :constants ("host-call" "set" "get") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "keys" "host-set!" "promise-then" "host-call" "dom-window" "fetch" {:upvalue-count nil :arity nil :constants ("host-get" "ok" "status" {:upvalue-count nil :arity nil :constants ("host-call" "host-get" "headers" "get") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "promise-then" "host-call" "text" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "fetch-location" {:upvalue-count nil :arity nil :constants ("dom-query" "[sx-boost]" "#main-panel" "browser-navigate") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "fetch-and-restore" {:upvalue-count nil :arity nil :constants ("fetch-request" "dict" "url" "method" "GET" "headers" "body" "signal" {:upvalue-count nil :arity nil :constants ("content-type" "" "contains?" "text/html" "host-new" "DOMParser" "host-call" "parseFromString" "querySelector" "#sx-content" "dom-set-inner-html" "host-get" "innerHTML" "dom-create-element" "div" "sx-render" "dom-append" "process-oob-swaps" {:upvalue-count nil :arity nil :constants ("dispose-islands-in" "swap-dom-nodes" "=" "innerHTML" "children-to-fragment" "post-swap") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "select-from-container" "dispose-islands-in" "dom-get-inner-html" "post-swap" "dom-window" "scrollTo" nil) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants ("log-warn" "str" "fetch-and-restore error: ") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "fetch-preload" {:upvalue-count nil :arity nil :constants ("fetch-request" "dict" "url" "method" "GET" "headers" "body" "signal" {:upvalue-count nil :arity nil :constants ("preload-cache-set") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} {:upvalue-count nil :arity nil :constants () :bytecode (nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "fetch-streaming" {:upvalue-count nil :arity nil :constants ("fetch-and-restore" nil) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "dom-parse-html-document" {:upvalue-count nil :arity nil :constants ("host-new" "DOMParser" "host-call" "parseFromString" "text/html") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "dom-body-inner-html" {:upvalue-count nil :arity nil :constants ("host-get" "body" "innerHTML") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "create-script-clone" {:upvalue-count nil :arity nil :constants ("host-global" "document" "host-call" "createElement" "script" "host-get" "attributes" {:upvalue-count nil :arity nil :constants ("<" "host-get" "length" "host-call" "item" "setAttribute" "name" "value" "+" nil) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} nil "host-set!" "textContent") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "cross-origin?" {:upvalue-count nil :arity nil :constants ("starts-with?" "http://" "https://" "not" "browser-location-origin") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "browser-scroll-to" {:upvalue-count nil :arity nil :constants ("host-call" "dom-window" "scrollTo") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "with-transition" {:upvalue-count nil :arity nil :constants ("host-get" "host-global" "document" "startViewTransition" "host-call" "host-callback") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "event-source-connect" {:upvalue-count nil :arity nil :constants ("host-new" "EventSource" "host-set!" "_sxElement") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "event-source-listen" {:upvalue-count nil :arity nil :constants ("host-call" "addEventListener" "host-callback" {:upvalue-count nil :arity nil :constants () :bytecode (nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "bind-boost-link" {:upvalue-count nil :arity nil :constants ("dom-listen" "click" {:upvalue-count nil :arity nil :constants ("not" "event-modifier-key?" "prevent-default" "dom-has-attr?" "sx-get" "dom-set-attr" "sx-push-url" "true" "execute-request") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "bind-boost-form" {:upvalue-count nil :arity nil :constants ("dom-listen" "submit" {:upvalue-count nil :arity nil :constants ("prevent-default" "execute-request") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "bind-client-route-click" {:upvalue-count nil :arity nil :constants ("dom-listen" "click" {:upvalue-count nil :arity nil :constants ("not" "event-modifier-key?" "prevent-default" "dom-query" "[sx-boost]" "dom-get-attr" "sx-boost" "=" "true" "#sx-content" "try-client-route" "url-pathname" "save-scroll-position" "browser-push-state" "" "browser-scroll-to" nil "log-info" "str" "sx:route server fetch " "dom-set-attr" "sx-get" "sx-target" "sx-select" "sx-push-url" "execute-request") :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)}) :bytecode (nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)} "sw-post-message" "try-parse-json" {:upvalue-count nil :arity nil :constants ("json-parse") :bytecode (nil nil nil nil nil nil nil nil)} "strip-component-scripts" {:upvalue-count nil :arity nil :constants ("") (p :style "margin-top:1.5em" (a :href (unquote (str "/" slug "/")) "view post") " · " @@ -935,7 +969,6 @@ (dream-get "/posts" host/blog-index) (dream-get "/new" host/blog-new-form) (dream-get "/tags" host/blog-tags-index) - (dream-get "/relate-picker.js" host/blog-picker-js) (dream-get "/:slug/source" host/blog-source) (dream-get "/:slug/relate-options" host/blog-relate-options) (dream-get "/:slug" host/blog-post))) diff --git a/lib/host/conformance.sh b/lib/host/conformance.sh index 422cf9eb..8a80d03d 100755 --- a/lib/host/conformance.sh +++ b/lib/host/conformance.sh @@ -76,6 +76,7 @@ MODULES=( "lib/host/auth.sx" "lib/host/sxtp.sx" "lib/host/router.sx" + "lib/host/static.sx" "lib/host/feed.sx" "lib/host/relations.sx" "lib/host/blog.sx" diff --git a/lib/host/playwright/relate-picker.spec.js b/lib/host/playwright/relate-picker.spec.js index d1decede..a0fcdade 100644 --- a/lib/host/playwright/relate-picker.spec.js +++ b/lib/host/playwright/relate-picker.spec.js @@ -1,20 +1,32 @@ // Browser check for the relate picker (lib/host/blog.sx). Runs against an // ephemeral host server seeded with a host post + 25 candidates by // run-picker-check.sh, which copies this spec into the Playwright env and sets -// SX_TEST_URL. Exercises the login redirect, the JS-driven candidate load, -// debounced filter, infinite scroll, and click-to-relate. +// SX_TEST_URL. The picker is a DECLARATIVE SX-htmx form (no client JS): the form +// GETs //relate-options on "load" and on a debounced "input", swapping the +// results
        ; a full page carries a "load more" sentinel that pages on reveal. +// Exercises the login redirect, the initial populate, debounced filter, infinite +// scroll, click-to-relate, AND populate after a boosted SPA nav (the case the old +// inline