code wiki / (root) / nx_jslogic_census.nx

nx_jslogic_census.nx

buildroot/runtime/nx_jslogic_census.nx

18868 B413 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_jslogic_census.nx -- THE RULER for the JS/HTML-INTEROP-ONLY law (operator standing order 2026-08-12: "we shouldnt be building into the js strings -- nishi os from the first bit up, js and html only as an interop layer for 3rd-party systems"). It measures the AUTHORED JavaScript living inside the page emitter's string literals so the migration into the wasm engine has a number that can only go DOWN (the nx_sov_guard2 / nx_magicratchet ratchet shape). MECHANISM (comments are SKIPPED -- a scanner that reads comments measures the documentation): tokenize the NishiLang source into CODE / //-COMMENT / STRING states (backslash escapes inside strings; REAL newlines inside literals are legal and stay in-string). Literal bytes count only between the literal containing <script> and the literal containing </script> (inclusive), so HTML/CSS chrome outside the script region is never charged. The base64 wasm payload and gpe_num-emitted values are BUFFER emissions, not literals -- data crossing the boundary is lawful and is not counted. DECLARED IMPRECISION: the two boundary literals carry a few bytes of enclosing HTML, so totals are a small UPPER bound on authored JS. CLASSES from knowledge/jslogic_class.conf rows `<fnv64-decimal> <CLASS>` where CLASS is INTEROP (shim: decode/instantiate/blit/input/context plumbing) | LOGIC (game/engine behavior that belongs in the wasm) | SHADER (GLSL display path -- judged separately). A literal whose hash is not in the conf lands in UNKNOWN -- ITS OWN BUCKET, never silently merged; editing a classified literal changes its hash and forces re-classification by construction. usage: nx_jslogic_census check [srcpath] -> census + ratchet vs knowledge/status/jslogic.baseline nx_jslogic_census snapshot [srcpath] -> census + deliberately re-record the baseline nx_jslogic_census rows [srcpath] -> per-literal rows (hash, bytes, class, head) for conf work exit: 0 GREEN (logic+unknown <= baseline) | 1 RED rose vs baseline | 2 usage | 3 unreadable-src Journals every run: knowledge/status/jslogic.jrnl (epoch TAB totals). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_jslogic_census.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main jc_find jc_slen jc_slen ↻ jc_puts sys_write jc_slen ↻ sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close jc_rdint jc_fnv jc_pn sys_write ↻ sys_mmap ↻ sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_openat_append sys_fsync

structs

none

consts

29const JC_MAGIC_1024: i64 = 1024
31const JC_SRC_DEF: *u8 = "buildroot/runtime/nx_game_page_emit.nx"
32const JC_CONF: *u8 = "knowledge/jslogic_class.conf"
33const JC_BASE: *u8 = "knowledge/status/jslogic.baseline"
34const JC_JRNL: *u8 = "knowledge/status/jslogic.jrnl"
35const JC_MAXLIT: i64 = 4096

functions

37func jc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: jc_putsjc_findmain
38func jc_puts(s: *u8) -> i64 { sys_write(1, s, jc_slen(s)); return 0 }
called by 1: main calls 2: sys_writejc_slen
39func jc_pn(v: i64) -> i64
called by 1: main calls 2: sys_writesys_mmap
52func jc_find(hay: *u8, off: i64, n: i64, needle: *u8) -> i64
called by 1: main calls 1: jc_slen
66func jc_fnv(b: *u8, off: i64, len: i64) -> i64
called by 1: main
78func jc_rdint(s: *u8, pos: *i64, n: i64) -> i64
called by 1: main
96func main(argc: i64, argv: *i64) -> i64