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 / site / links.om

242 lines · 4345 bytes Raw Blame History
1note Preserve old root bookmarks without treating consent/refusal fragments as Classic navigation.
2text slids "top|home-lead|loop-title|story|machines|machines-title|speed|speed-title|evidence|architecture|research|turing-game|tg-round|tg-stream|tg-zero|tg-one|tg-score|tg-reset|tg-msg|terminal|terminal-clear-btn|terminal-output|terminal-form|terminal-input|status|live|follow|follow-reach"
3text slmach "machine-"
4text slspeed "speed-"
5
6fn sl_known value view uchar * to bool
7if ge len value len slmach
8if sr_equal part value 0 len slmach slmach
9ret true
10end
11end
12if ge len value len slspeed
13if sr_equal part value 0 len slspeed slspeed
14ret true
15end
16end
17p = ulong 0
18while lt p len slids bound 4096
19q = p
20while lt q len slids bound 4096
21if eq get slids q 124
22break
23end
24q = add q 1
25end
26if sr_equal value part slids p sub q p
27ret true
28end
29p = add q 1
30end
31ret false
32end
33
34fn sl_probe pos ulong to bool
35buf = new uchar 128 0
36if not sh_at shref pos
37ret false
38end
39p = add pos len shref
40if ge add p 3 get shlen 0
41ret false
42end
43quote = get shbuf p
44if not or eq quote 34 eq quote 39
45ret false
46end
47if ne get shbuf add p 1 47
48ret false
49end
50if ne get shbuf add p 2 35
51ret false
52end
53p = add p 3
54n = ulong 0
55while lt p get shlen 0 bound 256
56if eq get shbuf p quote
57ret sl_known part buf 0 n
58end
59if eq n len buf
60ret false
61end
62put buf n get shbuf p
63n = add n 1
64p = add p 1
65end
66ret false
67end
68
69fn sl_emit pos ulong to ulong
70p = add pos len shref
71sh_range pos add p 1
72sr_raw stclass
73ret add p 2
74end
75
76fn sl_scheme value view uchar * to bool
77for i ulong len value
78if eq get value i 58
79ret true
80end
81if or or eq get value i 47 eq get value i 35 eq get value i 63
82ret false
83end
84end
85ret false
86end
87
88fn sl_markdown_url value view uchar * to void
89routebuf = new uchar 512 0
90if sl_scheme value
91put srnoh 0 1
92gh_url value
93put srnoh 0 0
94ret
95end
96sr_raw shhost
97if ne get value 0 47
98n = st_field get shrrow 0 0 routebuf
99sr_raw part routebuf 0 n
100end
101sr_raw value
102end
103
104fn gh_probe pos ulong to bool
105if not sh_at shref pos
106ret false
107end
108p = add pos len shref
109if not or eq get shbuf p 34 eq get shbuf p 39
110ret false
111end
112p = add p 1
113ret or sh_at ghforge p or sh_at ghhost p sh_at ghhttp p
114end
115note gh_entlen and gh_entbyte: an href read back from emitted HTML is already escaped (sr_escape entities,
116note including # before a digit since r6); decode each entity to its byte so gh_url escapes it once.
117note Without this, #1-the-parts became #1-the-parts and then #1-the-parts (bay 7, 2026-11-10).
118fn gh_entlen pos ulong to ulong
119if ne get shbuf pos 38
120ret 1
121end
122if sh_at sreamp pos
123ret len sreamp
124end
125if sh_at srehash pos
126ret len srehash
127end
128if sh_at srelt pos
129ret len srelt
130end
131if sh_at sregt pos
132ret len sregt
133end
134if sh_at srequ pos
135ret len srequ
136end
137if sh_at sreapo pos
138ret len sreapo
139end
140ret 1
141end
142fn gh_entbyte pos ulong to uchar
143if ne get shbuf pos 38
144ret get shbuf pos
145end
146if sh_at sreamp pos
147ret uchar 38
148end
149if sh_at srehash pos
150ret uchar 35
151end
152if sh_at srelt pos
153ret uchar 60
154end
155if sh_at sregt pos
156ret uchar 62
157end
158if sh_at srequ pos
159ret uchar 34
160end
161if sh_at sreapo pos
162ret uchar 39
163end
164ret get shbuf pos
165end
166fn gh_emit pos ulong to ulong
167buf = new uchar 4096 0
168p = add pos len shref
169quote = get shbuf p
170p = add p 1
171sh_range pos p
172n = ulong 0
173while lt p get shlen 0 bound 4096
174if eq get shbuf p quote
175break
176end
177if eq n len buf
178sr_fail srebo
179end
180put buf n gh_entbyte p
181n = add n 1
182p = add p gh_entlen p
183end
184gh_url part buf 0 n
185ret p
186end
187
188text ghaopen "<a "
189text ghaclose "</a>"
190text ghangle ">"
191text ghspan "<span class=\"external-source\">"
192text ghprov " <span class=\"source-provenance\">(Source: "
193text ghpend ")</span></span>"
194fn gxanchor pos ulong to ulong
195if not sh_at ghaopen pos
196ret pos
197end
198e = sh_find ghangle pos
199h = sh_find shref pos
200if ge h e
201ret pos
202end
203p = add h len shref
204quote = get shbuf p
205if not or eq quote 34 eq quote 39
206ret pos
207end
208p = add p 1
209q = p
210while lt q e bound 4096
211if eq get shbuf q quote
212break
213end
214q = add q 1
215end
216buf = new uchar 4096 0
217n = sub q p
218if ge n len buf
219sr_fail srebo
220end
221m = ulong 0
222gi = p
223while lt gi q bound 4096
224put buf m gh_entbyte gi
225m = add m 1
226gi = add gi gh_entlen gi
227end
228n = m
229if not gxextern part buf 0 n
230ret pos
231end
232close = sh_find ghaclose add e 1
233if ge close get shlen 0
234ret pos
235end
236sr_raw ghspan
237sh_range add e 1 close
238sr_raw ghprov
239sr_esc part buf 0 n
240sr_raw ghpend
241ret add close len ghaclose
242end