code wiki / _hdl_build / _gallery_serve_ref.nx
_gallery_serve_ref.nx
buildroot/runtime/_hdl_build/_gallery_serve_ref.nx
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
imports: nx_seg_store.nxnx_canon_cid.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| none |
functions
| 16 | func eh_find(buf: *u8, n: i64, pat: *u8, plen: i64) -> i64 called by 1: gs_rate |
| 32 | func gs_cat(dst: *u8, off: i64, s: *u8) -> i64 |
| 39 | func gs_u(dst: *u8, off: i64, v: i64) -> i64 |
| 54 | func gs_grid_body(body: *u8, off: i64, prefix: *u8) -> i64 |
| 103 | func gs_grid(rbuf: *u8, prefix: *u8) -> i64 |
| 119 | func gs_peel_cid(req: *u8, rn: i64, cidout: *u8) -> i64 called by 1: gs_serve_png |
| 138 | func gs_sidecar(cid: *u8, pathout: *u8) -> i64 |
| 166 | func gs_serve_png(rbuf: *u8, req: *u8, rn: i64, root: *u8) -> i64 |
| 189 | func gs_rate(rbuf: *u8, req: *u8, rn: i64) -> i64 |
| 268 | func main() -> i64 |