interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / om / hive-page / hive.om

789 lines · 26036 bytes Raw Blame History
1note Hive page skeleton generator. Every structural decision for /hive/ lives in this unit:
2note the section set, its order, the ids and aria attributes, the bounded panel bodies, the
3note mission tree container, the compact agent row with its branch disclosure, the message, field
4note and family templates, the freshness strip, the empty states and the jump navigation. The
5note hydrator emitted by hive-js.om only fills these slots and toggles what this markup declares.
6note
7note Program mode, composed with contract.om and hive-js.om by check.sh. The pinned compiler
8note emits a static AArch64 ELF: skeleton on stdout, hydrator on fd 3, shared ~N~ contract tokens.
9note check.sh runs it twice and commits deterministic HTML and JavaScript with sha256 sidecars.
10note
11note meta holds one record per line and eight pipe separated fields per record: the section
12note opening tag up to the eyebrow (a bounded panel also opens its sticky head wrapper here),
13note eyebrow text, heading open tag up to the heading text, heading text, note open tag up to the
14note note text, note text, the tag that closes the head and, for a bounded panel, opens the
15note scroll body (empty for a section that does neither), and the closing tags for that
16note section. The head shape is a table decision too: the Signal record opens a head row in
17note field 1 that puts the eyebrow, the heading and the note on one compact band and closes
18note it in field 7, while every other record leaves field 7 empty.
19note So the section list, its order, its ids and the shape of its head are all table decisions:
20note reorder, rename, re-head, make scrollable or bound a section here, and the loop in main emits
21note records in table order until the table ends.
22note A record is terminated by byte 10 and its fields by byte 124, so no field may contain either
23note a newline or a pipe: multi-line markup lives in the text constants below and is written by
24note the section body functions, which main calls between field 7 and field 8.
25note The opening tag also carries data-requires: a section marked interactions is hidden by the
26note hydrator while the snapshot reports no messages, and always sections are never hidden.
27note
28note Two sections are bounded panels: hive-section-main (missions) and hive-section-narrow
29note (selected mission). Their head wrapper holds the eyebrow, heading, note and, where the panel
30note names a subject, that subject, and it never scrolls. Only the panel body scrolls, so a fleet
31note of hundreds of agents is one bounded scroll box instead of a document thousands of pixels
32note tall. Inside the missions body the search tools are sticky, so they stay reachable while the
33note tree scrolls under them.
34note The row template declares the branch disclosure button with aria-expanded and aria-controls.
35note The hydrator assigns the id it points at, hides it on a leaf row, and keeps the expanded state
36note per branch, so which branches start open is a hydrator decision made from the reported depth.
37note
38note Names: the compiler allows 8 bytes per data name and at most 6 parameters per function.
39note
40note The scene: Allen's two black holes. The source is native/kernel/ui/night.c and chirp.c in the
41note aienos-allen-portable-build tree, and docs/ALLEN_SKY_SCIENCE.md says for each part of it what is
42note measured, what is simplified and what is only an illustration. This unit computes the sequence
43note here, at generation time, in integer and f64 arithmetic, and writes both the scene markup and
44note its keyframes into main.html: the page serves samples of the law, not a hand written animation,
45note and public/assets/hive.css only places the stage and paints the discs.
46note
47note Timeline in milliseconds, from night.h: 0 the eyes adjust to the dark, 6800 they have (fade
48note end), 2600 the two holes appear, 6000 the inspiral starts, 12000 they merge, 12000 to 15600 the
49note ripple runs out and 15200 the last hole is gone. The page loops on a 19000 ms cycle, so the sky
50note holds for the 3400 ms between the end of the ripple and the next appearance.
51note
52note Wide orbit, orbit_angle and ck_night_at: separation a0 = 270 units, one turn per 5200 ms, angle
53note = (t - 2600) / 5200 turns. Each hole sits at (hx, hy) from the centre with
54note hx = (sep / 2) cos(2 pi angle) and hy = (sep / 4) sin(2 pi angle): the orbit is seen edge on, so
55note its height is half its width, exactly as night.c halves the sine again. Nothing is drawn before
56note 2600, so the first stop holds the 2600 position.
57note
58note Inspiral, 6000 to 12000: with L = (12000 - t) / 6000 the separation is a0 L^(1/4) and the angle
59note is spiral_from + turns (1 - L^(5/8)), with spiral_from = (6000 - 2600) 65536 / 5200 = 42850 and
60note turns = 65536 * 8 * 6000 / (5 * 5200) = 120989, both over 65536 of a turn: night.c's own fixed
61note point, so the spiral leaves the wide orbit at the speed and the phase the wide orbit had.
62note L^(1/4) is (L^(1/8))^2 and L^(5/8) is (L^(1/8))^5, and L^(1/8) is three square roots, which is
63note night.c's root8. The law is the leading order inspiral of a real pair (separation as t^(1/4),
64note angle as t^(5/8), t the time left); ALLEN_SKY_SCIENCE.md section 4 says the law is real and the
65note clock is not, because this picture spends 6 s where physics spends 42 s and draws 1.85 turns
66note where physics draws about 150.
67note
68note The shadows: a hole's shadow is 20 units of radius, grown in from 4000 to 6000 by
69note smooth(prog(t, 4000, 6000)), which is night.c's rs_full with the +1400 and +3400 marks of the
70note appearance. The region whose light the hole bends (the Einstein radius, 60 units) grows in from
71note 2600 to 5200 by smooth(prog(t, 2600, 5200)). The page cannot bend starlight pixel by pixel, so
72note the bend is drawn as a faint halo whose opacity is that same 0 to 256 ramp: the shape of the
73note halo is the page's, the timing is Allen's, and this is the one place the scene simplifies.
74note
75note Merge, 12000 to 15200: one hole whose shadow runs from 20 * 323 / 256 (= 25.234375) to 20 * 2
76note over 180 ms, with a glow of 60 * 362 / 256 (= 84.84375), the 1.414 of the science note's square
77note root of two. It rings: the photon ring's radius is 1 + 0.07 sin(2 pi tm / 95) exp(-tm / 260),
78note tm the milliseconds since the merger. Then the hole fades from 12900 to 15200 by
79note 1 - smooth(prog(t, 12900, 15200)); night.c also shrinks the shadow by the square of that fade,
80note and the page folds that into the fade. ALLEN_SKY_SCIENCE.md section 4 calls the ringdown an
81note illustration on a wrong timescale: the real mode is 250 Hz and is gone in about two cycles,
82note and the picture slows the period 24 times and the decay 65 times.
83note
84note The ripple, 12000 to 15600: one circle from the merge point out to 1000 units, which is far
85note enough to cross a 1280 wide band from the stage's place in it. Its opacity is the envelope
86note smooth(prog(tr, 0, 220)) (1 - smooth(prog(tr, 2160, 3600))) scaled to 0.35, which is the shape
87note and the size of night.c's ripple_light (it peaks at 46 of 256). ALLEN_SKY_SCIENCE.md section 4
88note calls the wave across the sky an illustration: the real strain is 1e-21 and it is not light.
89note The page draws the ripple as a circle; night.c also stretches it along the line the pair last
90note lay on, which a transform only scene cannot do.
91note
92note Every animated property below is transform or opacity, so the compositor runs the whole
93note sequence without layout. Each keyframe stop carries its sample time as a percentage of the
94note 19000 ms cycle, and the ms of the timeline are also in the data attributes and in the comment
95note the emitted style block starts with, so scripts/test-hive-cosmic.py can recompute the same law
96note in Python and compare every stop with it.
97note The emitted style block also carries the wiring, inside a prefers-reduced-motion media query and
98note behind the native motion checkbox, so with motion off elements keep their base state:
99note one representative frame, the two holes at a visible separation, no merged hole, no ripple.
100
101text meta "<section id=\"~0~\" class=\"hive-section hive-section-full\" aria-labelledby=\"~1~\" data-requires=\"always\"><div class=\"hive-head-row\"><p class=\"hive-eyebrow\">|01 / Signal|</p><h2 id=\"~1~\">|Source and freshness|</h2><p class=\"hive-note\">|This page reads the edge-rendered public board. It never assumes it can see every agent.|</div>|</section>|<section id=\"~2~\" class=\"hive-section hive-section-main hive-panel\" aria-labelledby=\"~3~\" data-requires=\"always\"><div class=\"hive-panel-head\"><p class=\"hive-eyebrow\">|02 / Missions|</p><h2 id=\"~3~\">|Current missions|</h2><p class=\"hive-note\">|One disclosure per branch. A status describes the agent's reported state, not a measure of progress.|</div><div class=\"hive-panel-body\">|</div></section>|<section id=\"~4~\" class=\"hive-section hive-section-narrow hive-panel\" aria-labelledby=\"~5~\" data-requires=\"always\"><div class=\"hive-panel-head\"><p class=\"hive-eyebrow\">|03 / Manifest|</p><h2 id=\"~5~\">|Selected mission|</h2><p class=\"hive-note\">|Runtime observations, not GitHub receipts or proof that a task succeeded.|</div><div class=\"hive-panel-body\">|</div></section>|<section id=\"~7~\" class=\"hive-section hive-section-full\" aria-labelledby=\"~8~\" data-requires=\"interactions\"><p class=\"hive-eyebrow\">|04 / Agent responses|</p><h2 id=\"~8~\">|What the agents are saying, live|</h2><p class=\"hive-note\">|Each agent's final reply at the end of a turn, in time order, inside one publication window. Human messages are never published, and text an agent quotes from one is withheld. Hidden reasoning, tool payloads and automatic context are not shown.||</section>|"
102
103text noteend "</p>\n"
104
105text lineend "\n"
106
107text page1a "<div class=\"hive\" id=\"~9~\" data-poll-ms=\"~59~\" data-stale-min-ms=\"~59~\" data-stale-max-ms=\"~60~\" data-clock-skew-ms=\"~61~\" data-request-timeout-ms=\"~62~\" data-fresh=\"false\">\n<input class=\"hive-motion-check\" id=\"~16~\" type=\"checkbox\"><label class=\"hive-motion-label\" for=\"~16~\">Animate the decorative sky</label>\n<nav class=\"hive-jumps\" aria-label=\"Hive sections\">\n<a href=\"#~0~\">Signal</a>\n<a href=\"#~2~\">Missions</a>\n<a href=\"#~4~\">Manifest</a>\n<a href=\"#~7~\" data-requires=\"interactions\">Agent responses</a>\n</nav>\n<header class=\"hive-masthead\">\n"
108
109text page1b "<p class=\"hive-eyebrow\">An open observatory, written in Omega</p>\n<h1>The hive<span class=\"hive-period\">.</span></h1>\n<p class=\"hive-intro\">Drake. A constellation of agents. Real work, unfolding in the open.</p>\n<p class=\"hive-welcome\">Watch the agents build, question, get things wrong and try again. You do not need to know how any of this works to begin.</p>\n<a class=\"hive-learn\" href=\"/learn/\">Learn to build with AI</a>\n</header>\n<aside class=\"hive-omega\" aria-label=\"How this page is made\">\n<p class=\"hive-omega-kicker\">Built in Omega</p>\n<p class=\"hive-omega-line\">This page is written in Omega. Every heading, panel and live row is generated by an Omega program, not by hand-written HTML.</p>\n<p class=\"hive-omega-note\">Omega is my own language and it is still being finished. Please bear with the glitches while I iron it out.</p>\n<a class=\"hive-omega-source\" href=\"https://interplane.io/drakestapleton/aienos.com/blob/main/om/hive-page/hive.om\" rel=\"noopener noreferrer\">Read the Omega source</a>\n</aside>\n<div class=\"hive-sections\">\n"
110
111text sig1 "<div class=\"hive-strip-facts\">\n<dl class=\"hive-times\">\n<dt>Source snapshot</dt><dd><time id=\"~10~\">Not received</time></dd>\n<dt>Browser received</dt><dd><time id=\"~11~\">Not received</time></dd>\n</dl>\n<div class=\"hive-strip-status\">\n<p id=\"~12~\" class=\"hive-connection\" role=\"status\" aria-live=\"polite\">Connecting to the observatory</p>\n<p id=\"~13~\" class=\"hive-small\">A browser clock is not evidence of a live source.</p>\n</div>\n</div>\n"
112
113text sig2 "<div class=\"hive-strip-foot\">\n<p id=\"~14~\" class=\"hive-counts\">Awaiting the first source observation.</p>\n<p id=\"~15~\" class=\"hive-coverage\">Coverage is not yet known. This view can be partial and it says so.</p>\n</div>\n"
114
115text tree1 "<div class=\"hive-tools\">\n<div class=\"hive-search\">\n<label for=\"~17~\">Find an agent, model or task</label>\n<input id=\"~17~\" type=\"search\" placeholder=\"Search the fleet\" autocomplete=\"off\">\n</div>\n<p id=\"~18~\" class=\"hive-small\"></p>\n</div>\n"
116
117text tree2 "<p id=\"~19~\" class=\"hive-empty\">No snapshot received yet. The last useful observation stays here if the connection drops.</p>\n<ul id=\"~20~\" class=\"hive-tree\" aria-label=\"Observed agent tree\"></ul>\n"
118
119text man1 "<p id=\"~21~\" class=\"hive-small\">Choose any root or nested agent. Its exact model, task and source times appear here.</p>\n<p id=\"~22~\" class=\"hive-empty\">No agent selected yet. This panel fills from the row you choose.</p>\n"
120
121text man2 "<div id=\"~23~\" hidden></div><div id=\"~64~\" hidden></div>\n"
122
123text chat1 "<div class=\"hive-conversation-controls\" role=\"group\" aria-label=\"Conversation scope\">\n<button id=\"~32~\" type=\"button\" aria-pressed=\"true\">All agents</button>\n<button id=\"~33~\" type=\"button\" aria-pressed=\"false\">Selected agent</button>\n</div>\n<p id=\"~34~\" class=\"hive-small\"></p>\n<p id=\"~35~\" class=\"hive-empty\">No published live message for this view yet.</p>\n"
124
125text chat2 "<ol id=\"~36~\" class=\"hive-chat\" tabindex=\"0\" aria-label=\"Recent agent replies, oldest first\"></ol>\n<p class=\"hive-source-note\">This is work in progress, including mistakes and failures. Agent replies are not verified project outcomes.</p>\n"
126
127text page2 "</div>\n<footer class=\"hive-closing\">\n<p>Curiosity is enough to start.</p>\n<a href=\"/learn/\">Take your first step with AI</a>\n<a href=\"/agents/\">Read the agents' working rules</a>\n<a href=\"https://interplane.io/drakestapleton/aienos.com/blob/main/om/hive-page/hive.om\" rel=\"noopener noreferrer\">Page structure on the forge</a>\n</footer>\n<noscript><p class=\"hive-empty\"><a href=\"/hive/board/\">Open the live board without JavaScript</a>. The board reloads every 15 seconds.</p></noscript>\n"
128
129
130text pageend "</div>\n"
131
132text tkhd "<style>/* Allen's two black holes. Every stop below is a sample of the inspiral law in native/kernel/ui/night.c, computed here by om/hive-page/hive.om. Timeline ms: 2600 appear, 4000 shadow starts, 6000 inspiral, 12000 merge, 12900 fade starts, 15200 gone, 15600 ripple end, 19000 cycle. Animated properties: transform and opacity only. The orbit and the chirp law are Allen's and real; the ripple across the sky and the ringing of the last hole are illustration, not evidence. */"
133
134text tkpa "@keyframes hive-posa{/*0ms 2600ms 6000ms 12000ms 15200ms 19000ms*/"
135text tkpb "@keyframes hive-posb{/*0ms 2600ms 6000ms 12000ms 15200ms 19000ms*/"
136text tkbnd "@keyframes hive-bend{/*2600ms 4000ms 5200ms 12000ms*/"
137text tksiz "@keyframes hive-size{/*4000ms 6000ms 12000ms*/"
138text tkmsz "@keyframes hive-msiz{/*12000ms 12180ms 15200ms*/"
139text tkmrg "@keyframes hive-mring{/*95ms period, 260ms decay*/"
140text tkmkp "@keyframes hive-mkeep{/*12000ms 12900ms 15200ms*/"
141text tkrpp "@keyframes hive-ripp{/*12000ms 12220ms 14160ms 15600ms*/"
142text tbrc "}"
143
144text tkmed "@media (prefers-reduced-motion:no-preference){"
145text tkwir ".hive:has(#hive-motion:checked) .hive-hole-a{animation:hive-posa var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-hole-b{animation:hive-posb var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-bend{animation:hive-bend var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-plate{animation:hive-size var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-merge{animation:hive-mkeep var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-mplate{animation:hive-msiz var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-ring{animation:hive-mring var(--hive-cycle) linear infinite}.hive:has(#hive-motion:checked) .hive-ripple{animation:hive-ripp var(--hive-cycle) linear infinite}"
146text tkend "}</style>"
147
148text tminus "-"
149text tdot "."
150text tme "em,"
151text tme2 "em,0)}"
152text tme3 "em,0)\""
153text ttr "%{transform:translate3d("
154text tsty "style=\"transform:translate3d("
155text tsp "%{transform:scale("
156text tso "%{opacity:"
157text tcs ");opacity:"
158text tcl ")}"
159text tcl2 "}"
160
161text scna "<div class=\"hive-scene\" aria-hidden=\"true\" data-scene=\"allen\" data-cycle=\"19000\" data-appear=\"2600\" data-spiral=\"6000\" data-merge=\"12000\" data-gone=\"15200\" data-ripple=\"15600\" style=\"--hive-cycle:19000ms\"><div class=\"hive-stage\"><span class=\"hive-ripple\"></span><span class=\"hive-hole hive-hole-a\" "
162text scnb "><span class=\"hive-bend\"></span><span class=\"hive-plate\"></span></span><span class=\"hive-hole hive-hole-b\" "
163text scnc "><span class=\"hive-bend\"></span><span class=\"hive-plate\"></span></span><span class=\"hive-merge\"><span class=\"hive-mglow\"></span><span class=\"hive-mplate\"><span class=\"hive-ring\"></span></span></span></div></div>"
164
165global digs uchar 24
166global gx f64 1
167global gy f64 1
168
169
170fn dig v ulong to void
171c = uchar v
172put digs 0 uchar add 48 c
173q = write 1 digs 0 1
174end
175
176fn unum v ulong to void
177p = ulong 10000
178k = false
179while gt p 0 bound 20
180 d = div v p
181 if or k ne d 0
182 dig d
183 k = true
184 v = rem v p
185 end
186 p = div p 10
187end
188if not k
189 dig 0
190end
191end
192
193fn num v f64 to void
194c = ulong mul add (fabs v) 0.005 100.0
195if and lt v 0.0 gt c 0
196 q = write 1 tminus 0 1
197end
198unum div c 100
199q = write 1 tdot 0 1
200f = rem c 100
201dig div f 10
202dig rem f 10
203end
204
205fn pct t ulong to void
206n = div mul t 1000000 19000
207unum div n 10000
208q = write 1 tdot 0 1
209m = rem n 10000
210dig div m 1000
211dig rem div m 100 10
212dig rem div m 10 10
213dig rem m 10
214end
215
216fn sinp t f64 to f64
217u = f64 -0.00000002505210838544172
218u = add 0.0000027557319223985893 (mul t mul t u)
219u = add -0.0001984126984126984 (mul t mul t u)
220u = add 0.008333333333333333 (mul t mul t u)
221u = add -0.16666666666666666 (mul t mul t u)
222u = add 1.0 mul t mul t u
223ret mul t u
224end
225
226fn cosp t f64 to f64
227u = f64 0.00000000208767569878681
228u = add -0.00000027557319223985893 (mul t mul t u)
229u = add 0.0000248015873015873 (mul t mul t u)
230u = add -0.001388888888888889 (mul t mul t u)
231u = add 0.041666666666666664 (mul t mul t u)
232u = add -0.5 mul t mul t u
233ret add 1.0 mul t mul t u
234end
235
236fn quad a f64 to f64
237while ge a 1.0 bound 100
238 a = sub a 1.0
239end
240while lt a 0.0 bound 100
241 a = add a 1.0
242end
243k = ulong mul a 4.0
244f = mul sub mul a 4.0 (f64 k) 1.5707963267948966
245if eq k 0
246 ret sinp f
247end
248if eq k 1
249 ret cosp f
250end
251if eq k 2
252 ret neg sinp f
253end
254ret neg cosp f
255end
256
257fn sepr t f64 to f64
258if lt t 6000.0
259 ret 270.0
260end
261l = div sub 12000.0 t 6000.0
262if lt l 0.0
263 l = 0.0
264end
265r = fsqrt fsqrt fsqrt l
266ret mul 270.0 mul r r
267end
268
269fn angr t f64 to f64
270if lt t 2600.0
271 ret 0.0
272end
273if lt t 6000.0
274 ret div sub t 2600.0 5200.0
275end
276l = div sub 12000.0 t 6000.0
277if lt l 0.0
278 l = 0.0
279end
280r = fsqrt fsqrt fsqrt l
281q = mul r r
282w = mul mul q q r
283ret add 0.653839111328125 mul 1.8461456298828125 sub 1.0 w
284end
285
286fn xyc t ulong sg long to void
287tt = f64 t
288s = sepr tt
289a = angr tt
290x = mul mul 0.5 s (quad add a 0.25)
291y = mul mul 0.25 s (quad a)
292if lt sg 0
293 x = neg x
294 y = neg y
295end
296put gx 0 x
297put gy 0 y
298end
299
300fn kpos t ulong sg long to void
301pct t
302q = write 1 ttr 0 len ttr
303xyc t sg
304num get gx 0
305q = write 1 tme 0 len tme
306num get gy 0
307q = write 1 tme2 0 len tme2
308end
309
310fn kbas t ulong sg long to void
311q = write 1 tsty 0 len tsty
312xyc t sg
313num get gx 0
314q = write 1 tme 0 len tme
315num get gy 0
316q = write 1 tme3 0 len tme3
317end
318
319fn smth u ulong to ulong
320v = u
321if gt v 256
322 v = 256
323end
324ret div mul mul v v sub 768 mul 2 v 65536
325end
326
327fn prog t ulong a ulong b ulong to ulong
328if le t a
329 ret 0
330end
331if ge t b
332 ret 256
333end
334ret div mul sub t a 256 sub b a
335end
336
337fn fsc t ulong v f64 to void
338pct t
339q = write 1 tsp 0 len tsp
340num v
341q = write 1 tcl 0 len tcl
342end
343
344fn fop t ulong v f64 to void
345pct t
346q = write 1 tso 0 len tso
347num v
348q = write 1 tcl2 0 len tcl2
349end
350
351fn fscop t ulong s f64 o f64 to void
352pct t
353q = write 1 tsp 0 len tsp
354num s
355q = write 1 tcs 0 len tcs
356num o
357q = write 1 tcl2 0 len tcl2
358end
359
360fn frse t ulong a ulong b ulong to void
361pct t
362q = write 1 tsp 0 len tsp
363num div (f64 smth prog t a b) 256.0
364q = write 1 tcl 0 len tcl
365end
366
367fn fopa t ulong a ulong b ulong to void
368pct t
369q = write 1 tso 0 len tso
370num div (f64 smth prog t a b) 256.0
371q = write 1 tcl2 0 len tcl2
372end
373
374fn fopb t ulong a ulong b ulong to void
375pct t
376q = write 1 tso 0 len tso
377num sub 1.0 div (f64 smth prog t a b) 256.0
378q = write 1 tcl2 0 len tcl2
379end
380
381fn exneg z f64 to f64
382u = neg div z 64.0
383s = add 1.0 u
384p = mul u u
385s = add s div p 2.0
386p = mul p u
387s = add s div p 6.0
388p = mul p u
389s = add s div p 24.0
390p = mul p u
391s = add s div p 120.0
392p = mul p u
393s = add s div p 720.0
394k = ulong 0
395while lt k 6 bound 10
396 s = mul s s
397 k = add k 1
398end
399ret s
400end
401
402fn wob t ulong to f64
403tm = f64 sub t 12000
404ret mul 0.07 mul (quad div tm 95.0) (exneg div tm 260.0)
405end
406
407fn msiz t ulong to void
408tm = sub t 12000
409pct t
410q = write 1 tsp 0 len tsp
411num add 1.26171875 mul 0.73828125 div (f64 smth prog tm 0 180) 256.0
412q = write 1 tcl 0 len tcl
413end
414
415fn mring t ulong to void
416pct t
417q = write 1 tsp 0 len tsp
418num add 1.0 wob t
419q = write 1 tcl 0 len tcl
420end
421
422fn krpp t ulong to void
423tr = ulong 0
424if gt t 12000
425 tr = sub t 12000
426end
427pct t
428q = write 1 tsp 0 len tsp
429num div mul 1000.0 (f64 tr) 3600.0
430q = write 1 tcs 0 len tcs
431num mul 0.35 div (f64 mul (smth prog tr 0 220) (sub 256 (smth prog tr 2160 3600))) 65536.0
432q = write 1 tcl2 0 len tcl2
433end
434
435fn kfpa to void
436q = write 1 tkpa 0 len tkpa
437kpos 0 1
438t = ulong 2600
439while le t 12000 bound 400
440 kpos t 1
441 t = add t 40
442end
443kpos 19000 1
444q = write 1 tbrc 0 1
445end
446
447fn kfpb to void
448q = write 1 tkpb 0 len tkpb
449kpos 0 -1
450t = ulong 2600
451while le t 12000 bound 400
452 kpos t -1
453 t = add t 40
454end
455kpos 19000 -1
456q = write 1 tbrc 0 1
457end
458
459fn kfben to void
460q = write 1 tkbnd 0 len tkbnd
461fop 0 0.0
462fopa 2600 2600 5200
463t = ulong 2700
464while le t 5100 bound 60
465 fopa t 2600 5200
466 t = add t 100
467end
468fopa 5200 2600 5200
469fop 11999 1.0
470fop 12000 0.0
471fop 19000 0.0
472q = write 1 tbrc 0 1
473end
474
475fn kfsiz to void
476q = write 1 tksiz 0 len tksiz
477fsc 0 0.0
478fsc 4000 0.0
479t = ulong 4100
480while le t 6000 bound 30
481 frse t 4000 6000
482 t = add t 100
483end
484fsc 11999 1.0
485fsc 12000 0.0
486fsc 19000 0.0
487q = write 1 tbrc 0 1
488end
489
490fn kfmsz to void
491q = write 1 tkmsz 0 len tkmsz
492fsc 0 0.0
493fsc 11999 0.0
494msiz 12000
495t = ulong 12010
496while le t 12400 bound 60
497 msiz t
498 t = add t 10
499end
500t = ulong 12440
501while le t 15200 bound 80
502 msiz t
503 t = add t 40
504end
505fsc 19000 0.0
506q = write 1 tbrc 0 1
507end
508
509fn kfmrg to void
510q = write 1 tkmrg 0 len tkmrg
511fsc 0 1.0
512fsc 11999 1.0
513mring 12000
514t = ulong 12010
515while le t 12400 bound 60
516 mring t
517 t = add t 10
518end
519t = ulong 12440
520while le t 15200 bound 80
521 mring t
522 t = add t 40
523end
524fsc 19000 1.0
525q = write 1 tbrc 0 1
526end
527
528fn kfmkp to void
529q = write 1 tkmkp 0 len tkmkp
530fop 0 0.0
531fop 11999 0.0
532fop 12000 1.0
533fopb 12900 12900 15200
534t = ulong 13000
535while le t 15200 bound 30
536 fopb t 12900 15200
537 t = add t 100
538end
539fop 19000 0.0
540q = write 1 tbrc 0 1
541end
542
543fn kfrpp to void
544q = write 1 tkrpp 0 len tkrpp
545fscop 0 0.0 0.0
546fscop 11999 0.0 0.0
547t = ulong 12000
548while le t 15600 bound 60
549 krpp t
550 t = add t 100
551end
552fscop 19000 1000.0 0.0
553q = write 1 tbrc 0 1
554end
555
556fn scene to void
557q = write 1 tkhd 0 len tkhd
558kfpa
559kfpb
560kfben
561kfsiz
562kfmsz
563kfmrg
564kfmkp
565kfrpp
566q = write 1 tkmed 0 len tkmed
567q = write 1 tkwir 0 len tkwir
568q = write 1 tkend 0 len tkend
569q = write 1 scna 0 len scna
570kbas 7000 1
571q = write 1 scnb 0 len scnb
572kbas 7000 -1
573q = write 1 scnc 0 len scnc
574end
575
576fn fieldend p ulong to ulong
577i = p
578while lt i len meta
579c = get meta i
580if eq c 124
581ret i
582end
583if eq c 10
584ret i
585end
586i = add i 1
587end
588ret len meta
589end
590
591fn emit a ulong b ulong to void
592for i ulong sub b a
593byteput get meta add a i
594end
595flush
596end
597
598fn fld p ulong to ulong
599a = p
600b = fieldend a
601emit a b
602ret add b 1
603end
604
605fn secthead p ulong to ulong
606q = fld p
607q = fld q
608q = fld q
609q = fld q
610q = fld q
611q = fld q
612n = write 1 noteend 0 len noteend
613if lt n 0
614trap 3
615end
616q = fld q
617ret q
618end
619
620fn sec_signal to void
621n = render_sig1
622if lt n 0
623trap 3
624end
625n = render_sig2
626if lt n 0
627trap 3
628end
629end
630
631fn sec_tree to void
632n = render_tree1
633if lt n 0
634trap 3
635end
636n = render_tree2
637if lt n 0
638trap 3
639end
640end
641
642fn sec_manifest to void
643n = render_man1
644if lt n 0
645trap 3
646end
647n = render_man2
648if lt n 0
649trap 3
650end
651end
652
653fn sec_chat to void
654n = render_chat1
655if lt n 0
656trap 3
657end
658n = render_chat2
659if lt n 0
660trap 3
661end
662end
663
664fn body k uchar to void
665if eq k 0
666sec_signal
667ret
668end
669if eq k 1
670sec_tree
671ret
672end
673if eq k 2
674sec_manifest
675ret
676end
677if eq k 3
678sec_chat
679ret
680end
681end
682
683fn main to int
684put target 0 1
685n = render_page1a
686if lt n 0
687trap 3
688end
689scene
690n = write 1 page1b 0 len page1b
691if lt n 0
692trap 3
693end
694p = ulong 0
695k = uchar 0
696while lt p len meta
697p = secthead p
698body k
699p = fld p
700n = write 1 lineend 0 len lineend
701if lt n 0
702trap 3
703end
704k = add k 1
705end
706n = write 1 page2 0 len page2
707if lt n 0
708trap 3
709end
710n = write 1 pageend 0 len pageend
711if lt n 0
712trap 3
713end
714javascript
715ret 0
716end
717
718fn render_page1a to long
719for i ulong len page1a
720byteput get page1a i
721end
722flush
723ret long len page1a
724end
725
726fn render_sig1 to long
727for i ulong len sig1
728byteput get sig1 i
729end
730flush
731ret long len sig1
732end
733
734fn render_sig2 to long
735for i ulong len sig2
736byteput get sig2 i
737end
738flush
739ret long len sig2
740end
741
742fn render_tree1 to long
743for i ulong len tree1
744byteput get tree1 i
745end
746flush
747ret long len tree1
748end
749
750fn render_tree2 to long
751for i ulong len tree2
752byteput get tree2 i
753end
754flush
755ret long len tree2
756end
757
758fn render_man1 to long
759for i ulong len man1
760byteput get man1 i
761end
762flush
763ret long len man1
764end
765
766fn render_man2 to long
767for i ulong len man2
768byteput get man2 i
769end
770flush
771ret long len man2
772end
773
774fn render_chat1 to long
775for i ulong len chat1
776byteput get chat1 i
777end
778flush
779ret long len chat1
780end
781
782fn render_chat2 to long
783for i ulong len chat2
784byteput get chat2 i
785end
786flush
787ret long len chat2
788end
789