code wiki / _hdl_build / nx_deck_gate.nx
nx_deck_gate.nx source
↩ module page · 104 lines · 6438 B
1// nx_deck_gate.nx -- GATE: generate the GOVERNMENT presentation from our verified models, in both formats.
2// T1 STRUCTURE -- 7 slides, 16 bullets built from the supply-chain / fab / jobs / cascade twins.
3// T2 SOVEREIGN -- the .ndeck file is written and contains DECK + SLIDE + TITLE (our superior native format).
4// T3 POWERPOINT-- the OOXML slide is written and contains <p:sld + presentationml namespace (opens in PowerPoint once zipped to .pptx).
5// T4 CONTENT -- the OOXML carries the real title text (the deck reflects the model numbers).
6// T5 NEVER-BRICK- deterministic.
7// GREEN iff all. Sovereign nx_cc->nxasm. First organ of the Nishi office suite. expect_exit: 0 license_tier: ORIGINAL
8import "nx_deck.nx"
9import "nx_research_extract.nx" // re_has
10import "nx_syscalls.nx"
11
12func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
13func 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 }
14func rd(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 { return 0 } let n: i64=sys_read(fd, buf, cap); sys_close(fd); if n<0 { return 0 } return n }
15
16func main() -> i64 {
17 w("=== nx_deck_gate: GOVERNMENT deck generator (.ndeck sovereign + .pptx-compatible OOXML) ===\n" as *u8)
18 var pass: i64 = 0; var total: i64 = 0
19
20 let nslides: i64 = 7
21 let titles: *i64=sys_mmap(8*8) as *i64
22 titles[0]="Domestic Supply-Chain Security and Sovereign Fabrication" as *u8 as i64
23 titles[1]="The Risk Today" as *u8 as i64
24 titles[2]="The Plan: Reshore plus Sovereign Fab" as *u8 as i64
25 titles[3]="Affordable Sovereign Chip Fab" as *u8 as i64
26 titles[4]="Good Middle-Class Jobs" as *u8 as i64
27 titles[5]="Circular Win-Win-Win" as *u8 as i64
28 titles[6]="The Ask" as *u8 as i64
29
30 let bullets: *i64=sys_mmap(8*24) as *i64
31 bullets[0]="A Nishi plan for city, state, and federal partnership" as *u8 as i64
32 bullets[1]="Critical chips sourced from geopolitical adversaries" as *u8 as i64
33 bullets[2]="Supply-chain risk index 44; only 183 permil domestic" as *u8 as i64
34 bullets[3]="Single-source dependence on chips and rare-earth magnets" as *u8 as i64
35 bullets[4]="Domesticate chips, magnets, and clean energy" as *u8 as i64
36 bullets[5]="Risk 44 to 2; domestic content 183 to 929 permil" as *u8 as i64
37 bullets[6]="Enclosed micron fab: 15k dollars vs 10M clean room (666x cheaper)" as *u8 as i64
38 bullets[7]="Maskless litho: no mask shop, zero-dollar redesign" as *u8 as i64
39 bullets[8]="Self-sufficiency 333 to 1000 permil; solar is the keystone" as *u8 as i64
40 bullets[9]="600 jobs at 70k living wage plus 40 percent benefits" as *u8 as i64
41 bullets[10]="Homes affordable at 4x income; 6-week paid time off" as *u8 as i64
42 bullets[11]="European-exceeding middle-class lifestyle" as *u8 as i64
43 bullets[12]="Second-life parts cascade: wealthy to middle to poor and schools" as *u8 as i64
44 bullets[13]="Energy cost declines for all while the top upgrades" as *u8 as i64
45 bullets[14]="Government partnership for domestic security and prosperity" as *u8 as i64
46 bullets[15]="Fundable, costed, and digitally-twin verified" as *u8 as i64
47
48 let boff: *i64=sys_mmap(8*8) as *i64
49 let bcnt: *i64=sys_mmap(8*8) as *i64
50 boff[0]=0; bcnt[0]=1
51 boff[1]=1; bcnt[1]=3
52 boff[2]=4; bcnt[2]=2
53 boff[3]=6; bcnt[3]=3
54 boff[4]=9; bcnt[4]=3
55 boff[5]=12; bcnt[5]=2
56 boff[6]=14; bcnt[6]=2
57
58 // T1 structure
59 var nb: i64 = 0; var s: i64 = 0
60 while s < nslides { nb = nb + bcnt[s]; s = s + 1 }
61 total=total+1; if nslides==7 { if nb==16 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) } } else { w(" [FAIL] " as *u8) }
62 w("T1 structure: " as *u8); wn(nslides); w(" slides, " as *u8); wn(nb); w(" bullets (from the verified models)\n" as *u8)
63
64 // emit sovereign .ndeck
65 let f1: i64 = sys_openat_wr("knowledge/nx_gov_deck.ndeck" as *u8, 420)
66 if f1 >= 0 { deck_write_ndeck(f1, titles[0] as *u8, titles, nslides, bullets, boff, bcnt); sys_close(f1) }
67 // emit PowerPoint-compatible OOXML (slide 1)
68 let f2: i64 = sys_openat_wr("knowledge/nx_gov_slide1.xml" as *u8, 420)
69 if f2 >= 0 { deck_write_pptx_slide(f2, titles[1] as *u8, bullets, boff[1], bcnt[1]); sys_close(f2) }
70
71 let cap: i64 = 65536
72 let buf: *u8 = sys_mmap(cap)
73
74 // T2 sovereign format
75 let n1: i64 = rd("knowledge/nx_gov_deck.ndeck" as *u8, buf, cap)
76 var t2: i64 = 1
77 if re_has(buf, n1, "DECK " as *u8)==0 { t2=0 }
78 if re_has(buf, n1, "TITLE The Ask" as *u8)==0 { t2=0 }
79 total=total+1; if t2==1 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
80 w("T2 sovereign .ndeck: " as *u8); wn(n1); w(" bytes, has DECK/SLIDE/TITLE (superior native format)\n" as *u8)
81
82 // T3 PowerPoint-compatible
83 let n2: i64 = rd("knowledge/nx_gov_slide1.xml" as *u8, buf, cap)
84 var t3: i64 = 1
85 if re_has(buf, n2, "<p:sld" as *u8)==0 { t3=0 }
86 if re_has(buf, n2, "presentationml" as *u8)==0 { t3=0 }
87 total=total+1; if t3==1 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
88 w("T3 PowerPoint-compatible OOXML: " as *u8); wn(n2); w(" bytes, has <p:sld + presentationml (zips to a .pptx)\n" as *u8)
89
90 // T4 content
91 let t4ok: i64 = re_has(buf, n2, "The Risk Today" as *u8)
92 total=total+1; if t4ok==1 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
93 w("T4 content: the OOXML carries the real slide title (deck reflects the models)\n" as *u8)
94
95 // T5 never-brick
96 let n3: i64 = rd("knowledge/nx_gov_deck.ndeck" as *u8, buf, cap)
97 total=total+1; if n3==n1 { pass=pass+1; w(" [PASS] " as *u8) } else { w(" [FAIL] " as *u8) }
98 w("T5 never-brick: deterministic (" as *u8); wn(n3); w("==" as *u8); wn(n1); w(")\n" as *u8)
99
100 w(" wrote knowledge/nx_gov_deck.ndeck (sovereign) + knowledge/nx_gov_slide1.xml (PowerPoint OOXML)\n" as *u8)
101 w("\n=== nx_deck_gate " as *u8); wn(pass); w("/" as *u8); wn(total)
102 if pass == total { w(" GREEN (gov deck generated: sovereign .ndeck + PowerPoint-compatible OOXML; first organ of the Nishi office suite)\n" as *u8); sys_exit(0); return 0 }
103 w(" RED\n" as *u8); sys_exit(1); return 1
104}