code wiki / _hdl_build / nx_swgpu_ship.nx

nx_swgpu_ship.nx source

↩ module page · 24 lines · 1533 B

1// nx_swgpu_ship.nx -- stage nx_aw_push for the software-GPU showcase: knowledge/swgpu.html -> docroot 2// swgpu/index.html -> https://nishifamily.com/swgpu (additive, never-brick). license_tier: ORIGINAL expect_exit: 0 3import "nx_syscalls.nx" 4 5func sw_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 6 7func main() -> i64 { 8 let sfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.src\x00" as *u8, 420) 9 if sfd < 0 { sw_w("nx_swgpu_ship: cannot stage src\n\x00" as *u8); return 1 } 10 let sp: *u8 = "/mnt/c/Users/elder/nishi-core/nxc2/knowledge/swgpu.html\n\x00" as *u8 11 var sn: i64 = 0 12 while sp[sn] != (0 as u8) { sn = sn + 1 } 13 sys_write(sfd, sp, sn) 14 sys_close(sfd) 15 let dfd: i64 = sys_openat_wr("/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst\x00" as *u8, 420) 16 if dfd < 0 { sw_w("nx_swgpu_ship: cannot stage dst\n\x00" as *u8); return 2 } 17 let dp: *u8 = "mkdir -p /volume1/homes/elderwesto/nishihost/sites/nishifamily/swgpu; cat > /volume1/homes/elderwesto/nishihost/sites/nishifamily/swgpu/index.html.tmp; mv -f /volume1/homes/elderwesto/nishihost/sites/nishifamily/swgpu/index.html.tmp /volume1/homes/elderwesto/nishihost/sites/nishifamily/swgpu/index.html\n\x00" as *u8 18 var dn: i64 = 0 19 while dp[dn] != (0 as u8) { dn = dn + 1 } 20 sys_write(dfd, dp, dn) 21 sys_close(dfd) 22 sw_w("nx_swgpu_ship: staged (swgpu.html -> sites/nishifamily/swgpu/index.html); deploy = run nx_aw_push\n\x00" as *u8) 23 return 0 24}