code wiki / _hdl_build / nx_nishios_docview.nx

nx_nishios_docview.nx

buildroot/runtime/_hdl_build/nx_nishios_docview.nx

23627 B406 linesdepth 9pulls 32 transitivereach 0 importersview sourcekind tooltopic nishios
docsdependenciesstructsconstsfunctions

about

nx_nishios_docview.nx -- DOC-OMNITOOL-ON-ALL-OS, rung N-DOC-1: NishiOS OPENS DOCUMENTS. Operator (2026-07-08): "i want nishi browser and os to support rendering these different docs ... the browser is becoming the workhorse of systems." The Linux browser side shipped (nx_browser + nx_doc_view fork-dispatch, gate 7/7, live PNG proof). This rung puts the same capability on NISHIOS, following the proven nx_nishios_browser idiom: boot the persisted NishiOS image on the sovereign x86 emu, and ONLY because the disk-loaded kernel reached LONG mode does the OS app layer open a DOCUMENT -- a persisted .md file read back off disk -> the ON-OS VIEWER REGISTRY (ext -> renderer id; NishiOS has no process fork yet, so renderers LINK as libs (nx_md_lib) and are invoked at ONE dispatch point; adding a format = one registry row + one lib import, the dispatch core never changes) -> md_to_html -> br_layout -> br_draw_fb -> composited into the NishiOS desktop as a "NISHI DOCS" window. Export = knowledge/status/ nishios_docview.bmp + .html = one picture of "boot NishiOS -> open report.md natively". KAT: T1 booted off the persisted image; T2 LONG mode; T3 UART banner 'NishiOS'; T4 registry routes .md AND refuses .xyz; T5 conversion real (h1/bold/link/blockquote/pre markers in the produced HTML); T6 REAL layout (ok, boxes>=15, page_h>=100); T7 heading ink pixels; T8 link-blue pixels; T9 body-text pixels; T10 BMP exact size; T11 NEG 0-sector image never reaches long mode -> viewer never fires; T12 NEG empty document collapses the box count vs the real document (content-sensitive evidence). HONEST SEAM (same as nx_nishios_browser): the emu EXECUTES the MBR loader + real->protected->long transition off the on-disk bytes; the doc pipeline then runs in NishiLang as the OS's app layer painting nx_fb. Renderers as x86-on-emu processes via nx_nxe_loader, on-OS networking, and live input remain future rungs -- named, not claimed. MEASURED (BMP palette probe, 07-09): on this author-styled page the render core paints its DEFAULT ink palette -- headings #14142b (20,20,43), body #202124 (32,33,36) -- author-CSS text colors (link-blue, pre backgrounds) are NOT yet applied; that render-core CSS-color rung is likewise named, not claimed. The pixel KATs below assert the MEASURED palette, not a wished one. NEVER-BRICK (Rule 26): FILE artifacts only; models INT 13h *reads*. expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_browser_render.nx nx_itoa_lib.nx nx_fb.nx nx_md_lib.nx nx_nishios_docview.nx

imports: nx_browser_render.nxnx_itoa_lib.nxnx_fb.nxnx_md_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nd_puts nd_build_image nd_movrax nd_write_file sys_openat_wr sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close nd_boot_image nd_emu_boot_disk nd_mode nd_num nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write sys_munmap nd_slen nd_ext_of nd_reg_lookup nd_reg_render md_to_html md_cat md_esc1 md_cat ↻ md_all_dash md_num_to md_inline md_cat ↻ md_esc1 ↻ br_layout br_slen sys_mmap ↻ rh_extract_styles sys_mmap ↻

structs

none

consts

33const ND_MAGIC_200000: i64 = 200000
34const ND_MAGIC_32767: i64 = 32767
35const ND_MAGIC_65536: i64 = 65536
36const ND_MAGIC_1048576: i64 = 1048576
118const ND_IMG_SZ: i64 = 1024
205const ND_W: i64 = 640
206const ND_H: i64 = 480
207const ND_BW: i64 = 620
208const ND_BH: i64 = 426
209const ND_OX: i64 = 10
210const ND_OY: i64 = 38

functions

38func nd_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 1: main
43func nd_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
44func nd_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
45func nd_contains(hay: *u8, hn: i64, ndl: *u8, nn: i64) -> i64
called by 1: main
51func nd_mode(cr0: i64, efer: i64) -> i64 { let pe: i64=cr0&1; let pg: i64=(cr0>>31)&1; let lme: i64=(efer>>8)&1; if pe==0 { return 0 } if pg==1 { if lme==1 { return 2 } } return 1 }
called by 1: nd_emu_boot_disk
55func nd_emu_boot_disk(mem: *u8, disk: *u8, entry: i64, console: *u8, clen: *i64, st: *i64) -> i64
called by 1: nd_boot_image calls 1: nd_mode
120func nd_movrax(img: *u8, base: i64, o: i64, b0: i64, b1: i64, b2: i64, b3: i64) -> i64
called by 1: nd_build_image
128func nd_build_image(img: *u8) -> i64
called by 1: main calls 1: nd_movrax
168func nd_boot_image(img: *u8, console: *u8, clen: *i64, st: *i64, loaded: *i64) -> i64
called by 1: main calls 1: nd_emu_boot_disk
182func nd_str(fb: *u8, W: i64, H: i64, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64
called by 1: main calls 2: font8x8_tablefb_setpx
197func nd_write_file(path: *u8, data: *u8, n: i64) -> i64
called by 1: main calls 1: sys_openat_wr
212func nd_count_rgb(desk: *u8, r: i64, g: i64, b: i64) -> i64
228func nd_count_rgb_full(desk: *u8, r: i64, g: i64, b: i64) -> i64
246func nd_ext_of(name: *u8, ext: *u8) -> i64
called by 1: main
255func nd_reg_lookup(ext: *u8) -> i64
called by 1: main
259func nd_reg_render(id: i64, src: *u8, slen: i64, out: *u8) -> i64
called by 1: main calls 1: md_to_html
264func main() -> i64