code wiki / _hdl_build / nx_cover_gen.nx
nx_cover_gen.nx
buildroot/runtime/_hdl_build/nx_cover_gen.nx
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
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
| 9 | const K_MAGIC_1024: i64 = 1024 |
| 10 | const K_MAGIC_5381: i64 = 5381 |
| 11 | const K_MAGIC_16384: i64 = 16384 |
functions
| 13 | func cg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 14 | func cg_p(s: *u8) -> i64 { sys_write(1, s, cg_slen(s)); return 0 } |
| 15 | func ensure_dir(path: *u8) -> i64 { __syscall(258, 0-100, path, 0x1ed, 0, 0, 0); return 0 } called by 1: main |
| 16 | func 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 |
| 17 | func 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 } |
| 19 | func jval(hay: *u8, hl: i64, key: *u8, out: *u8, cap: i64) -> i64 |
| 29 | func axe(o: *u8, p: *i64, s: *u8) -> i64 called by 1: main |
| 39 | func 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 |
| 40 | func 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 } |
| 42 | func main(argc: i64, argv: *i64) -> i64 |