code wiki / _hdl_build / nx_tpl_parts.nx

nx_tpl_parts.nx

buildroot/runtime/_hdl_build/nx_tpl_parts.nx

11998 B240 linesdepth 5pulls 8 transitivereach 1 importersview sourcekind tooltopic tpl
docsdependenciesstructsconstsfunctions

about

nx_tpl_parts.nx -- R-PARTS of the SITE FACTORY (the LEGO half of "ingest parts AND complete templates"): extract SECTION-LEVEL patterns from template HTML into the pattern corpus as reusable BRICKS. For each content section a template uses (hero/feat/proof/price/gal/vid/faq/form/cta) we keep only the abstract STRUCTURE: the section kind + bucketed feature metrics (links/imgs/headings/forms/buttons) + its position. Each distinct (kind, metric-buckets) collapses to ONE content-addressed `part:<hash>` record in the SAME seg_store corpus that holds the page-level `pat:` records -- one corpus, two granularities, so composition can lego from bricks as well as whole-page patterns. BUDGET-GUARDED by construction (max_parts + byte ceiling, fail-fast trap; [[feedback-substrate-generators-must-have-budget-guard]]); idempotent (in-run + cross-run dedup). We store structure only -- never a template's assets. license_tier: ORIGINAL usage: nx_tpl_parts <template-dir> <corpus-prefix> [max_parts]

dependencies 1 imports · 1 importers

nx_tpl_ingest.nx nx_tpl_parts.nx nx_tpl_parts_gate.nx

imports: nx_tpl_ingest.nx

imported by: nx_tpl_parts_gate.nx

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

main ti_puts ti_len ti_atoi tp_run ss_manifest_file sys_mmap ss_cat ss_readall sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ss_open ss_open2 sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn sys_mmap ↻ ss_cat ↻ ss_readall ↻ sys_munmap ss_cat ↻ ss_loadfile sys_map_file sys_openat_rd ↻ sys_lseek ↻ sys_close ↻ ss_readall ↻ ss_load_aux2 sys_mmap ↻ ss_cat ↻ ss_loadfile ↻ ss_r32 sys_munmap ↻ ssl_total_keys ss_r32 ↻ ssl_pow2 ssl_build

structs

none

consts

12const TP_MAGIC_131072: i64 = 131072
13const TP_MAGIC_1024: i64 = 1024
14const TP_MAGIC_2000: i64 = 2000
16const TP_RECCAP: i64 = 1024
17const TP_MAXK: i64 = 12

functions

19func tp_bucket(v: i64) -> i64
called by 1: tp_mkkey
27func tp_scan(h: *u8, n: i64, toks: *i64, offs: *i64) -> i64
called by 2: tp_runmain calls 2: ti_find_citi_cta_off
73func tp_metrics(h: *u8, from: i64, to: i64, m: *i64) -> i64
called by 2: tp_runmain calls 1: ti_count_ci
85func tp_mkkey(kind: *u8, m: *i64, keyout: *u8) -> i64
100func tp_record(kind: *u8, m: *i64, pos: i64, src: *u8, out: *u8) -> i64
called by 1: tp_run calls 2: ti_catti_catn
115func tp_run(tpldir: *u8, prefix: *u8, max_parts: i64, counts: *i64) -> i64
221func main(argc: i64, argv: *i64) -> i64