code wiki / _hdl_build / nx_opc.nx

nx_opc.nx

buildroot/runtime/_hdl_build/nx_opc.nx

6079 B119 linesdepth 6pulls 9 transitivereach 18 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_crc32.nx nx_zip_header.nx nx_deflate.nx nx_opc.nx nx_book_links_gate.nx nx_book_mojibake_e2e_gate.nx nx_book_titles_gate.nx nx_cbz_fixture.nx nx_docx.nx nx_epub_fixture_build.nx nx_odt.nx nx_pptx.nx nx_roku_cert_gate.nx nx_roku_emit.nx

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

11const K_MAGIC_8388624: i64 = 8388624
12const K_MAGIC_1980: i64 = 1980

functions

14func opc_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
15func 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
16func 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
17func 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
18func opc_region_eq(buf: *u8, off: i64, len: i64, s: *u8) -> i64
called by 1: opc_read_part calls 1: opc_strlen
25func opc_write(path: *u8, names: *i64, datap: *i64, lens: *i64, count: i64) -> i64
92func opc_read_part(path: *u8, want: *u8, out: *u8, cap: i64) -> i64