code wiki / _hdl_build / nx_srcset_lib_gate.nx
nx_srcset_lib_gate.nx
buildroot/runtime/_hdl_build/nx_srcset_lib_gate.nx
about
nx_srcset_lib_gate.nx -- the referee for BR14 (nx_srcset_lib, symbol bi_srcset).
IN-PROCESS BY CONSTRUCTION. It imports the subject and the render core it is wired into, so the
subject is inside THIS gate's own build closure and a mutation of nx_srcset_lib.nx reaches these
teeth. A gate that fork/execs a deployed elf cannot be mutation-proven -- every mutant reads
NOT-REACHED -- so nothing here forks anything.
===================================================================================================
THE ACCEPT RULE, PRE-DECLARED BEFORE THE FIRST RUN (written 2026-08-26, before any result existed).
BR14 is proven by this gate IF AND ONLY IF all five hold; anything less is reported NOT PROVEN by
name, and the rung stays open.
A. GRAMMAR. Every documented descriptor form selects the candidate the HTML selection algorithm
selects, for a target DERIVED from the viewport and the device pixel ratio -- not from any
breakpoint written in this estate.
B. DISCRIMINATION. The three trivial wrong implementations -- always-take-the-first candidate,
always-take-the-last, always-take-the-largest -- each FAIL at least one tooth. A ruler that
cannot be distinguished from taking the first item has measured nothing.
C. WIRING. An <img> whose only usable URL lives in srcset / data-src / data-srcset resolves to
THAT URL through the real br_layout, i.e. page.bsrc_off names it. Proving the lib in isolation
proves a function, not a browser.
D. NO REGRESSION. An <img> carrying only a plain src resolves to byte-identically the range the
pre-BR14 code chose, checked against an INDEPENDENT instrument (nx_dom_find_attr direct).
E. PAINTED, NOT MERELY SELECTED. On a fixture page whose figures are lazy and responsive,
imgsrc_laid == decoded == painted: every laid-out <img> box decodes through the real image
path and leaves its own pixels in the framebuffer. This is the done-rule's SHAPE on a fixture
this gate controls. It is NOT the done-rule's live half (the wikipedia benchmark page over the
network), which needs the GUI and a network and is NOT claimed here.
===================================================================================================
dependencies 6 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_srcset_lib.nxnx_browser_render.nxnx_img_to_rgb.nxnx_png_write.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 38 | const SG_DIR: *u8 = "/tmp/nx_srcset_lib_gate" |
| 39 | const SG_PNG: *u8 = "/tmp/nx_srcset_lib_gate/px.png" |
| 40 | const SG_DIR_MODE: i64 = 493 // 0755 -- owner rwx, group/other rx |
| 44 | const SG_IMG_R: i64 = 255 |
| 45 | const SG_IMG_G: i64 = 0 |
| 46 | const SG_IMG_B: i64 = 255 |
| 47 | const SG_IMG_W: i64 = 24 |
| 48 | const SG_IMG_H: i64 = 24 |
| 49 | const SG_VW: i64 = 640 // the fixture viewport; every target below is DERIVED from it |
| 50 | const SG_FB_W: i64 = 700 |
| 51 | const SG_FB_H: i64 = 900 |
| 52 | const SG_RGB_CH: i64 = 3 |
| 53 | const SG_RGBA_CH: i64 = 4 |
| 54 | const SG_DPR_1X: i64 = 1000 |
| 55 | const SG_DPR_1P5X: i64 = 1500 |
| 56 | const SG_DPR_2X: i64 = 2000 |
| 57 | const SG_DPR_3X: i64 = 3000 |
| 145 | const SG_MAXFAIL: i64 = 16 |
functions
| 59 | func sg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 61 | func sg_eq(a: i64, b: i64) -> i64 { if a == b { return 1 } return 0 } called by 1: main |
| 64 | func sg_span_is(buf: *u8, off: i64, len: i64, lit: *u8) -> i64 |
| 77 | func sg_picks(list: *u8, size_px: i64, dpr: i64, want: *u8, sc: *i64, oo: *i64, ol: *i64) -> i64 |
| 84 | func sg_code(list: *u8, size_px: i64, dpr: i64, sc: *i64, oo: *i64, ol: *i64) -> i64 |
| 89 | func sg_took_first(list: *u8, size_px: i64, dpr: i64, sc: *i64, oo: *i64, ol: *i64) -> i64 |
| 97 | func sg_src_is(tag: *u8, vw: i64, dpr: i64, want: *u8, sc: *i64, oo: *i64, ol: *i64) -> i64 |
| 103 | func sg_src_code(tag: *u8, vw: i64, dpr: i64, sc: *i64, oo: *i64, ol: *i64) -> i64 |
| 108 | func sg_make_png(wh: *i64) -> i64 |
| 128 | func sg_px_is_img(px: *u8, x: i64, y: i64) -> i64 called by 1: main |
| 148 | func sg_note_fail(nm: *u8) -> i64 |
| 157 | func sg_check(nm: *u8, cond: i64, ctr: *i64) -> i64 |
| 162 | func sg_bite(nm: *u8, bad: i64, good: i64, ctr: *i64) -> i64 |
| 167 | func sg_dump_fails() -> i64 |
| 182 | func main() -> i64 |