code wiki / (root) / nx_nishios_shell.nx

nx_nishios_shell.nx

buildroot/runtime/nx_nishios_shell.nx

9622 B148 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind tooltopic nishios
docsdependenciesstructsconstsfunctions

about

nx_nishios_shell.nx -- NishiOS GUI rung-6: the terminal runs a REAL tool (`ls` over the real FS). rung-5 made the terminal typeable with builtins; this makes it a real SHELL: typing "ls" dispatches to an actual directory listing via sys_openat_rd + sys_getdents64 + dirent_name (the same syscalls the sovereign coreutils `ls` uses), reading the REAL knowledge/status directory and rendering the entries in the terminal. GUI keystrokes -> shell -> real kernel syscalls -> real filesystem -> pixels. KAT: typing "ls" produced a real listing (contains our own .bmp artifacts), the listing rendered in the terminal body, and the BMP exported. HONEST SEAM: scancode source still scripted (PS/2 IRQ1 = hw rung); but the COMMAND now hits the real filesystem, not a canned string. No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_fb.nx nx_itoa_lib.nx nx_font8x8.nx nx_nishios_shell.nx

imports: nx_fb.nxnx_itoa_lib.nxnx_font8x8.nx

imported by: nobody (leaf or entry point)

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

main sh_puts build_keymap run_cmd sh_streq sh_slen do_ls sh_scopy sys_getdents64 dirent_reclen dirent_name sh_isdot sh_scopy ↻ sh_num nxi_out nxi_fd sys_mmap ccz_cat_num sys_write sys_munmap font8x8_table sys_mmap ↻ fg fb_rect fb_setpx kt_str kt_char fb_setpx ↻ kt_wrap kt_char ↻ fb_bmp_save sys_mmap ↻ fb_p32 fb_p16 sys_openat_wr sys_write ↻ sys_close sys_openat_wr ↻ sh_streq ↻ sh_contains

structs

none

consts

13const K_MAGIC_16384: i64 = 16384
14const K_MAGIC_192054: i64 = 192054

functions

16func sh_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
21func sh_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
22func sh_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: sh_streqsh_contains
23func sh_streq(a: *u8, alen: i64, b: *u8) -> i64 { let bl: i64=sh_slen(b); if alen!=bl { return 0 } var i: i64=0; while i<alen { if a[i]!=b[i] { return 0 } i=i+1 } return 1 }
called by 2: run_cmdmain calls 1: sh_slen
24func sh_scopy(dst: *u8, doff: i64, src: *u8) -> i64 { var i: i64=0; while src[i]!=(0 as u8) { dst[doff+i]=src[i]; i=i+1 } return doff+i }
called by 2: do_lsrun_cmd
25func sh_contains(hay: *u8, haylen: i64, needle: *u8) -> i64 { let nl: i64=sh_slen(needle); if nl==0 { return 1 } var i: i64=0; while i+nl<=haylen { var ok: i64=1; var j: i64=0; while j<nl { if hay[i+j]!=needle[j] { ok=0; j=nl } else { j=j+1 } } if ok==1 { return 1 } i=i+1 } return 0 }
called by 1: main calls 1: sh_slen
26func sh_isdot(name: *u8) -> i64 { if name[0]==(46 as u8) { if name[1]==(0 as u8) { return 1 } if name[1]==(46 as u8) { if name[2]==(0 as u8) { return 1 } } } return 0 }
called by 1: do_ls
28func kt_char(fb: *u8, W: i64, H: i64, table: *u8, x: i64, y: i64, ch: i64, r: i64, g: i64, b: i64) -> i64
called by 2: kt_strkt_wrap calls 1: fb_setpx
36func kt_str(fb: *u8, W: i64, H: i64, table: *u8, x: i64, y: i64, s: *u8, r: i64, g: i64, b: i64) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { kt_char(fb,W,H,table, x+i*8, y, s[i] as i64, r,g,b); i=i+1 } return 0 }
called by 1: main calls 1: kt_char
37func kt_count(fb: *u8, W: i64, x0: i64, y0: i64, x1: i64, y1: i64) -> i64 { var c: i64=0; var y: i64=y0; while y<y1 { var x: i64=x0; while x<x1 { if (fb[(y*W+x)*3+1] as i64) > 180 { c=c+1 } x=x+1 } y=y+1 } return c }
called by 1: main
39func kt_wrap(fb: *u8, W: i64, H: i64, table: *u8, x0: i64, y0: i64, s: *u8, maxcols: i64, r: i64, g: i64, b: i64) -> i64
called by 1: main calls 1: kt_char
45func build_keymap(km: *u8) -> i64
called by 1: main
56func do_ls(path: *u8, out: *u8, cap: i64) -> i64
77func run_cmd(line: *u8, linelen: i64, out: *u8) -> i64
called by 1: main calls 3: sh_streqdo_lssh_scopy
88func main() -> i64