code wiki / _hdl_build / nx_mailmerge.nx

nx_mailmerge.nx

buildroot/runtime/_hdl_build/nx_mailmerge.nx

6644 B124 linesdepth 8pulls 12 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_mailmerge.nx -- SOVEREIGN mail merge for the Nishi Office suite (the lawyer workflow): one TEMPLATE .docx carrying {{field}} placeholders + a tab-separated DATA source (header row of field names, then one record per row) -> one personalized .docx per record. Composes directly on nx_docx (docx_read_part reads the template's raw word/document.xml; docx_write_document_xml frames each merged result as a valid OPC package). Placeholder values are XML-escaped, so '&'/'<' in data are safe. Unknown placeholders are left literally (never silently dropped). Use case: generate per-heir bequest letters / probate notices from the estate inventory. nx_mailmerge <template.docx> <data.tsv> <out_prefix> -> writes <out_prefix>1.docx .. <out_prefix>N.docx (one per data row) HONEST LIMITATION: substitutes at the document.xml byte level, so a placeholder must live within a single <w:t> run (true for templates we author; a real Word template that splits {{x}} across runs is a follow-on). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_docx.nx nx_mailmerge.nx

imports: nx_docx.nx

imported by: nobody (leaf or entry point)

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

main dx_puts sys_write docx_read_part opc_read_part sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close zip_read_u32 zip_parse_lfh zip_read_u32 ↻ zip_read_u16 opc_region_eq opc_strlen nx_deflate_inflate sys_mmap ↻ nx_bitstream_alloc sys_mmap ↻ _deflate_inflate_block nx_bitstream_read_lsb nx_bitstream_bits_remainin _bs_peek_byte nx_bitstream_byte_align nx_bitstream_read_byte_ali nx_bitstream_byte_align ↻ _deflate_build_static_litl sys_mmap ↻ nx_huffman_build _deflate_build_static_dist sys_mmap ↻ nx_huffman_build ↻ _deflate_decode_huffman_bl nx_huffman_decode_lsb _deflate_length_base _deflate_length_extra nx_bitstream_read_lsb ↻

structs

none

consts

13const K_MAGIC_1048592: i64 = 1048592
14const K_MAGIC_1048576: i64 = 1048576

functions

17func mm_slice_eq(a: *u8, aoff: i64, alen: i64, b: *u8, boff: i64, blen: i64) -> i64
called by 1: mm_merge_one
22func mm_int_to(buf: *u8, off: i64, v: i64) -> i64
called by 1: main
29func mm_escape_region(out: *u8, o: i64, src: *u8, soff: i64, slen: i64) -> i64
called by 1: mm_merge_one calls 1: dx_cat
40func mm_parse_line(buf: *u8, start: i64, n: i64, off: *i64, len: *i64, nextp: *i64) -> i64
called by 1: main
60func mm_merge_one(tmpl: *u8, tlen: i64, tsv: *u8, hoff: *i64, hlen: *i64, nfields: i64, voff: *i64, vlen: *i64, nvals: i64, out: *u8) -> i64
called by 1: main calls 2: mm_slice_eqmm_escape_region
82func main(argc: i64, argv: *i64) -> i64