code wiki / _hdl_build / nx_meal_source.nx

nx_meal_source.nx

buildroot/runtime/_hdl_build/nx_meal_source.nx

10233 B239 linesdepth 4pulls 6 transitivereach 9 importersview sourcekind librarytopic meal
docsdependenciesstructsconstsfunctions

about

nx_meal_source.nx -- LIB: the LINK-ROT-PROOF provenance spine of the meal planner. Every recipe rendered on a Nishi page carries WHERE IT CAME FROM -- publisher, original URL, license -- together with a PRESERVED COPY of that origin page written as a WARC/1.0 resource record (nx_web_archive, ISO 28500 -- the same format the Internet Archive and Browsertrix emit, so ours interoperates). When the origin rots, the citation still resolves: the page serves the preserved bytes instead of a 404, and the credit line stays TRUE instead of pointing at a dead host. HONESTY BY CONSTRUCTION (rule 23; R0a "a placeholder that reads as a real claim"): ms_is_archived is a MEASUREMENT, never a stored flag -- it re-reads the WARC and confirms the payload is actually retrievable before the page is permitted to render "archived copy". A recorded INTENT to archive can therefore never masquerade as an archive that EXISTS. ms_capture_verify proves the same for a fresh capture, round-trip, byte-for-byte -- binary payloads with embedded CRLF are exactly where a line-based archive corrupts silently. Schema (prefix passed in, e.g. knowledge/store/meal-): meal:srcids -> TAB list of recipe ids meal:src:<rid> -> title <t> publisher <t> origin_url <t> license <t> captured_day <t> origin_bytes This file RECORDS and MEASURES provenance; it renders NOTHING (rule 9) -- nx_meal_page owns all markup. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 4 importers

nx_food_science.nx nx_web_archive.nx nx_seg_store.nx nx_syscalls.nx nx_meal_source.nx nx_meal_emit.nx nx_meal_page.nx nx_meal_source_gate.nx nx_skill_video.nx

imports: nx_food_science.nxnx_web_archive.nxnx_seg_store.nxnx_syscalls.nx

imported by: nx_meal_emit.nxnx_meal_page.nxnx_meal_source_gate.nxnx_skill_video.nx

structs

none

consts

25const MS_TAB: i64 = 9
26const MS_KEYCAP: i64 = 160
27const MS_VALCAP: i64 = 2048
28const MS_LISTCAP: i64 = 8192
29const MS_TOKCAP: i64 = 96
32const MS_F_TITLE: i64 = 0
33const MS_F_PUBLISHER: i64 = 1
34const MS_F_URL: i64 = 2
35const MS_F_LICENSE: i64 = 3
36const MS_F_DAY: i64 = 4
37const MS_F_BYTES: i64 = 5
41const MS_ROT_NONE: i64 = 0
42const MS_ROT_RISK: i64 = 1
43const MS_ROT_PROOF: i64 = 2

functions

54func ms_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
55func ms_keybuf() -> *u8 { if MS_KB == 0 { MS_KB = sys_mmap(MS_KEYCAP) as i64 } return MS_KB as *u8 }
called by 1: ms_field calls 1: sys_mmap
56func ms_valbuf() -> *u8 { if MS_VB == 0 { MS_VB = sys_mmap(MS_VALCAP) as i64 } return MS_VB as *u8 }
57func ms_pq() -> *i64 { if MS_PQ == 0 { MS_PQ = sys_mmap(16) as i64 } return MS_PQ as *i64 }
58func ms_lq() -> *i64 { if MS_LQ == 0 { MS_LQ = sys_mmap(16) as i64 } return MS_LQ as *i64 }
61func ms_put(prefix: *u8, key: *u8, val: *u8) -> i64
71func ms_src_key(rid: *u8, out: *u8) -> i64
called by 2: ms_recordms_field calls 1: as_append
80func ms_split(buf: *u8, len: i64, outtoks: *i64) -> i64
called by 2: ms_listms_list_add calls 1: sys_mmap
105func ms_list(prefix: *u8, outtoks: *i64) -> i64
113func ms_list_add(prefix: *u8, rid: *u8) -> i64
137func ms_record(prefix: *u8, rid: *u8, title: *u8, publisher: *u8, url: *u8, license: *u8, captured_day: i64, origin_bytes: i64) -> i64
155func ms_field(prefix: *u8, rid: *u8, f: i64, out: *u8) -> i64
165func ms_field_num(prefix: *u8, rid: *u8, f: i64) -> i64
called by 1: main calls 3: ms_valbufms_fieldfd_atoi
176func ms_capture(warc: *u8, off: i64, url: *u8, date: *u8, ctype: *u8, payload: *u8, plen: i64) -> i64
called by 2: mainmain
182func ms_is_archived(warc: *u8, warclen: i64, url: *u8) -> i64
191func ms_archive_bytes(warc: *u8, warclen: i64, url: *u8) -> i64
199func ms_archive_off(warc: *u8, warclen: i64, url: *u8) -> i64
208func ms_capture_verify(warc: *u8, warclen: i64, url: *u8, payload: *u8, plen: i64) -> i64
called by 1: main calls 3: ms_pqms_lqms_len
224func ms_is_citable(prefix: *u8, rid: *u8) -> i64
234func ms_rot_state(prefix: *u8, rid: *u8, warc: *u8, warclen: i64) -> i64