code wiki / _hdl_build / nx_docx.nx

nx_docx.nx

buildroot/runtime/_hdl_build/nx_docx.nx

36095 B569 linesdepth 7pulls 11 transitivereach 2 importersview sourcekind librarytopic docx
docsdependenciesstructsconstsfunctions

about

nx_docx.nx -- SOVEREIGN MS-Word (.docx / OOXML) interop for the Nishi Office suite. A .docx is an OPC package = a ZIP of XML parts (framed by the shared nx_opc). This organ READS and WRITES real .docx with ZERO 3rd-party code: write : paragraphs -> a minimal valid OPC package ([Content_Types].xml + _rels/.rels + word/document.xml) -> a file Microsoft Word / unzip can open. read : a .docx -> the text of word/document.xml (STORED and DEFLATE entries both handled via nx_opc), extracting each <w:t> run and joining runs with newlines, unescaping XML entities. This is the "lawyers make native edits / interop with Microsoft Office" keystone; nx_mailmerge composes on top. Sovereignty = our own ZIP+OOXML; rigor (non-novel-format doctrine) = the harness ALSO proves a 3rd-party unzip/zipfile opens what we write and that we read what it writes. nx_docx write <path.docx> <paragraph1> [paragraph2 ...] nx_docx read <path.docx> license_tier: ORIGINAL

dependencies 3 imports · 2 importers

nx_syscalls.nx nx_itoa_lib.nx nx_opc.nx nx_docx.nx nx_mailmerge.nx nx_vizsla_docgen.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_opc.nx

imported by: nx_mailmerge.nxnx_vizsla_docgen.nx

structs

none

consts

17const K_MAGIC_1048592: i64 = 1048592
18const K_MAGIC_1048576: i64 = 1048576
19const K_MAGIC_262160: i64 = 262160
20const K_MAGIC_2097168: i64 = 2097168
21const K_MAGIC_2097152: i64 = 2097152
93const DX_EMU_PER_PX: i64 = 9525 // 914400 EMU/inch / 96 px/inch (ECMA-376 drawing units)

functions

23func dx_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
28func dx_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
29func dx_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
30func dx_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i]{return 0} i=i+1 } if b[i]!=(0 as u8){return 0} return 1 }
31func dx_cat(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 }
34func dx_match(buf: *u8, pos: i64, n: i64, pat: *u8) -> i64
40func dx_xml_escape(dst: *u8, off: i64, s: *u8) -> i64
51func dx_build_document(paras: *i64, nparas: i64, out: *u8) -> i64
66func docx_write_document_xml(path: *u8, doc: *u8, doclen: i64) -> i64
79func docx_write(path: *u8, paras: *i64, nparas: i64) -> i64
96func dx_catn(dst: *u8, off: i64, v: i64) -> i64
109func dx_png_dim(png: *u8, n: i64, out_wh: *i64) -> i64
127func dx_emit_drawing(out: *u8, off: i64, rid: *u8, wpx: i64, hpx: i64, pid: i64, name: *u8) -> i64
153func dx_emit_sectpr(out: *u8, off: i64, hdr_rid: *u8, ftr_rid: *u8) -> i64
165func dx_emit_track(out: *u8, off: i64, rev: i64, author: *u8, date: *u8, ins_txt: *u8, del_txt: *u8) -> i64
192func dx_cm_add(out: *u8, off: i64, cid: i64, txt: *u8) -> i64
207func dx_cm_part(out: *u8, off: i64, cid: i64, author: *u8, initials: *u8, date: *u8, body: *u8) -> i64
225func dx_fn_add(out: *u8, off: i64, fid: i64, txt: *u8) -> i64
236func dx_fn_part(out: *u8, off: i64, fid: i64, body: *u8) -> i64
250func dx_esc_span(dst: *u8, off: i64, spec: *u8, s: i64, e: i64) -> i64
260func dx_emit_para(out: *u8, o: i64, rpr: *u8, spec: *u8, s: i64, e: i64) -> i64
269func dx_build_body_rich(spec: *u8, slen: i64, out: *u8) -> i64
325func docx_write_rich(path: *u8, spec: *u8, slen: i64) -> i64
330func dx_readfile(path: *u8, buf: *u8, cap: i64) -> i64
338func docx_read_part(path: *u8, want: *u8, out: *u8, cap: i64) -> i64
343func docx_read_text(path: *u8, out: *u8, cap: i64) -> i64
383func dx_wrapopen(pb: *u8, o: i64, rb: i64, ri: i64) -> i64
389func dx_wrapclose(pb: *u8, o: i64, rb: i64, ri: i64) -> i64
401func dx_to_html(path: *u8, out: *u8, cap: i64, dlurl: *u8) -> i64
507func main(argc: i64, argv: *i64) -> i64