code wiki / (root) / nx_workmix_lib.nx

nx_workmix_lib.nx source

↩ module page · 421 lines · 20910 B

1// nx_workmix_lib.nx -- THE WORK-MIX RULER (ecosystem EC56, 2026-09-17): what LANDED in a window, classed by what it was an 2// investment IN. OPERATOR 2026-09-17: measure and shift our investment, through better and better estate capabilities, 3// towards features, and reduce the rework, enablement and expansion investment that detracts from the goals we set. 4// FEATURE a landed rung whose rungrole is contender or arm; with no rungrole, a rung on a board the class table marks product 5// ENABLEMENT rungrole substrate; with no rungrole, a rung on an operations board. Split by whether a FEATURE rung names it 6// in its deps (it unblocks a feature) or no feature rung does (enablement for its own sake, the class to shrink) 7// REWORK a land row whose rung's newest EARLIER event is a retract (the claim was withdrawn and landed again); retract 8// rows are counted beside it as events of their own. A rung that lands twice is NOT rework by that alone: a 9// land row journals a SLICE, and slices are how a rung is climbed (the close ruler learned this the same day). 10// UNCLASSED everything the data cannot class: no rungrole and no board class, a superseded or malformed role, a board 11// whose plan could not be read. It is its OWN bucket and it is printed: a class the ruler guessed is a lie. 12// the classes PARTITION the land rows of the window (their sum is printed beside the row count). 13// ONE reader of land rows: the events come from the costcal ledger (nx_costest_lib grammar); plans are read only for what the 14// ledger does not carry -- rungrole rows and deps. Pure: buffers and numbers in, so a gate drives it on planted rows. 15// license_tier: ORIGINAL No hw writes (Rule 26). 16import "nx_syscalls.nx" 17import "nx_costest_lib.nx" 18import "nx_ladder_lib.nx" 19 20const WM_I64: i64 = 8 21const WM_C_FEATURE: i64 = 0 22const WM_C_ENABLEMENT: i64 = 1 23const WM_C_REWORK: i64 = 2 24const WM_C_UNCLASSED: i64 = 3 25const WM_CLASSES: i64 = 4 26const WM_B_NONE: i64 = 0 - 1 // the class table has no row for the board 27const WM_B_PRODUCT: i64 = 0 28const WM_B_OPERATIONS: i64 = 1 29const WM_BOARD_TAG: *u8 = "board" // board|<domain>|product or operations|<why> 30const WM_BOARD_NF: i64 = 4 31const WM_BOARD_F_DOM: i64 = 1 32const WM_BOARD_F_CLASS: i64 = 2 33const WM_WORD_PRODUCT: *u8 = "product" 34const WM_WORD_OPERATIONS: *u8 = "operations" 35const WM_ROLE_F_RUNG: i64 = 1 // rungrole|<rung>|<role>|<target>|<why> 36const WM_ROLE_F_ROLE: i64 = 2 37const WM_ROLE_MIN_NF: i64 = 3 38const WM_RUNG_F_DEPS: i64 = 7 // rung|id|title|symbol|note|kind|cost|deps 39const WM_A_EV: i64 = 0 // acc[WM_A_EV + class]: land rows of the window, by class 40const WM_A_DECIU: i64 = 4 // acc[WM_A_DECIU + class]: their declared cost in deci-u, by class 41const WM_A_LAND: i64 = 8 // every land row inside the window 42const WM_A_RETRACTS: i64 = 9 // every retract row inside the window 43const WM_A_RELANDS: i64 = 10 // land rows classed REWORK (the same number as acc[WM_A_EV + WM_C_REWORK]: two counters, one population) 44const WM_A_ENAB_NAMED: i64 = 11 // ENABLEMENT rows whose rung a FEATURE rung names in its deps 45const WM_A_ENAB_UNNAMED: i64 = 12 46const WM_A_BY_ROLE: i64 = 13 // rows classed by a rungrole row 47const WM_A_BY_BOARD: i64 = 14 // rows classed by the board class table 48const WM_A_NOPLAN: i64 = 15 // rows on a board whose plan could not be read (they are UNCLASSED) 49const WM_A_OPENED: i64 = 16 // open rows whose FIRST journal row falls inside the window: started here, not landed 50const WM_A_MALFORMED: i64 = 17 // ledger rows that carry an event tag and the wrong shape: counted, never half-read 51const WM_A_SLOTS: i64 = 18 52const WM_CH_COMMA: i64 = 44 53const WM_CH_SP: i64 = 32 54const WM_CH_SEMI: i64 = 59 55const WM_PERMIL: i64 = 1000 56 57func wm_class_name(c: i64) -> *u8 { 58 if c == WM_C_FEATURE { return "FEATURE" as *u8 } 59 if c == WM_C_ENABLEMENT { return "ENABLEMENT" as *u8 } 60 if c == WM_C_REWORK { return "REWORK" as *u8 } 61 return "UNCLASSED" as *u8 62} 63 64// the class table's word for a board: PRODUCT, OPERATIONS, or NONE when no row names it (or the word is neither) 65func wm_board_class(conf: *u8, cn: i64, dom: *u8) -> i64 { 66 let off: *i64 = sys_mmap(WM_I64) as *i64 67 var p: i64 = 0 68 while p < cn { 69 let e: i64 = ces_line_end(conf, cn, p) 70 if e > p { if ces_nfields(conf, p, e) >= WM_BOARD_NF { 71 let l0: i64 = ces_field(conf, p, e, 0, off) 72 if ces_span_is(conf, off[0], l0, WM_BOARD_TAG) == 1 { 73 let dl: i64 = ces_field(conf, p, e, WM_BOARD_F_DOM, off) 74 if ces_span_is(conf, off[0], dl, dom) == 1 { 75 let wl: i64 = ces_field(conf, p, e, WM_BOARD_F_CLASS, off) 76 if ces_span_is(conf, off[0], wl, WM_WORD_PRODUCT) == 1 { return WM_B_PRODUCT } 77 if ces_span_is(conf, off[0], wl, WM_WORD_OPERATIONS) == 1 { return WM_B_OPERATIONS } 78 return WM_B_NONE 79 } 80 } 81 } } 82 p = e + 1 83 } 84 return WM_B_NONE 85} 86 87func wm_span_eq2(a: *u8, aoff: i64, alen: i64, b: *u8, boff: i64, blen: i64) -> i64 { 88 if alen != blen { return 0 } 89 if alen <= 0 { return 0 } 90 var i: i64 = 0 91 while i < alen { if a[aoff + i] != b[boff + i] { return 0 } i = i + 1 } 92 return 1 93} 94 95// the rungrole of a rung on its board's plan: an LD_R_* code, or LD_NONE when no rungrole row names the rung. 96// rung is the span [roff, roff+rlen) of rbuf, so a ledger row's rung field is compared in place. 97func wm_rung_role(plan: *u8, pn: i64, rbuf: *u8, roff: i64, rlen: i64) -> i64 { 98 let off: *i64 = sys_mmap(WM_I64) as *i64 99 let tl: i64 = ces_slen(LD_LADDER_TAG) 100 var p: i64 = 0 101 while p < pn { 102 let e: i64 = ces_line_end(plan, pn, p) 103 if e - p > tl { if ld_span_is(plan, p, tl, LD_LADDER_TAG) == 1 { if ces_nfields(plan, p, e) >= WM_ROLE_MIN_NF { 104 let gl: i64 = ces_field(plan, p, e, WM_ROLE_F_RUNG, off) 105 if gl > 0 { if wm_span_eq2(plan, off[0], gl, rbuf, roff, rlen) == 1 { 106 let kl: i64 = ces_field(plan, p, e, WM_ROLE_F_ROLE, off) 107 return ld_role_code(plan, off[0], kl) 108 } } 109 } } } 110 p = e + 1 111 } 112 return LD_NONE 113} 114 115// the class of a landed rung from its rungrole (LD_NONE when it carries none) and its board's class 116func wm_class_of(role: i64, bclass: i64) -> i64 { 117 if role == LD_R_CONTENDER { return WM_C_FEATURE } 118 if role == LD_R_ARM { return WM_C_FEATURE } 119 if role == LD_R_SUBSTRATE { return WM_C_ENABLEMENT } 120 if role != LD_NONE { return WM_C_UNCLASSED } // superseded, or a role word the ladder ruler does not know 121 if bclass == WM_B_PRODUCT { return WM_C_FEATURE } 122 if bclass == WM_B_OPERATIONS { return WM_C_ENABLEMENT } 123 return WM_C_UNCLASSED 124} 125 126const WM_K_LAND: i64 = 1 127const WM_K_RETRACT: i64 = 2 128// the kind of a ledger line: land, retract, 0 for neither; CES_NONE when it carries an event tag and the wrong field count 129func wm_event_kind(buf: *u8, p: i64, e: i64, off: *i64) -> i64 { 130 if e <= p { return 0 } 131 let l0: i64 = ces_field(buf, p, e, 0, off) 132 let t0: i64 = off[0] 133 if ces_span_is(buf, t0, l0, CES_LAND) == 1 { 134 if ces_nfields(buf, p, e) == CES_EV_LAND_NF { return WM_K_LAND } 135 return CES_NONE 136 } 137 if ces_span_is(buf, t0, l0, CES_RETRACT) == 1 { 138 if ces_nfields(buf, p, e) == CES_EV_RETRACT_NF { return WM_K_RETRACT } 139 return CES_NONE 140 } 141 return 0 142} 143 144// is the NEWEST event of this row's rung before epoch a retract? Then the claim was withdrawn and this row lands it again. 145// (on equal epochs the later ledger row decides: the ledger is written in journal order) 146func wm_reland(led: *u8, n: i64, p0: i64, e0: i64, epoch: i64, off: *i64) -> i64 { 147 let dl: i64 = ces_field(led, p0, e0, CES_EV_F_DOM, off) 148 let doff: i64 = off[0] 149 let gl: i64 = ces_field(led, p0, e0, CES_EV_F_RUNG, off) 150 let goff: i64 = off[0] 151 var best: i64 = CES_NONE 152 var bestkind: i64 = 0 153 var p: i64 = 0 154 while p < n { 155 let e: i64 = ces_line_end(led, n, p) 156 let k: i64 = wm_event_kind(led, p, e, off) 157 if k > 0 { 158 let dl2: i64 = ces_field(led, p, e, CES_EV_F_DOM, off) 159 let doff2: i64 = off[0] 160 if ces_span_eq(led, doff, dl, doff2, dl2) == 1 { 161 let gl2: i64 = ces_field(led, p, e, CES_EV_F_RUNG, off) 162 let goff2: i64 = off[0] 163 if ces_span_eq(led, goff, gl, goff2, gl2) == 1 { 164 let el: i64 = ces_field(led, p, e, CES_EV_F_EPOCH, off) 165 let ep: i64 = ces_parse_int(led, off[0], el) 166 if ep >= 0 { if ep < epoch { if ep >= best { best = ep; bestkind = k } } } 167 } 168 } 169 } 170 p = e + 1 171 } 172 if bestkind == WM_K_RETRACT { return 1 } 173 return 0 174} 175 176func wm_is_sep(c: i64) -> i64 { 177 if c == WM_CH_COMMA { return 1 } 178 if c == WM_CH_SEMI { return 1 } 179 if c == WM_CH_SP { return 1 } 180 return 0 181} 182 183// does the deps text [off, off+len) name the token? Tokens are separated by commas, semicolons and spaces; a token that 184// merely BEGINS with the name (EC5 inside EC55) never matches. 185func wm_deps_has(buf: *u8, off: i64, len: i64, tok: *u8, tl: i64) -> i64 { 186 if tl <= 0 { return 0 } 187 let end: i64 = off + len 188 var i: i64 = off 189 while i < end { 190 var go: i64 = 1 191 while go == 1 { if i < end { if wm_is_sep(buf[i] as i64) == 1 { i = i + 1 } else { go = 0 } } else { go = 0 } } 192 let s: i64 = i 193 go = 1 194 while go == 1 { if i < end { if wm_is_sep(buf[i] as i64) == 0 { i = i + 1 } else { go = 0 } } else { go = 0 } } 195 if i - s == tl { 196 var j: i64 = 0 197 var same: i64 = 1 198 while j < tl { if buf[s + j] != tok[j] { same = 0 } j = j + 1 } 199 if same == 1 { return 1 } 200 } 201 } 202 return 0 203} 204 205// room for one board's rows in the feature-deps index: each row is a span of the plan plus the domain, a pipe and a 206// newline, and a plan of pn bytes holds at most pn divided by the SHORTEST POSSIBLE rung row of them. That shortest row is 207// READ OFF THE GRAMMAR (its tag and the pipes between its fields), never typed (operator 2026-09-17: derived, not renamed). 208func wm_index_bound(pn: i64, dom: *u8) -> i64 { 209 let shortest: i64 = ces_slen(CES_RUNG_TAG) + CES_RUNG_NF - 1 210 return pn + (pn / shortest + 1) * (ces_slen(dom) + 2) + 1 211} 212 213// one board's FEATURE rungs that declare deps, appended to the index as <owner-domain>|<deps text> rows. Returns the new fill. 214func wm_index_board(plan: *u8, pn: i64, dom: *u8, bclass: i64, idx: *u8, o0: i64) -> i64 { 215 let off: *i64 = sys_mmap(WM_I64) as *i64 216 var o: i64 = o0 217 var p: i64 = 0 218 while p < pn { 219 let e: i64 = ces_line_end(plan, pn, p) 220 if e > p { 221 let l0: i64 = ces_field(plan, p, e, 0, off) 222 if ces_span_is(plan, off[0], l0, CES_RUNG_TAG) == 1 { if ces_nfields(plan, p, e) >= CES_RUNG_NF { 223 let dl: i64 = ces_field(plan, p, e, WM_RUNG_F_DEPS, off) 224 let doff: i64 = off[0] 225 var has: i64 = 0 226 if dl > 1 { has = 1 } 227 if dl == 1 { if plan[doff] != (CES_CH_DASH as u8) { has = 1 } } 228 if has == 1 { 229 let il: i64 = ces_field(plan, p, e, CES_RUNG_F_ID, off) 230 let role: i64 = wm_rung_role(plan, pn, plan, off[0], il) 231 if wm_class_of(role, bclass) == WM_C_FEATURE { 232 o = ces_cat(idx, o, dom) 233 idx[o] = CES_CH_PIPE as u8 234 o = o + 1 235 var k: i64 = 0 236 while k < dl { idx[o] = plan[doff + k]; o = o + 1; k = k + 1 } 237 idx[o] = CES_CH_NL as u8 238 o = o + 1 239 idx[o] = 0 as u8 240 } 241 } 242 } } 243 } 244 p = e + 1 245 } 246 return o 247} 248 249// does a FEATURE rung name this rung in its deps: <domain>:<rung> from any board, or the bare <rung> from its own board 250func wm_named_by_feature(idx: *u8, n: i64, dom: *u8, rung: *u8, qual: *u8, off: *i64) -> i64 { 251 let rl: i64 = ces_slen(rung) 252 let ql: i64 = ces_slen(qual) 253 var p: i64 = 0 254 while p < n { 255 let e: i64 = ces_line_end(idx, n, p) 256 if e > p { 257 let ol: i64 = ces_field(idx, p, e, 0, off) 258 let same: i64 = ces_span_is(idx, off[0], ol, dom) 259 let ds: i64 = off[0] + ol + 1 260 if ds < e { 261 if wm_deps_has(idx, ds, e - ds, qual, ql) == 1 { return 1 } 262 if same == 1 { if wm_deps_has(idx, ds, e - ds, rung, rl) == 1 { return 1 } } 263 } 264 } 265 p = e + 1 266 } 267 return 0 268} 269 270func wm_board_index(names: *i64, np: i64, dom: *u8) -> i64 { 271 var i: i64 = 0 272 while i < np { 273 let nm: *u8 = names[i] as *u8 274 if ces_span_is(nm, 0, ces_slen(nm), dom) == 1 { return i } 275 i = i + 1 276 } 277 return CES_NONE 278} 279 280func wm_copy_span(dst: *u8, o0: i64, src: *u8, off: i64, len: i64) -> i64 { 281 var o: i64 = o0 282 var k: i64 = 0 283 while k < len { dst[o] = src[off + k]; o = o + 1; k = k + 1 } 284 dst[o] = 0 as u8 285 return o 286} 287 288// THE CENSUS: every land and retract row of the ledger inside [lo, hi), classed. names, pbuf and plen are the np boards 289// whose plans were read; conf is the board class table; idx is the feature-deps index (wm_index_board over every board). 290// Returns the land rows of the window; acc carries the partition (WM_A_*). 291func wm_mix_census(led: *u8, ln: i64, lo: i64, hi: i64, conf: *u8, cn: i64, names: *i64, pbuf: *i64, plen: *i64, np: i64, idx: *u8, idxn: i64, acc: *i64) -> i64 { 292 var z: i64 = 0 293 while z < WM_A_SLOTS { acc[z] = 0; z = z + 1 } 294 let off: *i64 = sys_mmap(WM_I64) as *i64 295 // scratch for one row's names, sized from the ledger itself: no row is longer than the file that holds it 296 let sd: *u8 = sys_mmap(ln + 1) 297 let sg: *u8 = sys_mmap(ln + 1) 298 let sq: *u8 = sys_mmap(ln * 2 + 2) 299 var p: i64 = 0 300 while p < ln { 301 let e: i64 = ces_line_end(led, ln, p) 302 let kind: i64 = wm_event_kind(led, p, e, off) 303 if kind == CES_NONE { acc[WM_A_MALFORMED] = acc[WM_A_MALFORMED] + 1 } 304 if kind > 0 { 305 let el: i64 = ces_field(led, p, e, CES_EV_F_EPOCH, off) 306 let ep: i64 = ces_parse_int(led, off[0], el) 307 if ep < 0 { acc[WM_A_MALFORMED] = acc[WM_A_MALFORMED] + 1 } 308 var inwin: i64 = 0 309 if ep >= lo { if ep < hi { inwin = 1 } } 310 if inwin == 1 { if kind == WM_K_RETRACT { acc[WM_A_RETRACTS] = acc[WM_A_RETRACTS] + 1 } } 311 if inwin == 1 { if kind == WM_K_LAND { 312 acc[WM_A_LAND] = acc[WM_A_LAND] + 1 313 let cl: i64 = ces_field(led, p, e, CES_EV_F_COST, off) 314 var cost: i64 = ces_parse_int(led, off[0], cl) 315 if cost < 0 { cost = 0 } 316 let dl: i64 = ces_field(led, p, e, CES_EV_F_DOM, off) 317 wm_copy_span(sd, 0, led, off[0], dl) 318 var qo: i64 = wm_copy_span(sq, 0, led, off[0], dl) 319 sq[qo] = CES_CH_COLON as u8 320 qo = qo + 1 321 let gl: i64 = ces_field(led, p, e, CES_EV_F_RUNG, off) 322 wm_copy_span(sg, 0, led, off[0], gl) 323 wm_copy_span(sq, qo, led, off[0], gl) 324 var cls: i64 = WM_C_UNCLASSED 325 if wm_reland(led, ln, p, e, ep, off) == 1 { 326 cls = WM_C_REWORK 327 acc[WM_A_RELANDS] = acc[WM_A_RELANDS] + 1 328 } else { 329 var role: i64 = LD_NONE 330 let bi: i64 = wm_board_index(names, np, sd) 331 if bi >= 0 { role = wm_rung_role(pbuf[bi] as *u8, plen[bi], sg, 0, gl) } else { acc[WM_A_NOPLAN] = acc[WM_A_NOPLAN] + 1 } 332 cls = wm_class_of(role, wm_board_class(conf, cn, sd)) 333 if cls != WM_C_UNCLASSED { 334 if role != LD_NONE { acc[WM_A_BY_ROLE] = acc[WM_A_BY_ROLE] + 1 } else { acc[WM_A_BY_BOARD] = acc[WM_A_BY_BOARD] + 1 } 335 } 336 } 337 acc[WM_A_EV + cls] = acc[WM_A_EV + cls] + 1 338 acc[WM_A_DECIU + cls] = acc[WM_A_DECIU + cls] + cost 339 if cls == WM_C_ENABLEMENT { 340 if wm_named_by_feature(idx, idxn, sd, sg, sq, off) == 1 { acc[WM_A_ENAB_NAMED] = acc[WM_A_ENAB_NAMED] + 1 } else { acc[WM_A_ENAB_UNNAMED] = acc[WM_A_ENAB_UNNAMED] + 1 } 341 } 342 } } 343 } 344 if kind == 0 { if e > p { 345 let t0l: i64 = ces_field(led, p, e, 0, off) 346 if ces_span_is(led, off[0], t0l, CES_OPEN_TAG) == 1 { if ces_nfields(led, p, e) == CES_OPEN_NF { 347 let fl: i64 = ces_field(led, p, e, CES_OPEN_F_FIRST, off) 348 let first: i64 = ces_parse_int(led, off[0], fl) 349 if first >= lo { if first < hi { acc[WM_A_OPENED] = acc[WM_A_OPENED] + 1 } } 350 } } 351 } } 352 p = e + 1 353 } 354 return acc[WM_A_LAND] 355} 356 357func wm_class_sum(acc: *i64) -> i64 { 358 return acc[WM_A_EV + WM_C_FEATURE] + acc[WM_A_EV + WM_C_ENABLEMENT] + acc[WM_A_EV + WM_C_REWORK] + acc[WM_A_EV + WM_C_UNCLASSED] 359} 360 361// part per thousand of whole; CES_NONE when there is no whole (an empty window has no share, never a zero share) 362func wm_permil(part: i64, whole: i64) -> i64 { 363 if whole <= 0 { return CES_NONE } 364 return (part * WM_PERMIL) / whole 365} 366 367// THE LINE SIZES ITSELF (operator 2026-09-17: derived, not renamed). While wm_dry is 1 the walk below writes NOTHING and 368// charges each key its own length plus the widest number the formatter can emit, so the walk that writes the line is the 369// walk that sizes its buffer: wm_line_bound can never disagree with wm_line, and no buffer size is typed by anyone. 370static wm_dry: i64 371const WM_LINE_TAIL: *u8 = " verdict=CENSUSED\n" 372func wm_kv(dst: *u8, o0: i64, key: *u8, v: i64) -> i64 { 373 if wm_dry == 1 { return o0 + ces_slen(key) + CES_NUM_CAP } 374 var o: i64 = ces_cat(dst, o0, key) 375 o = ces_fmt_int(dst, o, v) 376 return o 377} 378func wm_tail(dst: *u8, o: i64) -> i64 { 379 if wm_dry == 1 { return o + ces_slen(WM_LINE_TAIL) } 380 return ces_cat(dst, o, WM_LINE_TAIL) 381} 382 383// ONE canonical line. The classes partition the land rows (sum beside land_rows); retracts are events of their own; 384// feature_permil is over EVERY land row and classed_permil says how much of the window the data could class at all. 385func wm_line(dst: *u8, o0: i64, asof: i64, days: i64, boards: i64, acc: *i64) -> i64 { 386 var o: i64 = wm_kv(dst, o0, "WORKMIX asof=" as *u8, asof) 387 o = wm_kv(dst, o, " window_days=" as *u8, days) 388 o = wm_kv(dst, o, " boards=" as *u8, boards) 389 o = wm_kv(dst, o, " land_rows=" as *u8, acc[WM_A_LAND]) 390 o = wm_kv(dst, o, " FEATURE=" as *u8, acc[WM_A_EV + WM_C_FEATURE]) 391 o = wm_kv(dst, o, " ENABLEMENT=" as *u8, acc[WM_A_EV + WM_C_ENABLEMENT]) 392 o = wm_kv(dst, o, " REWORK=" as *u8, acc[WM_A_EV + WM_C_REWORK]) 393 o = wm_kv(dst, o, " UNCLASSED=" as *u8, acc[WM_A_EV + WM_C_UNCLASSED]) 394 o = wm_kv(dst, o, " sum=" as *u8, wm_class_sum(acc)) 395 o = wm_kv(dst, o, " feature_permil=" as *u8, wm_permil(acc[WM_A_EV + WM_C_FEATURE], acc[WM_A_LAND])) 396 o = wm_kv(dst, o, " classed_permil=" as *u8, wm_permil(acc[WM_A_LAND] - acc[WM_A_EV + WM_C_UNCLASSED], acc[WM_A_LAND])) 397 o = wm_kv(dst, o, " feature_deciu=" as *u8, acc[WM_A_DECIU + WM_C_FEATURE]) 398 o = wm_kv(dst, o, " enablement_deciu=" as *u8, acc[WM_A_DECIU + WM_C_ENABLEMENT]) 399 o = wm_kv(dst, o, " rework_deciu=" as *u8, acc[WM_A_DECIU + WM_C_REWORK]) 400 o = wm_kv(dst, o, " unclassed_deciu=" as *u8, acc[WM_A_DECIU + WM_C_UNCLASSED]) 401 o = wm_kv(dst, o, " enablement_feeds_feature=" as *u8, acc[WM_A_ENAB_NAMED]) 402 o = wm_kv(dst, o, " enablement_unnamed=" as *u8, acc[WM_A_ENAB_UNNAMED]) 403 o = wm_kv(dst, o, " retracts=" as *u8, acc[WM_A_RETRACTS]) 404 o = wm_kv(dst, o, " relands_after_retract=" as *u8, acc[WM_A_RELANDS]) 405 o = wm_kv(dst, o, " started_in_window_not_landed=" as *u8, acc[WM_A_OPENED]) 406 o = wm_kv(dst, o, " by_role=" as *u8, acc[WM_A_BY_ROLE]) 407 o = wm_kv(dst, o, " by_board=" as *u8, acc[WM_A_BY_BOARD]) 408 o = wm_kv(dst, o, " noplan=" as *u8, acc[WM_A_NOPLAN]) 409 o = wm_kv(dst, o, " malformed=" as *u8, acc[WM_A_MALFORMED]) 410 o = wm_tail(dst, o) 411 return o 412} 413 414// the bytes the status line can need at its widest: ONE dry walk of wm_line itself, plus the terminator 415func wm_line_bound() -> i64 { 416 let z: *i64 = sys_mmap(WM_A_SLOTS * WM_I64) as *i64 417 wm_dry = 1 418 let n: i64 = wm_line(0 as *u8, 0, 0, 0, 0, z) 419 wm_dry = 0 420 return n + 1 421}