interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / omega / allen / repository-screen.om

543 lines · 8912 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note Repository window over committed Canvas/font API. No platform calls.
3note Inputs ghkey: ASCII r refresh,b back,Tab switch,Enter open,Esc back;
4note 256 up,257 down,258 page up,259 page down,260 left,261 right.
5note Pointer uses logical Canvas coordinates and button1 press; wheel/swipe in rows.
6note Gh view README0/files1/details2. Unsupported Unicode glyphs render one ? per scalar.
7global Ghr ulong 8
8global Ghlines ulong 262145
9global Ghnumb uchar 20
10text Ghlabs "Allen / GitHub\nREADME\nFiles\nRefresh [R]\nBack [B]\nLIVE HTTPS / api.github.com\nLoading live GitHub response...\nNo current response. Refresh to retry.\nAsk me to find Allen's GitHub repository.\nUnsupported request. I can open Allen's repository.\nHTTP / transport error\nResponse exceeds bounded capacity\nInvalid response, identity, path or text\nAccess denied or GitHub rate limit\nRequest generation or path limit\nDefault branch:\nCommit:\nCommit time:\nRetrieved epoch seconds:\nRetrieval clock unavailable; session response:\nREADME not present at this commit (HTTP 404).\nEmpty README.\nEmpty directory.\nPath:\nBytes:\nObject SHA:\nDirectory\nFile\nOther object (not followed)\nText only; links and instructions are not executed.\nUp/Down scroll | PgUp/PgDn | Tab views | Enter open\nSource: github.com/\n"
11fn ghscalar p ulong to ulong
12c = get Ghread p
13if lt c 128
14ret add p 1
15end
16if lt c 224
17ret add p 2
18end
19if lt c 240
20ret add p 3
21end
22ret add p 4
23end
24fn ghmeasure to void
25w = get Cv 0
26h = get Cv 1
27if lt w 160
28w = 160
29end
30if lt h 240
31h = 240
32end
33cols = div sub w 32 10
34put Ghr 0 cols
35put Ghr 1 div sub h 212 18
36if eq get Ghr 1 0
37put Ghr 1 1
38end
39if and eq get Ghr 3 get Gh 12 eq get Ghr 4 cols
40ret
41end
42put Ghr 3 get Gh 12
43put Ghr 4 cols
44put Ghlines 0 0
45nrows = ulong 1
46col = ulong 0
47p = ulong 0
48while lt p get Gh 7
49c = get Ghread p
50p = ghscalar p
51if eq c 10
52put Ghlines nrows p
53nrows = add nrows 1
54col = 0
55else
56if ne c 13
57col = add col 1
58if ge col cols
59if lt p get Gh 7
60if ne get Ghread p 10
61put Ghlines nrows p
62nrows = add nrows 1
63col = 0
64end
65end
66end
67end
68end
69end
70put Ghr 2 nrows
71end
72fn ghrows to ulong
73if eq get Gh 4 0
74ret get Ghr 2
75end
76if eq get Gh 4 1
77ret get Gh 8
78end
79ret 1
80end
81fn ghlimit to ulong
82n = ghrows
83if le n get Ghr 1
84ret 0
85end
86ret sub n get Ghr 1
87end
88fn ghscroll delta long to void
89if ne get Gh 0 2
90ret
91end
92ghmeasure
93n = ghlimit
94at = get Gh 5
95if gt at n
96at = n
97end
98if lt delta 0
99note Avoid negating LONG_MIN.
100if le delta neg long at
101at = 0
102else
103at = ulong add long at delta
104end
105else
106if ge ulong delta sub n at
107at = n
108else
109at = add at ulong delta
110end
111end
112put Gh 5 at
113end
114fn ghswipe delta long to void
115ghscroll delta
116end
117fn ghopen to void
118if ne get Gh 4 1
119ret
120end
121if ge get Gh 6 get Gh 8
122ret
123end
124slot = mul get Gh 6 5
125if ne get Ghfiles add slot 2 2
126put Gh 4 2
127put Gh 5 0
128ret
129end
130p = get Ghfiles slot
131n = get Ghfiles add slot 1
132for i ulong n
133put Ghdir i get Ghpool add p i
134end
135put Gh 10 n
136put Gh 8 0
137put Gh 9 0
138put Gh 5 0
139put Gh 6 0
140ghissue 4
141end
142fn ghback to void
143if eq get Gh 4 2
144put Gh 4 1
145put Gh 5 0
146ret
147end
148if and eq get Gh 4 1 gt get Gh 10 0
149n = get Gh 10
150while gt n 0
151n = sub n 1
152if eq get Ghdir n 47
153put Gh 10 n
154put Gh 8 0
155put Gh 9 0
156ghissue 4
157ret
158end
159end
160put Gh 10 0
161put Gh 8 0
162put Gh 9 0
163ghissue 4
164ret
165end
166put Gh 4 0
167put Gh 5 0
168end
169fn ghselect down bool to void
170if eq get Gh 8 0
171ret
172end
173n = get Gh 6
174if down
175if lt add n 1 get Gh 8
176n = add n 1
177end
178else
179if gt n 0
180n = sub n 1
181end
182end
183put Gh 6 n
184if lt n get Gh 5
185put Gh 5 n
186end
187if ge n add get Gh 5 get Ghr 1
188put Gh 5 add sub n get Ghr 1 1
189end
190end
191fn ghkey key ulong to void
192if or eq key 114 eq key 82
193ghrefresh
194ret
195end
196if ne get Gh 0 2
197ret
198end
199ghmeasure
200if or or eq key 98 eq key 27 eq key 260
201ghback
202ret
203end
204if eq key 9
205put Gh 4 rem add get Gh 4 1 2
206put Gh 5 0
207ret
208end
209if or eq key 13 eq key 261
210ghopen
211ret
212end
213if or eq key 256 eq key 257
214if eq get Gh 4 1
215ghselect eq key 257
216else
217if eq key 256
218ghscroll -1
219else
220ghscroll 1
221end
222end
223end
224if eq key 258
225ghscroll neg long get Ghr 1
226end
227if eq key 259
228ghscroll long get Ghr 1
229end
230end
231fn ghpointer x long y long button ulong to void
232if ne button 1
233ret
234end
235if or lt x 0 lt y 0
236ret
237end
238if or ge x long get Cv 0 ge y long get Cv 1
239ret
240end
241if and ge y 142 lt y 170
242if and ge x 300 lt x 460
243ghrefresh
244ret
245end
246if ne get Gh 0 2
247ret
248end
249if lt x 140
250put Gh 4 0
251put Gh 5 0
252else
253if lt x 280
254put Gh 4 1
255put Gh 5 0
256else
257if ge x 460
258ghback
259end
260end
261end
262ret
263end
264if ne get Gh 0 2
265ret
266end
267if and eq get Gh 4 1 ge y 178
268ghmeasure
269row = div ulong sub y 178 18
270if ge row get Ghr 1
271ret
272end
273row = add row get Gh 5
274if lt row get Gh 8
275if eq row get Gh 6
276ghopen
277else
278put Gh 6 row
279end
280end
281end
282end
283fn ghfill x ulong y ulong w ulong h ulong color ulong to void
284note The night colour is the screen's shade: translucent, so the sky shows through it.
285a = ulong 255
286if eq color 395282
287a = 208
288end
289cvfill x y w h color a
290end
291fn ghdraw c uchar x long y long color ulong to void
292if not cvglyph c x y color
293put Ghr 7 1
294end
295end
296fn ghlabel wanted ulong x long y long to void
297which = ulong 0
298for i ulong len Ghlabs
299c = get Ghlabs i
300if eq c 10
301if eq which wanted
302ret
303end
304which = add which 1
305else
306if eq which wanted
307if ge x long sub get Cv 0 8
308ret
309end
310ghdraw c x y 12573663
311x = add x 10
312end
313end
314end
315end
316fn ghsource src ulong p ulong to uchar
317if eq src 0
318ret get Ghmeta p
319end
320if eq src 1
321ret get Ghread p
322end
323if eq src 2
324ret get Ghpool p
325end
326ret get Ghdir p
327end
328fn ghtext src ulong p ulong n ulong x long y long color ulong to void
329stop = add p n
330while lt p stop
331c = ghsource src p
332p = add p 1
333if eq c 10
334ret
335end
336if ne c 13
337if ge x long sub get Cv 0 8
338ret
339end
340if ge c 128
341while lt p stop
342d = ghsource src p
343if or lt d 128 ge d 192
344break
345end
346p = add p 1
347end
348c = 63
349end
350if lt c 32
351c = 32
352end
353ghdraw c x y color
354x = add x 10
355end
356end
357end
358fn ghnum v ulong x long y long to void
359n = ulong 0
360put Ghnumb n uchar add rem v 10 48
361n = add n 1
362v = div v 10
363while gt v 0
364put Ghnumb n uchar add rem v 10 48
365n = add n 1
366v = div v 10
367end
368while gt n 0
369n = sub n 1
370ghdraw get Ghnumb n x y 12573663
371x = add x 10
372end
373end
374fn ghreadview to void
375if ne get Gh 13 0
376ghlabel 20 16 192
377ret
378end
379if eq get Gh 7 0
380ghlabel 21 16 192
381ret
382end
383for i ulong get Ghr 1
384row = add get Gh 5 i
385if ge row get Ghr 2
386ret
387end
388p = get Ghlines row
389stop = get Gh 7
390if lt add row 1 get Ghr 2
391stop = get Ghlines add row 1
392end
393y = long add 192 mul i 18
394ghtext 1 p sub stop p 16 y 15132654
395end
396end
397fn ghfileview to void
398if eq get Gh 8 0
399ghlabel 22 16 192
400ret
401end
402for i ulong get Ghr 1
403row = add get Gh 5 i
404if ge row get Gh 8
405ret
406end
407slot = mul row 5
408y = add 178 mul i 18
409if eq row get Gh 6
410ghfill 8 y sub get Cv 0 16 18 1850175
411end
412p = get Ghfiles slot
413n = get Ghfiles add slot 1
414mark = uchar 45
415if eq get Ghfiles add slot 2 2
416mark = 43
417end
418ghdraw mark 16 long add y 14 7119850
419ghtext 2 p n 36 long add y 14 15132654
420end
421end
422fn ghdetails to void
423slot = mul get Gh 6 5
424ghlabel 23 16 192
425ghtext 2 get Ghfiles slot get Ghfiles add slot 1 86 192 15132654
426ghlabel 24 16 212
427ghnum get Ghfiles add slot 3 96 212
428ghlabel 25 16 232
429ghtext 2 get Ghfiles add slot 4 40 16 250 15132654
430typ = get Ghfiles add slot 2
431if eq typ 1
432ghlabel 27 16 270
433else
434ghlabel 28 16 270
435end
436end
437fn ghheader to void
438ghlabel 0 16 24
439ghlabel 31 16 44
440note The repository is whatever discovery validated; until then the line shows only the host.
441ghtext 0 720 get Ghlen 5 206 44 15132654
442if eq get Gh 0 2
443ghlabel 5 16 64
444ghtext 0 320 get Ghlen 2 16 84 15132654
445ghlabel 15 16 104
446ghtext 0 64 get Ghlen 1 176 104 15132654
447ghlabel 16 16 124
448ghtext 0 832 12 96 124 15132654
449ghtext 0 896 get Ghlen 4 236 124 12573663
450end
451ghfill 8 142 sub get Cv 0 16 28 1581342
452ghlabel 1 16 160
453ghlabel 2 156 160
454ghlabel 3 306 160
455ghlabel 4 476 160
456end
457fn ghstatus to void
458state = get Gh 0
459if eq state 0
460ghlabel 8 16 192
461end
462if eq state 1
463ghlabel 6 16 192
464ghnum get Ghreq 0 16 216
465end
466if eq state 4
467ghlabel 9 16 192
468end
469if eq state 3
470ghlabel 7 16 192
471err = get Gh 2
472label = ulong 10
473if eq err 2
474label = 11
475end
476if eq err 3
477label = 12
478end
479if eq err 4
480label = 13
481end
482if eq err 8
483label = 14
484end
485ghlabel label 16 216
486ghnum get Gh 3 16 240
487if ne get Gdiag 0 0
488note Show the failing stage and the transport states so a photograph identifies the break.
489ghnum get Gdiag 0 96 240
490ghnum get Gdiag 1 176 240
491ghnum get Gdiag 2 256 240
492ghnum get Gdiag 3 336 240
493ghnum get Gdiag 4 416 240
494end
495end
496end
497fn ghfooter to void
498y = long sub get Cv 1 24
499if eq get Gh 0 2
500stamp = get Ghat 3
501if gt stamp 0
502ghlabel 18 16 y
503ghnum stamp 266 y
504else
505ghlabel 19 16 y
506ghnum get Gh 12 516 y
507end
508end
509ghlabel 30 16 long sub get Cv 1 6
510end
511fn ghrender to bool
512if eq get Cv 6 0
513ret false
514end
515if or lt get Cv 0 320 lt get Cv 1 288
516ret false
517end
518if not cvfont 10 1000
519ret false
520end
521if not cvclip 0 0 get Cv 0 get Cv 1
522ret false
523end
524put Ghr 7 0
525ghmeasure
526ghfill 0 0 get Cv 0 get Cv 1 395282
527ghheader
528if eq get Gh 0 2
529if eq get Gh 4 0
530ghreadview
531end
532if eq get Gh 4 1
533ghfileview
534end
535if eq get Gh 4 2
536ghdetails
537end
538else
539ghstatus
540end
541ghfooter
542ret eq get Ghr 7 0
543end