code wiki / _hdl_build / nx_audio_serve_gate.nx
nx_audio_serve_gate.nx
buildroot/runtime/_hdl_build/nx_audio_serve_gate.nx
about
nx_audio_serve_gate.nx -- gate for the audiobook player BRAIN (SC34/35/37, server-side Nishi code). Sets up a
liberated M4B (fixture->m4b_book->render) then drives nx_audio_serve's handle-mode router with 4 real HTTP
requests and proves the daemon does the work the browser would otherwise need JS for:
1. Range: bytes=4-11 -> 206 Partial Content + Content-Range + the exact bytes (so <audio> seeks/streams).
2. ?sleep=1 -> the stream is CAPPED to 1*BYTES_PER_MIN (=100) -> SC34 sleep timer, server-side.
3. POST /bookmark pos=137 -> 303 + the position stored in reader/<slug>/audio_pos.txt -> SC35.
4. GET /resume -> returns {"pos":137} (cross-device resume) -> SC37.
GREEN = the player capabilities are NISHI-CODE APIs (no browser JS). expect_exit: 0 license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| none |
functions
| 11 | func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 12 | func gnum(v0: i64) -> i64 { var v: i64=v0; if v<0 { sys_write(1,"-" as *u8,1); v=0-v } let b: *u8=sys_mmap(24); var k: i64=0; if v==0 {b[0]=48 as u8;k=1} while v>0 {b[k]=(48+(v%10)) as u8; v=v/10; k=k+1} let o: *u8=sys_mmap(24); var j: i64=0; while j<k {o[j]=b[k-1-j];j=j+1} sys_write(1,o,k); return 0 } |
| 13 | func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: wf |
| 14 | func ghas(hay: *u8, hl: i64, needle: *u8) -> i64 called by 1: main |
| 21 | func rd(path: *u8, lenp: *i64) -> *u8 { lenp[0]=0; return sys_read_file(path, lenp) } |
| 22 | func wf(path: *u8, s: *u8) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 {return 0-1} sys_write(fd, s, slen(s)); sys_close(fd); return 0 } |
| 23 | func spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 |
| 44 | func main() -> i64 |