code wiki / _hdl_build / nx_isotope_ingest.nx

nx_isotope_ingest.nx

buildroot/runtime/_hdl_build/nx_isotope_ingest.nx

7396 B138 linesdepth 7pulls 8 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_isotope_ingest.nx -- chemistry external-reference loop, ingest stage. Reads the FOUNDATIONED NIST Atomic Weights data (knowledge/fetched/nist/atomic_weights.raw, CID'd + signed by nx_isotope_foundation) and MECHANICALLY extracts each isotope's (Atomic Number Z, Mass Number A, Relative Atomic Mass) from the "key = value" records, converting the mass to Q4 micro-AMU (mass*10000, rounded) to match our periodic table's iso_mass_q4 scaling. Writes a content-addressed canonical record per isotope into the sovereign seg_store (prefix knowledge/store/isotope-, key "iso:<Z>:<A>") -- the SSOT, NOT a TSV. Parse: a record's "Relative Atomic Mass =" line always follows its "Atomic Number =" and "Mass Number =" lines, so we carry cur_z/cur_a and emit on the mass line. Value like "15.99491461957(72)" -> stop at '(', Q4 = int*10000 + 4 decimals + round(5th). Baked self-test: iso:1:1 -> 10078 (H-1), iso:6:12 -> 120000 (C-12 exactly). license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_canon_cid.nx nx_seg_store.nx nx_uxf_decode.nx nx_isotope_ingest.nx

imports: nx_syscalls.nxnx_canon_cid.nxnx_seg_store.nxnx_uxf_decode.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap ii_read sys_openat_rd sys_read sys_close iw sys_write sys_exit ss_begin ss_begin_cap sys_mmap ↻ ii_starts ii_int ii_q4 ii_itoa sys_mmap ↻ canon_encode sys_mmap ↻ cc_cmp cc_w32 cc_len sys_munmap ss_add ss_add2 ss_w32 ss_len sys_now_ms sys_mmap ↻ sys_clock_gettime_mono ss_commit ss_segid_ok sys_mmap ↻ ss_cat ss_catn sys_mmap ↻ sys_write ↻ ss_write_seg ss_segid_ok ↻ sys_mmap ↻

structs

none

consts

16const II_MAGIC_10000: i64 = 10000
17const II_MAGIC_262144: i64 = 262144
19const II_RAW: *u8 = "knowledge/fetched/nist/atomic_weights.raw"
20const II_STORE: *u8 = "knowledge/store/isotope-"

functions

22func iw(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
23func iwn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(16); var m: i64=v; let t: *u8=sys_mmap(16); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1}; sys_write(fd,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
24func ii_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 }
called by 1: main
25func ii_itoa(v: i64, dst: *u8) -> i64 { var m: i64=v; let t: *u8=sys_mmap(24); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{dst[i]=t[k-1-i];i=i+1} dst[k]=0 as u8; return k }
called by 1: main calls 1: sys_mmap
27func ii_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
38func ii_starts(buf: *u8, ls: i64, le: i64, prefix: *u8) -> i64
called by 1: main
49func ii_int(buf: *u8, pos: i64, le: i64) -> i64
called by 1: main
57func ii_q4(buf: *u8, pos: i64, le: i64) -> i64
called by 1: main
78func main() -> i64