Rune - Fix array passing, optimize constant array indices
[rune.git] / tests / bcopy.d
1 #!/usr/local/bin/rune -x
2 #
3 #       Demonstrate a loop.
4
5 library import "sys";
6 library import <stdio>;
7
8 int
9 main(int ac, char **av)
10 {
11         int8_t size8 = 1;
12         int16_t size16 = 1;
13         int32_t size32 = 1;
14         int64_t size64 = 1;
15         uint8_t usize8 = 1;
16         uint16_t usize16 = 2;
17         uint32_t usize32 = 1;
18         uint64_t usize64 = 1;
19         char buf[32];
20
21         Sys.bcopy("a", &buf[0], size8);
22         Sys.bcopy("b", &buf[1], size16);
23         Sys.bcopy("c", &buf[2], size32);
24         Sys.bcopy("d", &buf[3], size64);
25         Sys.bcopy("e", &buf[4], usize8);
26         Sys.bcopy("ff", &buf[5], usize16);
27         Sys.bcopy("g", &buf[7], usize32);
28         Sys.bcopy("h", &buf[8], usize64);
29
30         stdio.stdout->show("buf abcdeffgh -> ", &buf[0]);
31 }