code wiki / _hdl_build / nx_cdmap_export_gate.nx

nx_cdmap_export_gate.nx

buildroot/runtime/_hdl_build/nx_cdmap_export_gate.nx

20725 B269 linesdepth 9pulls 16 transitivereach 0 importersview sourcekind gate/prooftopic cdmap
docsdependenciesstructsconstsfunctions

about

nx_cdmap_export_gate.nx -- referee for the position map's EXPORT (datavis DV6, nx_cdmap_raster_lib, 2026-09-15). A planted page carries a :root token block and a small cdmap svg with one of every construct the emitter writes (frame rect with stroke, dashed gridline, momentum polyline with the arrow marker, filled polygon, a bubble with a translucent fill and a momentum ring, a bold haloed label, anchored axis titles, a -90 rotated title, a cdnote group, an uppercase muted quadrant word, a rotation the subset does not draw, and an element outside the subset). The gate composes the library IN-PROCESS and holds the render to the pixels: the token colours land where the elements are, the translucent bubble blends by the declared opacity, the dash is ON where the phase says on and OFF where it says off, the arrow tip is ink, the labels leave dark ink in their boxes, the rotated title leaves ink in a vertical band, and every count on the stats record equals the fixture's census. Both files are then written through rs_export and read back (PNG signature and IHDR dimensions; SVG namespace present and every colour variable resolved). Negative controls drive the named refusals (no figure, no tokens, no font, a scale out of range) and a determinism tooth renders twice. When the live search page is on disk it is exported to /tmp and announced through gv_kv, never gv_need. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_cdmap_raster_lib.nx nx_syscalls.nx nx_gate_verdict.nx nx_cdmap_export_gate.nx

imports: nx_cdmap_raster_lib.nxnx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ sys_mkdir gv_check gv_puts ↻ g_write sys_openat_wr sys_write ↻ sys_mmap ↻ sys_close g_exists sys_openat_rd sys_close ↻ sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ sys_mmap ↻ gv_check_eq

structs

none

consts

