code wiki / (root) / nx_rigfloor.nx

nx_rigfloor.nx

buildroot/runtime/nx_rigfloor.nx

33090 B675 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_rigfloor.nx -- DERIVE THE ASSET FLOOR FROM THE REFERENCE CORPUS INSTEAD OF DECLARING IT. WHY THIS EXISTS. nx_asset_floor_gate is THE ruler for "is this character game-ready", and it carried five HAND-PICKED bounds: AF_VERT_MIN 4000, AF_TRI_MIN 8000, AF_TRI_MAX 120000, AF_JOINT_MIN 40, AF_MIDLINE 3000. A picked bound structurally cannot answer the question the operator actually asks -- can we emit something that MATCHES THE MODELS WE HAVE -- because it is not a function of the models we have. This organ makes the bound a MEASUREMENT of the reference population, so the gate stops ASSERTING a floor and starts REPORTING one. THIS IS NOT A SECOND RULER. nx_asset_floor_gate remains the one ruler; this is the PRODUCER that derives its bounds into a conf the gate reads. Producer and consumer cannot disagree because there is exactly one of each. nx_spendgate ranked nx_asset_floor_gate as the top incumbent for this intent -- extending it is the entire point, and a rival floor organ would be the duplicate-ruler defect. ROSTER-DRIVEN, NOT DIRECTORY-WALKING, ON PURPOSE. sys_getdents64 exists and a bounded walker is proven in nx_wiki_content_loader. It is still the wrong primitive HERE: the corpus IS the thing under measurement, so a silently-truncated listing would not merely lose a file, it would corrupt the derived bound itself and then publish that bound as a fact. A roster is complete by construction and its coverage is DECIDABLE -- rows declared vs rows read, both printed, and if they do not sum then no floor is written at all. METHOD: OBSERVED RANGE OVER THE FULL POPULATION. No percentile index is chosen, because choosing one would reintroduce exactly the picked constant this organ exists to remove. The band is [min, max] of what the reference assets actually are. WHY n>=2 IS NOT A MAGIC NUMBER. A range needs two observations to HAVE WIDTH. At n=1 the band is a point and would refuse every asset except that one file -- a bar that is not a bar. So the organ abstains at n<2. That is the arity of the operation, not a threshold anyone selected. EXITS: 0 OK | 1 OUT-OF-BAND | 2 usage | 3 UNOBSERVABLE (no corpus / degenerate / partial read) A partial roster read NEVER degrades to a floor: it abstains, because a floor derived from an unknown fraction of the corpus is worse than no floor -- it looks authoritative and is not. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_rigfloor.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main rf_usage rf_out sys_write sys_exit rf_derive 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 ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close rf_out ↻ rf_measure sys_mmap ↻ sys_read_file ↻ rf_out ↻ rf_rd64 rf_find rf_tag_eq rf_rd64 ↻ rf_rd32 rf_say rf_bputs

structs

none

consts

