Semicolons are required; when condition for certain file scope declarations; #import syntax change

This commit is contained in:
Ginger Bill
2016-12-01 22:44:00 +00:00
parent be8b9bda2f
commit 4bb45700a5
29 changed files with 3400 additions and 3244 deletions
+2 -30
View File
@@ -1,34 +1,6 @@
#import "fmt.odin"
#import "utf8.odin"
#import "fmt.odin";
main :: proc() {
MAX :: 64
buf: [MAX]rune
backing: [MAX]byte
offset: int
msg := "Hello"
count := utf8.rune_count(msg)
assert(count <= MAX)
runes := buf[:count]
offset = 0
for i := 0; i < count; i++ {
s := msg[offset:]
r, len := utf8.decode_rune(s)
runes[count-i-1] = r
offset += len
}
offset = 0
for i := 0; i < count; i++ {
data, len := utf8.encode_rune(runes[i])
copy(backing[offset:], data[:len])
offset += len
}
reverse := backing[:offset] as string
fmt.println(reverse) // olleH
fmt.println("Hellope");
}