code wiki / _hdl_build / nx_sched_research_fetch.nx
nx_sched_research_fetch.nx source
↩ module page · 33 lines · 2591 B
1// nx_sched_research_fetch.nx -- the Nishi researcher fetching ORIENTATION on s-class pulse/clock/scheduling
2// architectures (operator: "s class exceed like how pulses work on clocks ... so we avoid issues ... do s class
3// exceed research with the nishi researcher"). Sovereign fetch stack (nx_fetch_staged = our DNS + TLS-1.3 + X.509),
4// Wikipedia orientation points only (the allowed sourcing). Stores to knowledge/fetched/sched_*.raw so the
5// researcher index (nx_research_grow) can fold them. Skip-and-continue on any failure. license_tier: ORIGINAL expect_exit: 0
6import "nx_fetch_unit.nx"
7import "nx_syscalls.nx"
8
9func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
10func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
11
12func fetch_to(url: *u8, path: *u8) -> i64 {
13 let body: *u8 = sys_mmap(FU_CAP)
14 let n: i64 = nx_fetch_staged(url, body, FU_CAP)
15 if n <= 0 { w(" FAIL "); w(url); w(" rc="); wn(n); w("\n" as *u8); return 0 }
16 let fd: i64 = sys_openat_wr(path, 0x1a4); if fd >= 0 { sys_write(fd, body, n); sys_close(fd) }
17 w(" OK "); w(path); w(" ("); wn(n); w(" B) <- "); w(url); w("\n" as *u8)
18 return n
19}
20
21func main(argc: i64, argv: *i64) -> i64 {
22 w("=== nx_sched_research_fetch -- orientation: clock/pulse/scheduling architectures ===\n" as *u8)
23 sys_mkdir("knowledge" as *u8, 0x1ed); sys_mkdir("knowledge/fetched" as *u8, 0x1ed)
24 var got: i64 = 0
25 got = got + fetch_to("https://en.wikipedia.org/wiki/Clock_signal" as *u8, "knowledge/fetched/sched_clocksignal.raw" as *u8)
26 got = got + fetch_to("https://en.wikipedia.org/wiki/Clock_distribution_network" as *u8, "knowledge/fetched/sched_clocktree.raw" as *u8)
27 got = got + fetch_to("https://en.wikipedia.org/wiki/Phase-locked_loop" as *u8, "knowledge/fetched/sched_pll.raw" as *u8)
28 got = got + fetch_to("https://en.wikipedia.org/wiki/Cron" as *u8, "knowledge/fetched/sched_cron.raw" as *u8)
29 got = got + fetch_to("https://en.wikipedia.org/wiki/Scheduling_(computing)" as *u8, "knowledge/fetched/sched_scheduling.raw" as *u8)
30 got = got + fetch_to("https://en.wikipedia.org/wiki/Dynamic_ticks" as *u8, "knowledge/fetched/sched_tickless.raw" as *u8)
31 w("nx_sched_research_fetch: total bytes="); wn(got); w(" -> knowledge/fetched/sched_*.raw (fold via nx_research_grow)\n" as *u8)
32 sys_exit(0); return 0
33}