code wiki / _hdl_build / nx_ad_emitter_grow.nx
nx_ad_emitter_grow.nx source
↩ module page · 74 lines · 7375 B
1// nx_ad_emitter_grow.nx -- TEACH + GROW the builder's emitter catalog. First TEACHES every emitter we've built
2// (the sizes/themes/accent/animations the generator already uses), then GROWS new ones (procedural SVG accents,
3// CSS animations, color themes) and registers them -- so the builder keeps growing its own emitters. Idempotent
4// (re-run teaches/grows only what's missing). All templates are sovereign-safe (no <script/src=). Run it to
5// grow the catalog: every new capability we build should call er_register so the builder learns it. license_tier: ORIGINAL
6import "nx_ad_emitter_registry.nx"
7import "nx_syscalls.nx"
8
9func gr_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
10func gr_i(v: i64) -> i64 { let t: *u8 = sys_mmap(24); var m: i64 = v; 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 } let o: *u8=sys_mmap(24); var w: i64=0; var q: i64=k-1; while q>=0 { o[w]=t[q]; w=w+1; q=q-1 } sys_write(1,o,w); return 0 }
11
12// register one + report whether it was newly learned.
13func gr_reg(tag: *u8, kind: *u8, id: *u8, label: *u8, tpl: *u8) -> i64 {
14 let r: i64 = er_register(ER_PATH, kind, id, label, tpl)
15 if r == 1 { gr_p(" + " as *u8); gr_p(tag); gr_p(" " as *u8); gr_p(kind); gr_p("/" as *u8); gr_p(id); gr_p("\n" as *u8) }
16 return r
17}
18
19func gr_counts() -> i64 {
20 gr_p(" catalog: size=" as *u8); gr_i(er_count(ER_PATH, "size" as *u8))
21 gr_p(" theme=" as *u8); gr_i(er_count(ER_PATH, "theme" as *u8))
22 gr_p(" accent=" as *u8); gr_i(er_count(ER_PATH, "accent" as *u8))
23 gr_p(" animation=" as *u8); gr_i(er_count(ER_PATH, "animation" as *u8)); gr_p("\n" as *u8)
24 return 0
25}
26
27func main(argc: i64, argv: *i64) -> i64 {
28 gr_p("=== nx_ad_emitter_grow: TEACH the builder, then GROW the emitters ===\n" as *u8)
29 var taught: i64 = 0
30
31 gr_p("TEACH (register everything the generator already emits):\n" as *u8)
32 // sizes (WxH)
33 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "rectangle" as *u8, "Rectangle 300x250" as *u8, "300x250" as *u8)
34 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "leaderboard" as *u8, "Leaderboard 728x90" as *u8, "728x90" as *u8)
35 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "mobile" as *u8, "Mobile 320x50" as *u8, "320x50" as *u8)
36 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "skyscraper" as *u8, "Skyscraper 160x600" as *u8, "160x600" as *u8)
37 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "halfpage" as *u8, "Half page 300x600" as *u8, "300x600" as *u8)
38 taught = taught + gr_reg("teach" as *u8, "size" as *u8, "billboard" as *u8, "Billboard 970x250" as *u8, "970x250" as *u8)
39 // themes (bg|fg|accent|actxt)
40 taught = taught + gr_reg("teach" as *u8, "theme" as *u8, "light" as *u8, "Light" as *u8, "#ffffff|#16202e|#0b2545|#ffffff" as *u8)
41 taught = taught + gr_reg("teach" as *u8, "theme" as *u8, "dark" as *u8, "Dark" as *u8, "#0b2545|#eaf1fb|#4da3ff|#06122b" as *u8)
42 taught = taught + gr_reg("teach" as *u8, "theme" as *u8, "warm" as *u8, "Warm" as *u8, "#fff7ed|#7c2d12|#ea580c|#ffffff" as *u8)
43 // accents (SVG template; {ACCENT}/{ACTXT}/{INI} placeholders)
44 taught = taught + gr_reg("teach" as *u8, "accent" as *u8, "monogram" as *u8, "Sponsor monogram" as *u8, "<svg class='nb-logo' width='32' height='32' viewBox='0 0 36 36' aria-hidden='true'><circle cx='18' cy='18' r='18' fill='{ACCENT}'/><text x='18' y='23' text-anchor='middle' font-size='15' font-weight='700' fill='{ACTXT}'>{INI}</text></svg>" as *u8)
45 // animations (CSS @keyframes+rule template; {S} = scope suffix)
46 taught = taught + gr_reg("teach" as *u8, "animation" as *u8, "static" as *u8, "Static (none)" as *u8, "" as *u8)
47 taught = taught + gr_reg("teach" as *u8, "animation" as *u8, "pulse" as *u8, "CTA pulse" as *u8, "@keyframes nbp-{S}{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}.nb-{S} .nb-cta{animation:nbp-{S} 1.6s ease-in-out infinite}" as *u8)
48 gr_p(" newly taught=" as *u8); gr_i(taught); gr_p("\n" as *u8)
49 gr_counts()
50
51 gr_p("GROW (generate NEW emitters and teach them to the builder):\n" as *u8)
52 var grew: i64 = 0
53 // new SVG accents (sovereign vector; no fetch/script)
54 grew = grew + gr_reg("grow" as *u8, "accent" as *u8, "star" as *u8, "Five-point star" as *u8, "<svg class='nb-logo' width='30' height='30' viewBox='0 0 24 24' aria-hidden='true'><path fill='{ACCENT}' d='M12 2l2.9 6.3 6.9.6-5.2 4.5 1.6 6.7L12 17l-6.2 3.6 1.6-6.7L2.2 8.9l6.9-.6z'/></svg>" as *u8)
55 grew = grew + gr_reg("grow" as *u8, "accent" as *u8, "burst" as *u8, "Sale burst" as *u8, "<svg class='nb-logo' width='34' height='34' viewBox='0 0 40 40' aria-hidden='true'><path fill='{ACCENT}' d='M20 2l4 6 7-2-2 7 6 4-6 4 2 7-7-2-4 6-4-6-7 2 2-7-6-4 6-4-2-7 7 2z'/></svg>" as *u8)
56 grew = grew + gr_reg("grow" as *u8, "accent" as *u8, "verified" as *u8, "Verified check" as *u8, "<svg class='nb-logo' width='30' height='30' viewBox='0 0 24 24' aria-hidden='true'><circle cx='12' cy='12' r='11' fill='{ACCENT}'/><path fill='none' stroke='{ACTXT}' stroke-width='2.5' d='M7 12.5l3.5 3.5L17 9'/></svg>" as *u8)
57 grew = grew + gr_reg("grow" as *u8, "accent" as *u8, "dots" as *u8, "Dot grid" as *u8, "<svg class='nb-logo' width='30' height='30' viewBox='0 0 24 24' aria-hidden='true'><g fill='{ACCENT}'><circle cx='5' cy='5' r='2.4'/><circle cx='12' cy='5' r='2.4'/><circle cx='19' cy='5' r='2.4'/><circle cx='5' cy='12' r='2.4'/><circle cx='12' cy='12' r='2.4'/><circle cx='19' cy='12' r='2.4'/></g></svg>" as *u8)
58 // new CSS animations (sovereign; no JS)
59 grew = grew + gr_reg("grow" as *u8, "animation" as *u8, "slide" as *u8, "Headline slide-in" as *u8, "@keyframes nbsl-{S}{from{transform:translateX(-8px);opacity:.3}to{transform:translateX(0);opacity:1}}.nb-{S} .nb-head{animation:nbsl-{S} .6s ease-out}" as *u8)
60 grew = grew + gr_reg("grow" as *u8, "animation" as *u8, "fade" as *u8, "Body fade-cycle" as *u8, "@keyframes nbfd-{S}{0%,100%{opacity:.7}50%{opacity:1}}.nb-{S} .nb-body{animation:nbfd-{S} 2.4s ease-in-out infinite}" as *u8)
61 grew = grew + gr_reg("grow" as *u8, "animation" as *u8, "zoom" as *u8, "Gentle zoom" as *u8, "@keyframes nbzm-{S}{0%,100%{transform:scale(1)}50%{transform:scale(1.03)}}.nb-{S}{animation:nbzm-{S} 3s ease-in-out infinite}" as *u8)
62 // new themes (palettes)
63 grew = grew + gr_reg("grow" as *u8, "theme" as *u8, "ocean" as *u8, "Ocean" as *u8, "#06283d|#eaf6ff|#1b98e0|#062033" as *u8)
64 grew = grew + gr_reg("grow" as *u8, "theme" as *u8, "forest" as *u8, "Forest" as *u8, "#14281d|#e8f3ec|#2f9e44|#0b1a12" as *u8)
65 grew = grew + gr_reg("grow" as *u8, "theme" as *u8, "sunset" as *u8, "Sunset" as *u8, "#2b1029|#ffe9e3|#ff6b6b|#2b1029" as *u8)
66 grew = grew + gr_reg("grow" as *u8, "theme" as *u8, "royal" as *u8, "Royal" as *u8, "#1a1442|#ece9ff|#7c6cff|#0d0a26" as *u8)
67 gr_p(" newly grown=" as *u8); gr_i(grew); gr_p("\n" as *u8)
68 gr_counts()
69
70 let total: i64 = er_count(ER_PATH, "size" as *u8) + er_count(ER_PATH, "theme" as *u8) + er_count(ER_PATH, "accent" as *u8) + er_count(ER_PATH, "animation" as *u8)
71 gr_p("TOTAL emitters the builder now knows = " as *u8); gr_i(total)
72 gr_p(" (re-run = idempotent; every new capability calls er_register so the builder keeps growing.)\n" as *u8)
73 sys_exit(0); return 0
74}