code wiki / _hdl_build / nx_xlsx.nx

nx_xlsx.nx

buildroot/runtime/_hdl_build/nx_xlsx.nx

60962 B1283 linesdepth 7pulls 11 transitivereach 0 importersview sourcekind tooltopic xlsx
docsdependenciesstructsconstsfunctions

about

nx_xlsx.nx -- SOVEREIGN MS-Excel (.xlsx / SpreadsheetML) interop for the Nishi Office suite. A .xlsx is an OPC package (framed by the shared nx_opc, same ZIP as .docx) with 5 parts: [Content_Types].xml, _rels/.rels, xl/workbook.xml, xl/_rels/workbook.xml.rels, xl/worksheets/sheet1.xml fromtsv : a tab-separated grid -> a valid Excel-openable .xlsx (numeric cells as <v>, text as inlineStr; cell text XML-escaped). Use case: an estate asset SCHEDULE / valuation workbook. read : a .xlsx -> the sheet1 grid back as TSV (handles our inlineStr + numeric cells). Sovereignty = our own SpreadsheetML; rigor = the harness proves a 3rd-party (python zipfile) opens our .xlsx with valid CRC-32s and the expected cell values. HONEST LIMITATION: read supports inlineStr + numeric <v>; a real Excel file that uses a sharedStrings table (t="s") would yield string INDICES not text -- sharedStrings read is a follow-on. Sparse columns are emitted in document order (dense round-trip is exact; gaps are not repositioned). nx_xlsx fromtsv <in.tsv> <out.xlsx> | nx_xlsx read <in.xlsx> license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_opc.nx nx_xlsx.nx

imports: nx_syscalls.nxnx_itoa_lib.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 xl_puts sys_write sys_exit xl_streq xlsx_write_tsv sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close xl_macro_apply sys_mmap ↻ xl_dir_is xl_tok xl_streq ↻ xl_atoi_s xf_grid_new sys_mmap ↻ xf_load xl_is_numeric xf_q4_of xf_evalcell sys_mmap ↻ xf_expr xf_term xf_factor xf_ws xf_ws ↻ xf_ws ↻ xl_puts ↻ xl_num nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap

structs

120struct XfGrid

consts

17const XF_MAGIC_10000: i64 = 10000
18const XF_MAGIC_8388624: i64 = 8388624
19const XF_MAGIC_4194320: i64 = 4194320
20const XF_MAGIC_4194304: i64 = 4194304
21const XF_MAGIC_8388608: i64 = 8388608
22const XF_MAGIC_1048592: i64 = 1048592
23const XF_MAGIC_16384: i64 = 16384
24const XF_MAGIC_33554432: i64 = 33554432
25const XF_MAGIC_1048576: i64 = 1048576
117const XF_MAXC: i64 = 64
118const XF_MAXR: i64 = 1024
538const XL_MAXR: i64 = 512
539const XL_MAXC: i64 = 64
540const XL_CELLW: i64 = 40

functions

27func xl_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 2: xlsx_write_tsvmain calls 1: sys_write
32func xl_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: xlsx_write_tsvmain calls 1: nxi_out
33func xl_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 2: xl_macro_applymain
34func xl_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
35func xl_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 }
36func xl_uint(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; 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 o: i64=off; var i: i64=0; while i<k{dst[o]=t[k-1-i];o=o+1;i=i+1} return o }
37func xl_match(buf: *u8, pos: i64, n: i64, pat: *u8) -> i64
called by 1: xlsx_write_tsv
41func xl_col(dst: *u8, off: i64, idx: i64) -> i64
47func xl_is_numeric(src: *u8, soff: i64, slen: i64) -> i64
63func xl_escape_region(out: *u8, o: i64, src: *u8, soff: i64, slen: i64) -> i64
called by 2: xl_emit_cellxl_build_sheet_g calls 1: xl_cat
73func xl_emit_cell(out: *u8, o: i64, col: i64, row: i64, src: *u8, soff: i64, slen: i64) -> i64
88func xl_build_sheet(tsv: *u8, tn: i64, out: *u8) -> i64
134func xf_grid_new(tsv: *u8) -> *XfGrid
150func xf_ws(s: *u8, ip: *i64, e: i64) -> i64
156func xf_q4_of(s: *u8, off: i64, len: i64) -> i64
173func xf_fmtq4(dst: *u8, off: i64, v: i64) -> i64
196func xf_refparse(s: *u8, ip: *i64, e: i64, rc: *i64) -> i64
216func xf_cellnum(g: *XfGrid, r: i64, c: i64) -> i64
237func xf_factor(g: *XfGrid, ip: *i64, e: i64) -> i64
354func xf_term(g: *XfGrid, ip: *i64, e: i64) -> i64
376func xf_expr(g: *XfGrid, ip: *i64, e: i64) -> i64
397func xf_evalcell(g: *XfGrid, r: i64, c: i64) -> i64
412func xf_load(g: *XfGrid, tsv: *u8, tn: i64) -> i64
477func xl_build_sheet_g(g: *XfGrid, tsv: *u8, tn: i64, out: *u8) -> i64
542func xl_dir_is(buf: *u8, s: i64, e: i64, tag: *u8) -> i64
549func xl_tok(buf: *u8, p: i64, e: i64, out: *u8, cap: i64, np: *i64) -> i64
558func xl_atoi_s(s: *u8) -> i64
567func xl_macro_apply(tsv: *u8, n: i64, out: *u8, cap: i64) -> i64
689func xl_styles_dxf() -> *u8
694func xl_emit_cf_dv(out: *u8, off: i64, tsv: *u8, n: i64) -> i64
762func xlsx_write_tsv(tsvpath: *u8, outpath: *u8) -> i64
805func xl_shared_load(path: *u8, sbuf: *u8, soffs: *i64, maxn: i64) -> i64
845func xlsx_read_tsv(path: *u8, out: *u8, cap: i64) -> i64
916func xl_esc1(dst: *u8, o: i64, c: i64) -> i64
924func xl_rowhtml(out: *u8, off: i64, tsv: *u8, s: i64, e: i64, ishdr: i64) -> i64
950func xl_chart_html(out: *u8, off: i64, tsv: *u8, tn: i64) -> i64
1066func xl_tsv_to_html(tsv: *u8, tn: i64, out: *u8, dlurl: *u8, label: *u8) -> i64
1091func xlsx_to_html(path: *u8, out: *u8, dlurl: *u8) -> i64
1103func xl_colletter(s: *u8) -> i64
1117func xl_pivot(tsv: *u8, tn: i64, gc: i64, vc: i64, pout: *u8) -> i64
1212func main(argc: i64, argv: *i64) -> i64