code wiki / _hdl_build / nx_opc.nx
nx_opc.nx
buildroot/runtime/_hdl_build/nx_opc.nx
about
nx_opc.nx -- shared sovereign OPC (Open Packaging Conventions) ZIP framer + part reader. Every OOXML format
(.docx, .xlsx, .pptx) is an OPC package = a ZIP of XML parts; this is the ONE ZIP implementation they share
(DRY keystone). opc_write frames parts as a STORED-method ZIP with real CRC-32s -> a file Word/Excel/unzip
opens; opc_read_part materializes a named part's raw bytes (STORED copy, or DEFLATE inflate via nx_deflate,
so it reads what Word/Excel actually produce). Reuses nx_crc32 (standard ISO-HDLC = exactly ZIP's CRC) +
nx_zip_header (LFH/EOCD parser) + nx_deflate (inflate). license_tier: ORIGINAL
dependencies 4 imports · 16 importers
diagram shows first 10 each side; +0 more imports, +6 more importers in the complete lists below.
imports: nx_syscalls.nxnx_crc32.nxnx_zip_header.nxnx_deflate.nx
imported by: nx_book_links_gate.nxnx_book_mojibake_e2e_gate.nxnx_book_titles_gate.nxnx_cbz_fixture.nxnx_docx.nxnx_epub_fixture_build.nxnx_odt.nxnx_pptx.nxnx_roku_cert_gate.nxnx_roku_emit.nxnx_roku_emit_gate.nxnx_roku_grid_emit.nxnx_roku_grid_gate.nxnx_roku_grid_remote_gate.nxnx_xlsx.nxnx_xlsx_view_gate.nx
structs
| none |
consts
| 11 | const K_MAGIC_8388624: i64 = 8388624 |
| 12 | const K_MAGIC_1980: i64 = 1980 |
functions
| 14 | func opc_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 15 | func opc_copy(dst: *u8, off: i64, src: *u8, n: i64) -> i64 { var i: i64=0; while i<n { dst[off+i]=src[i]; i=i+1 } return off+n } called by 1: opc_write |
| 16 | func opc_put_u16(buf: *u8, off: i64, v: i64) -> i64 { buf[off]=(v & 0xff) as u8; buf[off+1]=((v>>8) & 0xff) as u8; return off+2 } called by 1: opc_write |
| 17 | func opc_put_u32(buf: *u8, off: i64, v: i64) -> i64 { buf[off]=(v & 0xff) as u8; buf[off+1]=((v>>8)&0xff) as u8; buf[off+2]=((v>>16)&0xff) as u8; buf[off+3]=((v>>24)&0xff) as u8; return off+4 } called by 1: opc_write |
| 18 | func opc_region_eq(buf: *u8, off: i64, len: i64, s: *u8) -> i64 |
| 25 | func opc_write(path: *u8, names: *i64, datap: *i64, lens: *i64, count: i64) -> i64 called by 5: mainodt_writepptx_write_specmainmain calls 9: sys_mmapnx_crc32opc_strlenopc_put_u32opc_put_u16opc_copy+3 |
| 92 | func opc_read_part(path: *u8, want: *u8, out: *u8, cap: i64) -> i64 |