code wiki / _hdl_build / _pdf_reflow_lib.nx

_pdf_reflow_lib.nx

buildroot/runtime/_hdl_build/_pdf_reflow_lib.nx

10116 B205 linesdepth 3pulls 4 transitivereach 3 importersview sourcekind librarytopic pdf
docsdependenciesstructsconstsfunctions

about

_pdf_reflow_lib.nx -- SOVEREIGN PDF -> reflowable-mobile-HTML pipeline (shared library). Imported by nx_pdf_reflow.nx (the KAT gate) and nx_media_server.nx (the live /reflow route), so the extraction logic lives once (DRY). Pure functions: caller provides the html/txt/dec buffers. pr_pdf_to_reflow(pdf,n,html,txt,dec,txt_out) -> html_len: iterates EVERY "stream".."endstream", decodes FlateDecode (zlib +2) or raw, runs an operator-aware content-stream text extractor (BT/ET, Tj/TJ, '/", Td/TD/T*, (..)+<hex> strings, TJ word-gaps, line breaks; i+op in an *i64 state cell + pr_lit/pr_hex helpers to keep per-function locals low -- a fat function miscompiles under nx_cc), and emits reflowable mobile HTML. txt_out[0] receives the extracted-text char count (the reflow-vs-pageimage signal). license_tier: ORIGINAL

dependencies 3 imports · 3 importers

nx_syscalls.nx _inflate_lib_authored.nx nx_charset.nx _pdf_reflow_lib.nx nx_media_server.nx nx_pdf_reflow.nx nx_pdf_reflow_charset_gate.nx

imports: nx_syscalls.nx_inflate_lib_authored.nxnx_charset.nx

imported by: nx_media_server.nxnx_pdf_reflow.nxnx_pdf_reflow_charset_gate.nx

structs

none

consts

none

functions

14func pr_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: pr_hasmain
15func pr_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 }
called by 1: pr_pdf_to_reflow
17func pr_sub(buf: *u8, n: i64, from: i64, needle: *u8, nl: i64) -> i64
22func pr_has(hay: *u8, hn: i64, needle: *u8) -> i64
called by 1: main calls 1: pr_slen
29func pr_back_flate(pdf: *u8, pos: i64, win: i64) -> i64
called by 1: pr_pdf_to_reflow calls 1: pr_sub
35func pr_alpha(ch: i64) -> i64 { if ch>=65 { if ch<=90 { return 1 } } if ch>=97 { if ch<=122 { return 1 } } return 0 }
called by 1: pr_extract
38func pr_lit(c: *u8, n: i64, out: *u8, st: *i64) -> i64
called by 1: pr_extract
63func pr_hex(c: *u8, n: i64, out: *u8, st: *i64) -> i64
called by 1: pr_extract
87func pr_extract(c: *u8, n: i64, out: *u8, op0: i64) -> i64
134func pr_pdf_to_reflow(pdf: *u8, n: i64, html: *u8, txt: *u8, dec: *u8, txt_out: *i64) -> i64