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 / scene-input.om

319 lines · 4221 bytes Raw Blame History
1note Bounded model scene input. Existing scene stays the strict canonical parser.
2note Nm thinking,normalized bytes,tidying count,hidden lines,line bytes,mood seen,
3note invalid/overflow,plain candidate bytes,canonical line count. Input restored.
4global Nm ulong 9
5global Nraw uchar 2048
6global Nline uchar 2048
7global Nnorm uchar 2048
8global Nplain uchar 160
9text Ntags "<think></think>"
10fn nlow c uchar to uchar
11if and ge c 65 le c 90
12ret add sub c 65 97
13end
14ret c
15end
16fn nalpha c uchar to bool
17v = nlow c
18ret and ge v 97 le v 122
19end
20fn nmatch at ulong off ulong size ulong to bool
21if gt add at size get Nm 4
22ret false
23end
24for i ulong size
25if ne nlow get Nline add at i get Ntags add off i
26ret false
27end
28end
29ret true
30end
31fn nemit c uchar to void
32n = get Nm 1
33if ge n 2048
34put Nm 6 1
35ret
36end
37put Nnorm n c
38put Nm 1 add n 1
39end
40fn nmark c uchar to bool
41if or eq c 45 eq c 42
42ret true
43end
44if or eq c 35 eq c 62
45ret true
46end
47ret eq c 34
48end
49fn nlead c uchar to bool
50if or eq c 32 eq c 42
51ret true
52end
53if eq c 35
54ret true
55end
56ret nalpha c
57end
58fn ndigits p ulong to ulong
59while lt p get Nm 4
60if not isdigit get Nline p
61ret p
62end
63p = add p 1
64end
65ret p
66end
67fn nspaces p ulong to ulong
68while lt p get Nm 4
69if ne get Nline p 32
70ret p
71end
72p = add p 1
73end
74ret p
75end
76fn npstep s ulong to ulong
77n = get Nm 4
78c = get Nline s
79if nmark c
80if eq add s 1 n
81ret n
82end
83if nlead get Nline add s 1
84ret add s 1
85end
86ret s
87end
88if not isdigit c
89ret s
90end
91p = ndigits s
92if ge add p 1 n
93ret s
94end
95if not or eq get Nline p 46 eq get Nline p 41
96ret s
97end
98if ne get Nline add p 1 32
99ret s
100end
101ret add p 2
102end
103fn nprefix to ulong
104s = ulong 0
105while lt s get Nm 4
106next = npstep s
107if eq next s
108ret s
109end
110put Nm 2 add get Nm 2 1
111s = nspaces next
112end
113ret s
114end
115fn nfinish to void
116n = get Nm 4
117while gt n 0
118if eq get Nline sub n 1 32
119n = sub n 1
120else
121nprocess n
122ret
123end
124end
125end
126fn nprocess n ulong to void
127put Nm 4 n
128hide = ne get Nm 0 0
129for i ulong n
130if nmatch i 0 7
131put Nm 0 1
132hide = true
133end
134if nmatch i 7 8
135put Nm 0 0
136hide = true
137end
138end
139if hide
140put Nm 3 add get Nm 3 1
141ret
142end
143if ge n 3
144if and eq get Nline 0 96 eq get Nline 1 96
145if eq get Nline 2 96
146put Nm 2 add get Nm 2 1
147ret
148end
149end
150end
151s = nprefix
152if ge s n
153ret
154end
155w = s
156while lt w n
157if nalpha get Nline w
158w = add w 1
159else
160nword s w n
161ret
162end
163end
164nword s w n
165end
166fn nword s ulong w ulong n ulong to void
167for i ulong sub w s
168put In add s i nlow get Nline add s i
169end
170word = scword s sub w s
171if gt word 10
172word = 0
173end
174r = w
175while lt r n
176c = get Nline r
177if or eq c 42 eq c 34
178r = add r 1
179put Nm 2 add get Nm 2 1
180else
181nappend s w r n word
182ret
183end
184end
185nappend s w r n word
186end
187fn nappend s ulong w ulong r ulong n ulong word ulong to void
188if lt r n
189if not or eq get Nline r 32 eq get Nline r 58
190word = 0
191end
192end
193if eq word 0
194size = sub n s
195if and eq get Nm 7 0 le size 159
196if lt get Nm 8 12
197for i ulong size
198put Nplain i get Nline add s i
199end
200put Nm 7 size
201end
202end
203for i ulong size
204nemit get Nline add s i
205end
206else
207if eq word 1
208if lt get Nm 8 12
209put Nm 5 1
210end
211end
212for i ulong sub w s
213nemit nlow get Nline add s i
214end
215head = ne word 2
216for i ulong sub n r
217c = get Nline add r i
218if eq c 58
219if ne word 1
220head = false
221end
222end
223if head
224c = nlow c
225end
226nemit c
227end
228end
229nemit 10
230put Nm 8 add get Nm 8 1
231end
232fn nclear to void
233for i ulong 8
234put Sc i 0
235end
236for i ulong 64
237put Things i 0
238end
239put Sw 3 0
240end
241fn scdecode to bool
242for i ulong 9
243put Nm i 0
244end
245nclear
246n = get Inlen 0
247if gt n 2048
248put Nm 6 1
249ret false
250end
251for i ulong n
252if eq get In i 0
253put Nm 6 1
254ret false
255end
256put Nraw i get In i
257end
258for i ulong n
259c = get Nraw i
260if eq c 10
261nfinish
262put Nm 4 0
263else
264if eq c 9
265c = uchar 32
266put Nm 2 add get Nm 2 1
267end
268if and ge c 32 le c 126
269p = get Nm 4
270keep = true
271if eq c 32
272if eq p 0
273keep = false
274else
275if eq get Nline sub p 1 32
276keep = false
277end
278end
279end
280if keep
281put Nline p c
282put Nm 4 add p 1
283else
284put Nm 2 add get Nm 2 1
285end
286else
287put Nm 2 add get Nm 2 1
288end
289end
290end
291nfinish
292ok = false
293if eq get Nm 6 0
294for i ulong get Nm 1
295put In i get Nnorm i
296end
297put Inlen 0 get Nm 1
298ok = scene
299if ne get Nm 5 0
300ok = true
301end
302if not ok
303if gt get Nm 7 0
304for i ulong get Nm 7
305put In i get Nplain i
306end
307put Inlen 0 get Nm 7
308ok = scsay 0 get Nm 7
309end
310end
311else
312nclear
313end
314for i ulong n
315put In i get Nraw i
316end
317put Inlen 0 n
318ret ok
319end