interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / drafts / rosettacode / repeat-a-string.wiki

43 lines · 885 bytes Raw Blame History
1=={{header|Omegese}}==
2{{works with|omc|sha256 2c824805, aien-dev/omega-mv e5b32567, Linux AArch64}}
3Omega has no imports, so the small output helpers (<code>emit</code> and friends) are part of the program.
4<syntaxhighlight lang="text">
5om2
6text nl "\n"
7text ha "ha"
8text star "*"
9note emit writes every byte of a to stdout; a short write is retried, an error exits 1
10fn emit a view uchar * to void
11o = ulong 0
12while lt o len a bound 4096
13k = write 1 a o sub len a o
14if le k 0
15exit 1
16end
17o = add o ulong k
18end
19end
20note repeat writes a, k times, into one buffer (up to 256 bytes, more traps 3) and prints it
21fn repeat a view uchar * k ulong to void
22b = new uchar 256 0
23p = ulong 0
24for j ulong k
25for i ulong len a
26put b p get a i
27p = add p 1
28end
29end
30emit part b 0 p
31emit nl
32end
33fn main to int
34repeat ha 5
35repeat star 5
36ret 0
37end
38</syntaxhighlight>
39{{out}}
40<pre>
41hahahahaha
42*****
43</pre>