code wiki / _hdl_build / nx_ui_contrast.nx

nx_ui_contrast.nx

buildroot/runtime/_hdl_build/nx_ui_contrast.nx

5238 B99 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind tooltopic ui
docsdependenciesstructsconstsfunctions

about

nx_ui_contrast.nx -- QUANTITATIVE layer of the judging system: MEASURED WCAG contrast (not technique presence). Extracts --nx-color-ink / --nx-color-bg from each emitted page's :root and computes the ACCURATE WCAG 2.x contrast ratio via nx_brand_guard (fx_pow sRGB gamma, matches the WCAG reference). AA>=4.50:1, AAA>=7.00:1. Composes nx_brand_guard (-> its nx_syscalls layer; no nx_syscalls_x86_64 dup). Helpers uc_*-prefixed to avoid any collision with the brand_guard/brand_tokens/fx import chain. In _hdl_build/ beside nx_brand_guard so the import resolves. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_brand_guard.nx nx_ui_contrast.nx

imports: nx_brand_guard.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main uc_puts uc_grade uc_slurp sys_read uc_puts ↻ uc_ext uc_find uc_len uc_len ↻ uc_white bg_contrast_hex_x100 sys_mmap bg_decode_hex nx_css_color_decode _css_color_hex_digit _css_color_hex_pair _css_color_hex_digit ↻ bg_contrast_x100 bg_rel_lum fx_mul bg_chan_lin fx_div fx_pow uc_num uc_num ↻ bg_contrast_hex_x100 ↻

structs

none

consts

8const K_MAGIC_262144: i64 = 262144

functions

10func uc_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8) { n=n+1 } sys_write(1,s,n); return 0 }
called by 2: uc_grademain
11func uc_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m-(m/10)*10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 }
called by 2: uc_grademain
12func uc_len(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8) { n=n+1 } return n }
called by 2: uc_finduc_ext
14func uc_find(hay: *u8, n: i64, pat: *u8) -> i64
called by 1: uc_ext calls 1: uc_len
26func uc_slurp(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: uc_grade calls 1: sys_read
35func uc_ext(buf: *u8, n: i64, key: *u8, out: *u8) -> i64
called by 1: uc_grade calls 2: uc_finduc_len
54func uc_white(h: *u8) -> i64 { h[0]=35 as u8; h[1]=102 as u8; h[2]=102 as u8; h[3]=102 as u8; h[4]=102 as u8; h[5]=102 as u8; h[6]=102 as u8; h[7]=0 as u8; return 0 }
called by 1: uc_grade
56func uc_grade(name: *u8, path: *u8, buf: *u8, cap: i64, tot: *i64) -> i64
78func main() -> i64