code wiki / _hdl_build / nx_extract_heal.nx

nx_extract_heal.nx

buildroot/runtime/_hdl_build/nx_extract_heal.nx

10320 B222 linesdepth 3pulls 3 transitivereach 14 importersview sourcekind librarytopic extract
docsdependenciesstructsconstsfunctions

about

nx_extract_heal.nx -- SELF-HEALING, ADAPTIVE media-URL recognition. The insight: make pattern recognition DATA-DRIVEN (a pattern TABLE, not hardcoded logic), so the system can LEARN a new pattern from a failure and ADAPT -- instead of a human editing code every time a site changes. Flow: classify via the table; on a MISS for a URL a critic/adversary confirms IS media, LOG it + LEARN (add a pattern derived from the URL, e.g. its CDN host) so the next URL from that source is caught. This is how "auto-heal + adapt" beats yt-dlp's break-then-hand-patch cycle. Seeds with the same knowledge as nx_media_signal's xt_classify (now as DATA).

dependencies 2 imports · 7 importers

nx_syscalls.nx nx_media_signal.nx nx_extract_heal.nx nx_extract_heal_gate.nx nx_extract_persist_gate.nx nx_media_adapt_gate.nx nx_media_extract.nx nx_media_nuxt_manifest_gate.nx nx_media_sniff_daemon.nx nx_sniff_faillog_gate.nx

imports: nx_syscalls.nxnx_media_signal.nx

imported by: nx_extract_heal_gate.nxnx_extract_persist_gate.nxnx_media_adapt_gate.nxnx_media_extract.nxnx_media_nuxt_manifest_gate.nxnx_media_sniff_daemon.nxnx_sniff_faillog_gate.nx

structs

none

consts

9const XSIG_MAGIC_4096: i64 = 4096
10const XSIG_MAGIC_4095: i64 = 4095
11const XSIG_MAGIC_1048576: i64 = 1048576
13const XSIG_EXT: i64 = 1
14const XSIG_PATH: i64 = 2
15const XSIG_HOST: i64 = 3
16const XH_STRIDE: i64 = 5 // per-pattern: [sigtype, pat_ptr, patlen, kind, conf]
17const XH_MAXPAT: i64 = 1024

functions

19func xh_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: xh_addc
20func xh_new() -> *i64 { let t: *i64 = sys_mmap(8 * (1 + XH_MAXPAT * XH_STRIDE)) as *i64; t[0] = 0; return t }
called by 4: mainmainmainmx_extract calls 1: sys_mmap
21func xh_add(t: *i64, sigtype: i64, pat: *u8, patlen: i64, kind: i64, conf: i64) -> i64
called by 1: xh_addc
28func xh_addc(t: *i64, sigtype: i64, pat: *u8, kind: i64, conf: i64) -> i64 { return xh_add(t, sigtype, pat, xh_slen(pat), kind, conf) }
called by 1: xh_seed calls 2: xh_addxh_slen
30func xh_seed(t: *i64) -> i64
called by 2: mainmx_extract calls 1: xh_addc
46func xh_best(t: *i64, list: *u8, listlen: i64, out: *u8, cap: i64, kind: *i64) -> i64
79func xh_classify(t: *i64, url: *u8, ul: i64, out_kind: *i64) -> i64
called by 4: xh_bestclsclsmx_harvest calls 1: xt_find
98func xh_host(url: *u8, ul: i64, out: *u8, cap: i64) -> i64
calls 1: xt_find
112func xh_has_host(t: *i64, host: *u8, hl: i64) -> i64
124func xh_learn(t: *i64, url: *u8, ul: i64, known_kind: i64) -> i64
133func xh_log(logbuf: *u8, off: i64, cap: i64, url: *u8, ul: i64, reason: *u8) -> i64
145func xh_flush(path: *u8, logbuf: *u8, loglen: i64) -> i64
152func xh_putn(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; if m==0 { dst[off]=48 as u8; return off+1 } 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 } var j: i64=0; while j<k { dst[off]=t[k-1-j]; off=off+1; j=j+1 } return off }
154func xh_pint(buf: *u8, ip: *i64) -> i64
172func xh_save(t: *i64, path: *u8) -> i64
193func xh_load(t: *i64, path: *u8) -> i64