code wiki / _hdl_build / nx_night_grade.nx

nx_night_grade.nx

buildroot/runtime/_hdl_build/nx_night_grade.nx

9615 B187 linesdepth 8pulls 9 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_night_grade.nx -- SOVEREIGN night-reading benchmark gate (Reader arc, rung W-NIGHT-1). MEASURES the sourced eye-fatigue mechanism (blue light) per reader theme. The palette SSOT now lives in the NATIVE content-addressed seg_store (ncfg / nx_native_config) -- NOT a flat .tsv (operator 2026-06-20: "stop using tsv, nishi ecosystem only, all rungs everywhere"). The gate SEEDS the 6-theme palette into a fresh per-run store then reads it back BY COLUMN NAME, so it has ZERO dependency on knowledge/registry/night_themes.tsv (migrated off + removed). For each theme it computes, from the dominant emitted colors (bg + fg, sRGB 0..255): blue_emit = bb*BG_W + fb*FG_W (emitted blue, area-weighted) total_emit = (br+bg+bb)*BG_W + (fr+fg+fb)*FG_W blue_frac = blue_emit*1000 / total_emit (per-mille -- "how blue is the light", coverage-independent) BG_W:FG_W = 9:1 = documented assumption that page background covers ~90% of the screen. Sourced rationale (knowledge/research/2026-06-16-night-reading-sourced.md): short-wavelength (blue) light drives the circadian/eye-fatigue response (melanopsin/ipRGC); warm 2700-3000K cuts blue; sRGB display white = 6500K (bluish). The night win = LESS BLUE, by composition -- not merely darkness. Negative controls prove the metric measures blue, not dark. KAT order in the store (positional rows): 0 light, 1 sepia, 2 dark, 3 night, 4 black, 5 coolnight(neg). expect_exit: 0 (all assertions green) license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_native_config.nx nx_night_grade.nx

imports: nx_syscalls.nxnx_native_config.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap ng_load sys_mmap ↻ ng_fresh_prefix sys_now_ms sys_mmap ↻ sys_clock_gettime_mono sys_mmap ↻ ng_seed ncfg_begin ss_begin ss_begin_cap sys_mmap ↻ ng_row sys_mmap ↻ ncfg_add_row sys_mmap ↻ canon_encode sys_mmap ↻ cc_cmp cc_w32 cc_len sys_munmap ncfg_key ss_add ss_add2 ss_len ncfg_set_count sys_mmap ↻ ncfg_count_key ncfg_itoa sys_mmap ↻ ss_add ↻ ncfg_commit ss_commit ss_segid_ok sys_mmap ↻ ss_cat ss_catn

structs

none

consts

none

functions

26func ng_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 3: ng_assertng_loadmain calls 1: sys_write
27func ng_putn(v: i64) -> i64
called by 2: ng_loadmain calls 2: sys_mmapsys_write
35func ng_assert(label: *u8, cond: i64) -> i64
called by 1: main calls 1: ng_puts
40func ng_atoi(s: *u8) -> i64
called by 1: ng_load
52func ng_fresh_prefix(out: *u8, base: *u8) -> i64
called by 1: ng_load calls 2: sys_now_mssys_mmap
67func ng_row(w: *i64, idx: i64, nm: *u8, v0: *u8, v1: *u8, v2: *u8, v3: *u8, v4: *u8, v5: *u8, kind: *u8) -> i64
called by 1: ng_seed calls 2: sys_mmapncfg_add_row
81func ng_seed(prefix: *u8) -> i64
93func ng_load(ints: *i64) -> i64
121func main() -> i64