code wiki / (root) / nx_archive_capture_demo.nx

nx_archive_capture_demo.nx

buildroot/runtime/nx_archive_capture_demo.nx

7408 B120 linesdepth 21pulls 148 transitivereach 0 importersview sourcekind sketch/demotopic archive
docsdependenciesstructsconstsfunctions

about

nx_archive_capture_demo.nx -- R4 LIVE end-to-end: browse page3.com AS IT EXISTED in 1997, with its media list. Pipeline: fetch page3.com's REAL Wayback CDX -> cdx_parse -> nx_temporal_index -> query as-of-1997 -> build the raw archived-content URL (web.archive.org/web/<ts14>id_/<original>) -> fetch the ACTUAL 1997 page -> content-address it (CID = polynomial hash, the seg_store key) -> scan its HTML for media references (the per-page media shopping-list). Composes the VERIFIED nx_cdx_parse + nx_temporal_index + our sovereign TLS-1.3 fetch, with retry-on-failure (graceful degradation -- web.archive.org occasionally drops a connection). Live, read-only. license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_cdx_parse.nx nx_temporal_index.nx nx_archive_capture_demo.nx

imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_cdx_parse.nxnx_temporal_index.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id

structs

none

consts

13const K_MAGIC_1000000007: i64 = 1000000007
14const K_MAGIC_4194304: i64 = 4194304
15const K_MAGIC_2048: i64 = 2048
16const K_MAGIC_19970601: i64 = 19970601

functions

18func gw(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: fetch_retrymain calls 1: sys_write
19func gn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8=sys_mmap(24); var w: i64=0; var q: i64=k-1; while q>=0 { o[w]=t[q]; w=w+1; q=q-1 } sys_write(1,o,w); return 0 }
called by 2: fetch_retrymain calls 2: sys_writesys_mmap
20func ap(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { buf[off+i]=s[i]; i=i+1 } return off+i }
called by 1: main
21func apslice(dst: *u8, off: i64, src: *u8, so: i64, sl: i64) -> i64 { var i: i64=0; while i<sl { dst[off+i]=src[so+i]; i=i+1 } return off+sl }
called by 1: main
22func phead(out: *u8, n: i64, lim: i64) -> i64 { var m: i64=n; if m<0 { m=0 } if m>lim { m=lim } if m>0 { sys_write(1,out,m) } sys_write(1,"\n" as *u8,1); return 0 }
called by 1: main calls 1: sys_write
23func cid_hash(buf: *u8, n: i64) -> i64 { var h: i64=0; var i: i64=0; while i<n { h = (h*131 + (buf[i] as i64)) % K_MAGIC_1000000007; i=i+1 } return h }
called by 1: main
24func dstarts(buf: *u8, off: i64, n: i64, lit: *u8, litlen: i64) -> i64 { if off+litlen>n { return 0 } var i: i64=0; while i<litlen { var a: i64=buf[off+i] as i64; if a>=0x41 { if a<=0x5a { a=a+0x20 } } if a != (lit[i] as i64) { return 0 } i=i+1 } return 1 }
called by 1: count_img
25func count_img(buf: *u8, n: i64) -> i64 { var c: i64=0; var i: i64=0; while i+4<=n { if dstarts(buf,i,n,"<img" as *u8,4)==1 { c=c+1; i=i+4 } else { i=i+1 } } return c }
called by 1: main calls 1: dstarts
27func fetch_retry(url: *u8, store: *TrustStore, out: *u8, cap: i64, st: *i64, tries: i64) -> i64
called by 1: main calls 2: gwgn
37func main() -> i64