code wiki / (root) / nx_arousal_skin_gate.nx

nx_arousal_skin_gate.nx source

↩ module page · 160 lines · 10097 B

1// nx_arousal_skin_gate.nx -- liar-killed GATE for the skin optics AND the LOOK organ. 2// 3// Load-bearing teeth: 4// SPECTRAL R preserved while G/B collapse -> R:G RISES with perfusion (why flush reads red) 5// PROPAGATION different sites at the SAME perfusion give DIFFERENT colour AND different onset time 6// TEMPORAL onset x must be STRICTLY INCREASING across surface sites -- the staircase you can see 7// in the render is asserted here as numbers, from the same pass that drew it 8// MORPHOLOGY nipple apparent projection peaks EARLY (myotonic ~6s) then is masked by slow areolar 9// engorgement -- non-monotonic, like systolic peaking at plateau rather than orgasm 10// BEER-LAMBERT no channel is ever destroyed (regression guard against linear subtraction) 11// 12// Tooth total is DERIVED; G_MIN_TEETH is a floor so a deleted tooth trips RED. 13// usage: nx_arousal_skin_gate [skin_elf] [render_elf] 14// license_tier: ORIGINAL expect_exit: 0 15import "nx_syscalls.nx" 16 17const G_OUTCAP: i64 = 16384 18const G_MIN_TEETH: i64 = 24 19 20func g_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 21func g_putn(v: i64) -> i64 { 22 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 } 23 var m: i64 = v 24 let d: *u8 = sys_mmap(24); var k: i64 = 0 25 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 26 let o: *u8 = sys_mmap(24); var w: i64 = 0 27 while w < k { o[w] = d[k-1-w]; w = w + 1 } 28 sys_write(1, o, k) 29 sys_munmap(d, 24); sys_munmap(o, 24) 30 return 0 31} 32func g_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 33func g_bool(name: *u8, got: i64, want: i64, passp: *i64) -> i64 { 34 passp[1] = passp[1] + 1 35 g_puts("T " as *u8); g_puts(name); g_puts(" got=" as *u8); g_putn(got) 36 if got == want { g_puts(" PASS\n" as *u8); passp[0] = passp[0] + 1 } else { g_puts(" FAIL\n" as *u8) } 37 return 0 38} 39func g_has(hay: *u8, hn: i64, needle: *u8) -> i64 { 40 let nl: i64 = g_slen(needle) 41 if nl == 0 { return 0 } 42 var i: i64 = 0 43 while i + nl <= hn { var k: i64 = 0; var ok: i64 = 1; while k < nl { if hay[i+k] != needle[k] { ok = 0; k = nl } k = k + 1 } if ok == 1 { return 1 } i = i + 1 } 44 return 0 45} 46func g_run(elf: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, a5: *u8, out: *u8, cap: i64) -> i64 { 47 let pb: *i64 = sys_mmap(16) as *i64 48 sys_pipe2(pb, 0) 49 let rfd: i64 = pb[0] & 0xFFFFFFFF 50 let wfd: i64 = (pb[0] >> 32) & 0xFFFFFFFF 51 let pid: i64 = sys_fork() 52 if pid == 0 { 53 sys_dup3(wfd, 1, 0) 54 sys_close(rfd); sys_close(wfd) 55 let av: *i64 = sys_mmap(80) as *i64 56 av[0] = elf as i64 57 var ac: i64 = 1 58 if a1 as i64 != 0 { av[ac] = a1 as i64; ac = ac + 1 } 59 if a2 as i64 != 0 { av[ac] = a2 as i64; ac = ac + 1 } 60 if a3 as i64 != 0 { av[ac] = a3 as i64; ac = ac + 1 } 61 if a4 as i64 != 0 { av[ac] = a4 as i64; ac = ac + 1 } 62 if a5 as i64 != 0 { av[ac] = a5 as i64; ac = ac + 1 } 63 av[ac] = 0 64 sys_execve(elf, av, 0 as *i64) 65 sys_exit(127) 66 } 67 sys_close(wfd) 68 var tot: i64 = 0 69 var n: i64 = sys_read(rfd, out, cap - 1) 70 while n > 0 { tot = tot + n; if tot >= cap - 1 { n = 0 } else { n = sys_read(rfd, (out as i64 + tot) as *u8, cap - 1 - tot) } } 71 sys_close(rfd) 72 let st: *i64 = sys_mmap(16) as *i64 73 sys_wait4(pid, st, 0) 74 out[tot] = 0 as u8 75 return tot 76} 77 78func main(argc: i64, argv: *i64) -> i64 { 79 var elf: *u8 = "_build/nx_arousal_skin.sov.elf" as *u8 80 if argc >= 2 { elf = argv[1] as *u8 } 81 var relf: *u8 = "_build/nx_arousal_render.sov.elf" as *u8 82 if argc >= 3 { relf = argv[2] as *u8 } 83 let pass: *i64 = sys_mmap(16) as *i64 84 pass[0] = 0 85 pass[1] = 0 86 let out: *u8 = sys_mmap(G_OUTCAP) 87 var n: i64 = 0 88 89 // --- perfusion ramp on torso, melanin 200 --------------------------------------------------- 90 n = g_run(elf, "skin" as *u8, "2" as *u8, "300" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 91 g_bool("hb-low-perfusion-330" as *u8, g_has(out, n, "hb=330" as *u8), 1, pass) 92 g_bool("redness-low-rg1270" as *u8, g_has(out, n, "rg=1270" as *u8), 1, pass) 93 g_bool("no-flush-below-site-threshold" as *u8, g_has(out, n, "flush=0" as *u8), 1, pass) 94 95 n = g_run(elf, "skin" as *u8, "2" as *u8, "900" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 96 // flush now FEEDS the hemoglobin term -- before that fix every surface site rendered identically 97 g_bool("flush-raises-hb-to-904" as *u8, g_has(out, n, "hb=904" as *u8), 1, pass) 98 g_bool("soret-signature-r861-g480" as *u8, g_has(out, n, "r=861 g=480" as *u8), 1, pass) 99 g_bool("redness-high-rg1793" as *u8, g_has(out, n, "rg=1793" as *u8), 1, pass) 100 g_bool("NEG-redness-is-not-flat" as *u8, g_has(out, n, "rg=1270" as *u8), 0, pass) 101 g_bool("flush-fires-above-threshold-714" as *u8, g_has(out, n, "flush=714" as *u8), 1, pass) 102 103 // --- site propagation: SAME perfusion, DIFFERENT site -> DIFFERENT colour -------------------- 104 n = g_run(elf, "skin" as *u8, "0" as *u8, "700" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 105 g_bool("submammary-flushes-first-333" as *u8, g_has(out, n, "flush=333" as *u8), 1, pass) 106 g_bool("submammary-colour-hb669" as *u8, g_has(out, n, "hb=669" as *u8), 1, pass) 107 n = g_run(elf, "skin" as *u8, "4" as *u8, "700" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 108 g_bool("extremities-last-no-flush-at-700" as *u8, g_has(out, n, "flush=0" as *u8), 1, pass) 109 // THE DEFECT THE RENDER FOUND: before flush fed the colour, both sites read hb=570 -- pixel 110 // identical -- so the whole propagation map was VISUALLY INERT. It must not read 669 here. 111 g_bool("NEG-extremities-colour-differs-from-submammary" as *u8, g_has(out, n, "hb=669" as *u8), 0, pass) 112 n = g_run(elf, "skin" as *u8, "5" as *u8, "700" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 113 g_bool("genital-gain-local-perf-980" as *u8, g_has(out, n, "local_perf=980" as *u8), 1, pass) 114 115 // --- melanin + Beer-Lambert no-destroyed-channel regression guard ---------------------------- 116 n = g_run(elf, "skin" as *u8, "2" as *u8, "900" as *u8, "700" as *u8, 0 as *u8, out, G_OUTCAP) 117 g_bool("melanin-darkens-red-to-741" as *u8, g_has(out, n, "r=741" as *u8), 1, pass) 118 g_bool("NEG-melanin-does-not-preserve-r861" as *u8, g_has(out, n, "r=861" as *u8), 0, pass) 119 g_bool("blue-survives-high-melanin-271" as *u8, g_has(out, n, "b=271" as *u8), 1, pass) 120 g_bool("NEG-blue-does-not-saturate-to-0" as *u8, g_has(out, n, "b=0" as *u8), 0, pass) 121 n = g_run(elf, "skin" as *u8, "2" as *u8, "1000" as *u8, "1000" as *u8, 0 as *u8, out, G_OUTCAP) 122 g_bool("extreme-case-preserves-all-channels" as *u8, g_has(out, n, "r=671 g=301 b=202" as *u8), 1, pass) 123 g_bool("NEG-extreme-case-destroys-no-channel" as *u8, g_has(out, n, "b=0" as *u8), 0, pass) 124 125 // --- THE LOOK ORGAN: temporal propagation, asserted as numbers from the drawing pass --------- 126 n = g_run(relf, "_scratch/gate_render.png" as *u8, "1" as *u8, "900" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 127 // header(30) + 6 bands(40) + morph(60) + genital(40) + drive(40) + axis(24) = 434, gutter 120 128 g_bool("render-emits-labelled-860x434" as *u8, g_has(out, n, "w=860 h=434" as *u8), 1, pass) 129 // THE STAIRCASE, in MILLISECONDS (a pixel index is meaningless outside one canvas size and 130 // changes silently on resize -- which is exactly what happened when the gutter was added). 131 g_bool("onset-staircase-200s-233s-272s-319s-468s" as *u8, g_has(out, n, "onset_0=199729 onset_1=232611 onset_2=271583 onset_3=319079 onset_4=467658" as *u8), 1, pass) 132 // genital leads everything (lower threshold 400 AND 1.4x gain) -- ~82 s 133 g_bool("genital-onset-leads-at-82s" as *u8, g_has(out, n, "onset_5=81596" as *u8), 1, pass) 134 // NEG: a site-blind model would fire every onset at the same instant. 135 g_bool("NEG-onsets-are-not-simultaneous" as *u8, g_has(out, n, "onset_0=199729 onset_1=199729" as *u8), 0, pass) 136 // MORPHOLOGY: myotonic nipple response peaks EARLY (x=19 of 720 = ~24s), long before the slow 137 // vascular envelope saturates -- then areolar engorgement masks it and projection DECLINES. 138 g_bool("nipple-peak-is-early-x19" as *u8, g_has(out, n, "nip_peak_x=19" as *u8), 1, pass) 139 // MALE render: the male slow-vascular tau (185s) is FASTER than the female (210s), so every 140 // onset must land EARLIER on the same drive. Cross-sex discrimination on the same code path. 141 n = g_run(relf, "_scratch/gate_render_m.png" as *u8, "0" as *u8, "900" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 142 g_bool("male-onsets-earlier-177s-206s-239s" as *u8, g_has(out, n, "onset_0=176589 onset_1=205818 onset_2=238700" as *u8), 1, pass) 143 g_bool("NEG-male-onsets-are-not-female-onsets" as *u8, g_has(out, n, "onset_0=199729" as *u8), 0, pass) 144 // TIME-VARYING TRACK: an inhibition event must DELAY onsets that had not yet fired, and leave 145 // onsets that already fired untouched. 146 n = g_run(relf, "_scratch/gate_render_i.png" as *u8, "1" as *u8, "900" as *u8, "200" as *u8, "1000" as *u8, out, G_OUTCAP) 147 g_bool("track-arg-absent-gives-step-onsets" as *u8, g_has(out, n, "track_pts=0 " as *u8), 1, pass) 148 149 // --- refusals ------------------------------------------------------------------------------- 150 n = g_run(elf, "skin" as *u8, "9" as *u8, "500" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 151 g_bool("refuses-bad-site" as *u8, g_has(out, n, "REFUSED reason=bad_site" as *u8), 1, pass) 152 n = g_run(elf, "skin" as *u8, "2" as *u8, "5000" as *u8, "200" as *u8, 0 as *u8, out, G_OUTCAP) 153 g_bool("refuses-perfusion-out-of-range" as *u8, g_has(out, n, "REFUSED reason=perfusion_out_of_range" as *u8), 1, pass) 154 155 g_puts("AROUSAL-SKIN-GATE pass=" as *u8); g_putn(pass[0]); g_puts("/" as *u8); g_putn(pass[1]); g_puts(" verdict=" as *u8) 156 if pass[1] < G_MIN_TEETH { g_puts("RED reason=teeth_deleted\n" as *u8); return 1 } 157 if pass[0] == pass[1] { g_puts("GREEN\n" as *u8); return 0 } 158 g_puts("RED\n" as *u8) 159 return 1 160}