39const RF_EXIT_OK: i64 = 0
40const RF_EXIT_OUT_OF_BAND: i64 = 1
41const RF_EXIT_USAGE: i64 = 2
42const RF_EXIT_UNOBSERVABLE: i64 = 3
45const RF_HDR_BYTES: i64 = 32
46const RF_SECHDR_BYTES: i64 = 32
47const RF_SEC_OFF_FIELD: i64 = 8
48const RF_NSEC_FIELD: i64 = 16
49const RF_MAGIC_BYTES: i64 = 8
50const RF_TAG_BYTES: i64 = 4
51const RF_WORD_BYTES: i64 = 8
52const RF_PERMIL: i64 = 1000
53const RF_BYTE_RADIX: i64 = 256
54const RF_BYTE_MASK: i64 = 255
57const RF_ASCII_ZERO: i64 = 48
58const RF_ASCII_NINE: i64 = 57
59const RF_ASCII_MINUS: i64 = 45
60const RF_ASCII_EQ: i64 = 61
61const RF_ASCII_NL: i64 = 10
62const RF_ASCII_CR: i64 = 13
63const RF_ASCII_HASH: i64 = 35
64const RF_VERB_DERIVE: i64 = 100
65const RF_VERB_SCORE: i64 = 115
66const RF_DECIMAL: i64 = 10
69const RF_CONF_CAP: i64 = 65536
70const RF_SCRATCH_CAP: i64 = 64
71const RF_PATH_CAP: i64 = 4096
72const RF_MAX_ROWS: i64 = 4096
73const RF_STDOUT: i64 = 1
74const RF_PAIR: i64 = 2
80const RF_CONTAINER_UNKNOWN: i64 = 0
81const RF_CONTAINER_NXA: i64 = 1 // NXANIM01 -- our shipped rigged asset
82const RF_CONTAINER_MSH: i64 = 2 // NXMSH2 -- what nx_gltf2mesh emits from a glTF donor
86const RF_MSH_MAGIC_BYTE: i64 = 78 // 'N' at offset 0
87const RF_MSH_VER_OFF: i64 = 5
88const RF_MSH_VER_BYTE: i64 = 50 // '2' at offset 5 -- the version discriminator
89const RF_MSH_NLAYER_FIELD: i64 = 8 // u32 LE layer count
90const RF_MSH_NTRI_FIELD: i64 = 12 // u32 LE triangle count
91const RF_MSH_HDR_BYTES: i64 = 16 // FIXED header; the FULL header is 16 + nlay*24
92const RF_MSH_LAYROW_BYTES: i64 = 24
93const RF_U32_BYTES: i64 = 4
97const RF_MSH_TRIREC_BYTES: i64 = 84
104const RF_AXES: i64 = 7
105const RF_AX_VERTS: i64 = 0
106const RF_AX_TRIS: i64 = 1
107const RF_AX_JOINTS: i64 = 2
108const RF_AX_TPV_PERMIL: i64 = 3
109const RF_AX_VPJ: i64 = 4
110const RF_AX_PARTS: i64 = 5
111const RF_AX_TPP: i64 = 6 // triangles per named part -- the NXMSH2 shape signal

functions

113func rf_out(s: *u8) -> i64
120func rf_rd64(b: *u8, off: i64) -> i64
called by 2: rf_findrf_measure
126func rf_tag_eq(b: *u8, off: i64, t: *u8) -> i64
called by 1: rf_find
133func rf_find(b: *u8, nsec: i64, t: *u8) -> i64
called by 1: rf_measure calls 2: rf_tag_eqrf_rd64
144func rf_bputs(buf: *u8, off: i64, s: *u8) -> i64
151func rf_bputnum(buf: *u8, off: i64, v: i64, scratch: *u8) -> i64
called by 3: rf_kvrf_sayrf_band
166func rf_kv(buf: *u8, off: i64, key: *u8, v: i64, scratch: *u8) -> i64
177func rf_emit_band(cb: *u8, off: i64, kmin: *u8, kmax: *u8, idx: i64,
called by 1: rf_derive calls 1: rf_kv
184func rf_say(label: *u8, v: i64, scratch: *u8, line: *u8) -> i64
195func rf_conf_i64(buf: *u8, n: i64, key: *u8, miss: i64) -> i64
called by 1: rf_score
243func rf_rd32(b: *u8, off: i64) -> i64
called by 1: rf_measure
255func rf_measure(path: *u8, out: *i64, avail: *i64) -> i64
337func rf_usage() -> i64
called by 1: main calls 1: rf_out
345func rf_derive(roster: *u8, outconf: *u8) -> i64
549func rf_band(name: *u8, v: i64, lo: i64, hi: i64, scratch: *u8, line: *u8, bad: *i64) -> i64
575func rf_score(asset: *u8, conf: *u8) -> i64
659func main(argc: i64, argv: *i64) -> i64