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 / omc / tests / pools / g3i.om

74 lines · 1475 bytes Raw Blame History
1om2
2note gate-pools 3: enlarge runs inside the value of put, the index of get, and the counts of read and
3note write; every call grows the pool it serves by 4096 elements and a blocker pool beside it, so mremap
4note moves the regions and later mappings reuse the old addresses (the gate counts both with strace).
5note stdin: the 40 bytes abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMN. Every grower is an OM-2 inline body.
6global P ulong *
7global Q ulong *
8global U uchar *
9global V uchar *
10global ob uchar 24
11fn pnum v ulong to void
12put ob 23 10
13i = ulong 23
14x = v
15go = true
16while go bound 21
17i = sub i 1
18put ob i uchar add rem x 10 48
19x = div x 10
20go = ne x 0
21end
22k = write 1 ob i sub 24 i
23end
24fn plong v long to void
25if lt v 0
26put ob 0 uchar 45
27k = write 1 ob 0 1
28pnum ulong neg v
29else
30pnum ulong v
31end
32end
33fn gv v ulong to ulong inline
34r = enlarge P add len P 4096
35r = enlarge Q add len Q 4096
36ret v
37end
38fn gi j ulong to ulong inline
39r = enlarge P add len P 4096
40r = enlarge Q add len Q 4096
41ret j
42end
43fn gu n ulong to ulong inline
44r = enlarge U add len U 4096
45r = enlarge V add len V 4096
46ret n
47end
48fn main to int
49r = enlarge Q ulong 1
50r = enlarge P ulong 1
51r = enlarge V ulong 1
52r = enlarge U ulong 64
53j = ulong 0
54while lt j 40
55put P j gv add mul j 3 1
56x = get P gi j
57pnum x
58k = read 0 U j gu 1
59k = write 1 U j gu 1
60pnum ulong k
61j = add j 1
62end
63k = write 1 U 0 40
64s = ulong 0
65j = ulong 0
66while lt j 40
67s = add s get P j
68j = add j 1
69end
70pnum s
71pnum len P
72pnum len U
73ret 0
74end