nx_nishios_shell.nx
buildroot/runtime/nx_nishios_shell.nx
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
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
structs
| none |
consts
| 13 | const K_MAGIC_16384: i64 = 16384 |
| 14 | const K_MAGIC_192054: i64 = 192054 |
functions
| 16 | func 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 |
| 21 | func sh_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 22 | func sh_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 23 | func 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 } |
| 24 | func 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 } |
| 25 | func 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 } |
| 26 | func 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 |
| 28 | func kt_char(fb: *u8, W: i64, H: i64, table: *u8, x: i64, y: i64, ch: i64, r: i64, g: i64, b: i64) -> i64 |
| 36 | func 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 } |
| 37 | func 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 |
| 39 | func 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 |
| 45 | func build_keymap(km: *u8) -> i64 called by 1: main |
| 56 | func do_ls(path: *u8, out: *u8, cap: i64) -> i64 |
| 77 | func run_cmd(line: *u8, linelen: i64, out: *u8) -> i64 |
| 88 | func main() -> i64 |