18const G_DIR: *u8 = "/tmp/nx_cdmap_export_gate/"
19const G_PAGE: *u8 = "/tmp/nx_cdmap_export_gate/page.html"
20const G_NOSVG: *u8 = "/tmp/nx_cdmap_export_gate/nosvg.html"
21const G_NOROOT: *u8 = "/tmp/nx_cdmap_export_gate/noroot.html"
22const G_SVG: *u8 = "/tmp/nx_cdmap_export_gate/cdmap.svg"
23const G_PNG: *u8 = "/tmp/nx_cdmap_export_gate/cdmap.png"
24const G_LIVE_SVG: *u8 = "/tmp/nx_cdmap_export_gate/live.svg"
25const G_LIVE_PNG: *u8 = "/tmp/nx_cdmap_export_gate/live.png"
26const G_LIVE_PAGE: *u8 = "sites/nishifamily/compare/search/index.html"
27const G_NOFONT: *u8 = "/tmp/nx_cdmap_export_gate/absent.ttf"
28const G_FONT_NAS: *u8 = "knowledge/fonts/LiberationSans-Regular.ttf"
29const G_FONT_NAS_BOLD: *u8 = "knowledge/fonts/LiberationSans-Bold.ttf"
30const G_FONT_UP: *u8 = "../knowledge/fonts/LiberationSans-Regular.ttf"
31const G_FONT_UP_BOLD: *u8 = "../knowledge/fonts/LiberationSans-Bold.ttf"
32const G_FONT_LAPTOP: *u8 = "web_assets/fonts/LiberationSans-Regular.ttf"
33const G_FONT_LAPTOP_BOLD: *u8 = "web_assets/fonts/LiberationSans-Bold.ttf"
34const G_MODE_644: i64 = 420
35const G_DIR_MODE: i64 = 493
36const G_I64: i64 = 8
37const G_SCALE: i64 = 2
38const G_VB_W: i64 = 200
39const G_VB_H: i64 = 120
40const G_CH_HASH: i64 = 35
41const G_TOL: i64 = 2 // channel tolerance for a blended pixel (integer rounding)
42const G_DARK_MAX_R: i64 = 120 // a label pixel darker than this red channel is ink
43const G_PNG_SIG0: i64 = 137
44const G_PNG_SIG1: i64 = 80
45const G_PNG_W_OFF: i64 = 16
46const G_PNG_H_OFF: i64 = 20
47const G_BYTE: i64 = 256
49const G_BG_R: i64 = 243
50const G_BG_G: i64 = 241
51const G_BG_B: i64 = 236
52const G_PANEL_R: i64 = 249
53const G_PANEL_G: i64 = 247
54const G_PANEL_B: i64 = 243
55const G_MUT_R: i64 = 92
56const G_MUT_G: i64 = 96
57const G_MUT_B: i64 = 104
58const G_BUB_R: i64 = 86
59const G_BUB_G: i64 = 180
60const G_BUB_B: i64 = 233
61const G_BUB_A: i64 = 820
62const G_RING_R: i64 = 40
63const G_RING_G: i64 = 160
64const G_RING_B: i64 = 90
65const G_POLY_R: i64 = 230
66const G_POLY_G: i64 = 159
67const G_POLY_B: i64 = 0
68const G_PERMIL: i64 = 1000
70const G_HEAD: *u8 = "<html><head><style>\n:root{\n --nx-color-bg: rgb(243,241,236);\n --nx-color-fg: rgb(26,26,28);\n --nx-color-panel: rgb(249,247,243);\n --nx-color-line: rgb(219,216,208);\n --nx-color-mut: rgb(92,96,104);\n --nx-color-accent: rgb(88,64,180);\n --nx-font-mono: ui-monospace;\n}\n@media (prefers-color-scheme: dark){:root{--nx-color-bg: rgb(0,0,0);}}\n</style></head><body><p>before</p>\n<figure class='cdfig'><svg class='cdmap' viewBox='0 0 200 120' width='100%' font-family='system-ui'>\n<title id='cdmap-title'>fixture</title><desc id='cdmap-desc'>a planted map</desc>\n<defs><marker id='cdarrow' viewBox='0 0 8 8' refX='7' refY='4'><path d='M0,0 L8,4 L0,8 z' fill='var(--nx-color-mut)'/></marker></defs>\n<rect x='20' y='10' width='160' height='90' rx='6' fill='var(--nx-color-panel)' stroke='var(--nx-color-line)'/>\n<line x1='20' y1='55' x2='180' y2='55' stroke='var(--nx-color-mut)' stroke-dasharray='6 4'/>\n<polygon points='150,70 170,70 170,90 150,90' fill='rgb(230,159,0)' fill-opacity='1'/>\n<polyline data-p='1' points='60,80 90,50' fill='none' stroke='rgb(40,160,90)' stroke-dasharray='4 3' marker-end='url("
71const G_TAIL: *u8 = "cdarrow)'/>\n<circle cx='100' cy='40' r='10' data-p='1' fill='rgb(86,180,233)' fill-opacity='0.82' stroke='rgb(40,160,90)' stroke-width='2'><title>Nishi 700 300</title></circle>\n<text x='112' y='44' data-p='1' font-size='13' fill='var(--nx-color-fg)' style='paint-order:stroke;stroke:var(--nx-color-bg);stroke-width:3px;stroke-linejoin:round' font-weight='700'>Nishi</text>\n<text x='100' y='114' fill='var(--nx-color-mut)' font-size='12' text-anchor='middle'>Centrality 700&ndash;1000 &middot; up &rarr;</text>\n<text x='8' y='55' fill='var(--nx-color-mut)' font-size='12' text-anchor='middle' transform='rotate(-90 8 55)'>Distinct</text>\n<g class='cdnote'><title>note n1</title><rect x='120' y='12' width='50' height='20' rx='4' fill='var(--nx-color-panel)' stroke='var(--nx-color-mut)' stroke-dasharray='2 2'/>\n<text x='125' y='26' fill='var(--nx-color-fg)' font-size='11'>bright &amp; loud</text>\n</g>\n<text x='30' y='30' fill='var(--nx-color-mut)' font-size='11' text-anchor='middle' opacity='0.75' style='letter-spacing:.12em;text-transform:uppercase'>tail</text>\n<text x='5' y='112' fill='var(--nx-color-fg)' font-size='12' transform='rotate(45 5 112)'>skew</text>\n<ellipse cx='5' cy='5' rx='2' ry='2' fill='var(--nx-color-fg)'/>\n</svg><figcaption>cap</figcaption></figure><p>after</p></body></html>\n"
72const G_NOSVG_BODY: *u8 = "<html><head><style>:root{--nx-color-bg: rgb(1,2,3);}</style></head><body><svg viewBox='0 0 10 10'><rect x='0' y='0' width='1' height='1'/></svg></body></html>\n"
73const G_NOROOT_BODY: *u8 = "<html><body><svg class='cdmap' viewBox='0 0 10 10'><rect x='0' y='0' width='1' height='1' fill='rgb(1,2,3)'/></svg></body></html>\n"

functions

75func g_write(path: *u8, a: *u8, b: *u8, hash: i64) -> i64
84func g_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
called by 1: main calls 2: sys_openat_rdsys_close
85func g_px(fb: *i64, W: i64, x: i64, y: i64, rgb: *i64) -> i64 { return rs_fb_get(fb, W, x, y, rgb) }
called by 2: g_isg_dark_in
86func g_near(v: i64, want: i64) -> i64 { if rs_abs(v - want) <= G_TOL { return 1 } return 0 }
called by 2: g_ismain
87func g_is(fb: *i64, W: i64, x: i64, y: i64, r: i64, g: i64, b: i64) -> i64
called by 1: main calls 3: g_pxg_nearsys_munmap
95func g_dark_in(fb: *i64, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64) -> i64
called by 1: main calls 2: g_pxsys_munmap
103func g_fb_sum(fb: *i64, n: i64) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < n { s = s + fb[i] % 1000003; i = i + 1 } return s }
called by 1: main
104func g_has(buf: *u8, n: i64, needle: *u8) -> i64 { if cr_find(buf, 0, n, needle) != CR_ABSENT { return 1 } return 0 }
called by 1: main
105func g_be32(b: *u8, o: i64) -> i64 { return (b[o] as i64) * G_BYTE * G_BYTE * G_BYTE + (b[o + 1] as i64) * G_BYTE * G_BYTE + (b[o + 2] as i64) * G_BYTE + (b[o + 3] as i64) }
called by 1: main
107func main() -> i64