code wiki / _hdl_build / nx_cover_gen.nx

nx_cover_gen.nx

buildroot/runtime/_hdl_build/nx_cover_gen.nx

11018 B158 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_cover_gen.nx -- SOVEREIGN GENERATED book covers (operator: "keep going especially on the book covers"). Many liberated books (MOBI/KF8) + native-authored books have NO cover, so the shelf falls back to a title-text box. This GENERATES a designed SVG cover from the book's title + author: a deterministic palette (title hash -> 1 of 6 designed color schemes), a wrapped serif title, the author, a Nishi mark. SVG = sovereign (we emit every byte), vector (crisp at any size), tiny, deterministic (same title -> same cover), and renders in <img> in the shelf + reader. Writes reader/<slug>/cover.svg + sets book.json "cover":"cover.svg" IF the book is coverless (a real extracted cover wins). Usage: nx_cover_gen <slug>. expect_exit: 0 license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_cover_gen.nx

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

main sys_mmap cat sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close cg_p sys_write cg_slen sys_exit jval cg_slen ↻ cg_slen ↻ aw awn sys_mmap ↻ axe ensure_dir writef sys_openat_wr sys_write ↻ sys_close ↻ sys_write ↻

structs

none

consts

9const K_MAGIC_1024: i64 = 1024
10const K_MAGIC_5381: i64 = 5381
11const K_MAGIC_16384: i64 = 16384

functions

13func cg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 3: cg_pjvalmain
14func cg_p(s: *u8) -> i64 { sys_write(1, s, cg_slen(s)); return 0 }
called by 1: main calls 2: sys_writecg_slen
15func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 }
called by 1: main
16func cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o+i]=s[i];i=i+1} return o+i }
called by 1: main
17func writef(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(path, 0x1a4); if fd<0 {return 0-1} sys_write(fd, buf, n); sys_close(fd); return 0 }
19func jval(hay: *u8, hl: i64, key: *u8, out: *u8, cap: i64) -> i64
called by 1: main calls 1: cg_slen
29func axe(o: *u8, p: *i64, s: *u8) -> i64
called by 1: main
39func aw(o: *u8, p: *i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ o[p[0]]=s[i]; p[0]=p[0]+1; i=i+1 } return 0 }
called by 1: main
40func awn(o: *u8, p: *i64, v0: i64) -> i64 { var v: i64=v0; if v<0 { o[p[0]]=45 as u8; p[0]=p[0]+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} var j: i64=k-1; while j>=0 { o[p[0]]=b[j]; p[0]=p[0]+1; j=j-1 } return 0 }
called by 1: main calls 1: sys_mmap
42func main(argc: i64, argv: *i64) -> i64