code wiki / _hdl_build / nx_myotable.nx
nx_myotable.nx
buildroot/runtime/_hdl_build/nx_myotable.nx
about
nx_myotable.nx -- ★THE MUSCLE SET AS ONE TABLE, fail-closed, so the count can actually grow.
★THE DEFECT. nx_myoset describes each muscle across FOUR PARALLEL IF-CHAINS -- ms_origin, ms_insert,
ms_peak, ms_name -- so adding one muscle means editing four functions and keeping them aligned by
hand. nx_skelgen documented this exact shape for its joints: "the same 13 joints are described across
sg_jparent, sg_jdx, sg_jdy, sg_jdz and the constraint pair, so adding a joint means editing six
places." It is the third instance in this codebase and the cure has not changed: ONE TABLE.
★★AND A REAL FAIL-OPEN BUG, not just an ergonomic one: every chain ENDS IN AN UNGUARDED DEFAULT
(`return 250`, `return "gastrocnemius"`). So ms_origin(999) answers 250 and ms_name(999) answers
"gastrocnemius" -- ★A PHANTOM MUSCLE THAT LOOKS COMPLETELY REAL. Nothing anywhere says how many
muscles exist, so no caller can even know it asked out of range. This table REFUSES instead.
⚠★★WHAT THIS DELIBERATELY DOES **NOT** DO: pad the count. The measured gap is ~18 modelled against
~700 named skeletal muscles, and it would be easy to type another twenty rows of plausible-looking
attachment stations right here. This session convicted exactly that habit -- the shoulder width was
half its true value because someone typed a number that looked reasonable -- so the mechanism ships
with the EXISTING eight re-derived byte-exactly, and every future row must arrive SOURCED.
★The right source is already in hand: attachments should be DERIVED FROM BONE LANDMARKS that
nx_skelgen emits, not typed -- the "attach relative to the parent" law this lane learned on the brow.
nx_myotable selftest
license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 26 | const MT_NM: i64 = 8 // muscles presently modelled -- the honest count, and it is QUERYABLE |
| 27 | const MT_S: i64 = 4 // row stride: origin, insertion, peak, name-id |
| 28 | const MT_BAD: i64 = 0 - 1 // the refusal value; distinct from every legitimate station |
functions
| 32 | func mt_table(T: *i64) -> i64 called by 1: main |
| 45 | func mt_count() -> i64 { return MT_NM } called by 1: main |
| 48 | func mt_ok(m: i64) -> i64 { if m < 0 { return 0 } if m >= MT_NM { return 0 } return 1 } |
| 49 | func mt_origin(T: *i64, m: i64) -> i64 { if mt_ok(m)==0 { return MT_BAD } return T[m*MT_S] } |
| 50 | func mt_insert(T: *i64, m: i64) -> i64 { if mt_ok(m)==0 { return MT_BAD } return T[m*MT_S+1] } |
| 51 | func mt_peak(T: *i64, m: i64) -> i64 { if mt_ok(m)==0 { return MT_BAD } return T[m*MT_S+2] } |
| 52 | func mt_nameid(T: *i64, m: i64) -> i64 { if mt_ok(m)==0 { return MT_BAD } return T[m*MT_S+3] } |
| 54 | func mt_span(T: *i64, m: i64) -> i64 |
| 62 | func mt_weight(T: *i64, m: i64, station: i64) -> i64 |
| 79 | func main(argc: i64, argv: *i64) -> i64 |