code wiki / _hdl_build / nx_odt.nx
nx_odt.nx
buildroot/runtime/_hdl_build/nx_odt.nx
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
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
structs
| none |
consts
| 12 | const K_MAGIC_1048592: i64 = 1048592 |
| 13 | const K_MAGIC_1048576: i64 = 1048576 |
functions
| 15 | func 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 } |
| 16 | func 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 } |
| 17 | func 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 |
| 18 | func 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 |
| 19 | func 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 } |
| 20 | func ot_match(buf: *u8, pos: i64, n: i64, pat: *u8) -> i64 called by 1: odt_read_text |
| 23 | func ot_xml_escape(dst: *u8, off: i64, s: *u8) -> i64 |
| 32 | func ot_build_content(paras: *i64, nparas: i64, out: *u8) -> i64 |
| 40 | func odt_write(path: *u8, paras: *i64, nparas: i64) -> i64 |
| 52 | func odt_read_text(path: *u8, out: *u8, cap: i64) -> i64 |
| 87 | func main(argc: i64, argv: *i64) -> i64 |