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 / string-concatenation.wiki

42 lines · 932 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 str "hello"
8text lit " literal"
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 copyto copies s into d at offset off and returns the offset after it (past the end traps 3)
21fn copyto d edit uchar * off ulong s view uchar * to ulong
22for i ulong len s
23put d add off i get s i
24end
25ret add off len s
26end
27fn main to int
28emit str
29emit nl
30b = new uchar 64 0
31p = copyto b 0 str
32p = copyto b p lit
33emit part b 0 p
34emit nl
35ret 0
36end
37</syntaxhighlight>
38{{out}}
39<pre>
40hello
41hello literal
42</pre>