code wiki / (root) / nx_garment_twin_gate.nx

nx_garment_twin_gate.nx

buildroot/runtime/nx_garment_twin_gate.nx

9334 B156 linesdepth 11pulls 49 transitivereach 0 importersview sourcekind gate/prooftopic garment
docsdependenciesstructsconstsfunctions

about

nx_garment_twin_gate.nx -- THE GATE FOR THE FLAT-FRONT GARMENT PREVIEW (nx_garment_twin forked for real), 2026-08-24. FIXTURES AT RUNTIME in /tmp/nx_garment_twin_gate/: a 32x32 P6 print (left half pure red, right half pure white) and two confs derived from the estate conf's shape -- one with relief, one with relief_permil=0 (the neg-control: no knit modulation may appear when the relief is zero). Teeth read the DECODED output: canvas dimensions, the fabric outside the chest box reads as (shaded) fabric albedo, the print region is redder than the fabric, ink only darkens (print-region luma below fabric luma), the knit modulation is PRESENT with relief and ABSENT without it (bite). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_img_to_rgb.nx nx_garment_twin_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_img_to_rgb.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ gv_puts ↻ sys_mkdir sys_unlinkat gg_write_print sys_mmap ↻ gg_write_bytes sys_openat_wr sys_write ↻ sys_close gg_write_text gg_write_bytes ↻ gv_check gv_puts ↻ sys_mmap ↻ gg_decode nx_img_to_rgb sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek

structs

none

consts

14const GG_SUBJECT_DEFAULT: *u8 = "nx_garment_twin.elf"
15const GG_DIR: *u8 = "/tmp/nx_garment_twin_gate"
16const GG_PRINT: *u8 = "/tmp/nx_garment_twin_gate/print.ppm"
17const GG_CONF: *u8 = "/tmp/nx_garment_twin_gate/relief.conf"
18const GG_CONF_FLAT: *u8 = "/tmp/nx_garment_twin_gate/flat.conf"
19const GG_OUT: *u8 = "/tmp/nx_garment_twin_gate/out.png"
20const GG_OUT_FLAT: *u8 = "/tmp/nx_garment_twin_gate/outflat.png"
21const GG_MODE_DIR: i64 = 493
22const GG_MODE_0644: i64 = 420
23const GG_CAPTURE_CAP: i64 = 65536
24const GG_ARGV_SLOTS: i64 = 8
25const GG_SLOT: i64 = 8
26const GG_CHANNELS: i64 = 3
27const GG_PW: i64 = 32
28const GG_PH: i64 = 32
29const GG_CODE_MAX: i64 = 255
30const GG_PPM_HDR: *u8 = "P6\n32 32\n255\n"
31const GG_W: i64 = 256 // fixture canvas (the conf rows below)
32const GG_H: i64 = 320
33const GG_FAB: i64 = 246 // fixture fabric albedo (one value for all three channels: a neutral)
34const GG_BOX_X: i64 = 51 // 200 permil of 256
35const GG_BOX_Y: i64 = 80 // 250 permil of 320
36const GG_BOX_W: i64 = 153 // 600 permil of 256
37const GG_PROBE_X: i64 = 8 // a fabric pixel well outside the box
38const GG_PROBE_Y: i64 = 8
39const GG_RUN_LEN: i64 = 24 // a run of fabric pixels: the knit must vary along it when relief is on
40const GG_RED_X_OFF: i64 = 10 // inside the red half of the placed print
41const GG_RED_Y_OFF: i64 = 10
42const GG_SHADE_FLOOR: i64 = 700 // ambient_permil of the fixture conf: fabric never darker than this permil of albedo
43const GG_PERMIL: i64 = 1000
44const GG_EXIT_OK: i64 = 0

functions

46func gg_write_bytes(path: *u8, b: *u8, n: i64) -> i64
54func gg_write_text(path: *u8, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return gg_write_bytes(path, s, n) }
called by 1: main calls 1: gg_write_bytes
55func gg_write_print(path: *u8) -> i64
called by 1: main calls 2: sys_mmapgg_write_bytes
75func gg_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, out: *u8, outlen: *i64) -> i64
called by 1: main calls 2: sys_mmaptr_run_capture
86func gg_decode(path: *u8, wh: *i64) -> *u8
called by 1: main calls 1: nx_img_to_rgb
91func gg_px(rgb: *u8, w: i64, x: i64, y: i64, c: i64) -> i64 { return rgb[(y * w + x) * GG_CHANNELS + c] as i64 }
called by 2: gg_run_spreadmain
93func gg_run_spread(rgb: *u8, w: i64, x0: i64, y: i64, n: i64) -> i64
called by 1: main calls 1: gg_px
101func main(argc: i64, argv: *i64) -> i64