code wiki / (root) / nx_cdmap_export.nx

nx_cdmap_export.nx

buildroot/runtime/nx_cdmap_export.nx

5181 B93 linesdepth 9pulls 15 transitivereach 0 importersview sourcekind tooltopic cdmap
docsdependenciesstructsconstsfunctions

about

nx_cdmap_export.nx -- EXPORT A COMPARE PAGE'S POSITION MAP AS A STANDALONE SVG AND A PNG (datavis DV6, 2026-09-15). Composes nx_cdmap_raster_lib: the page's :root colour tokens are read, the inline <svg class='cdmap'> is sliced, written as a self-contained SVG (namespace declared, every var(--nx-color-*) resolved to the rgb the page defined) and rasterised through the sovereign font engine and PNG writer at an integer scale. Every element class the figure carries is COUNTED on the receipt line, and every construct outside the drawn subset is counted too (skipped, unresolved colours, rotations the subset does not draw), so a reader can tell a complete render from a partial one by reading the line, never by opening the picture. The receipt's LAST token is the verdict. nx_cdmap_export <index.html> <out.svg> <out.png> [regular.ttf [bold.ttf [scale]]] Fonts default to the Liberation Sans faces probed at the NAS path, the buildroot-relative path and the laptop path. Exit 0 = both files landed, 1 = refused (the code is named), 2 = usage. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_cdmap_raster_lib.nx nx_syscalls.nx nx_cdmap_export.nx

imports: nx_cdmap_raster_lib.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main xp_put sys_write xp_font xp_exists sys_openat_rd sys_close xp_atoi rs_export sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read sys_munmap sys_close ↻ cr_find cr_slen sys_mmap ↻ rs_viewbox cr_tag_end cr_find ↻ cr_int_at sys_munmap ↻ tf_load sys_mmap ↻

structs

none

consts

14const XP_EXIT_OK: i64 = 0
15const XP_EXIT_REFUSED: i64 = 1
16const XP_EXIT_USAGE: i64 = 2
17const XP_ARGS_MIN: i64 = 4
18const XP_A_PAGE: i64 = 1
19const XP_A_SVG: i64 = 2
20const XP_A_PNG: i64 = 3
21const XP_A_FREG: i64 = 4
22const XP_A_FBOLD: i64 = 5
23const XP_A_SCALE: i64 = 6
24const XP_LINE_BYTES: i64 = 1024
25const XP_FONT_NAS: *u8 = "knowledge/fonts/LiberationSans-Regular.ttf"
26const XP_FONT_NAS_BOLD: *u8 = "knowledge/fonts/LiberationSans-Bold.ttf"
27const XP_FONT_UP: *u8 = "../knowledge/fonts/LiberationSans-Regular.ttf"
28const XP_FONT_UP_BOLD: *u8 = "../knowledge/fonts/LiberationSans-Bold.ttf"
29const XP_FONT_LAPTOP: *u8 = "web_assets/fonts/LiberationSans-Regular.ttf"
30const XP_FONT_LAPTOP_BOLD: *u8 = "web_assets/fonts/LiberationSans-Bold.ttf"
31const XP_CH_0: i64 = 48
32const XP_CH_9: i64 = 57
33const XP_BASE10: i64 = 10

functions

35func xp_put(s: *u8) -> i64 { sys_write(1, s, rs_slen(s)); return 0 }
called by 2: xp_ksmain calls 1: sys_write
36func xp_kv(k: *u8, v: i64) -> i64
48func xp_ks(k: *u8, v: *u8) -> i64 { xp_put(" " as *u8); xp_put(k); xp_put("=" as *u8); xp_put(v); return 0 }
called by 1: main calls 1: xp_put
49func xp_atoi(s: *u8) -> i64
called by 1: main
55func xp_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: xp_font calls 2: sys_openat_rdsys_close
57func xp_font(argv: *i64, argc: i64, idx: i64, nas: *u8, up: *u8, laptop: *u8) -> *u8
called by 1: main calls 1: xp_exists
64func main(argc: i64, argv: *i64) -> i64