code wiki / _hdl_build / nx_site_build.nx

nx_site_build.nx

buildroot/runtime/_hdl_build/nx_site_build.nx

15766 B321 linesdepth 2pulls 3 transitivereach 2 importersview sourcekind tooltopic site
docsdependenciesstructsconstsfunctions

about

nx_site_build.nx -- R1 WHOLE-SITE emitter. From ONE .site blueprint, emit a multi-PAGE site with a SHARED cross-page nav, INTERNAL links between pages, and its own sitemap.xml + robots.txt -- all through the gorgeous S-class kit (nx_sclass_kit sk_*), so every page is s-class-by-construction. Closes the whole-site gaps the factory census named: shared nav, internal <a href> links, and wired sitemap/robots EMISSION over our output. Reuses the andelinwest .site blueprint verbatim (title|/header|brand|cta|href /hero|headline|sub|cta|href /search|action|placeholder /cards+card|title|body /steps+step| /trust+sig| /footer|): the page LIST is derived from the cards (like nx_site_pages), but upgraded to the premium kit + real navigation + a self-emitted sitemap. usage: nx_site_build <config.site> <docroot> <domain> [theme:0|1] emits: <docroot>/index.html + <docroot>/practice/<slug>.html (one per card) + sitemap.xml + robots.txt SCALE: one buffer is mmap'd ONCE and reused per page (no per-iteration mmap -> no bump-allocator starvation). license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_sclass_kit.nx nx_syscalls.nx nx_site_build.nx nx_siteedit_daemon.nx

imports: nx_sclass_kit.nxnx_syscalls.nx

imported by: nx_siteedit_daemon.nx

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

main sb_w sys_write sys_exit sb_build_site sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sb_w ↻ sb_cg sb_slen sb_lm sb_fld sb_cards sb_lm ↻ sb_copy sb_slug sb_single sb_lm ↻ sb_copy ↻ sys_mkdir sb_cat sk_open_site sk_head he_puts sk_header_open he_puts ↻ emit_nav sk_nav_item he_puts ↻ sb_phref sb_cat ↻ sk_header_close he_puts ↻ sk_hero he_puts ↻

structs

none

consts

14const SB_MAGIC_1024: i64 = 1024
15const SB_MAGIC_131072: i64 = 131072
16const SB_MAGIC_262144: i64 = 262144
18const SB_ICON: *u8 = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M12 3l8 4v5c0 4-3.5 7-8 9-4.5-2-8-5-8-9V7l8-4z\"/></svg>"

functions

20func sb_w(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: sb_build_sitemain calls 1: sys_write
21func sb_wn(v: i64) -> i64
called by 1: sb_build_site calls 2: sys_writesys_mmap
30func sb_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: sb_cg
31func sb_cat(out: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){out[o]=s[i]; o=o+1; i=i+1} return o }
34func sb_copy(arena: *u8, ap: i64, text: *u8, start: i64, end: i64) -> i64
called by 2: sb_cardssb_single
42func sb_lm(text: *u8, ls: i64, le: i64, key: *u8, klen: i64) -> i64
50func sb_cg(text: *u8, tn: i64, key: *u8, out: *u8, cap: i64) -> i64
called by 1: sb_build_site calls 2: sb_slensb_lm
74func sb_fld(val: *u8, idx: i64, out: *u8) -> i64
called by 1: sb_build_site
84func sb_slug(title: *u8, out: *u8) -> i64
called by 1: sb_cards
103func sb_cards(text: *u8, tn: i64, ct: *i64, cb: *i64, cs: *i64, arena: *u8, apP: *i64, maxc: i64) -> i64
called by 1: sb_build_site calls 3: sb_lmsb_copysb_slug
132func sb_single(text: *u8, tn: i64, key: *u8, klen: i64, ptrs: *i64, arena: *u8, apP: *i64, maxc: i64) -> i64
called by 1: sb_build_site calls 2: sb_lmsb_copy
155func sb_phref(out: *u8, slug: *u8) -> i64
called by 2: emit_navsb_build_site calls 1: sb_cat
162func emit_nav(buf: *u8, off: i64, ncards: i64, ct: *i64, cs: *i64, hrefbuf: *u8) -> i64
called by 1: sb_build_site calls 2: sk_nav_itemsb_phref
173func emit_trust(buf: *u8, off: i64, nsigs: i64, sigs: *i64) -> i64
185func sb_build_site(config: *u8, docroot: *u8, domain: *u8, theme: i64) -> i64
308func main(argc: i64, argv: *i64) -> i64