code wiki / _hdl_build / nx_cdmap_export_gate.nx
nx_cdmap_export_gate.nx
buildroot/runtime/_hdl_build/nx_cdmap_export_gate.nx
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
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
structs
| none |
consts
| 18 | const G_DIR: *u8 = "/tmp/nx_cdmap_export_gate/" |
| 19 | const G_PAGE: *u8 = "/tmp/nx_cdmap_export_gate/page.html" |
| 20 | const G_NOSVG: *u8 = "/tmp/nx_cdmap_export_gate/nosvg.html" |
| 21 | const G_NOROOT: *u8 = "/tmp/nx_cdmap_export_gate/noroot.html" |
| 22 | const G_SVG: *u8 = "/tmp/nx_cdmap_export_gate/cdmap.svg" |
| 23 | const G_PNG: *u8 = "/tmp/nx_cdmap_export_gate/cdmap.png" |
| 24 | const G_LIVE_SVG: *u8 = "/tmp/nx_cdmap_export_gate/live.svg" |
| 25 | const G_LIVE_PNG: *u8 = "/tmp/nx_cdmap_export_gate/live.png" |
| 26 | const G_LIVE_PAGE: *u8 = "sites/nishifamily/compare/search/index.html" |
| 27 | const G_NOFONT: *u8 = "/tmp/nx_cdmap_export_gate/absent.ttf" |
| 28 | const G_FONT_NAS: *u8 = "knowledge/fonts/LiberationSans-Regular.ttf" |
| 29 | const G_FONT_NAS_BOLD: *u8 = "knowledge/fonts/LiberationSans-Bold.ttf" |
| 30 | const G_FONT_UP: *u8 = "../knowledge/fonts/LiberationSans-Regular.ttf" |
| 31 | const G_FONT_UP_BOLD: *u8 = "../knowledge/fonts/LiberationSans-Bold.ttf" |
| 32 | const G_FONT_LAPTOP: *u8 = "web_assets/fonts/LiberationSans-Regular.ttf" |
| 33 | const G_FONT_LAPTOP_BOLD: *u8 = "web_assets/fonts/LiberationSans-Bold.ttf" |
| 34 | const G_MODE_644: i64 = 420 |
| 35 | const G_DIR_MODE: i64 = 493 |
| 36 | const G_I64: i64 = 8 |
| 37 | const G_SCALE: i64 = 2 |
| 38 | const G_VB_W: i64 = 200 |
| 39 | const G_VB_H: i64 = 120 |
| 40 | const G_CH_HASH: i64 = 35 |
| 41 | const G_TOL: i64 = 2 // channel tolerance for a blended pixel (integer rounding) |
| 42 | const G_DARK_MAX_R: i64 = 120 // a label pixel darker than this red channel is ink |
| 43 | const G_PNG_SIG0: i64 = 137 |
| 44 | const G_PNG_SIG1: i64 = 80 |
| 45 | const G_PNG_W_OFF: i64 = 16 |
| 46 | const G_PNG_H_OFF: i64 = 20 |
| 47 | const G_BYTE: i64 = 256 |
| 49 | const G_BG_R: i64 = 243 |
| 50 | const G_BG_G: i64 = 241 |
| 51 | const G_BG_B: i64 = 236 |
| 52 | const G_PANEL_R: i64 = 249 |
| 53 | const G_PANEL_G: i64 = 247 |
| 54 | const G_PANEL_B: i64 = 243 |
| 55 | const G_MUT_R: i64 = 92 |
| 56 | const G_MUT_G: i64 = 96 |
| 57 | const G_MUT_B: i64 = 104 |
| 58 | const G_BUB_R: i64 = 86 |
| 59 | const G_BUB_G: i64 = 180 |
| 60 | const G_BUB_B: i64 = 233 |
| 61 | const G_BUB_A: i64 = 820 |
| 62 | const G_RING_R: i64 = 40 |
| 63 | const G_RING_G: i64 = 160 |
| 64 | const G_RING_B: i64 = 90 |
| 65 | const G_POLY_R: i64 = 230 |
| 66 | const G_POLY_G: i64 = 159 |
| 67 | const G_POLY_B: i64 = 0 |
| 68 | const G_PERMIL: i64 = 1000 |
| 70 | const 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(" |
| 71 | const 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–1000 · up →</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 & 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" |
| 72 | const 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" |
| 73 | const 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
| 75 | func g_write(path: *u8, a: *u8, b: *u8, hash: i64) -> i64 |
| 84 | func g_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 85 | func g_px(fb: *i64, W: i64, x: i64, y: i64, rgb: *i64) -> i64 { return rs_fb_get(fb, W, x, y, rgb) } |
| 86 | func g_near(v: i64, want: i64) -> i64 { if rs_abs(v - want) <= G_TOL { return 1 } return 0 } |
| 87 | func g_is(fb: *i64, W: i64, x: i64, y: i64, r: i64, g: i64, b: i64) -> i64 |
| 95 | func g_dark_in(fb: *i64, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64) -> i64 |
| 103 | func 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 |
| 104 | func 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 |
| 105 | func 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 |
| 107 | func main() -> i64 |