code wiki / _hdl_build / nx_odt.nx

nx_odt.nx

buildroot/runtime/_hdl_build/nx_odt.nx

7178 B108 linesdepth 7pulls 10 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_odt.nx -- SOVEREIGN OpenDocument Text (.odt / ODF) interop for the Nishi Office suite. .odt is a ZIP (framed by the shared nx_opc) of XML parts -- the format LibreOffice / OpenOffice / Google Docs use natively. So with nx_docx (.docx) + nx_odt (.odt) Nishi interops with BOTH dominant office families. write : paragraphs -> mimetype (STORED, FIRST entry per ODF) + META-INF/manifest.xml + content.xml read : a .odt -> the text of content.xml (extracts <text:p> paragraphs, strips inner spans, unescapes XML) ODF requires the `mimetype` part to be the FIRST entry and STORED (uncompressed) so the package magic is detectable -- opc_write writes STORED with no extra field, and we pass mimetype first, so that holds. nx_odt write <path.odt> <paragraph1> [paragraph2 ...] | nx_odt read <path.odt> license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_opc.nx nx_odt.nx

imports: nx_syscalls.nxnx_opc.nx

imported by: nobody (leaf or entry point)

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

main ot_puts sys_write sys_exit ot_streq sys_mmap odt_write sys_mmap ↻ ot_build_content ot_cat ot_xml_escape ot_cat ↻ ot_strlen opc_write sys_mmap ↻ nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at opc_strlen opc_put_u32 opc_put_u16 opc_copy sys_openat_wr sys_write ↻ sys_close ot_num sys_mmap ↻ sys_write ↻ odt_read_text sys_mmap ↻ opc_read_part sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ zip_read_u32

structs

none

consts

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

functions

15func ot_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
16func ot_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=(48 as u8);k=1}; while m>0{t[k]=((48+(m%10)) as u8);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
17func ot_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: odt_write
18func ot_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 }
called by 1: main
19func ot_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 }
20func ot_match(buf: *u8, pos: i64, n: i64, pat: *u8) -> i64
called by 1: odt_read_text
23func ot_xml_escape(dst: *u8, off: i64, s: *u8) -> i64
called by 1: ot_build_content calls 1: ot_cat
32func ot_build_content(paras: *i64, nparas: i64, out: *u8) -> i64
called by 1: odt_write calls 2: ot_catot_xml_escape
40func odt_write(path: *u8, paras: *i64, nparas: i64) -> i64
52func odt_read_text(path: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_mmapopc_read_partot_match
87func main(argc: i64, argv: *i64) -> i64