interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / node / tool.om

875 lines · 18126 bytes Raw Blame History
1note Omega Node tool adapter (DRA-290): the typed coding tools of the
2note round40 repair protocol, one bounded process per granted tool. OM-2:
3note { printf 'om2\n'; cat seed/agent/path.om seed/node/gram.om seed/node/tool.om; } | omc
4note The Node's authority runs it in its own process group (auth_wtool), so
5note cancellation kills it and every compiler or test run it started.
6note Usage:
7note omnode-tool read ROOT PATH
8note omnode-tool replace ROOT PATH OLD NEW
9note omnode-tool check ROOT PATH WORK OMC KIND K N A
10note ROOT is the workspace; PATH must pass omagent's path rule (agpathok,
11note seed/agent/path.om) inside it, and the file is opened without following
12note a final symbolic link. Files are at most 3800 bytes.
13note Record on stdout, exit 0: one line OMNT1 status olen clen, then the
14note observation and the file content back to back. Status: 0 done (Read
15note succeeded., Edit saved., Tests passed.), 1 File not found., 2 path
16note refused, 3 file over 3800 bytes, 4 I/O error, 5 replace refused (old
17note must occur exactly once, 1..40 bytes; new 0..40), 6 check failed (the
18note observation says why). Exit 2: usage.
19note replace writes the new content to PATH.omnode-new, syncs it, renames it
20note over PATH and syncs the directory: Edit saved. means durable.
21note check follows round40 repair.py compile_test: a source that is empty
22note or over 600 bytes is refused; it is compiled with OMC (compile only);
23note a compiler error is returned as omc printed it, trimmed; then every
24note line must be in the bounded repair grammar, calc and main must appear
25note once each, main must keep ret calc int A, and a loop goal needs its
26note for loop. Then for each input of A, 0, 3, 7 (distinct, in order) the
27note candidate with ret calc int replaced is compiled in WORK and run with
28note execpure (Landlock, no new privileges, CPU, file, process and memory
29note ceilings, seccomp; at most 2 s wall clock, then SIGKILL), and its exit
30note status must equal the goal (KIND 1 add x+K, 2 mul x*K, 3 loop x+K*N)
31note with no output. The content returned is the file as checked.
32text tnew ".omnode-new"
33text trec "OMNT1 "
34text oread "Read succeeded."
35text onf "File not found."
36text oedit "Edit saved."
37text opass "Tests passed."
38text orefu "Refused unsupported source."
39text ofns "Required functions missing."
40text omain "main must preserve the requested input."
41text oloop "Required loop missing."
42text otf1 "Test failed: calc("
43text otf2 ") expected "
44text otf3 ", got "
45text otf4 "."
46text orepl "Old text must occur exactly once."
47text opath "Path refused."
48text obig "File is over 3800 bytes."
49text oio "I/O error."
50text cread "read"
51text crepl "replace"
52text ccheck "check"
53text fsrc "c.om"
54text fbin "c.bin"
55text ferr "c.err"
56text fout "c.out"
57text fnull "/dev/null"
58
59note ======== records
60
61fn tl_out o view uchar * n ulong to void
62p = ulong 0
63for it ulong 4096
64if ge p n
65ret
66end
67r = write 1 o p sub n p
68if le r 0
69ret
70end
71p = add p ulong r
72end
73end
74
75note The number of decimal digits of v.
76fn tl_nd v ulong to ulong
77if lt v 10
78ret 1
79end
80ret add 1 tl_nd div v 10
81end
82
83note Append the decimal v to o at p; the new end.
84fn tl_dec o edit uchar * p ulong v ulong to ulong
85d = new uchar 24 0
86k = ulong 0
87x = v
88for i ulong 24
89put d k uchar add 48 rem x 10
90k = add k 1
91x = div x 10
92if eq x 0
93break
94end
95end
96for j ulong k
97put o add p j get d sub sub k j 1
98end
99ret add p k
100end
101
102fn tl_cat o edit uchar * p ulong a view uchar * n ulong to ulong
103for i ulong n
104put o add p i get a i
105end
106ret add p n
107end
108
109note The record: status st, observation ob[0, on), content cb[0, cn).
110fn tl_rec st ulong ob view uchar * cb view uchar * cn ulong to int
111o = new uchar 8192 0
112p = tl_cat o 0 trec len trec
113p = tl_dec o p st
114put o p 32
115p = tl_dec o add p 1 len ob
116put o p 32
117p = tl_dec o add p 1 cn
118put o p 10
119p = tl_cat o add p 1 ob len ob
120p = tl_cat o p cb cn
121tl_out o p
122ret 0
123end
124
125note ======== files
126
127note Read path pa into b; the length, -2 not found, -3 over 3800 bytes,
128note -4 another error (not a regular file included).
129fn tl_slurp pa view uchar * b edit uchar 4096 to long
130st = new uchar 128 0
131fd = fopen pa 0 len pa 557056 0
132if eq fd -2
133ret neg long 2
134end
135if lt fd 0
136ret neg long 4
137end
138r = fstat int fd st 0 128
139md = or ulong get st 16 shl ulong get st 17 8
140if or lt r 0 ne and md 61440 32768
141x = fclose int fd
142ret neg long 4
143end
144n = ulong 0
145for it ulong 4096
146if ge n 4096
147break
148end
149k = read int fd b n sub 4096 n
150if le k 0
151break
152end
153n = add n ulong k
154end
155x = fclose int fd
156if gt n 3800
157ret neg long 3
158end
159ret long n
160end
161
162note Write b[0, n) to the new file pa (truncated, no final symbolic link)
163note and sync it. 0 or negative.
164fn tl_spit pa view uchar * b view uchar * n ulong to long
165fd = fopen pa 0 len pa 557633 420
166if lt fd 0
167ret fd
168end
169p = ulong 0
170for it ulong 4096
171if ge p n
172break
173end
174k = write int fd b p sub n p
175if le k 0
176x = fclose int fd
177ret neg long 5
178end
179p = add p ulong k
180end
181r = fsync int fd
182x = fclose int fd
183ret r
184end
185
186note Rename a over b (packed list), then sync the directory of b.
187fn tl_mv a view uchar * b view uchar * to long
188pk = new uchar 4096 0
189na = len a
190nb = len b
191put pk 0 2
192put pk 2 uchar and na 255
193put pk 3 uchar shr na 8
194for i ulong na
195put pk add 4 i get a i
196end
197o = add 4 na
198put pk o uchar and nb 255
199put pk add o 1 uchar shr nb 8
200for j ulong nb
201put pk add add o 2 j get b j
202end
203r = renames pk 0 add add o 2 nb 0
204if lt r 0
205ret r
206end
207s = ulong 0
208for k ulong nb
209if eq get b k 47
210s = k
211end
212end
213dn = new uchar 4096 0
214dl = ulong 1
215put dn 0 46
216if gt s 0
217for m ulong s
218put dn m get b m
219end
220dl = s
221end
222fd = fopen dn 0 dl 540672 0
223if lt fd 0
224ret fd
225end
226r = fsync int fd
227x = fclose int fd
228ret r
229end
230
231note ======== read and replace
232
233fn tl_read pa view uchar * to int
234b = new uchar 4096 0
235if not agpathok pa
236ret tl_rec 2 opath b 0
237end
238n = tl_slurp pa b
239if eq n -2
240ret tl_rec 1 onf b 0
241end
242if eq n -3
243ret tl_rec 3 obig b 0
244end
245if lt n 0
246ret tl_rec 4 oio b 0
247end
248ret tl_rec 0 oread b ulong n
249end
250
251note true when a occurs in b at offset i (b holds at least i + len a bytes).
252fn tl_at b view uchar 4096 i ulong a view uchar * to bool
253for j ulong len a
254if ne get b add i j get a j
255ret false
256end
257end
258ret true
259end
260
261note Occurrences of a in b[0, bn), counted without overlap.
262fn tl_count b view uchar 4096 bn ulong a view uchar * to ulong
263an = len a
264c = ulong 0
265i = ulong 0
266for it ulong add bn 1
267if gt add i an bn
268ret c
269end
270if tl_at b i a
271c = add c 1
272i = add i an
273else
274i = add i 1
275end
276end
277ret c
278end
279
280note The offset of the first occurrence of a in b[0, bn) (one is known).
281fn tl_find b view uchar 4096 bn ulong a view uchar * to ulong
282for i ulong bn
283if tl_at b i a
284ret i
285end
286end
287ret bn
288end
289
290note Copy b[s, n) to d at p; the new end.
291fn tl_tail d edit uchar 4096 p ulong b view uchar 4096 s ulong n ulong to ulong
292for i ulong sub n s
293put d add p i get b add s i
294end
295ret add p sub n s
296end
297
298note Durably replace pa with d[0, dn): PATH.omnode-new written and synced,
299note renamed over pa, directory synced. 0 or negative.
300fn tl_save pa view uchar * d view uchar 4096 dn ulong to long
301tn = new uchar 4096 0
302q = tl_cat tn 0 pa len pa
303q = tl_cat tn q tnew len tnew
304r = tl_spit view part tn 0 q d dn
305if eq r 0
306r = tl_mv view part tn 0 q pa
307end
308if lt r 0
309x = unlink tn 0 q
310end
311ret r
312end
313
314note replace with PATH at d[0, L0), OLD at aw[0, L1), NEW at aw[1024, L2).
315fn tl_repl d view uchar 8192 aw view uchar 2048 l view ulong 4 to int
316b = new uchar 4096 0
317o = new uchar 4096 0
318if not agpathok view part d 0 get l 0
319ret tl_rec 2 opath b 0
320end
321if or or eq get l 1 0 gt get l 1 40 gt get l 2 40
322ret tl_rec 5 orepl b 0
323end
324n = tl_slurp view part d 0 get l 0 b
325if eq n -2
326ret tl_rec 1 onf b 0
327end
328if eq n -3
329ret tl_rec 3 obig b 0
330end
331if lt n 0
332ret tl_rec 4 oio b 0
333end
334if ne tl_count b ulong n view part aw 0 get l 1 1
335ret tl_rec 5 orepl b ulong n
336end
337p = tl_edit b ulong n aw l o
338if gt p 3800
339ret tl_rec 3 obig b ulong n
340end
341if lt tl_save view part d 0 get l 0 o p 0
342ret tl_rec 4 oio b ulong n
343end
344ret tl_rec 0 oedit o p
345end
346
347note b[0, n) with its one OLD replaced by NEW into o; the length.
348fn tl_edit b view uchar 4096 n ulong aw view uchar 2048 l view ulong 4 o edit uchar 4096 to ulong
349i = tl_find b n view part aw 0 get l 1
350p = tl_cat o 0 b i
351p = tl_cat o p view part aw 1024 get l 2 get l 2
352ret tl_tail o p b add i get l 1 n
353end
354
355note ======== check
356
357note The trimmed span of b[0, n) (ASCII white space) into m[0], m[1].
358fn tl_trim b view uchar 4096 n ulong m edit ulong 16 to void
359s = ulong 0
360for i ulong n
361if gt get b s 32
362break
363end
364s = add s 1
365end
366e = n
367for j ulong sub n s
368if gt get b sub e 1 32
369break
370end
371e = sub e 1
372end
373put m 0 s
374put m 1 e
375end
376
377note Grammar and structure of b[0, n): 0 good, else the refusal (1
378note unsupported, 2 functions, 3 main input, 4 loop). The value of the one
379note ret calc int line goes to m[2], its line start to m[3], end to m[4].
380fn tl_shape b view uchar 4096 n ulong kind ulong m edit ulong 16 to ulong
381tl_trim b n m
382for q ulong 4
383put m add 10 q 0
384end
385a = get m 0
386for it ulong add n 1
387if gt a get m 1
388break
389end
390z = gr_eol b a get m 1
391if not tl_tally b a z m
392ret 1
393end
394a = add z 1
395end
396if or ne get m 10 1 ne get m 11 1
397ret 2
398end
399if ne get m 12 1
400ret 3
401end
402if and eq kind 3 eq get m 13 0
403ret 4
404end
405ret 0
406end
407
408note Count line b[a, z) into m: 10 calc, 11 main, 12 ret calc int (value
409note to m[2], span to m[3], m[4]), 13 for loops. false outside the grammar.
410fn tl_tally b view uchar 4096 a ulong z ulong m edit ulong 16 to bool
411if not gr_gram b a z
412ret false
413end
414if gr_lin b a z 0 0
415put m 10 add get m 10 1
416end
417if gr_lin b a z 1 0
418put m 11 add get m 11 1
419end
420if gr_lin b a z 9 1
421put m 13 add get m 13 1
422end
423if gr_lin b a z 5 2
424put m 12 add get m 12 1
425put m 2 tl_num b add a len grcal z
426put m 3 a
427put m 4 z
428end
429ret true
430end
431
432fn tl_num b view uchar 4096 a ulong e ulong to ulong
433v = ulong 0
434for i ulong sub e a
435v = add mul v 10 sub ulong get b add a i 48
436end
437ret v
438end
439
440note ======== processes
441
442note Wait for pid up to dl ns; kill its group at the deadline. The wait
443note status word (exit code in byte 1, signal in byte 0's low 7 bits).
444fn tl_wait pid long dl ulong to ulong
445ws = new uchar 4 0
446t0 = ulong monons
447for it ulong 100000
448g = waitpid int pid ws 0 4 1
449if gt g 0
450ret or ulong get ws 0 shl ulong get ws 1 8
451end
452if lt g 0
453ret 65535
454end
455if ge sub ulong monons t0 dl
456x = killpid neg int pid 9
457g = waitpid int pid ws 0 4 0
458ret 65535
459end
460x = sleepns 1000000
461end
462ret 65535
463end
464
465note The child's stdin (k 0) or stdout (k 1) for mode md, opened.
466fn tl_fd md ulong k ulong to long
467if eq md 0
468if eq k 0
469ret fopen fsrc 0 len fsrc 524288 0
470end
471ret fopen fbin 0 len fbin 524865 448
472end
473if eq k 0
474ret fopen fnull 0 len fnull 524288 0
475end
476ret fopen fout 0 len fout 524865 448
477end
478
479note Run the packed argv pk[0, pn) in its own process group. md 0 (the
480note compiler): stdin c.om, stdout c.bin, execprog, 10 s. md 1 (a test):
481note stdin /dev/null, stdout c.out, execpure, 2 s (round40's timeout).
482note stderr to c.err. The wait status, or 65535 when it did not finish
483note (its group is killed).
484fn tl_run pk view uchar 4096 pn ulong md ulong to ulong
485pid = fork
486if eq pid 0
487r = setpgid 0 0
488fi = tl_fd md 0
489fo = tl_fd md 1
490fe = fopen ferr 0 len ferr 524865 448
491if or or lt fi 0 lt fo 0 lt fe 0
492exit 120
493end
494r = dupfd int fi 0 0
495r = dupfd int fo 1 0
496r = dupfd int fe 2 0
497if eq md 1
498r = execpure pk 0 pn
499else
500r = execprog pk 0 pn
501end
502exit 121
503end
504if lt pid 0
505ret 65535
506end
507r = setpgid int pid int pid
508if eq md 1
509ret tl_wait pid 2000000000
510end
511ret tl_wait pid 10000000000
512end
513
514note Pack one or two arguments into pk; the length.
515fn tl_pack pk edit uchar 4096 a view uchar * b view uchar * to ulong
516na = len a
517nb = len b
518c = ulong 1
519if gt nb 0
520c = 2
521end
522put pk 0 uchar c
523put pk 1 0
524put pk 2 uchar and na 255
525put pk 3 uchar shr na 8
526for i ulong na
527put pk add 4 i get a i
528end
529o = add 4 na
530if eq c 1
531ret o
532end
533put pk o uchar and nb 255
534put pk add o 1 uchar shr nb 8
535for j ulong nb
536put pk add add o 2 j get b j
537end
538ret add add o 2 nb
539end
540
541note The trimmed compiler message of file c.err into ob; its length.
542fn tl_cerr ob edit uchar 4096 to ulong
543b = new uchar 4096 0
544m = new ulong 16 0
545n = tl_slurp ferr b
546if lt n 0
547ret 0
548end
549tl_trim b ulong n m
550k = sub get m 1 get m 0
551for i ulong k
552put ob i get b add get m 0 i
553end
554ret k
555end
556
557note Compile src[0, n) to c.bin in the current (WORK) directory with omc
558note path oc. 0 compiled, 1 refused by omc (message in c.err), 2 failed.
559fn tl_omc oc view uchar * src view uchar * n ulong to ulong
560pk = new uchar 4096 0
561none = new uchar 1 0
562if ne tl_spit fsrc src n 0
563ret 2
564end
565pn = tl_pack pk oc view part none 0 0
566ws = tl_run pk pn 0
567if eq ws 0
568ret 0
569end
570if ne and ws 127 0
571ret 2
572end
573c = and shr ws 8 255
574if or eq c 120 eq c 121
575ret 2
576end
577ret 1
578end
579
580note The wait status ws of a test run as the round40 return code: the exit
581note code, or minus the signal.
582fn tl_code ws ulong to long
583if eq ws 65535
584ret neg long 9
585end
586if ne and ws 127 0
587ret neg long and ws 127
588end
589ret long and shr ws 8 255
590end
591
592note Test failed: calc(x) expected w, got g. into ob; its length.
593fn tl_tfail ob edit uchar 4096 x ulong w ulong g long to ulong
594p = tl_cat ob 0 otf1 len otf1
595p = tl_dec ob p x
596p = tl_cat ob p otf2 len otf2
597p = tl_dec ob p w
598p = tl_cat ob p otf3 len otf3
599v = ulong 0
600if lt g 0
601put ob p 45
602p = add p 1
603v = ulong neg g
604else
605v = ulong g
606end
607p = tl_dec ob p v
608ret tl_cat ob p otf4 len otf4
609end
610
611note The goal for input x of kind m[5] (1 add, 2 mul, 3 loop), K m[6], N m[7].
612fn tl_want m view ulong 16 x ulong to ulong
613if eq get m 5 1
614ret add x get m 6
615end
616if eq get m 5 2
617ret mul x get m 6
618end
619ret add x mul get m 6 get m 7
620end
621
622note true when the file c.out is empty.
623fn tl_quiet to bool
624st = new uchar 128 0
625r = stat fout 0 len fout st 0 128
626if lt r 0
627ret false
628end
629for i ulong 8
630if ne get st add 48 i 0
631ret false
632end
633end
634ret true
635end
636
637note Run c.bin for input m[9]: 0 passed, else the observation's length in ob.
638fn tl_exec m view ulong 16 ob edit uchar 4096 to ulong
639pk = new uchar 4096 0
640none = new uchar 1 0
641pn = tl_pack pk fbin view part none 0 0
642g = tl_code tl_run pk pn 1
643x = get m 9
644w = tl_want m x
645if and eq g long w tl_quiet
646ret 0
647end
648ret tl_tfail ob x w g
649end
650
651note One test: the candidate b with input x = m[9] (ret calc int line
652note m[3]..m[4]) compiled and run. 0 passed, else the length of the
653note observation in ob, or 4096 for an I/O failure.
654fn tl_test oc view uchar * b view uchar 4096 n ulong m view ulong 16 ob edit uchar 4096 to ulong
655c = new uchar 4096 0
656p = tl_cat c 0 b get m 3
657p = tl_cat c p grcal len grcal
658p = tl_dec c p get m 9
659p = tl_tail c p b get m 4 n
660r = tl_omc oc view part c 0 p p
661if eq r 1
662ret tl_cerr ob
663end
664if ne r 0
665ret 4096
666end
667ret tl_exec m ob
668end
669
670note Inputs A, 0, 3, 7 without repeats, in that order: the i-th, or 999.
671fn tl_input a ulong i ulong to ulong
672v = new ulong 4 0
673put v 0 a
674put v 1 0
675put v 2 3
676put v 3 7
677k = ulong 0
678for j ulong 4
679dup = false
680for q ulong j
681if eq get v q get v j
682dup = true
683end
684end
685if not dup
686if eq k i
687ret get v j
688end
689k = add k 1
690end
691end
692ret 999
693end
694
695note The check of b[0, n) (m[5..8] = kind, K, N, A) in WORK; the record.
696fn tl_check2 oc view uchar * b view uchar 4096 n ulong m edit ulong 16 to int
697ob = new uchar 4096 0
698if or eq n 0 gt n 600
699ret tl_rec 6 orefu b n
700end
701r = tl_omc oc b n
702if eq r 1
703k = tl_cerr ob
704ret tl_rec 6 view part ob 0 k b n
705end
706if ne r 0
707ret tl_rec 4 oio b n
708end
709sh = tl_shape b n get m 5 m
710if eq sh 1
711ret tl_rec 6 orefu b n
712end
713if eq sh 2
714ret tl_rec 6 ofns b n
715end
716if or eq sh 3 ne get m 2 get m 8
717ret tl_rec 6 omain b n
718end
719note round40 wants the line to read exactly ret calc int A (no leading 0).
720if ne sub get m 4 get m 3 add len grcal tl_nd get m 8
721ret tl_rec 6 omain b n
722end
723if eq sh 4
724ret tl_rec 6 oloop b n
725end
726for i ulong 4
727x = tl_input get m 8 i
728if eq x 999
729break
730end
731put m 9 x
732t = tl_test oc b n m ob
733if eq t 4096
734ret tl_rec 4 oio b n
735end
736if ne t 0
737ret tl_rec 6 view part ob 0 t b n
738end
739end
740ret tl_rec 0 opass b n
741end
742
743note Argument i into a fresh slice of d at offset o (at most 1024 bytes);
744note its length, or -1.
745fn tl_arg i ulong d edit uchar 8192 o ulong to long
746ret argread i d o 1024
747end
748
749fn tl_cnum i ulong to ulong
750b = new uchar 16 0
751n = argread i b 0 16
752if or lt n 1 gt n 3
753ret 999
754end
755v = ulong 0
756for j ulong ulong n
757c = ulong get b j
758if or lt c 48 gt c 57
759ret 999
760end
761v = add mul v 10 sub c 48
762end
763ret v
764end
765
766note check ROOT PATH WORK OMC KIND K N A, after chdir ROOT.
767fn tl_check d edit uchar 8192 to int
768b = new uchar 4096 0
769m = new ulong 16 0
770put m 5 tl_cnum 6
771put m 6 tl_cnum 7
772put m 7 tl_cnum 8
773put m 8 tl_cnum 9
774if or or lt get m 5 1 gt get m 5 3 or gt get m 6 99 gt get m 7 99
775ret 2
776end
777if gt get m 8 99
778ret 2
779end
780on = tl_arg 5 d 0
781pn = tl_arg 3 d 1024
782wn = tl_arg 4 d 2048
783if or or lt on 1 lt pn 1 lt wn 1
784ret 2
785end
786put m 14 ulong on
787put m 15 ulong pn
788ret tl_chk1 d ulong wn m b
789end
790
791note check, with OMC at d[0, m14), PATH at d[1024, m15), WORK at d[2048, wn).
792fn tl_chk1 d edit uchar 8192 wn ulong m edit ulong 16 b edit uchar 4096 to int
793if not agpathok view part d 1024 get m 15
794ret tl_rec 2 opath b 0
795end
796n = tl_slurp view part d 1024 get m 15 b
797if eq n -2
798ret tl_rec 1 onf b 0
799end
800if eq n -3
801ret tl_rec 3 obig b 0
802end
803if lt n 0
804ret tl_rec 4 oio b 0
805end
806r = chdir d 2048 wn
807if lt r 0
808ret tl_rec 4 oio b 0
809end
810ret tl_check2 view part d 0 get m 14 b ulong n m
811end
812
813fn tl_main to int
814d = new uchar 8192 0
815c = argcnt
816if lt c 4
817ret 2
818end
819cn = tl_arg 1 d 4096
820if lt cn 1
821ret 2
822end
823rn = tl_arg 2 d 5120
824if lt rn 1
825ret 2
826end
827if lt chdir d 5120 ulong rn 0
828ret 2
829end
830if and heq2 view part d 4096 ulong cn ccheck eq c 10
831ret tl_check d
832end
833pn = tl_arg 3 d 0
834if lt pn 0
835ret 2
836end
837if and heq2 view part d 4096 ulong cn cread eq c 4
838ret tl_read view part d 0 ulong pn
839end
840if and heq2 view part d 4096 ulong cn crepl eq c 6
841ret tl_rmain d ulong pn
842end
843ret 2
844end
845
846note replace ROOT PATH OLD NEW, with PATH at d[0, pn).
847fn tl_rmain d edit uchar 8192 pn ulong to int
848aw = new uchar 2048 0
849l = new ulong 4 0
850an = argread 4 aw 0 1024
851wn = argread 5 aw 1024 1024
852if or lt an 0 lt wn 0
853ret 2
854end
855put l 0 pn
856put l 1 ulong an
857put l 2 ulong wn
858ret tl_repl d aw l
859end
860
861fn heq2 a view uchar * t view uchar * to bool
862if ne len a len t
863ret false
864end
865for i ulong len a
866if ne get a i get t i
867ret false
868end
869end
870ret true
871end
872
873fn main to int
874ret tl_main
875end