code wiki / (root) / nx_mailpiece.nx

nx_mailpiece.nx

buildroot/runtime/nx_mailpiece.nx

18419 B356 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_mailpiece.nx -- PHYSICAL MAIL COMPOSITION (rung 2 of Nishi Mail to SOTA). Composes a print-ready postcard as an RGB raster and writes it as PNG (preview + the exact bitmap the sovereign print path nx_img_print -> PWG/URF -> IPP feeds to a real printer). NISHI-POSTCARD: 6x4in @300dpi = 1800x1200. FRONT = greeting design (accent bleed + cream panel + centered title). BACK = USPS layout: message on the left, a vertical divider, the recipient address block in the address zone on the right, a stamp (indicia) box top-right, and the lower-right IMb barcode clear zone kept blank by construction. Sovereign: pure integer raster ops + the sovereign 8x8 font; no 3rd party. Last-mile (print vs carrier) is the next rung. Commands: postcard <front.png> <back.png> <greeting> <message> <recipient> <line1> <city> <region> <postal> ; argless = selftest. expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_font8x8.nx nx_png_write.nx nx_mailpiece.nx

imports: nx_syscalls.nxnx_font8x8.nxnx_png_write.nx

imported by: nobody (leaf or entry point)

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

main cmd_selftest p sys_write slen compose font8x8_table sys_mmap fg sys_mmap ↻ fill_rect set_px rect_outline fill_rect ↻ text_w slen ↻ draw_text draw_glyph set_px ↻ nx_png_write_rgb sys_openat_wr sys_mmap ↻ sys_write ↻ pw_chunk pw_u32be sys_mmap ↻ sys_write ↻ sys_write ↻ pw_crc_block pw_adler32 sys_close draw_wrap draw_glyph ↻ cpy p ↻ fsize sys_openat_rd sys_lseek sys_close ↻ sys_mmap ↻

structs

none

consts

13const K_MAGIC_1800: i64 = 1800
14const K_MAGIC_1200: i64 = 1200
15const K_MAGIC_1080: i64 = 1080
16const K_MAGIC_1040: i64 = 1040
17const K_MAGIC_1560: i64 = 1560
18const K_MAGIC_1720: i64 = 1720
19const K_MAGIC_1587: i64 = 1587
20const K_MAGIC_2550: i64 = 2550
21const K_MAGIC_3300: i64 = 3300
22const K_MAGIC_1099: i64 = 1099
23const K_MAGIC_1102: i64 = 1102
24const K_MAGIC_2199: i64 = 2199
25const K_MAGIC_2202: i64 = 2202
26const K_MAGIC_1250: i64 = 1250
27const K_MAGIC_1380: i64 = 1380
28const K_MAGIC_1950: i64 = 1950
29const K_MAGIC_2500: i64 = 2500
30const K_MAGIC_2590: i64 = 2590
31const K_MAGIC_3140: i64 = 3140
32const K_MAGIC_2850: i64 = 2850
33const K_MAGIC_1238: i64 = 1238
34const K_MAGIC_2620: i64 = 2620
35const K_MAGIC_2760: i64 = 2760
36const K_MAGIC_2640: i64 = 2640
37const K_MAGIC_1612: i64 = 1612
38const K_MAGIC_1088: i64 = 1088
39const K_MAGIC_3150: i64 = 3150
40const K_MAGIC_2175: i64 = 2175
41const K_MAGIC_1575: i64 = 1575
42const K_MAGIC_2050: i64 = 2050
43const K_MAGIC_1300: i64 = 1300
44const K_MAGIC_1890: i64 = 1890

functions

46func slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: ptext_w
47func p(s: *u8) -> i64 { sys_write(1, s, slen(s)); return 0 }
48func pn(v: i64) -> i64
called by 1: cmd_selftest calls 3: psys_mmapsys_write
54func seq(a: *u8, b: *u8) -> i64
called by 1: main
62func set_px(rgb: *u8, W: i64, H: i64, x: i64, y: i64, r: i64, g: i64, b: i64) -> i64
called by 2: fill_rectdraw_glyph
71func fill_rect(rgb: *u8, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64, r: i64, g: i64, b: i64) -> i64
76func rect_outline(rgb: *u8, W: i64, H: i64, x0: i64, y0: i64, x1: i64, y1: i64, th: i64, r: i64, g: i64, b: i64) -> i64
84func draw_glyph(rgb: *u8, W: i64, H: i64, tbl: *u8, ch: i64, x: i64, y: i64, sc: i64, r: i64, g: i64, b: i64) -> i64
called by 2: draw_textdraw_wrap calls 1: set_px
104func draw_text(rgb: *u8, W: i64, H: i64, tbl: *u8, s: *u8, x: i64, y: i64, sc: i64, sp: i64, r: i64, g: i64, b: i64) -> i64
111func draw_wrap(rgb: *u8, W: i64, H: i64, tbl: *u8, s: *u8, x: i64, y: i64, sc: i64, maxw: i64, r: i64, g: i64, b: i64) -> i64
130func cpy(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
131func text_w(s: *u8, sc: i64, sp: i64) -> i64 { return slen(s) * (8*sc + sp) }
called by 2: composecompose_card calls 1: slen
132func fsize(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let n: i64 = sys_lseek(fd, 0, 2); sys_close(fd); return n }
135func compose(fp: *u8, bp: *u8, greeting: *u8, message: *u8, recipient: *u8, line1: *u8, city: *u8, region: *u8, postal: *u8) -> i64
182func compose_letter(a: *i64) -> i64
219func compose_envelope(a: *i64) -> i64
242func compose_card(a: *i64) -> i64
278func cmd_selftest() -> i64
334func main(argc: i64, argv: *i64) -> i64