code wiki / _hdl_build / nx_book_links_gate.nx

nx_book_links_gate.nx

buildroot/runtime/_hdl_build/nx_book_links_gate.nx

8740 B93 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind gate/prooftopic book
docsdependenciesstructsconstsfunctions

about

nx_book_links_gate.nx -- liar-kill gate for ISSUE-3 server side: nx_epub_book must (1) EMIT in-book <a href> as inline link markers (STX 0x02 url SOH 0x01 text ETX 0x03) the reader renders as clickable <a>, (2) expose each chapter's source basename as chapters[].src so the reader resolves an internal href -> chapter idx, and (3) keep capturing footnotes (chapters[].fn[]). Builds a real EPUB w/ an external link, an internal link, and a footnote; runs the REAL nx_epub_book (self-rebuilt); asserts the emitted bytes + JSON. expect_exit: 0 license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_opc.nx nx_book_links_gate.nx

imports: nx_syscalls.nxnx_opc.nx

imported by: nobody (leaf or entry point)

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

main tg_p sys_write sys_mmap ensure_dir chk tg_p ↻ hassub tg_slen sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit tg_n sys_write ↻ sys_mmap ↻

structs

none

consts

none

functions

9func tg_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: chkmain calls 1: sys_write
10func tg_n(v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(1,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0 {b[0]=48 as u8;k=1} while v>0 {b[k]=(48+(v%10)) as u8; v=v/10; k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k {o[j]=b[k-1-j];j=j+1} sys_write(1,o,k); return 0 }
called by 1: main calls 2: sys_writesys_mmap
11func tg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: hassub
12func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 }
called by 1: main
13func hassub(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: tg_slen
19func has1(buf: *u8, n: i64, a: i64) -> i64 { var i: i64=0; while i < n { if (buf[i]&0xff)==a { return 1 } i=i+1 } return 0 }
20func run2(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64
34func chk(label: *u8, cond: i64, pf: *i64) -> i64
called by 1: main calls 1: tg_p
40func main() -> i64