code wiki / (root) / nx_glsl_tokdiff.nx

nx_glsl_tokdiff.nx

buildroot/runtime/nx_glsl_tokdiff.nx

7572 B125 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_glsl_tokdiff.nx -- THE SHADER TOKEN RULER, the program (gameengine S12c accept-rule instrument, 2026-09-05). usage: nx_glsl_tokdiff <a.glsl> <b.glsl> -> THE CANONICAL DIFF (S12c-2): whitespace, comments, numeric spelling, compound assignment, redundant parentheses, multi-declarators, brace-less branches and counted loops normalised (see nx_glsl_tok_lib, THE CANONICAL FORM); exit 0 IDENTICAL / 1 DIFFERS / 2 UNREADABLE (the refusing token is named by byte offset and spelling). shorter_is_prefix=1 is the per-SLICE accept signal of the cast port: an emitted slice is proven when its canonical stream is a prefix of the hand text's, the whole shader when the verdict reads IDENTICAL. nx_glsl_tokdiff raw <a.glsl> <b.glsl> -> the incumbent token-level ruler (no structural normalisation), kept runnable so the canonical form can always be measured against what it replaced. nx_glsl_tokdiff extract <src> <start-marker> <end-marker> <out> [endincl] -> copies the text between the markers (start exclusive; end exclusive, or INCLUSIVE with the endincl word) and UNESCAPES the JS-literal spellings \n \" \\ so a shader embedded in a page emitter's string can be judged as shader text. A backtick right after the start marker (a JS template-literal opener) is skipped, so no caller has to pass a backtick through a launcher (measured 2026-09-05: the argument vanished and the run printed nothing). exit 0 / 2 One ruler (nx_glsl_tok_lib), composed in-process; the gate drives the same lib over planted fixtures in both directions. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 0 importers

nx_glsl_tok_lib.nx nx_glsl_tokdiff.nx

imports: nx_glsl_tok_lib.nx

imported by: nobody (leaf or entry point)

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

main td_streq gt_fputs sys_write gt_slen td_extract gt_fputs ↻ td_find gt_slen ↻ gt_slen ↻ gt_fputn 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_write ↻ td_raw gt_fputs ↻ gt_diff sys_mmap ↻ gt_tokenize gt_isspace gt_isalpha gt_isdigit gt_op2 gt_expand gt_is_compound gt_lvalue_start gt_tok_is

structs

none

consts

22const TD_MODE_0644: i64 = 420
23const C_BSLASH: i64 = 92
24const C_DQUOTE: i64 = 34
25const C_BTICK: i64 = 96
26const C_n: i64 = 110

functions

28func td_streq(a: *u8, b: *u8) -> i64
called by 1: main
34func td_find(buf: *u8, n: i64, from: i64, key: *u8) -> i64
called by 1: td_extract calls 1: gt_slen
47func td_extract(src: *u8, sm: *u8, em: *u8, outp: *u8, endincl: i64) -> i64
called by 1: main calls 4: gt_fputstd_findgt_slengt_fputn
85func td_raw(pa: *u8, pb: *u8) -> i64
called by 1: main calls 3: gt_fputsgt_diffgt_report
99func main(argc: i64, argv: *i64) -> i64