blob: d8d0ca309ef42d7f4d60be3c62d6bda736ed9b3c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
namespace;
include rt;
// embed declarations: file bytes become globals and locals of the declared type.
embed "tests/data/embed/text.txt" as text;
embed "tests/data/embed/answer.bin" as int answer;
embed "tests/data/embed/bytes.bin" as u8[] bytes;
embed "tests/data/embed/bytes.bin" as i8[8] signed;
embed "tests/data/embed/text.txt" as char* chars;
embed "tests/data/embed/onehalf.f32" as f32 half;
embed "tests/data/embed/bytes.bin" as char[] cs;
embed "tests/data/embed/nul.bin" as bstr nul;
embed "tests/data/embed/shorts.bin" as u16[] shorts;
fn main() {
rt.put_s(text); rt.put_c(32);
rt.put_n(len(text)); rt.put_c(32);
rt.put_n(answer); rt.put_c(32);
rt.put_n(len(bytes)); rt.put_c(32); rt.put_n(bytes[4]); rt.put_c(32);
rt.put_n(len(signed)); rt.put_c(32); rt.put_n(signed[4]); rt.put_c(32); rt.put_n(signed[7]); rt.put_c(32);
rt.put_n(chars[6]); rt.put_c(32);
rt.put_n((int)(half * 10.0)); rt.put_c(32);
rt.put_n(len(cs)); rt.put_c(32); rt.put_n(cs[4]); rt.put_c(32);
rt.put_n(len(nul)); rt.put_c(32); rt.put_n(nul[2]); rt.put_c(32);
rt.put_n(shorts[0] + shorts[1] * 10 + shorts[2] * 100); rt.put_c(32);
embed "tests/data/embed/answer.bin" as int local;
embed "tests/data/embed/bytes.bin" as u8[] copy;
embed "tests/data/embed/text.txt" as lt;
copy[0] = 9;
rt.put_n(local + copy[0] + bytes[0] + len(lt)); rt.put_c(10);
return 0;
}
|