code wiki / _hdl_build / _gallery_serve_ref.nx

_gallery_serve_ref.nx

buildroot/runtime/_hdl_build/_gallery_serve_ref.nx

13613 B327 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind orphan librarytopic gallery
docsdependenciesstructsconstsfunctions

about

_gallery_serve_ref.nx -- HAND REFERENCE (written ONCE, scratch) for the spec2 gallery daemon target. This is the byte-identical TARGET nx_eg (which==2) must reproduce from a STRUCTURAL spec table. Its control flow extends the PROVEN spec1 frame (socket->setsockopt->bind->listen->`while accept`-> `if cfd<0 continue`->fork->dispatch->send) with a 3-ROUTE flat-if chain: GET / -> gs_grid (browse: lists the REAL ingested img: CIDs from the seg-store) GET /img/<CID> -> gs_serve_png (serves the REAL on-disk PNG bytes via a CID->path sidecar) POST /rate -> gs_rate (same-origin enforced; appends EXACTLY one EVAL O-line) Dialect rails honored: flat-ifs only (LM-002), no &&/|| (LM-001 -> compound guards are SEQUENCES of flat ifs), funcs <=6 params (LM-BIGARGS), mask-after-shift port bytes (LM-005). The route literals "GET / " / "GET /img/" / "POST /rate" are the tamperable spec fields. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_seg_store.nx nx_canon_cid.nx nx_syscalls.nx _gallery_serve_ref.nx

imports: nx_seg_store.nxnx_canon_cid.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

structs

none

consts

none

functions

16func eh_find(buf: *u8, n: i64, pat: *u8, plen: i64) -> i64
called by 1: gs_rate
32func gs_cat(dst: *u8, off: i64, s: *u8) -> i64
39func gs_u(dst: *u8, off: i64, v: i64) -> i64
called by 2: gs_gridgs_serve_png calls 1: sys_mmap
54func gs_grid_body(body: *u8, off: i64, prefix: *u8) -> i64
103func gs_grid(rbuf: *u8, prefix: *u8) -> i64
119func gs_peel_cid(req: *u8, rn: i64, cidout: *u8) -> i64
called by 1: gs_serve_png
138func gs_sidecar(cid: *u8, pathout: *u8) -> i64
called by 1: gs_serve_png calls 2: sys_mmapsys_read_file
166func gs_serve_png(rbuf: *u8, req: *u8, rn: i64, root: *u8) -> i64
189func gs_rate(rbuf: *u8, req: *u8, rn: i64) -> i64
calls 2: eh_findgs_cat
268func main() -> i64