code wiki / (root) / nx_debt_triple.nx

nx_debt_triple.nx source

↩ module page · 478 lines · 20193 B

1// nx_debt_triple.nx -- THE FEEDER THE SOVEREIGN RANKER LACKS. It maps every OPEN debt row to the 2// (value, momentum, cost) triple nx_dr_ocm consumes, and it holds the position->row_id map that the 3// ranker itself does not carry. Built 2026-09-03 to retire a break-glass laptop script: the ranking 4// DECISION was already sovereign, the feature extraction was not, so the ordering was not reproducible 5// without one seat's scratchpad. 6// 7// WHY A FEEDER AT ALL, AND WHY NOT SEVERITY. Severity on this board is a SELF-DECLARED argv byte, 8// validated only for the range '1'..'9' -- no derivation anywhere. Measured over the board 2026-09-03, 9// eaten-share by declared severity is FLAT AND NON-MONOTONIC across sev4..sev8 (205, 219, 416, 300, 328 10// permil) which is 2588 of 2846 open rows = 909 permil of the population, separating only at sev9. 11// A severity-ranked drain therefore produces a CONFIDENT MEANINGLESS ORDER. This organ never reads it. 12// 13// THE FEATURES ARE COUNTS OF OTHER ROWS, i.e. investigation cost other seats have ALREADY PAID: 14// VALUE = 1 + min(lane_rows,DT_CLAMP) + min(organ_reach,DT_CLAMP) 15// lane_rows = open rows sharing this row's first scope path segment 16// organ_reach= open rows naming the same nx_ organ this row names 17// MOMENTUM = freshness bucket of the LANE's newest row id (ids are epochs): <=7d 7, <=30d 5, <=60d 3, else 1 18// COST = DT_COST_BASE, minus DT_CHEAP_STEP per self-carried remedy marker (a row that names its own 19// fix is cheap to work), plus DT_DEAR_STEP per expense marker, clamped to [1,DT_CLAMP] 20// 21// ★THE SATURATION GUARD IS THE POINT, AND IT WAS EARNED THE HARD WAY. A first cut of this feeder split 22// the scope on '_' so every nx_* scope collapsed to the token "nx": lane_rows read 147 on nearly every 23// row and momentum then sat at ONE VALUE for 830 permil of the board. A RANKER FED A SATURATED FEATURE 24// RETURNS A CONFIDENT ORDER BUILT ON NOISE, and nothing downstream can tell. So this organ MEASURES each 25// feature's mode share and REFUSES to emit ranker arguments when any feature ties a strict majority. 26// THE BAR IS DERIVED, NOT PICKED: at >500 permil one value holds more than half the population, so the 27// feature cannot order a majority against itself. That is a property of ordering, not a taste. 28// 29// nx_debt_triple emit [debt-prefix] -> one TSV row per open debt + saturation + envelope 30// nx_debt_triple args <budget> <n> [debt-prefix] -> "<budget> v m c ..." for nx_dr_ocm, + the pos->id map 31// nx_debt_triple selftest -> teeth, exit 0 GREEN / 1 RED 32// Exit: 0 ok | 1 SATURATED (args refused) | 2 usage | 3 UNREADABLE plane. verdict= is the last token. 33// license_tier: ORIGINAL. Reads the debt plane and writes only stdout. No hw writes (Rule 26). 34import "nx_syscalls.nx" 35import "nx_rowparse_lib.nx" 36import "nx_store_seed_lib.nx" 37 38const DT_EXIT_OK: i64 = 0 39const DT_EXIT_SAT: i64 = 1 40const DT_EXIT_USAGE: i64 = 2 41const DT_EXIT_UNREAD: i64 = 3 42const DT_SPAN: i64 = 8 43const DT_OUT: i64 = 1048576 44const DT_MAXROWS: i64 = 8192 45const DT_TAB: i64 = 9 46const DT_NL: i64 = 10 47const DT_CLAMP: i64 = 40 48const DT_COST_BASE: i64 = 10 49const DT_CHEAP_STEP: i64 = 2 50const DT_DEAR_STEP: i64 = 4 51const DT_COST_MIN: i64 = 1 52// A strict majority tied on one value: the feature cannot order that majority against itself. 53const DT_SAT_PERMIL: i64 = 500 54const DT_PERMIL: i64 = 1000 55const DT_DAY: i64 = 86400 56const DT_M_FRESH: i64 = 7 57const DT_M_WARM: i64 = 5 58const DT_M_COOL: i64 = 3 59const DT_M_COLD: i64 = 1 60const DT_D_FRESH: i64 = 7 61const DT_D_WARM: i64 = 30 62const DT_D_COOL: i64 = 60 63const DT_STATE_COL: i64 = 3 64const DT_SCOPE_COL: i64 = 5 65const DT_BIGPOP: i64 = 500 66const DT_BIGPOP_STEP: i64 = 3 67 68// span of TAB column `col` (0-based) inside [s,e); returns 1 and fills out[0]=start out[1]=len 69// case-insensitive literal search inside [s,e) 70func dt_find_ci(b: *u8, s: i64, e: i64, lit: *u8) -> i64 { 71 let n: i64 = rp_slen(lit) 72 if n == 0 { return 0 - 1 } 73 var i: i64 = s 74 while i + n <= e { 75 var k: i64 = 0 76 var ok: i64 = 1 77 while k < n { 78 var c: i64 = b[i+k] as i64 79 if c > 64 { if c < 91 { c = c + 32 } } 80 var d: i64 = lit[k] as i64 81 if d > 64 { if d < 91 { d = d + 32 } } 82 if c != d { ok = 0; k = n } else { k = k + 1 } 83 } 84 if ok == 1 { return i } 85 i = i + 1 86 } 87 return 0 - 1 88} 89// first path segment of the scope span, as a lane key: [s,e) up to '/' or ' ' 90func dt_lane_end(b: *u8, s: i64, l: i64) -> i64 { 91 var i: i64 = 0 92 while i < l { 93 let c: i64 = b[s+i] as i64 94 if c == 47 { return i } 95 if c == 32 { return i } 96 i = i + 1 97 } 98 return l 99} 100func dt_lane_eq(b: *u8, a_s: i64, a_l: i64, c_s: i64, c_l: i64) -> i64 { 101 if a_l != c_l { return 0 } 102 var i: i64 = 0 103 while i < a_l { 104 if b[a_s+i] != b[c_s+i] { return 0 } 105 i = i + 1 106 } 107 return 1 108} 109 110// first nx_ organ token inside [s,e): fills out[0]=start out[1]=len, returns 1 on hit 111func dt_organ(b: *u8, s: i64, e: i64, out: *i64) -> i64 { 112 let p: i64 = dt_find_ci(b, s, e, "nx_" as *u8) 113 if p < 0 { return 0 } 114 var end: i64 = p 115 while end < e { 116 let c2: i64 = b[end] as i64 117 var ok2: i64 = 0 118 if c2 > 96 { if c2 < 123 { ok2 = 1 } } 119 if c2 > 47 { if c2 < 58 { ok2 = 1 } } 120 if c2 == 95 { ok2 = 1 } 121 if ok2 == 0 { end = e } else { end = end + 1 } 122 } 123 out[0] = p 124 out[1] = end - p 125 if out[1] < 4 { return 0 } 126 return 1 127} 128// COST from the row's own text. A row that names its own remedy is cheap; one naming an operator, 129// a block, a campaign or a 500+ population is dear. Every marker is declared here, none is inferred. 130func dt_cost(b: *u8, s: i64, e: i64) -> i64 { 131 var c: i64 = DT_COST_BASE 132 if dt_find_ci(b, s, e, "FIX:" as *u8) >= 0 { c = c - DT_CHEAP_STEP } 133 if dt_find_ci(b, s, e, "REMEDY:" as *u8) >= 0 { c = c - DT_CHEAP_STEP } 134 if dt_find_ci(b, s, e, "DONE WHEN" as *u8) >= 0 { c = c - DT_CHEAP_STEP } 135 if dt_find_ci(b, s, e, "REPRODUCE" as *u8) >= 0 { c = c - DT_CHEAP_STEP } 136 if dt_find_ci(b, s, e, "NEXT STEP" as *u8) >= 0 { c = c - DT_CHEAP_STEP } 137 if dt_find_ci(b, s, e, "BLOCKED" as *u8) >= 0 { c = c + DT_DEAR_STEP } 138 if dt_find_ci(b, s, e, "OPERATOR" as *u8) >= 0 { c = c + DT_DEAR_STEP } 139 if dt_find_ci(b, s, e, "AWAITING" as *u8) >= 0 { c = c + DT_DEAR_STEP } 140 if dt_find_ci(b, s, e, "CAMPAIGN" as *u8) >= 0 { c = c + DT_DEAR_STEP } 141 if dt_find_ci(b, s, e, "estate-wide" as *u8) >= 0 { c = c + DT_DEAR_STEP } 142 if dt_find_ci(b, s, e, "fleet-wide" as *u8) >= 0 { c = c + DT_DEAR_STEP } 143 // a row quoting a population of DT_BIGPOP or more is describing a campaign, not an edit 144 var i: i64 = s 145 var big: i64 = 0 146 while i < e { 147 let c0: i64 = b[i] as i64 148 if c0 > 47 { if c0 < 58 { 149 var v: i64 = 0 150 var k: i64 = i 151 while k < e { 152 let c1: i64 = b[k] as i64 153 if c1 < 48 { k = e } else { if c1 > 57 { k = e } else { v = v * 10 + (c1 - 48); k = k + 1 } } 154 if v > 999999 { k = e } 155 } 156 if v >= DT_BIGPOP { big = 1 } 157 while i < e { let c3: i64 = b[i] as i64; if c3 < 48 { i = e } else { if c3 > 57 { i = e } else { i = i + 1 } } } 158 } } 159 i = i + 1 160 } 161 if big == 1 { c = c + DT_BIGPOP_STEP } 162 if c < DT_COST_MIN { c = DT_COST_MIN } 163 if c > DT_CLAMP { c = DT_CLAMP } 164 return c 165} 166// mode share in permil of an i64 column over n entries -- the saturation measurement 167func dt_mode_permil(a: *i64, n: i64) -> i64 { 168 if n <= 0 { return DT_PERMIL } 169 var best: i64 = 0 170 var i: i64 = 0 171 while i < n { 172 var k: i64 = 0 173 var cnt: i64 = 0 174 while k < n { 175 if a[k] == a[i] { cnt = cnt + 1 } 176 k = k + 1 177 } 178 if cnt > best { best = cnt } 179 i = i + 1 180 } 181 return (best * DT_PERMIL) / n 182} 183 184func main(argc: i64, argv: **u8) -> i64 { 185 var mode: i64 = 0 - 1 186 if argc > 1 { 187 if rp_lit_eq(argv[1] as *u8, 0, rp_slen(argv[1] as *u8), "emit" as *u8) == 1 { mode = 0 } 188 if rp_lit_eq(argv[1] as *u8, 0, rp_slen(argv[1] as *u8), "args" as *u8) == 1 { mode = 1 } 189 if rp_lit_eq(argv[1] as *u8, 0, rp_slen(argv[1] as *u8), "selftest" as *u8) == 1 { mode = 2 } 190 } 191 if mode < 0 { 192 sys_write(2, "usage: nx_debt_triple {emit [debt-prefix] | args <budget> <n> [debt-prefix] | selftest}\n" as *u8, 87) 193 sys_exit(DT_EXIT_USAGE) 194 return DT_EXIT_USAGE 195 } 196 var prefix: *u8 = "knowledge/store/debt-" as *u8 197 var budget: i64 = 60 198 var want: i64 = 40 199 if mode == 0 { if argc > 2 { prefix = argv[2] as *u8 } } 200 if mode == 1 { 201 if argc > 2 { budget = rp_num(argv[2] as *u8, 0, rp_slen(argv[2] as *u8)) } 202 if argc > 3 { want = rp_num(argv[3] as *u8, 0, rp_slen(argv[3] as *u8)) } 203 if argc > 4 { prefix = argv[4] as *u8 } 204 } 205 let out: *u8 = sys_mmap(DT_OUT) 206 var o: i64 = 0 207 if mode == 2 { 208 var pass: i64 = 0 209 var tot: i64 = 0 210 let fx: *u8 = sys_mmap(4096) 211 var fn: i64 = 0 212 fn = rp_put(fx, fn, "1788000000\t7\tnishihost/edge\topen\tROW ONE FIX: one line\n" as *u8) 213 let c1: *i64 = sys_mmap(DT_SPAN * 2) as *i64 214 let eA: i64 = rp_le(fx, 0, fn) 215 tot = tot + 1 216 if rp_col_tab(fx, 0, eA, 0, c1) == 1 { if rp_num(fx, c1[0], c1[1]) == 1788000000 { pass = pass + 1 } } 217 tot = tot + 1 218 if rp_col_tab(fx, 0, eA, 2, c1) == 1 { if rp_lit_eq(fx, c1[0], c1[1], "nishihost/edge" as *u8) == 1 { pass = pass + 1 } } 219 tot = tot + 1 220 if dt_lane_end(fx, c1[0], c1[1]) == 9 { pass = pass + 1 } 221 tot = tot + 1 222 if rp_col_tab(fx, 0, eA, 4, c1) == 1 { if dt_cost(fx, c1[0], eA) < DT_COST_BASE { pass = pass + 1 } } 223 let gx: *u8 = sys_mmap(4096) 224 var gn: i64 = 0 225 gn = rp_put(gx, gn, "1788000001\t7\tops\topen\tROW TWO BLOCKED on the OPERATOR\n" as *u8) 226 let eB: i64 = rp_le(gx, 0, gn) 227 tot = tot + 1 228 let c2: *i64 = sys_mmap(DT_SPAN * 2) as *i64 229 if rp_col_tab(gx, 0, eB, 4, c2) == 1 { if dt_cost(gx, c2[0], eB) > DT_COST_BASE { pass = pass + 1 } } 230 tot = tot + 1 231 if dt_cost(gx, c2[0], eB) <= DT_CLAMP { if dt_cost(fx, c1[0], eA) >= DT_COST_MIN { pass = pass + 1 } } 232 let sa: *i64 = sys_mmap(DT_SPAN * 4) as *i64 233 sa[0] = 5 234 sa[1] = 5 235 sa[2] = 5 236 sa[3] = 5 237 tot = tot + 1 238 if dt_mode_permil(sa, 4) == DT_PERMIL { pass = pass + 1 } 239 tot = tot + 1 240 if dt_mode_permil(sa, 4) > DT_SAT_PERMIL { pass = pass + 1 } 241 sa[2] = 6 242 sa[3] = 6 243 tot = tot + 1 244 if dt_mode_permil(sa, 4) == DT_SAT_PERMIL { pass = pass + 1 } 245 tot = tot + 1 246 if dt_mode_permil(sa, 4) > DT_SAT_PERMIL { } else { pass = pass + 1 } 247 tot = tot + 1 248 let cA: i64 = dt_cost(fx, c1[0], eA) 249 fx[11] = 57 as u8 250 if dt_cost(fx, c1[0], eA) == cA { pass = pass + 1 } 251 o = rp_put(out, o, "NX-DEBT-TRIPLE-SELFTEST passed " as *u8) 252 o = rp_putn(out, o, pass) 253 o = rp_put(out, o, "/" as *u8) 254 o = rp_putn(out, o, tot) 255 if pass == tot { o = rp_put(out, o, " verdict=GREEN\n" as *u8) } else { o = rp_put(out, o, " verdict=RED\n" as *u8) } 256 sys_write(1, out, o) 257 if pass == tot { sys_exit(DT_EXIT_OK); return DT_EXIT_OK } 258 sys_exit(1) 259 return 1 260 } 261 let dlen: *i64 = sys_mmap(DT_SPAN) as *i64 262 let buf: *u8 = sts_load_fit(prefix, dlen) 263 var n: i64 = dlen[0] 264 if (buf as i64) == 0 { n = 0 } 265 if n <= 0 { 266 sys_write(2, "NX-DEBT-TRIPLE UNREADABLE: the debt plane loaded 0 bytes -- no triple is emitted from nothing\n" as *u8, 93) 267 sys_exit(DT_EXIT_UNREAD) 268 return DT_EXIT_UNREAD 269 } 270 let rid: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 271 let rs: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 272 let re: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 273 let ls: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 274 let ll: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 275 let osx: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 276 let ol: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 277 let vv: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 278 let mm: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 279 let cc: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 280 let ds: *i64 = sys_mmap(DT_SPAN * DT_MAXROWS) as *i64 281 let cs: *i64 = sys_mmap(DT_SPAN * 2) as *i64 282 var k: i64 = 0 283 var i: i64 = 0 284 var scanned: i64 = 0 285 var capped: i64 = 0 286 while i < n { 287 let e: i64 = rp_le(buf, i, n) 288 scanned = scanned + 1 289 if k < DT_MAXROWS { 290 if rp_col_tab(buf, i, e, DT_STATE_COL, cs) == 1 { 291 if rp_lit_eq(buf, cs[0], cs[1], "open" as *u8) == 1 { 292 // THE ROW ID IS THE SECOND TOKEN OF COLUMN 0, after a space: the plane stores 293 // "<idx> <epoch-id>". Reading column 1 instead yielded the SEVERITY on one row 294 // shape and a title on the other, so every id was a small number, every age was 295 // astronomical and momentum collapsed to one bucket for the whole board. The 296 // saturation guard REFUSED on exactly that, which is how this was found. 297 var idv: i64 = 0 298 if rp_col_tab(buf, i, e, 0, cs) == 1 { 299 let c0s: i64 = cs[0] 300 let c0e: i64 = cs[0] + cs[1] 301 var sp: i64 = 0 - 1 302 var q: i64 = c0s 303 while q < c0e { 304 if buf[q] == (32 as u8) { if sp < 0 { sp = q } } 305 q = q + 1 306 } 307 if sp < 0 { idv = rp_num(buf, c0s, c0e - c0s) } else { idv = rp_num(buf, sp + 1, c0e - sp - 1) } 308 } 309 var sc_s: i64 = i 310 var sc_l: i64 = 0 311 if rp_col_tab(buf, i, e, DT_SCOPE_COL, cs) == 1 { sc_s = cs[0]; sc_l = cs[1] } 312 if sc_l == 0 { if rp_col_tab(buf, i, e, 2, cs) == 1 { sc_s = cs[0]; sc_l = cs[1] } } 313 rid[k] = idv 314 rs[k] = i 315 re[k] = e 316 ls[k] = sc_s 317 ll[k] = dt_lane_end(buf, sc_s, sc_l) 318 var d_s: i64 = i 319 if rp_col_tab(buf, i, e, 4, cs) == 1 { d_s = cs[0] } 320 ds[k] = d_s 321 if dt_organ(buf, i, e, cs) == 1 { osx[k] = cs[0]; ol[k] = cs[1] } else { osx[k] = 0; ol[k] = 0 } 322 k = k + 1 323 } 324 } 325 } else { capped = 1 } 326 i = e + 1 327 } 328 let now: i64 = sys_now_realtime_sec() 329 var a: i64 = 0 330 while a < k { 331 var lane_rows: i64 = 0 332 var newest: i64 = 0 333 var reach: i64 = 0 334 var b2: i64 = 0 335 while b2 < k { 336 if dt_lane_eq(buf, ls[a], ll[a], ls[b2], ll[b2]) == 1 { 337 lane_rows = lane_rows + 1 338 if rid[b2] > newest { newest = rid[b2] } 339 } 340 if ol[a] > 0 { if ol[b2] == ol[a] { if dt_lane_eq(buf, osx[a], ol[a], osx[b2], ol[b2]) == 1 { reach = reach + 1 } } } 341 b2 = b2 + 1 342 } 343 var vc: i64 = lane_rows 344 if vc > DT_CLAMP { vc = DT_CLAMP } 345 var rc: i64 = reach 346 if rc > DT_CLAMP { rc = DT_CLAMP } 347 vv[a] = 1 + vc + rc 348 let age: i64 = (now - newest) / DT_DAY 349 var mv: i64 = DT_M_COLD 350 if age <= DT_D_COOL { mv = DT_M_COOL } 351 if age <= DT_D_WARM { mv = DT_M_WARM } 352 if age <= DT_D_FRESH { mv = DT_M_FRESH } 353 mm[a] = mv 354 cc[a] = dt_cost(buf, ds[a], re[a]) 355 a = a + 1 356 } 357 let pv: i64 = dt_mode_permil(vv, k) 358 let pm: i64 = dt_mode_permil(mm, k) 359 let pc: i64 = dt_mode_permil(cc, k) 360 var sat: i64 = 0 361 if pv > DT_SAT_PERMIL { sat = 1 } 362 if pm > DT_SAT_PERMIL { sat = 1 } 363 if pc > DT_SAT_PERMIL { sat = 1 } 364 if mode == 0 { 365 var z: i64 = 0 366 while z < k { 367 o = rp_putn(out, o, rid[z]) 368 out[o] = DT_TAB as u8 369 o = o + 1 370 o = rp_putn(out, o, vv[z]) 371 out[o] = DT_TAB as u8 372 o = o + 1 373 o = rp_putn(out, o, mm[z]) 374 out[o] = DT_TAB as u8 375 o = o + 1 376 o = rp_putn(out, o, cc[z]) 377 out[o] = DT_TAB as u8 378 o = o + 1 379 o = rp_putspan(out, o, buf, ls[z], ll[z]) 380 out[o] = DT_NL as u8 381 o = o + 1 382 if o > DT_OUT - 4096 { z = k } else { z = z + 1 } 383 } 384 } 385 if mode == 1 { 386 if sat == 1 { 387 o = rp_put(out, o, "NX-DEBT-TRIPLE REFUSED-SATURATED: a feature ties a strict majority, so the ranker would return a confident order built on noise. mode_permil v=" as *u8) 388 o = rp_putn(out, o, pv) 389 o = rp_put(out, o, " m=" as *u8) 390 o = rp_putn(out, o, pm) 391 o = rp_put(out, o, " c=" as *u8) 392 o = rp_putn(out, o, pc) 393 o = rp_put(out, o, " bar=" as *u8) 394 o = rp_putn(out, o, DT_SAT_PERMIL) 395 o = rp_put(out, o, "\nverdict=SATURATED\n" as *u8) 396 sys_write(1, out, o) 397 sys_exit(DT_EXIT_SAT) 398 return DT_EXIT_SAT 399 } 400 var sel: i64 = 0 401 while sel < want { 402 if sel >= k { sel = want } else { 403 var bi: i64 = sel 404 var bs: i64 = 0 - 1 405 var t: i64 = sel 406 while t < k { 407 let sc: i64 = (vv[t] * mm[t]) / cc[t] 408 if sc > bs { bs = sc; bi = t } 409 t = t + 1 410 } 411 let t0: i64 = rid[sel] 412 rid[sel] = rid[bi] 413 rid[bi] = t0 414 let t1: i64 = vv[sel] 415 vv[sel] = vv[bi] 416 vv[bi] = t1 417 let t2: i64 = mm[sel] 418 mm[sel] = mm[bi] 419 mm[bi] = t2 420 let t3: i64 = cc[sel] 421 cc[sel] = cc[bi] 422 cc[bi] = t3 423 sel = sel + 1 424 } 425 } 426 var lim: i64 = want 427 if lim > k { lim = k } 428 o = rp_put(out, o, "ARGS " as *u8) 429 o = rp_putn(out, o, budget) 430 var z2: i64 = 0 431 while z2 < lim { 432 out[o] = 32 as u8 433 o = o + 1 434 o = rp_putn(out, o, vv[z2]) 435 out[o] = 32 as u8 436 o = o + 1 437 o = rp_putn(out, o, mm[z2]) 438 out[o] = 32 as u8 439 o = o + 1 440 o = rp_putn(out, o, cc[z2]) 441 z2 = z2 + 1 442 } 443 o = rp_put(out, o, "\n" as *u8) 444 var z3: i64 = 0 445 while z3 < lim { 446 o = rp_put(out, o, "MAP pos=" as *u8) 447 o = rp_putn(out, o, z3) 448 o = rp_put(out, o, " id=" as *u8) 449 o = rp_putn(out, o, rid[z3]) 450 o = rp_put(out, o, "\n" as *u8) 451 z3 = z3 + 1 452 } 453 } 454 o = rp_put(out, o, "ENVELOPE open_rows=" as *u8) 455 o = rp_putn(out, o, k) 456 o = rp_put(out, o, " lines_scanned=" as *u8) 457 o = rp_putn(out, o, scanned) 458 o = rp_put(out, o, " plane_bytes=" as *u8) 459 o = rp_putn(out, o, n) 460 o = rp_put(out, o, " row_cap=" as *u8) 461 o = rp_putn(out, o, DT_MAXROWS) 462 o = rp_put(out, o, " capped=" as *u8) 463 o = rp_putn(out, o, capped) 464 o = rp_put(out, o, " mode_permil_v=" as *u8) 465 o = rp_putn(out, o, pv) 466 o = rp_put(out, o, " mode_permil_m=" as *u8) 467 o = rp_putn(out, o, pm) 468 o = rp_put(out, o, " mode_permil_c=" as *u8) 469 o = rp_putn(out, o, pc) 470 o = rp_put(out, o, " saturation_bar=" as *u8) 471 o = rp_putn(out, o, DT_SAT_PERMIL) 472 o = rp_put(out, o, " severity_read=0\n" as *u8) 473 if sat == 1 { o = rp_put(out, o, "verdict=SATURATED\n" as *u8) } else { o = rp_put(out, o, "verdict=GREEN\n" as *u8) } 474 sys_write(1, out, o) 475 if sat == 1 { sys_exit(DT_EXIT_SAT); return DT_EXIT_SAT } 476 sys_exit(DT_EXIT_OK) 477 return DT_EXIT_OK 478}